• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GTK_TOOL_ITEM函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: add_section_toolbar

static void
add_section_toolbar (CEPageIP6 *page, GtkWidget *section, GCallback add_cb)
{
        GtkWidget *toolbar;
        GtkToolItem *item;
        GtkStyleContext *context;
        GtkWidget *box;
        GtkWidget *button;
        GtkWidget *image;

        toolbar = gtk_toolbar_new ();
        gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
        gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
        context = gtk_widget_get_style_context (toolbar);
        gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
        gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
        gtk_container_add (GTK_CONTAINER (section), toolbar);

        item = gtk_separator_tool_item_new ();
        gtk_tool_item_set_expand (item, TRUE);
        gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (item), FALSE);
        gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (item), 0);

        box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
        item = gtk_tool_item_new ();
        gtk_container_add (GTK_CONTAINER (item), box);
        button = gtk_button_new ();
        g_signal_connect_swapped (button, "clicked", G_CALLBACK (add_cb), page);
        image = gtk_image_new_from_icon_name ("list-add-symbolic", GTK_ICON_SIZE_MENU);
        atk_object_set_name (gtk_widget_get_accessible (button), _("Add"));
        gtk_button_set_image (GTK_BUTTON (button), image);
        gtk_container_add (GTK_CONTAINER (box), button);
        gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (item), 1);
}
开发者ID:jigpu,项目名称:gnome-control-center,代码行数:34,代码来源:ce-page-ip6.c


示例2: gtk_tool_item_update

static void
gtk_tool_item_update (GtkActivatable *activatable,
                      GtkAction      *action,
                      const gchar    *property_name)
{
    if (strcmp (property_name, "visible") == 0)
    {
        if (gtk_action_is_visible (action))
            gtk_widget_show (GTK_WIDGET (activatable));
        else
            gtk_widget_hide (GTK_WIDGET (activatable));
    }
    else if (strcmp (property_name, "sensitive") == 0)
        gtk_widget_set_sensitive (GTK_WIDGET (activatable), gtk_action_is_sensitive (action));
    else if (strcmp (property_name, "tooltip") == 0)
        gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (activatable),
                                        gtk_action_get_tooltip (action));
    else if (strcmp (property_name, "visible-horizontal") == 0)
        gtk_tool_item_set_visible_horizontal (GTK_TOOL_ITEM (activatable),
                                              gtk_action_get_visible_horizontal (action));
    else if (strcmp (property_name, "visible-vertical") == 0)
        gtk_tool_item_set_visible_vertical (GTK_TOOL_ITEM (activatable),
                                            gtk_action_get_visible_vertical (action));
    else if (strcmp (property_name, "is-important") == 0)
        gtk_tool_item_set_is_important (GTK_TOOL_ITEM (activatable),
                                        gtk_action_get_is_important (action));
}
开发者ID:jjardon,项目名称:gtk,代码行数:27,代码来源:gtktoolitem.c


示例3: nsgtk_toolbar_add_store_widget

/**
 * physically add widgets to store window
 */
bool nsgtk_toolbar_add_store_widget(GtkWidget *widget)
{
	if (window->numberh >= NSGTK_STORE_WIDTH) {
		window->currentbar = gtk_toolbar_new();
		if (window->currentbar == NULL) {
			warn_user("NoMemory", 0);
			return false;
		}
		gtk_toolbar_set_style(GTK_TOOLBAR(window->currentbar),
				GTK_TOOLBAR_BOTH);
		gtk_toolbar_set_icon_size(GTK_TOOLBAR(window->currentbar),
				GTK_ICON_SIZE_LARGE_TOOLBAR);
		gtk_box_pack_start(GTK_BOX(window->widgetvbox),
			window->currentbar, FALSE, FALSE, 0);
		window->numberh = 0;
	}
	gtk_widget_set_size_request(widget, NSGTK_BUTTON_WIDTH,
			NSGTK_BUTTON_HEIGHT);
	gtk_toolbar_insert(GTK_TOOLBAR(window->currentbar), GTK_TOOL_ITEM(
			widget), window->numberh++);
	gtk_tool_item_set_use_drag_window(GTK_TOOL_ITEM(widget), TRUE);
	gtk_drag_source_set(widget, GDK_BUTTON1_MASK, &entry, 1,
			GDK_ACTION_COPY);
	gtk_widget_show_all(window->window);
	return true;
}
开发者ID:galexcode,项目名称:NetSurf68k,代码行数:29,代码来源:toolbar.c


