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


C++ GTK_IS_MENU函数代码示例

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


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

示例1: menu_get_panel

PanelWidget *
menu_get_panel (GtkWidget *menu)
{
	PanelWidget *retval = NULL;

	g_return_val_if_fail (menu != NULL, NULL);

	if (GTK_IS_MENU_ITEM (menu))
		menu = gtk_widget_get_parent (menu);

	g_return_val_if_fail (GTK_IS_MENU (menu), NULL);

	while (menu) {
		retval = g_object_get_data (G_OBJECT (menu), "menu_panel");
		if (retval)
			break;

		menu = gtk_widget_get_parent (gtk_menu_get_attach_widget (GTK_MENU (menu)));
		if (!GTK_IS_MENU (menu))
			break;
	}

	if (retval && !PANEL_IS_WIDGET (retval)) {
		g_warning ("Invalid PanelWidget associated with menu");
		retval = NULL;
	}

	if (!retval) {
		g_warning ("Cannot find the PanelWidget associated with menu");
		retval = panels->data;
	}

	return retval;
}
开发者ID:MotoHoss,项目名称:mate-panel,代码行数:34,代码来源:menu.c

示例2: serializer_visit

static void serializer_visit (Serializer* self, GtkWidget* widget) {
    g_return_if_fail (self != NULL);
    g_return_if_fail (widget != NULL);
    if (GTK_IS_MENU_BAR (widget)) {
        GtkWidget* _tmp0_;
        serializer_visit_menubar (self, (_tmp0_ = widget, GTK_IS_MENU_BAR (_tmp0_) ? ((GtkMenuBar*) _tmp0_) : NULL));
    } else {
        if (GTK_IS_MENU (widget)) {
            GtkWidget* _tmp1_;
            serializer_visit_menu (self, (_tmp1_ = widget, GTK_IS_MENU (_tmp1_) ? ((GtkMenu*) _tmp1_) : NULL));
        } else {
            if (GTK_IS_MENU_ITEM (widget)) {
                GtkWidget* _tmp2_;
                serializer_visit_menuitem (self, (_tmp2_ = widget, GTK_IS_MENU_ITEM (_tmp2_) ? ((GtkMenuItem*) _tmp2_) : NULL));
            } else {
                if (GTK_IS_LABEL (widget)) {
                    GtkWidget* _tmp3_;
                    serializer_visit_label (self, (_tmp3_ = widget, GTK_IS_LABEL (_tmp3_) ? ((GtkLabel*) _tmp3_) : NULL));
                } else {
                    if (GTK_IS_IMAGE (widget)) {
                        GtkWidget* _tmp4_;
                        serializer_visit_image (self, (_tmp4_ = widget, GTK_IS_IMAGE (_tmp4_) ? ((GtkImage*) _tmp4_) : NULL));
                    } else {
                        if (GTK_IS_CONTAINER (widget)) {
                            GtkWidget* _tmp5_;
                            serializer_visit_container (self, (_tmp5_ = widget, GTK_IS_CONTAINER (_tmp5_) ? ((GtkContainer*) _tmp5_) : NULL));
                        }
                    }
                }
            }
        }
    }
}
开发者ID:thassan,项目名称:mate-globalmenu,代码行数:33,代码来源:serializer.c

示例3: menu_choice_activate

static void
menu_choice_activate (GtkWidget *item,
		      gpointer   data)
{
  gpointer udata = gtk_object_get_user_data (GTK_OBJECT (item));
  
  if (GTK_IS_MENU (current_popup_menu))
    {
      gtk_object_set_data (GTK_OBJECT (current_popup_menu), "BstChoice", udata);
      
      if (modal_loop_quit_on_menu_item_activate)
	modal_loop_running = FALSE;
    }
  else	/* current_popup_menu is not set e.g. for option menus */
    {
      while (GTK_IS_MENU (item->parent))
	{
	  GtkWidget *tmp;
          
	  item = item->parent;
	  tmp = gtk_menu_get_attach_widget (GTK_MENU (item));
	  if (GTK_IS_MENU_ITEM (tmp))
	    item = tmp;
	}
      g_assert (GTK_IS_MENU (item));
      
      gtk_object_set_data (GTK_OBJECT (item), "BstChoice", udata);
    }
}
开发者ID:whitelynx,项目名称:beast,代码行数:29,代码来源:bstmenus.c

示例4: lookup_widget

