当前位置: 首页>>代码示例>>C++>>正文


C++ GTK_WIDGET_CLASS函数代码示例

本文整理汇总了C++中GTK_WIDGET_CLASS函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_WIDGET_CLASS函数的具体用法?C++ GTK_WIDGET_CLASS怎么用?C++ GTK_WIDGET_CLASS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GTK_WIDGET_CLASS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sexy_icon_entry_size_request

static void
sexy_icon_entry_size_request(GtkWidget *widget, GtkRequisition *requisition)
{
//	GtkEntry *gtkentry;
	SexyIconEntry *entry;
	gint icon_widths = 0;
	int i;

//	gtkentry = GTK_ENTRY(widget);
	entry    = SEXY_ICON_ENTRY(widget);

	for (i = 0; i < MAX_ICONS; i++)
	{
		int icon_width = get_icon_width(entry, i);

		if (icon_width > 0)
			icon_widths += icon_width + ICON_MARGIN;
	}

	GTK_WIDGET_CLASS(parent_class)->size_request(widget, requisition);

	if (icon_widths > requisition->width)
		requisition->width += icon_widths;
}
开发者ID:ib,项目名称:xarchiver,代码行数:24,代码来源:sexy-icon-entry.c

示例2: widget_overlay_class_init

static void
widget_overlay_class_init (WidgetOverlayClass *klass)
{
	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
	GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);

	parent_class = g_type_class_peek_parent (klass);

	widget_class->realize = widget_overlay_realize;
	widget_class->unrealize = widget_overlay_unrealize;
	widget_class->get_preferred_width = widget_overlay_get_preferred_width;
	widget_class->get_preferred_height = widget_overlay_get_preferred_height;
	widget_class->size_allocate = widget_overlay_size_allocate;
	widget_class->draw = widget_overlay_draw;
	widget_class->event = widget_overlay_event;
	widget_class->show = widget_overlay_show;

	g_signal_override_class_closure (g_signal_lookup ("damage-event", GTK_TYPE_WIDGET),
					 WIDGET_OVERLAY_TYPE,
					 g_cclosure_new (G_CALLBACK (widget_overlay_damage),
							 NULL, NULL));

	container_class->add = widget_overlay_add;
	container_class->remove = widget_overlay_remove;
	container_class->forall = widget_overlay_forall;
	G_OBJECT_CLASS (klass)->dispose = widget_overlay_dispose;
	G_OBJECT_CLASS (klass)->finalize = widget_overlay_finalize;

	/* Properties */
        G_OBJECT_CLASS (klass)->set_property = widget_overlay_set_property;
        G_OBJECT_CLASS (klass)->get_property = widget_overlay_get_property;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_ADD_SCALE,
                                         g_param_spec_boolean ("add-scale", NULL, NULL,
                                                               FALSE,
                                                               (G_PARAM_READABLE | G_PARAM_WRITABLE)));
}
开发者ID:arthurnn,项目名称:libgda,代码行数:36,代码来源:widget-overlay.c

示例3: gtk_form_draw

    static gboolean
gtk_form_draw(GtkWidget *widget, cairo_t *cr)
{
    GList   *tmp_list = NULL;
    GtkForm *form     = NULL;

    g_return_val_if_fail(GTK_IS_FORM(widget), FALSE);

    gtk_form_render_background(widget, cr);

    form = GTK_FORM(widget);
    for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
    {
	GtkFormChild * const formchild = tmp_list->data;

	if (!gtk_widget_get_has_window(formchild->widget) &&
		gtk_cairo_should_draw_window(cr, formchild->window))
	{
	    /* To get gtk_widget_draw() to work, it is required to call
	     * gtk_widget_size_allocate() in advance with a well-posed
	     * allocation for a given child widget in order to set a
	     * certain private GtkWidget variable, called
	     * widget->priv->alloc_need, to the proper value; otherwise,
	     * gtk_widget_draw() fails and the relevant scrollbar won't
	     * appear on the screen.
	     *
	     * Calling gtk_form_position_child() like this is one of ways
	     * to make sure of that. */
	    gtk_form_position_child(form, formchild, TRUE);

	    gtk_form_render_background(formchild->widget, cr);
	}
    }

    return GTK_WIDGET_CLASS(gtk_form_parent_class)->draw(widget, cr);
}
开发者ID:kzlin129,项目名称:vim,代码行数:36,代码来源:gui_gtk_f.c

示例4: gb_terminal_view_class_init