示例4: updatePopupData

void ZLGtkApplicationWindow::updatePopupData(GtkMenuToolButton *button, shared_ptr<ZLPopupData> data) {
	if (data.isNull()) {
		return;
	}

	const size_t id = data->id();
	if (id == myPopupIdMap[GTK_TOOL_ITEM(button)]) {
		return;
	}
	myPopupIdMap[GTK_TOOL_ITEM(button)] = id;

	GtkMenu *menu = GTK_MENU(gtk_menu_tool_button_get_menu(button));
	GList *children = gtk_container_get_children(GTK_CONTAINER(menu));
	if (children != 0) {
		for (GList *ptr =  g_list_last(children); ; ptr = g_list_previous(ptr)) {
			gtk_container_remove(GTK_CONTAINER(menu), GTK_WIDGET(ptr->data));
			if (ptr == children) {
				break;
			}
		}
	}

	const size_t count = data->count();
	for (size_t i = 0; i < count; ++i) {
		GtkWidget *item = gtk_menu_item_new_with_label(data->text(i).c_str());
		gtk_widget_show_all(item);
		gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
		ZLGtkSignalUtil::connectSignal(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(itemActivated), &*data);
	}
}
开发者ID:euroelessar,项目名称:FBReader,代码行数:30,代码来源:ZLGtkApplicationWindow.cpp


示例5: ui_callback_on_filters_enabled

gboolean ui_callback_on_filters_enabled(GtkToolButton *button, gpointer data)
{
    gboolean enabled;
    gboolean changed;

    enabled = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON(button));

    g_info("Filters enabled event occurred %d", enabled);

    changed = ui_filters_enable (enabled);

    if (changed)
    {
        /* Set the tool tip text */
        if (enabled)
        {
            gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM(button), "Disable messages filtering");
        }
        else
        {
            gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM(button), "Enable messages filtering");
        }
        ui_tree_view_refilter ();
    }

    return TRUE;
}
开发者ID:2fumin,项目名称:EPC-openAir4G,代码行数:27,代码来源:ui_callbacks.c


示例6: load_stock_items

static void
load_stock_items (GtkToolPalette *palette)
{
  GtkWidget *group_af = gtk_tool_item_group_new ("Stock Icons (A-F)");
  GtkWidget *group_gn = gtk_tool_item_group_new ("Stock Icons (G-N)");
  GtkWidget *group_or = gtk_tool_item_group_new ("Stock Icons (O-R)");
  GtkWidget *group_sz = gtk_tool_item_group_new ("Stock Icons (S-Z)");
  GtkWidget *group = NULL;

  GtkToolItem *item;
  GSList *stock_ids;
  GSList *iter;

  stock_ids = gtk_stock_list_ids ();
  stock_ids = g_slist_sort (stock_ids, (GCompareFunc) strcmp);

  gtk_container_add (GTK_CONTAINER (palette), group_af);
  gtk_container_add (GTK_CONTAINER (palette), group_gn);
  gtk_container_add (GTK_CONTAINER (palette), group_or);
  gtk_container_add (GTK_CONTAINER (palette), group_sz);

  for (iter = stock_ids; iter; iter = g_slist_next (iter))
    {
      GtkStockItem stock_item;
      gchar *id = iter->data;

      switch (id[4])
        {
          case 'a':
            group = group_af;
            break;

          case 'g':
            group = group_gn;
            break;

          case 'o':
            group = group_or;
            break;

          case 's':
            group = group_sz;
            break;
        }

      item = gtk_tool_button_new_from_stock (id);
      gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (item), id);
      gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
      gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);

      if (!gtk_stock_lookup (id, &stock_item) || !stock_item.label)
        gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), id);

      g_free (id);
    }

  g_slist_free (stock_ids);
}
开发者ID:JosenChareles,项目名称:os-virt-viewer,代码行数:58,代码来源:toolpalette.c