ui::Widget
lookup_widget(ui::Widget       widget,
			   const gchar     *widget_name ){
    ui::Widget parent{ui::null};

	for (;; )
	{
		if ( GTK_IS_MENU( widget ) ) {
			parent = ui::Widget::from(gtk_menu_get_attach_widget( GTK_MENU( widget ) ));
		}
		else{
			parent = ui::Widget::from(gtk_widget_get_parent(widget));
		}
		if ( !parent ) {
			parent = ui::Widget::from(g_object_get_data( G_OBJECT( widget ), "GladeParentKey" ));
		}
		if ( parent == NULL ) {
			break;
		}
		widget = parent;
	}

	auto found_widget = ui::Widget::from(g_object_get_data( G_OBJECT( widget ), widget_name ));
	if ( !found_widget ) {
		g_warning( "Widget not found: %s", widget_name );
	}
	return found_widget;
}
开发者ID:xonotic,项目名称:netradient,代码行数:28,代码来源:support.cpp

示例5: book_view_gtk_populate_menu

void
book_view_gtk_populate_menu (BookViewGtk *self,
			     GtkWidget *menu)
{
  g_return_if_fail (IS_BOOK_VIEW_GTK (self));
  g_return_if_fail (GTK_IS_MENU (menu));

  GtkTreeSelection *selection = NULL;
  GtkTreeModel *model = NULL;
  GtkTreeIter iter;
  Ekiga::Contact *contact = NULL;
  GtkWidget *item = NULL;
  MenuBuilderGtk builder (menu);

  self->priv->book->populate_menu (builder);

  selection = gtk_tree_view_get_selection (self->priv->tree_view);

  if (gtk_tree_selection_get_selected (selection, &model, &iter)) {

    gtk_tree_model_get (model, &iter, COLUMN_CONTACT_POINTER, &contact, -1);

    if (contact) {

      item = gtk_separator_menu_item_new ();
      gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
      contact->populate_menu (builder);
    }
  }
}
开发者ID:NpNike,项目名称:ekiga,代码行数:30,代码来源:book-view-gtk.cpp

示例6: gtk_tearoff_menu_item_parent_set

static void
gtk_tearoff_menu_item_parent_set (GtkWidget *widget,
                                  GtkWidget *previous)
{
    GtkTearoffMenuItem *tearoff_menu_item = GTK_TEAROFF_MENU_ITEM (widget);
    GtkTearoffMenuItemPrivate *priv = tearoff_menu_item->priv;
    GtkMenu *menu;
    GtkWidget *parent;

    parent = gtk_widget_get_parent (widget);
    menu = GTK_IS_MENU (parent) ? GTK_MENU (parent) : NULL;

    if (previous)
        g_signal_handlers_disconnect_by_func (previous,
                                              tearoff_state_changed,
                                              tearoff_menu_item);

    if (menu)
    {
        priv->torn_off = gtk_menu_get_tearoff_state (menu);
        g_signal_connect (menu, "notify::tearoff-state",
                          G_CALLBACK (tearoff_state_changed),
                          tearoff_menu_item);
    }
}
开发者ID:Davletvm,项目名称:gtk,代码行数:25,代码来源:gtktearoffmenuitem.c

示例7: gtk_tearoff_menu_item_get_preferred_height

static void
gtk_tearoff_menu_item_get_preferred_height (GtkWidget      *widget,
        gint           *minimum,
        gint           *natural)
{
    GtkStyleContext *context;
    GtkBorder padding;
    GtkStateFlags state;
    GtkWidget *parent;
    guint border_width;

    context = gtk_widget_get_style_context (widget);
    state = gtk_widget_get_state_flags (widget);

    gtk_style_context_get_padding (context, state, &padding);
    border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));

    *minimum = *natural = (border_width * 2) + padding.top + padding.bottom;

    parent = gtk_widget_get_parent (widget);
    if (GTK_IS_MENU (parent) && gtk_menu_get_tearoff_state (GTK_MENU (parent)))
    {
        *minimum += ARROW_SIZE;
        *natural += ARROW_SIZE;
    }
    else
    {
        *minimum += padding.top + 4;
        *natural += padding.top + 4;
    }
}
开发者ID:Davletvm,项目名称:gtk,代码行数:31,代码来源:gtktearoffmenuitem.c

示例8:

GtkWidget*
lookup_widget                          (GtkWidget       *widget,
                                        const gchar     *widget_name)
{
  GtkWidget *parent = 0, *found_widget = 0;

  if (widget) { 
    for (;;)
      {
	if (GTK_IS_MENU (widget))
	  parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
	else
	  parent = widget->parent;
	if (parent == NULL)
	  break;
	widget = parent;
      }

    found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget),
						     widget_name);
    if (!found_widget)
      g_warning ("Widget not found: %s", widget_name);
  } else { 
    g_warning ("Widget is NULL: %s", widget_name);
  } 
  return found_widget;
}
开发者ID:pemsley,项目名称:coot,代码行数:27,代码来源:support.c

