本文整理匯總了C++中GTK_WIDGET_REALIZED函數的典型用法代碼示例。如果您正苦於以下問題:C++ GTK_WIDGET_REALIZED函數的具體用法?C++ GTK_WIDGET_REALIZED怎麽用?C++ GTK_WIDGET_REALIZED使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GTK_WIDGET_REALIZED函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: sexy_icon_entry_size_allocate
static void
sexy_icon_entry_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
g_return_if_fail(SEXY_IS_ICON_ENTRY(widget));
g_return_if_fail(allocation != NULL);
widget->allocation = *allocation;
GTK_WIDGET_CLASS(parent_class)->size_allocate(widget, allocation);
if (GTK_WIDGET_REALIZED(widget))
place_windows(SEXY_ICON_ENTRY(widget), allocation);
}
示例2: draw
/* When widget is exposed it's contents are redrawn. */
static gint draw(GtkWidget *widget, GdkEventExpose *event)
{
static gint i = 0;
i++;
if (!GTK_IS_WIDGET(widget)) return TRUE;
if(!GTK_WIDGET_REALIZED(widget)) return TRUE;
/* Draw only last expose. */
if (event->count > 0) return FALSE;
redraw(widget,NULL);
return FALSE;
}
示例3: gtk_redraw_frame_toolbars
static void
gtk_redraw_frame_toolbars (struct frame *f)
{
/* There are certain startup paths that lead to update_EmacsFrame in
faces.c being called before a new frame is fully initialized. In
particular before we have actually mapped it. That routine can
call this one. So, we need to make sure that the frame is
actually ready before we try and draw all over it. */
if (GTK_WIDGET_REALIZED (FRAME_GTK_TEXT_WIDGET (f)))
gtk_redraw_exposed_toolbars (f, 0, 0, FRAME_PIXWIDTH (f),
FRAME_PIXHEIGHT (f));
}
示例4: git_source_view_on_adj_changed
static void
git_source_view_on_adj_changed (GtkAdjustment *adj, GitSourceView *sview)
{
GitSourceViewPrivate *priv = sview->priv;
if (priv->hadjustment)
priv->x_offset = priv->hadjustment->value;
if (priv->vadjustment)
priv->y_offset = priv->vadjustment->value;
if (GTK_WIDGET_REALIZED (GTK_WIDGET (sview)))
gdk_window_invalidate_rect (GTK_WIDGET (sview)->window, NULL, FALSE);
}
示例5: ui_update
static gboolean
ui_update(Bubblemon *base)
{
int w, h, i;
const bubblemon_picture_t *bubblePic;
bubblemon_color_t *pixel;
guchar *p;
GdkGC *gc;
GtkWidget *draw_area = base->draw_area;
if((draw_area == NULL) ||
!GTK_WIDGET_REALIZED(draw_area) ||
!GTK_WIDGET_DRAWABLE(draw_area) ||
base->width <= 0)
{
return TRUE;
}
bubblePic = bubblemon_getPicture(base->bubblemon);
if ((bubblePic == NULL) ||
(bubblePic->width == 0) ||
(bubblePic->pixels == 0))
{
return TRUE;
}
w = bubblePic->width;
h = bubblePic->height;
gc = gdk_gc_new(draw_area->window);
p = base->rgb_buffer;
pixel = bubblePic->pixels;
for(i = 0; i < w * h; i++) {
*(p++) = pixel->components.r;
*(p++) = pixel->components.g;
*(p++) = pixel->components.b;
pixel++;
}
gdk_draw_rgb_image(draw_area->window, gc,
0, 0,
base->width, base->height,
GDK_RGB_DITHER_NORMAL,
base->rgb_buffer, w * 3);
gdk_gc_destroy(gc);
return TRUE;
}
示例6: ensure_buddy_pix
void ensure_buddy_pix (GtkWidget *window, int n) {
int width, height;
GdkGC *white_gc;
int pri;
int sec;
if (!buddy_pix[1].pix) /* not initialized */
return;
if (n < 0 || n > 9 || buddy_pix[n].pix)
return;
sec = ((n & 0x04) != 0)? 0x04 : 0x02;
pri = n & ~sec;
ensure_buddy_pix (window, pri);
if (!pri || !sec)
return;
if (!GTK_WIDGET_REALIZED (window))
gtk_widget_realize (window);
gdk_window_get_size (buddy_pix[1].pix, &width, &height);
buddy_pix[n].pix = gdk_pixmap_new (window->window, width, height, -1);
buddy_pix[n].mask = gdk_pixmap_new (window->window, width, height, 1);
white_gc = window->style->white_gc;
if (!masks_gc) {
masks_gc = gdk_gc_new (buddy_pix[n].mask);
gdk_gc_set_exposures (masks_gc, FALSE);
}
gdk_gc_set_foreground (masks_gc, &window->style->white);
gdk_draw_pixmap (buddy_pix[n].pix, white_gc, buddy_pix[pri].pix,
0, 0, 0, 0, width, height);
gdk_draw_pixmap (buddy_pix[n].mask, masks_gc, buddy_pix[pri].mask,
0, 0, 0, 0, width, height);
gdk_gc_set_clip_mask (white_gc, buddy_pix[sec].mask);
gdk_draw_pixmap (buddy_pix[n].pix, white_gc, buddy_pix[sec].pix,
0, 0, 0, 0, width, height);
gdk_gc_set_clip_mask (white_gc, NULL);
gdk_gc_set_clip_mask (masks_gc, buddy_pix[sec].mask);
gdk_draw_rectangle (buddy_pix[n].mask, masks_gc, TRUE, 0, 0, width, height);
gdk_gc_set_clip_mask (masks_gc, NULL);
}
示例7: thunar_sbr_number_renamer_update
static void
thunar_sbr_number_renamer_update (ThunarSbrNumberRenamer *number_renamer)
{
gboolean invalid = TRUE;
GdkColor back;
GdkColor text;
gchar *endp;
/* check whether "start" is valid for the "mode" */
if (number_renamer->mode < THUNAR_SBR_NUMBER_MODE_ABC)
{
/* "start" must be a positive number */
strtoul (number_renamer->start, &endp, 10);
invalid = (endp <= number_renamer->start || *endp != '\0');
}
else if (number_renamer->mode == THUNAR_SBR_NUMBER_MODE_ABC)
{
/* "start" property must be 'a', 'b', 'c', etc. */
invalid = (strlen (number_renamer->start) != 1
|| g_ascii_tolower (*number_renamer->start) < 'a'
|| g_ascii_tolower (*number_renamer->start) > 'z');
}
/* check if the start entry is realized */
if (GTK_WIDGET_REALIZED (number_renamer->start_entry))
{
/* check if the "start" value is valid */
if (G_UNLIKELY (invalid))
{
/* if GTK+ wouldn't be that stupid with style properties and
* type plugins, this would be themable, but unfortunately
* GTK+ is totally broken, and so it's hardcoded.
*/
gdk_color_parse ("#ff6666", &back);
gdk_color_parse ("White", &text);
/* setup a red background/text color to indicate the error */
gtk_widget_modify_base (number_renamer->start_entry, GTK_STATE_NORMAL, &back);
gtk_widget_modify_text (number_renamer->start_entry, GTK_STATE_NORMAL, &text);
}
else
{
/* reset background/text color */
gtk_widget_modify_base (number_renamer->start_entry, GTK_STATE_NORMAL, NULL);
gtk_widget_modify_text (number_renamer->start_entry, GTK_STATE_NORMAL, NULL);
}
}
/* notify everybody that we have a new state */
thunarx_renamer_changed (THUNARX_RENAMER (number_renamer));
}
示例8: calf_keyboard_size_allocate
static void
calf_keyboard_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
// CalfKeyboard *self = CALF_KEYBOARD(widget);
g_assert(CALF_IS_KEYBOARD(widget));
widget->allocation = *allocation;
widget->allocation.width = widget->requisition.width;
if (GTK_WIDGET_REALIZED(widget))
gdk_window_move_resize(widget->window,
allocation->x + (allocation->width - widget->allocation.width) / 2, allocation->y,
widget->allocation.width, allocation->height );
}
示例9: gv_tool_set_cursor
void
gv_tool_set_cursor(GvTool *tool, gint cursor_type)
{
if (tool->cursor != NULL)
gdk_cursor_destroy(tool->cursor);
tool->cursor = gdk_cursor_new(cursor_type);
if ((tool->view != NULL) && (GTK_WIDGET_REALIZED(GTK_WIDGET(tool->view))))
{
gdk_window_set_cursor(GTK_WIDGET(tool->view)->window, tool->cursor);
}
}
示例10: matenu_global_menu_item_sync_monitor_num
static gboolean matenu_global_menu_item_sync_monitor_num (MatenuGlobalMenuItem* self) {
gboolean result = FALSE;
GdkScreen* screen;
g_return_val_if_fail (self != NULL, FALSE);
screen = _g_object_ref0 (gtk_widget_get_screen ((GtkWidget*) self));
if (GTK_WIDGET_REALIZED ((GtkWidget*) self)) {
matenu_monitor_set_monitor_num (self->priv->active_window_monitor, gdk_screen_get_monitor_at_window (screen, ((GtkWidget*) self)->window));
} else {
matenu_monitor_set_monitor_num (self->priv->active_window_monitor, -1);
}
result = FALSE;
_g_object_unref0 (screen);
return result;
}
示例11: gtk_mng_view_size_allocate
static void
gtk_mng_view_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
{
FUNCTION_ENTRY();
g_return_if_fail (IS_GTK_MNG_VIEW (widget));
g_return_if_fail (allocation != NULL);
if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (widget->window,
allocation->x,
allocation->y,
allocation->width,
allocation->height);
}
示例12: gtk_moz_embed_open_stream
void
gtk_moz_embed_open_stream(GtkMozEmbed *embed, const char *base_uri,
const char *mime_type)
{
EmbedPrivate *embedPrivate;
g_return_if_fail (embed != NULL);
g_return_if_fail (GTK_IS_MOZ_EMBED(embed));
g_return_if_fail (GTK_WIDGET_REALIZED(GTK_WIDGET(embed)));
embedPrivate = (EmbedPrivate *)embed->data;
embedPrivate->OpenStream(base_uri, mime_type);
}
示例13: gtk_check_item_size_allocate
static void
gtk_check_item_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkCheckItem *check_item;
GtkToggleButton *toggle_button;
GtkButton *button;
GtkAllocation child_allocation;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_CHECK_ITEM (widget));
g_return_if_fail (allocation != NULL);
check_item = GTK_CHECK_ITEM (widget);
toggle_button = GTK_TOGGLE_BUTTON (widget);
if (toggle_button->draw_indicator)
{
widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (toggle_button->event_window,
allocation->x, allocation->y,
allocation->width, allocation->height);
button = GTK_BUTTON (widget);
if (GTK_BIN (button)->child && GTK_WIDGET_VISIBLE (GTK_BIN (button)->child))
{
child_allocation.x = (GTK_CONTAINER (widget)->border_width +
CHECK_ITEM_CLASS (widget)->indicator_size +
CHECK_ITEM_CLASS (widget)->indicator_spacing * 3 + 1 +
widget->allocation.x);
child_allocation.y = GTK_CONTAINER (widget)->border_width + 1 +
widget->allocation.y;
child_allocation.width = MAX (1, allocation->width -
(GTK_CONTAINER (widget)->border_width +
CHECK_ITEM_CLASS (widget)->indicator_size +
CHECK_ITEM_CLASS (widget)->indicator_spacing * 3 + 1) -
GTK_CONTAINER (widget)->border_width - 1);
child_allocation.height = MAX (1, allocation->height - (GTK_CONTAINER (widget)->border_width + 1) * 2);
gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation);
}
}
else
{
if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
(* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
}
}
示例14: update_child_count
static void
update_child_count (TrayData *data)
{
guint n_children = 0;
char text[64];
if (!GTK_WIDGET_REALIZED (data->window))
return;
gtk_container_foreach (GTK_CONTAINER (data->box), (GtkCallback) do_add, &n_children);
g_snprintf (text, sizeof (text), "%u icons", n_children);
gtk_label_set_text (data->count_label, text);
}
示例15: gtk_form_attach_child_window
static void
gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child)
{
if (child->window != NULL)
return; /* been there, done that */
if (GTK_WIDGET_NO_WINDOW(child->widget))
{
GtkWidget *widget;
GdkWindowAttr attributes;
gint attributes_mask;
widget = GTK_WIDGET(form);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = child->x;
attributes.y = child->y;
attributes.width = child->widget->requisition.width;
attributes.height = child->widget->requisition.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual(widget);
attributes.colormap = gtk_widget_get_colormap(widget);
attributes.event_mask = GDK_EXPOSURE_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
child->window = gdk_window_new(form->bin_window,
&attributes, attributes_mask);
gdk_window_set_user_data(child->window, widget);
gtk_style_set_background(widget->style,
child->window,
GTK_STATE_NORMAL);
gtk_widget_set_parent_window(child->widget, child->window);
gtk_form_set_static_gravity(child->window, TRUE);
/*
* Install signal handlers to map/unmap child->window
* alongside with the actual widget.
*/
gtk_signal_connect(GTK_OBJECT(child->widget), "map",
GTK_SIGNAL_FUNC(>k_form_child_map), child);
gtk_signal_connect(GTK_OBJECT(child->widget), "unmap",
GTK_SIGNAL_FUNC(>k_form_child_unmap), child);
}
else if (!GTK_WIDGET_REALIZED(child->widget))
{
gtk_widget_set_parent_window(child->widget, form->bin_window);
}
}