示例7: show_icon

static void show_icon(void)
{
	mailbutton = GTK_WIDGET(gtk_tool_button_new_from_stock(GEANYSENDMAIL_STOCK_MAIL));
	plugin_add_toolbar_item(geany_plugin, GTK_TOOL_ITEM(mailbutton));
	ui_add_document_sensitive(mailbutton);
#if GTK_CHECK_VERSION(2, 12, 0)
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(mailbutton), _("Send by mail"));
#endif
	g_signal_connect (G_OBJECT(mailbutton), "clicked", G_CALLBACK(send_as_attachment), NULL);
	gtk_widget_show_all (mailbutton);
	icon_in_toolbar = TRUE;
}
开发者ID:DaveMDS,项目名称:geany-plugins,代码行数:12,代码来源:sendmail.c


示例8: set_homogeneous

static void
set_homogeneous (GtkWidget *widget, gpointer data)
{
    gboolean *is_hom_p = data;

    gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (widget), *is_hom_p);
}
开发者ID:gpg,项目名称:gpa,代码行数:7,代码来源:gtktools.c


示例9: gtk_tool_item_set_homogeneous

// helper to create a dropdown menu item
void wxToolBarTool::CreateDropDown()
{
    gtk_tool_item_set_homogeneous(m_item, false);
    GtkOrientation orient = GTK_ORIENTATION_HORIZONTAL;
    GtkArrowType arrowType = GTK_ARROW_DOWN;
    if (GetToolBar()->HasFlag(wxTB_LEFT | wxTB_RIGHT))
    {
        orient = GTK_ORIENTATION_VERTICAL;
        arrowType = GTK_ARROW_RIGHT;
    }
    GtkWidget* box = gtk_box_new(orient, 0);
    GtkWidget* arrow = gtk_arrow_new(arrowType, GTK_SHADOW_NONE);
    GtkWidget* tool_button = gtk_bin_get_child(GTK_BIN(m_item));
    g_object_ref(tool_button);
    gtk_container_remove(GTK_CONTAINER(m_item), tool_button);
    gtk_container_add(GTK_CONTAINER(box), tool_button);
    g_object_unref(tool_button);
    GtkWidget* arrow_button = gtk_toggle_button_new();
    gtk_button_set_relief(GTK_BUTTON(arrow_button),
        gtk_tool_item_get_relief_style(GTK_TOOL_ITEM(m_item)));
    gtk_container_add(GTK_CONTAINER(arrow_button), arrow);
    gtk_container_add(GTK_CONTAINER(box), arrow_button);
    gtk_widget_show_all(box);
    gtk_container_add(GTK_CONTAINER(m_item), box);

    g_signal_connect(arrow_button, "toggled", G_CALLBACK(arrow_toggled), this);
    g_signal_connect(arrow_button, "button_press_event",
        G_CALLBACK(arrow_button_press_event), this);
}
开发者ID:GuyXY,项目名称:wxWidgets,代码行数:30,代码来源:toolbar.cpp


示例10: button_toggled