static void
gb_terminal_view_class_init (GbTerminalViewClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
  IdeLayoutViewClass *view_class = IDE_LAYOUT_VIEW_CLASS (klass);

  object_class->finalize = gb_terminal_view_finalize;
  object_class->set_property = gb_terminal_view_set_property;

  widget_class->realize = gb_terminal_realize;
  widget_class->get_preferred_width = gb_terminal_get_preferred_width;
  widget_class->get_preferred_height = gb_terminal_get_preferred_height;
  widget_class->grab_focus = gb_terminal_grab_focus;

  view_class->get_title = gb_terminal_get_title;
  view_class->create_split = gb_terminal_create_split;
  view_class->set_split_view =  gb_terminal_set_split_view;

  gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/plugins/terminal/gb-terminal-view.ui");
  gtk_widget_class_bind_template_child (widget_class, GbTerminalView, terminal_top);
  gtk_widget_class_bind_template_child (widget_class, GbTerminalView, bottom_container);

  g_type_ensure (VTE_TYPE_TERMINAL);

  properties [PROP_FONT_NAME] =
    g_param_spec_string ("font-name",
                         "Font Name",
                         "Font Name",
                         NULL,
                         (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_properties (object_class, LAST_PROP, properties);

  g_type_ensure (GB_TYPE_TERMINAL);
}
开发者ID:bhurtelashish,项目名称:gnome-builder,代码行数:36,代码来源:gb-terminal-view.c

示例5: contact_list_view_drag_begin

static void
contact_list_view_drag_begin (GtkWidget      *widget,
			      GdkDragContext *context)
{
	EmpathyContactListViewPriv *priv;
	GtkTreeSelection          *selection;
	GtkTreeModel              *model;
	GtkTreePath               *path;
	GtkTreeIter                iter;

	priv = GET_PRIV (widget);

	GTK_WIDGET_CLASS (empathy_contact_list_view_parent_class)->drag_begin (widget,
									      context);

	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
	if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
		return;
	}

	path = gtk_tree_model_get_path (model, &iter);
	priv->drag_row = gtk_tree_row_reference_new (model, path);
	gtk_tree_path_free (path);
}
开发者ID:james-w,项目名称:empathy,代码行数:24,代码来源:empathy-contact-list-view.c

示例6: gb_search_box_map

static void
gb_search_box_map (GtkWidget *widget)
{
  GbSearchBox *self = (GbSearchBox *)widget;
  GtkWidget *toplevel;

  g_return_if_fail (GB_IS_SEARCH_BOX (self));

  GTK_WIDGET_CLASS (gb_search_box_parent_class)->map (widget);

  gtk_widget_set_sensitive (GTK_WIDGET (self->button), FALSE);
  toplevel = gtk_widget_get_toplevel (widget);

  if (GB_IS_WORKBENCH (toplevel))
    {
      gb_set_weak_pointer (toplevel, &self->workbench);
      self->set_focus_handler =
        g_signal_connect_object (toplevel,
                                 "set-focus",
                                 G_CALLBACK (gb_search_box_workbench_set_focus),
                                 self,
                                 G_CONNECT_SWAPPED | G_CONNECT_AFTER);
    }
}
开发者ID:riadnassiffe,项目名称:gnome-builder,代码行数:24,代码来源:gb-search-box.c

示例7: mcus_led_get_accessible

static AtkObject *
mcus_led_get_accessible (GtkWidget *widget)
{
	static gboolean first_time = TRUE;

	if (first_time) {
		AtkObjectFactory *factory;
		AtkRegistry *registry;
		GType derived_type, derived_atk_type;

		/* Figure out whether accessibility is enabled by looking at the type of the accessible object which would be created for
		 * the parent type of MCUSLED. */
		derived_type = g_type_parent (MCUS_TYPE_LED);

		registry = atk_get_default_registry ();
		factory = atk_registry_get_factory (registry, derived_type);
		derived_atk_type = atk_object_factory_get_accessible_type (factory);
		if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
			atk_registry_set_factory_type (registry, MCUS_TYPE_LED, mcus_led_accessible_factory_get_type ());
		first_time = FALSE;
	}

	return GTK_WIDGET_CLASS (mcus_led_parent_class)->get_accessible (widget);
}
开发者ID:pwithnall,项目名称:mcus,代码行数:24,代码来源:led.c

示例8: ygtk_fixed_size_allocate

static void ygtk_fixed_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
	YGtkFixed *fixed = YGTK_FIXED (widget);
	fixed->set_size_cb (fixed, allocation->width, allocation->height, fixed->data);

	GSList *i;
	for (i = fixed->children; i; i = i->next) {
		YGtkFixedChild *child = i->data;
		int x = child->x;
		if (gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL)
			x = allocation->width - (child->x + child->width);
		x += allocation->x;
		int y = child->y + allocation->y;
		GtkAllocation child_alloc =
			{ x, y, MAX (child->width, 1), MAX (child->height, 1) };

		GtkRequisition min_child_req;
		GtkRequisition nat_child_req;
		gtk_widget_get_preferred_size (child->widget, &min_child_req, &nat_child_req);

		gtk_widget_size_allocate (child->widget, &child_alloc);
	}
	GTK_WIDGET_CLASS (ygtk_fixed_parent_class)->size_allocate (widget, allocation);
}
开发者ID:besser82,项目名称:libyui-gtk,代码行数:24,代码来源:ygtkfixed.c

