1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_MENU_UTIL_H_
6 #define CHROME_BROWSER_UI_LIBGTK2UI_MENU_UTIL_H_
10 #include "ui/gfx/image/image.h"
17 // Builds GtkImageMenuItems.
18 GtkWidget
* BuildMenuItemWithImage(const std::string
& label
, GtkWidget
* image
);
19 GtkWidget
* BuildMenuItemWithImage(const std::string
& label
,
20 const gfx::Image
& icon
);
21 GtkWidget
* BuildMenuItemWithLabel(const std::string
& label
);
23 ui::MenuModel
* ModelForMenuItem(GtkMenuItem
* menu_item
);
25 // This method is used to build the menu dynamically. The return value is the
27 GtkWidget
* AppendMenuItemToMenu(int index
,
31 bool connect_to_activate
,
32 GCallback item_activated_cb
,
35 // Gets the ID of a menu item.
36 // Returns true if the menu item has an ID.
37 bool GetMenuItemID(GtkWidget
* menu_item
, int* menu_id
);
39 // Execute command associated with specified id.
40 void ExecuteCommand(ui::MenuModel
* model
, int id
);
42 // Creates a GtkMenu from |model_|. block_activation_ptr is used to disable
43 // the item_activated_callback while we set up the set up the menu items.
44 // See comments in definition of SetMenuItemInfo for more info.
45 void BuildSubmenuFromModel(ui::MenuModel
* model
,
47 GCallback item_activated_cb
,
48 bool* block_activation
,
51 // Sets the check mark, enabled/disabled state and dynamic labels on menu items.
52 void SetMenuItemInfo(GtkWidget
* widget
, void* block_activation_ptr
);
54 } // namespace libgtk2ui
56 #endif // CHROME_BROWSER_UI_LIBGTK2UI_MENU_UTIL_H_