static void
button_toggled (GtkWidget           *widget,
		GtkToggleToolButton *toggle_tool_button)
{
  gboolean toggle_active;

  toggle_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));

  if (toggle_tool_button->priv->active != toggle_active)
    {
      GtkWidget *menu_item;
      
      toggle_tool_button->priv->active = toggle_active;
       
      if ((menu_item =
	   gtk_tool_item_get_proxy_menu_item (GTK_TOOL_ITEM (toggle_tool_button), MENU_ID)))
	{
	  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item),
					  toggle_tool_button->priv->active);
	}

      g_object_notify (G_OBJECT (toggle_tool_button), "active");
      g_signal_emit (toggle_tool_button, toggle_signals[TOGGLED], 0);
    }
}
开发者ID:BYC,项目名称:gtk,代码行数:25,代码来源:gtktoggletoolbutton.c


示例11: tm_populate

static void
tm_populate(GtkWidget * toolbar, BalsaToolbarModel * model)
{
    gboolean style_is_both;
    gboolean make_two_line;
    GArray *current;
    guint j;
    GActionMap *action_map =
        g_object_get_data(G_OBJECT(toolbar), BALSA_TOOLBAR_ACTION_MAP);

    style_is_both = (model->style == GTK_TOOLBAR_BOTH
                     || (model->style == (GtkToolbarStyle) - 1
                         && tm_default_style() == GTK_TOOLBAR_BOTH));
    make_two_line = style_is_both && tm_has_second_line(model);

    current = balsa_toolbar_model_get_current(model);
    for (j = 0; j < current->len; j++) {
        BalsaToolbarEntry *entry;
        GtkToolItem *item;

        entry = &g_array_index(current, BalsaToolbarEntry, j);

        if (!*entry->action) {
            item = gtk_separator_tool_item_new();
        } else {
            GtkWidget *icon;
            GAction *action;
            const GVariantType *type;
            gchar *prefixed_action;

            icon = gtk_image_new_from_icon_name
                (balsa_icon_id(entry->icon), GTK_ICON_SIZE_SMALL_TOOLBAR);
            action = g_action_map_lookup_action(action_map, entry->action);
            if (action &&
                (type = g_action_get_state_type(action)) &&
                g_variant_type_equal(type, G_VARIANT_TYPE_BOOLEAN)) {
                item = gtk_toggle_tool_button_new();
                g_object_set(G_OBJECT(item), "icon-widget", icon,
                             "label", entry->action, NULL);
            } else {
                item = gtk_tool_button_new(icon, entry->action);
            }
            tm_set_tool_item_label(GTK_TOOL_ITEM(item), entry->icon,
                                   make_two_line);

            prefixed_action =
                g_strconcat(action ? "win." : "app.", entry->action, NULL);
            gtk_actionable_set_action_name(GTK_ACTIONABLE(item),
                                           prefixed_action);
            g_free(prefixed_action);
        }
        gtk_toolbar_insert((GtkToolbar *) toolbar, item, -1);
    }

    gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),
                          model->style != (GtkToolbarStyle) (-1) ?
                          model->style : tm_default_style());

    gtk_widget_show_all(toolbar);
}
开发者ID:GNOME,项目名称:balsa,代码行数:60,代码来源:toolbar-factory.c


示例12: gimp_throbber_set_image

void
gimp_throbber_set_image (GimpThrobber *button,
                         GtkWidget    *image)
{
  g_return_if_fail (GIMP_IS_THROBBER (button));
  g_return_if_fail (image == NULL || GTK_IS_IMAGE (image));

  if (image != button->priv->image)
    {
      if (button->priv->image)
	{
	  if (gtk_widget_get_parent (button->priv->image))
            gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (button->priv->image)),
                                  button->priv->image);

	  g_object_unref (button->priv->image);
	}

      if (image)
        g_object_ref_sink (image);

      button->priv->image = image;

      gimp_throbber_construct_contents (GTK_TOOL_ITEM (button));

      g_object_notify (G_OBJECT (button), "image");
    }
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:28,代码来源:gimpthrobber.c


示例13: score_widget_new