示例9: gtk_revealer_real_get_preferred_width

static void
gtk_revealer_real_get_preferred_width (GtkWidget *widget,
                                       gint      *minimum_width_out,
                                       gint      *natural_width_out)
{
  GtkRevealer *revealer = GTK_REVEALER (widget);
  GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer);
  gint minimum_width;
  gint natural_width;
  GtkRevealerTransitionType transition;

  GTK_WIDGET_CLASS (gtk_revealer_parent_class)->get_preferred_width (widget, &minimum_width, &natural_width);

  transition = effective_transition (revealer);
  if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE ||
      transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT ||
      transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
    natural_width = round (natural_width * priv->current_pos);

  minimum_width = MIN (minimum_width, natural_width);

  *minimum_width_out = minimum_width;
  *natural_width_out = natural_width;
}
开发者ID:3v1n0,项目名称:gtk,代码行数:24,代码来源:gtkrevealer.c

示例10: gimp_unit_combo_box_style_set

static void
gimp_unit_combo_box_style_set (GtkWidget *widget,
                               GtkStyle  *prev_style)
{
  GtkCellLayout   *layout;
  GtkCellRenderer *cell;
  gdouble          scale;

  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);

  gtk_widget_style_get (widget, "label-scale", &scale, NULL);

  /*  hackedehack ...  */
  layout = GTK_CELL_LAYOUT (gtk_bin_get_child (GTK_BIN (widget)));
  gtk_cell_layout_clear (layout);

  cell = g_object_new (GTK_TYPE_CELL_RENDERER_TEXT,
                       "scale", scale,
                       NULL);
  gtk_cell_layout_pack_start (layout, cell, TRUE);
  gtk_cell_layout_set_attributes (layout, cell,
                                  "text",  GIMP_UNIT_STORE_UNIT_SHORT_FORMAT,
                                  NULL);
}
开发者ID:MichaelMure,项目名称:Gimp-Cage-Tool,代码行数:24,代码来源:gimpunitcombobox.c

示例11: gtk_revealer_real_get_preferred_height

static void
gtk_revealer_real_get_preferred_height (GtkWidget *widget,
                                        gint      *minimum_height_out,
                                        gint      *natural_height_out)
{
  GtkRevealer *revealer = GTK_REVEALER (widget);
  GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer);
  gint minimum_height;
  gint natural_height;
  GtkRevealerTransitionType transition;

  GTK_WIDGET_CLASS (gtk_revealer_parent_class)->get_preferred_height (widget, &minimum_height, &natural_height);

  transition = effective_transition (revealer);
  if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE ||
      transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP ||
      transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN)
    natural_height = round (natural_height * priv->current_pos);

  minimum_height = MIN (minimum_height, natural_height);

  *minimum_height_out = minimum_height;
  *natural_height_out = natural_height;
}
开发者ID:3v1n0,项目名称:gtk,代码行数:24,代码来源:gtkrevealer.c

示例12: matecomponent_plug_expose_event

static gboolean
matecomponent_plug_expose_event (GtkWidget      *widget,
			  GdkEventExpose *event)
{
	gboolean retval;

	retval = GTK_WIDGET_CLASS (matecomponent_plug_parent_class)->expose_event (widget, event);

	dbgprintf ("matecomponent_plug_expose_event %p (%d, %d), (%d, %d)"
		 "%s (%d && %d == %d)\n",
		 widget,
		 event->area.x, event->area.y,
		 event->area.width, event->area.height,
		 GTK_WIDGET_TOPLEVEL (widget) ? "toplevel" : "bin class",
		 GTK_WIDGET_VISIBLE (widget),
		 GTK_WIDGET_MAPPED (widget),
		 GTK_WIDGET_DRAWABLE (widget));

#ifdef DEBUG_CONTROL
	gdk_draw_line (widget->window,
		       widget->style->black_gc,
		       event->area.x + event->area.width,
		       event->area.y,
		       event->area.x, 
		       event->area.y + event->area.height);

	gdk_draw_line (widget->window,
		       widget->style->black_gc,
		       widget->allocation.x,
		       widget->allocation.y,
		       widget->allocation.x + widget->allocation.width,
		       widget->allocation.y + widget->allocation.height);
#endif

	return retval;
}
开发者ID:TheCoffeMaker,项目名称:Mate-Desktop-Environment,代码行数:36,代码来源:matecomponent-plug.c