示例9: maybe_check_submenu_state

static void
maybe_check_submenu_state (GtkMenuItem    *menu_item,
                           ThemeMatchData *match_data)
{
  /* Distinguish between active and passive focus, depending on whether the
   * focus is in submenu.
   *
   * Active focus:
   *   function = BOX
   *   state    = PRELIGHT
   *
   * Passive focus:
   *   function = BOX
   *   state    = SELECTED
   */
  if (menu_item->submenu)
    {
      GtkWidget *sub_item;

      sub_item = GTK_MENU_SHELL (menu_item->submenu)->active_menu_item;
      if (sub_item && gtk_widget_get_state (sub_item) != GTK_STATE_NORMAL)
	match_data->state = GTK_STATE_SELECTED;
    }

  /* This is a hack to cover the cases where a menu item is being 
   * used outside the usual a GtkMenu. More specificaly, this covers
   * menu items inside the hildon-desktop custom menu widget. */
  if (!GTK_IS_MENU (GTK_WIDGET (menu_item)->parent) &&
      !gtk_widget_is_focus (GTK_WIDGET (menu_item)) &&
      gtk_widget_get_state (GTK_WIDGET (menu_item)) != GTK_STATE_NORMAL)
    match_data->state = GTK_STATE_SELECTED;
}
开发者ID:GNOME,项目名称:sapwood,代码行数:32,代码来源:sapwood-style.c

示例10: ppg_menu_tool_item_set_menu

static void
ppg_menu_tool_item_set_menu (PpgMenuToolItem *item,
                             GtkMenu         *menu)
{
	PpgMenuToolItemPrivate *priv;

	g_return_if_fail(PPG_IS_MENU_TOOL_ITEM(item));
	g_return_if_fail(!menu || GTK_IS_MENU(menu));

	priv = item->priv;

	if (priv->menu) {
		g_signal_handler_disconnect(priv->menu, priv->menu_deactivate);
		priv->menu = NULL;
		priv->menu_deactivate = 0;
	}

	if (menu) {
		priv->menu = GTK_WIDGET(menu);
		priv->menu_deactivate =
			g_signal_connect(menu, "deactivate",
			                 G_CALLBACK(ppg_menu_tool_item_menu_deactivate),
			                 item);
	}
}
开发者ID:mgrundy,项目名称:perfkit,代码行数:25,代码来源:ppg-menu-tool-item.c

示例11: adwaita_draw_box

static void
adwaita_draw_box (GtkStyle * style,
                  GdkWindow * window,
                  GtkStateType state_type,
                  GtkShadowType shadow_type,
                  GdkRectangle * area,
                  GtkWidget * widget,
                  const gchar * detail,
                  gint x,
                  gint y,
                  gint width,
                  gint height)
{
  if (GTK_IS_MENU (widget) &&
      g_strcmp0 (detail, "menu") == 0 &&
      wm_is_fallback ())
    {
      cairo_t *cr = drawable_to_cairo (window, area);
      cairo_set_source_rgb (cr, 0.34, 0.34, 0.33);
      cairo_rectangle (cr, x, y, width, height);
      cairo_stroke (cr);

      cairo_destroy (cr);
    }
  else
    {
      GTK_STYLE_CLASS (adwaita_style_parent_class)->draw_box (style, window, state_type, shadow_type,
                                                              area, widget, detail,
                                                              x, y, width, height);
    }
}
开发者ID:GNOME,项目名称:gnome-themes-standard,代码行数:31,代码来源:adwaita_engine.c

示例12: lookup_widget

GtkWidget*
lookup_widget (GtkWidget   *widget,
               const gchar *widget_name)
{
  GtkWidget *parent, *found_widget;
  GtkBuilder *builder;

  g_return_val_if_fail(widget != NULL, NULL);

  for (;;)
    {
      if (GTK_IS_MENU (widget))
        parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
      else
        parent = widget->parent;
      if (parent == NULL)
        break;
      widget = parent;
    }

  builder = g_object_get_data (G_OBJECT (widget), "_sheet_dialogs_builder");
  found_widget = GTK_WIDGET (gtk_builder_get_object (builder, widget_name));
  /* not everything is under control of the builder,
   * e.g. "wrapbox_left" */
  if (!found_widget)
    found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget), widget_name);
  if (!found_widget)
    g_warning (_("Widget not found: %s"), widget_name);
  return found_widget;
}
开发者ID:AmiGanguli,项目名称:dia,代码行数:30,代码来源:sheets.c

示例13: search_box_new