static GtkToolItem*
score_widget_new()
{
    g_assert(score_widget == NULL);
    score_widget = sugar_toolkit_tool_text_new();
    return GTK_TOOL_ITEM(score_widget);
}
开发者ID:insidevivek,项目名称:GCompris,代码行数:7,代码来源:sugar.c


示例14: gb_tool_item_write_source

/*
 * Writes the source code needed to create this widget.
 * You have to output everything necessary to create the widget here, though
 * there are some convenience functions to help.
 */
static void
gb_tool_item_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
{
  if (data->create_widget)
    {
      source_add (data,
		  "  %s = (GtkWidget*) gtk_tool_item_new ();\n",
		  data->wname);
    }

  gb_widget_write_standard_source (widget, data);

  if (gtk_object_get_data (GTK_OBJECT (widget), VisibleHorz) != NULL)
    {
      source_add (data,
		  "  gtk_tool_item_set_visible_horizontal (GTK_TOOL_ITEM (%s), FALSE);\n",
		  data->wname);
    }

  if (gtk_object_get_data (GTK_OBJECT (widget), VisibleVert) != NULL)
    {
      source_add (data,
		  "  gtk_tool_item_set_visible_vertical (GTK_TOOL_ITEM (%s), FALSE);\n",
		  data->wname);
    }

  if (gtk_tool_item_get_is_important (GTK_TOOL_ITEM (widget)))
    {
      source_add (data,
		  "  gtk_tool_item_set_is_important (GTK_TOOL_ITEM (%s), TRUE);\n",
		  data->wname);
    }
}
开发者ID:AriaAsuka,项目名称:deadbeef,代码行数:38,代码来源:gbtoolitem.c


示例15: connect_proxy