示例13: class_init

static void class_init(void* g_class, void*)
{
    GtkWidgetClass* widget_class = (GtkWidgetClass*)g_class;
    widget_class->size_allocate = size_allocate;
    widget_class->realize = realize;
    widget_class->unrealize = unrealize;
    widget_class->map = map;
    widget_class->unmap = unmap;
    wxPizzaClass* klass = (wxPizzaClass*)g_class;

    // needed to make widget appear scrollable to GTK+
    klass->set_scroll_adjustments = set_scroll_adjustments;
    widget_class->set_scroll_adjustments_signal =
        g_signal_new(
            "set_scroll_adjustments",
            G_TYPE_FROM_CLASS(g_class),
            G_SIGNAL_RUN_LAST,
            G_STRUCT_OFFSET(wxPizzaClass, set_scroll_adjustments),
            NULL, NULL,
            g_cclosure_user_marshal_VOID__OBJECT_OBJECT,
            G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);

    parent_class = GTK_WIDGET_CLASS(g_type_class_peek_parent(g_class));
}
开发者ID:jonntd,项目名称:dynamica,代码行数:24,代码来源:win_gtk.cpp

示例14: mosaic_search_box_class_init

static void
mosaic_search_box_class_init (MosaicSearchBoxClass *klass)
{
  GObjectClass *gobject_class;
  GtkWidgetClass *widget_class;

  gobject_class = G_OBJECT_CLASS (klass);
  widget_class = GTK_WIDGET_CLASS (klass);

  gobject_class->constructor = mosaic_search_box_constructor;
  gobject_class->dispose = mosaic_search_box_dispose;
  gobject_class->set_property = mosaic_search_box_set_property;
  gobject_class->get_property = mosaic_search_box_get_property;

  widget_class->expose_event = mosaic_search_box_expose_event;
  widget_class->size_request = mosaic_search_box_size_request;

  obj_properties[PROP_TEXT] =
    g_param_spec_string ("text",
			 "Text in the search entry",
			 "Text, displayed in search entry",
			 NULL,
			 G_PARAM_CONSTRUCT | G_PARAM_READWRITE);

  g_object_class_install_property (gobject_class, PROP_TEXT, obj_properties [PROP_TEXT]);

  search_box_signals [CHANGED] =
    g_signal_new ("changed",
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (MosaicSearchBoxClass, changed),
		  NULL, NULL,
		  g_cclosure_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);

}
开发者ID:ZaWertun,项目名称:xwinmosaic,代码行数:36,代码来源:mosaic_search_box.c

示例15: gimp_spin_scale_class_init

static void
gimp_spin_scale_class_init (GimpSpinScaleClass *klass)
{
  GObjectClass       *object_class      = G_OBJECT_CLASS (klass);
  GtkWidgetClass     *widget_class      = GTK_WIDGET_CLASS (klass);
  GtkSpinButtonClass *spin_button_class = GTK_SPIN_BUTTON_CLASS (klass);

  object_class->dispose              = gimp_spin_scale_dispose;
  object_class->finalize             = gimp_spin_scale_finalize;
  object_class->set_property         = gimp_spin_scale_set_property;
  object_class->get_property         = gimp_spin_scale_get_property;

  widget_class->style_set            = gimp_spin_scale_style_set;
#if WITH_GTKMM_3_0
  widget_class->get_preferred_width  = gimp_spin_scale_get_preferred_width;
  widget_class->get_preferred_height = gimp_spin_scale_get_preferred_height;
  widget_class->draw                 = gimp_spin_scale_draw;
#else
  widget_class->size_request         = gimp_spin_scale_size_request;
  widget_class->expose_event         = gimp_spin_scale_expose;
#endif
  widget_class->button_press_event   = gimp_spin_scale_button_press;
  widget_class->button_release_event = gimp_spin_scale_button_release;
  widget_class->motion_notify_event  = gimp_spin_scale_motion_notify;
  widget_class->leave_notify_event   = gimp_spin_scale_leave_notify;
  widget_class->key_press_event      = gimp_spin_scale_keypress;

  spin_button_class->value_changed   = gimp_spin_scale_value_changed;

  g_object_class_install_property (object_class, PROP_LABEL,
                                   g_param_spec_string ("label", NULL, NULL,
                                                        NULL,
                                                        G_PARAM_READWRITE));

  g_type_class_add_private (klass, sizeof (GimpSpinScalePrivate));
}
开发者ID:zanqi,项目名称:inkscape,代码行数:36,代码来源:gimpspinscale.c


注:本文中的GTK_WIDGET_CLASS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。