GtkWidget*
search_box_new (AnjutaDocman *docman)
{
	SearchBox* search_box;
	AnjutaUI *ui;

	search_box = SEARCH_BOX (g_object_new (SEARCH_TYPE_BOX, "homogeneous",
											FALSE, NULL));

	g_signal_connect (G_OBJECT (docman), "document-changed",
					  G_CALLBACK (on_document_changed), search_box);

	search_box->priv->status = anjuta_shell_get_status (docman->shell, NULL);
	
	ui = anjuta_shell_get_ui (docman->shell, NULL);
	search_box->priv->popup_menu = gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui),
											"/SearchboxPopup");
	g_assert (search_box->priv->popup_menu != NULL && GTK_IS_MENU (search_box->priv->popup_menu));

	search_box->priv->case_action = 
		gtk_ui_manager_get_action (GTK_UI_MANAGER (ui),
		                           "/SearchboxPopup/CaseCheck");

	search_box->priv->highlight_action =
		gtk_ui_manager_get_action (GTK_UI_MANAGER (ui),
		                           "/SearchboxPopup/HighlightAll");
	search_box->priv->regex_action = 
		gtk_ui_manager_get_action (GTK_UI_MANAGER (ui),
		                           "/SearchboxPopup/RegexSearch");

	g_signal_connect (search_box->priv->popup_menu, "deactivate",
					  G_CALLBACK (gtk_widget_hide), NULL);

	return GTK_WIDGET (search_box);
}
开发者ID:kyoushuu,项目名称:anjuta,代码行数:35,代码来源:search-box.c

示例14: glade_gtk_menu_item_action_activate

void
glade_gtk_menu_item_action_activate (GladeWidgetAdaptor * adaptor,
                                     GObject * object,
                                     const gchar * action_path)
{
  GObject *obj = NULL, *shell = NULL;
  GladeWidget *w = glade_widget_get_from_gobject (object);

  while ((w = glade_widget_get_parent (w)))
    {
      obj = glade_widget_get_object (w);
      if (GTK_IS_MENU_SHELL (obj))
        shell = obj;
    }

  if (strcmp (action_path, "launch_editor") == 0)
    {
      if (shell)
        object = shell;

      if (GTK_IS_MENU_BAR (object))
        glade_gtk_menu_shell_launch_editor (object, _("Edit Menu Bar"));
      else if (GTK_IS_MENU (object))
        glade_gtk_menu_shell_launch_editor (object, _("Edit Menu"));
    }
  else
    GWA_GET_CLASS (GTK_TYPE_CONTAINER)->action_activate (adaptor,
                                                         object, action_path);

  if (shell)
    gtk_menu_shell_deactivate (GTK_MENU_SHELL (shell));
}
开发者ID:kugel-,项目名称:glade,代码行数:32,代码来源:glade-gtk-menu-item.c

示例15: eel_pop_up_context_menu

/**
 * eel_pop_up_context_menu:
 *
 * Pop up a context menu under the mouse.
 * The menu is sunk after use, so it will be destroyed unless the
 * caller first ref'ed it.
 *
 * This function is more of a helper function than a gtk extension,
 * so perhaps it belongs in a different file.
 *
 * @menu: The menu to pop up under the mouse.
 * @offset_x: Ignored.
 * @offset_y: Ignored.
 * @event: The event that invoked this popup menu, or #NULL if there
 * is no event available.  This is used to get the timestamp for the menu's popup.
 * In case no event is provided, gtk_get_current_event_time() will be used automatically.
 **/
void
eel_pop_up_context_menu (GtkMenu *menu,
                         GdkEventButton *event)
{
    int button;

    g_return_if_fail (GTK_IS_MENU (menu));

    /* The event button needs to be 0 if we're popping up this menu from
     * a button release, else a 2nd click outside the menu with any button
     * other than the one that invoked the menu will be ignored (instead
     * of dismissing the menu). This is a subtle fragility of the GTK menu code.
     */

    if (event) {
        button = event->type == GDK_BUTTON_RELEASE
                 ? 0
                 : event->button;
    } else {
        button = 0;
    }

    gtk_menu_popup (menu,					/* menu */
                    NULL,					/* parent_menu_shell */
                    NULL,					/* parent_menu_item */
                    NULL,					/* popup_position_func */
                    NULL,					/* popup_position_data */
                    button,					/* button */
                    event ? event->time : gtk_get_current_event_time ()); /* activate_time */

    g_object_ref_sink (menu);
    g_object_unref (menu);
}
开发者ID:ebbes,项目名称:nemo,代码行数:50,代码来源:eel-gtk-extensions.c


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