static void
connect_proxy (GtkAction *action,
               GtkWidget *proxy)
{
        if (GTK_IS_TOOL_ITEM (proxy)) {
                GtkToolItem *item = GTK_TOOL_ITEM (proxy);
                NautilusZoomAction *zaction = NAUTILUS_ZOOM_ACTION (action);
                NautilusNavigationWindow *window = zaction->priv->window;
                GtkWidget *zoom_control;

                zoom_control = nautilus_zoom_control_new ();
                gtk_container_set_border_width (GTK_CONTAINER (item), 4);
                gtk_container_add (GTK_CONTAINER (item),  zoom_control);
                gtk_widget_show (zoom_control);

                g_signal_connect_object (zoom_control, "zoom_in",
                                         G_CALLBACK (nautilus_window_zoom_in),
                                         window, G_CONNECT_SWAPPED);
                g_signal_connect_object (zoom_control, "zoom_out",
                                         G_CALLBACK (nautilus_window_zoom_out),
                                         window, G_CONNECT_SWAPPED);
                g_signal_connect_object (zoom_control, "zoom_to_level",
                                         G_CALLBACK (nautilus_window_zoom_to_level),
                                         window, G_CONNECT_SWAPPED);
                g_signal_connect_object (zoom_control, "zoom_to_default",
                                         G_CALLBACK (nautilus_window_zoom_to_default),
                                         window, G_CONNECT_SWAPPED);

                g_signal_connect (window, "zoom-changed",
                                  G_CALLBACK (zoom_changed_callback),
                                  zoom_control);
        }

        (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
}
开发者ID:petergtz,项目名称:nautilus,代码行数:35,代码来源:nautilus-zoom-action.c


示例16: gtk_tool_item_parent_set

static void
gtk_tool_item_parent_set (GtkWidget   *toolitem,
                          GtkWidget   *prev_parent)
{
    if (GTK_WIDGET (toolitem)->parent != NULL)
        gtk_tool_item_toolbar_reconfigured (GTK_TOOL_ITEM (toolitem));
}
开发者ID:jjardon,项目名称:gtk,代码行数:7,代码来源:gtktoolitem.c


示例17: rg_insert

static VALUE
rg_insert(int argc, VALUE *argv, VALUE self)
{
    GtkWidget* ret = NULL;
    VALUE type = Qnil;
    VALUE pos, widget, stock_id, element_type, text, ttext, ptext, icon, func;

    if (argc > 1) type = argv[1];

    if (NIL_P(type) || TYPE(type) == T_STRING){
        rb_scan_args(argc, argv, "15", &pos, &text, &ttext, &ptext, &icon, &func);
        if (NIL_P(func)) func = rb_block_proc();
        G_RELATIVE(self, func);
        ret = gtk_toolbar_insert_item(_SELF(self),N_RVAL2CSTR(text),
                                      N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext),
                                      N_RVAL2WIDGET(icon),
                                      GTK_SIGNAL_FUNC(exec_callback),
                                      (gpointer)func,
                                      NUM2INT(pos));
    } else if (TYPE(type) == T_FIXNUM) {
        rb_scan_args(argc, argv, "17", &pos, &element_type, &widget, &text, &ttext, &ptext, &icon, &func);
        if (NIL_P(func)) func = rb_block_proc();
        G_RELATIVE(self, func);

        ret = gtk_toolbar_insert_element(_SELF(self),
                                         RVAL2GENUM(element_type, GTK_TYPE_TOOLBAR_CHILD_TYPE),
                                         N_RVAL2WIDGET(widget), 
                                         N_RVAL2CSTR(text), N_RVAL2CSTR(ttext),
                                         N_RVAL2CSTR(ptext), N_RVAL2WIDGET(icon),
                                         GTK_SIGNAL_FUNC(exec_callback),
                                         (gpointer)func,
                                         NUM2INT(pos));
        if (RVAL2GENUM(element_type, GTK_TYPE_TOOLBAR_CHILD_TYPE) == GTK_TOOLBAR_CHILD_SPACE) 
            ret = NULL;
    } else if (TYPE(type) == T_SYMBOL) {
        rb_scan_args(argc, argv, "14", &pos, &stock_id, &ttext, &ptext, &func);
        if (NIL_P(func)) func = rb_block_proc();
        G_RELATIVE(self, func);

        ret = gtk_toolbar_insert_stock(_SELF(self), rb_id2name(SYM2ID(stock_id)),
                                       N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext),
                                       GTK_SIGNAL_FUNC(exec_callback),
                                       (gpointer)func, NUM2INT(pos));
#if GTK_CHECK_VERSION(2,4,0)
    } else if (rb_obj_is_kind_of(type, GTYPE2CLASS(GTK_TYPE_TOOL_ITEM))){
        rb_scan_args(argc, argv, "20", &pos, &widget);
        gtk_toolbar_insert(_SELF(self), GTK_TOOL_ITEM(RVAL2GOBJ(widget)),
                           NUM2INT(pos));
        return widget;
#endif
    } else {
        rb_scan_args(argc, argv, "22", &pos, &widget, &ttext, &ptext);
        gtk_toolbar_insert_widget(_SELF(self), GTK_WIDGET(RVAL2GOBJ(widget)),
                                  N_RVAL2CSTR(ttext), N_RVAL2CSTR(ptext),
                                  NUM2INT(pos));
        return widget;
    }

    return ret ? GOBJ2RVAL(ret) : Qnil;
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:60,代码来源:rbgtktoolbar.c


示例18: gtk_tool_button_create_menu_proxy

static gboolean
gtk_tool_button_create_menu_proxy (GtkToolItem *item)
{
  GtkToolButton *button = GTK_TOOL_BUTTON (item);
  GtkWidget *menu_item;
  GtkWidget *menu_image = NULL;
  GtkStockItem stock_item;
  gboolean use_mnemonic = TRUE;
  const char *label;

  if (_gtk_tool_item_create_menu_proxy (item))
    return TRUE;
 
  if (GTK_IS_LABEL (button->priv->label_widget))
    {
      label = gtk_label_get_label (GTK_LABEL (button->priv->label_widget));
      use_mnemonic = gtk_label_get_use_underline (GTK_LABEL (button->priv->label_widget));
    }
  else if (button->priv->label_text)
    {
      label = button->priv->label_text;
      use_mnemonic = button->priv->use_underline;
    }
  else if (button->priv->stock_id && gtk_stock_lookup (button->priv->stock_id, &stock_item))
    {
      label = stock_item.label;
    }
  else
    {
      label = "";
    }
  
  if (use_mnemonic)
    menu_item = gtk_image_menu_item_new_with_mnemonic (label);
  else
    menu_item = gtk_image_menu_item_new_with_label (label);

  if (GTK_IS_IMAGE (button->priv->icon_widget))
    {
      menu_image = clone_image_menu_size (GTK_IMAGE (button->priv->icon_widget),
					  gtk_widget_get_settings (GTK_WIDGET (button)));
    }
  else if (button->priv->stock_id)
    {
      menu_image = gtk_image_new_from_stock (button->priv->stock_id, GTK_ICON_SIZE_MENU);
    }

  if (menu_image)
    gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), menu_image);

  g_signal_connect_closure_by_id (menu_item,
				  g_signal_lookup ("activate", G_OBJECT_TYPE (menu_item)), 0,
				  g_cclosure_new_object_swap (G_CALLBACK (gtk_button_clicked),
							      G_OBJECT (GTK_TOOL_BUTTON (button)->priv->button)),
				  FALSE);

  gtk_tool_item_set_proxy_menu_item (GTK_TOOL_ITEM (button), MENU_ID, menu_item);
  
  return TRUE;
}
开发者ID:ystk,项目名称:debian-gtk-2.0,代码行数:60,代码来源:gtktoolbutton.c


示例19: gb_tool_item_set_properties

/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_tool_item_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gboolean visible_horz, visible_vert, is_important;

  visible_horz = gb_widget_input_bool (data, VisibleHorz);
  if (data->apply)
    {
      gtk_object_set_data (GTK_OBJECT (widget), VisibleHorz,
			   visible_horz ? NULL : "FALSE");
    }

  visible_vert = gb_widget_input_bool (data, VisibleVert);
  if (data->apply)
    {
      gtk_object_set_data (GTK_OBJECT (widget), VisibleVert,
			   visible_vert ? NULL : "FALSE");
    }

  is_important = gb_widget_input_bool (data, IsImportant);
  if (data->apply)
    {
      gtk_tool_item_set_is_important (GTK_TOOL_ITEM (widget), is_important);
    }
}
开发者ID:AriaAsuka,项目名称:deadbeef,代码行数:29,代码来源:gbtoolitem.c


示例20: XOJ_CHECK_TYPE

void ToolDrawCombocontrol::selected(ActionGroup group, ActionType action)
{
	XOJ_CHECK_TYPE(ToolDrawCombocontrol);

	if (!this->item)
	{
		return;
	}

	if (!GTK_IS_TOGGLE_TOOL_BUTTON(this->item))
	{
		g_warning("ToolDrawCombocontrol: selected action %i which is not a toggle action!", action);
		return;
	}

	string description;

	for (ToolDrawType* t : drawTypes)
	{
		if (action == t->type && this->action != t->type)
		{
			this->action = t->type;
			gtk_image_set_from_icon_name(GTK_IMAGE(iconWidget), t->icon.c_str(), GTK_ICON_SIZE_SMALL_TOOLBAR);
			description = t->name;
			break;
		}
	}

	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(item), description.c_str());
	if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(this->item)) != (this->action == action))
	{
		this->toolToggleButtonActive = (this->action == action);
		gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(this->item), this->toolToggleButtonActive);
	}
}
开发者ID:xournalpp,项目名称:xournalpp,代码行数:35,代码来源:ToolDrawCombocontrol.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GTK_TREE_MODEL函数代码示例发布时间:2022-05-30
下一篇:
C++ GTK_TOOL_BUTTON函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap