Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / libgtk2ui / menu_util.h
blobc81d32dcb915c15d19d51a94eecd09c64f144c7a
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_
8 #include <gtk/gtk.h>
10 #include "ui/gfx/image/image.h"
12 namespace ui {
13 class MenuModel;
16 namespace libgtk2ui {
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
26 // new menu item.
27 GtkWidget* AppendMenuItemToMenu(int index,
28 ui::MenuModel* model,
29 GtkWidget* menu_item,
30 GtkWidget* menu,
31 bool connect_to_activate,
32 GCallback item_activated_cb,
33 void* this_ptr);
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,
46 GtkWidget* menu,
47 GCallback item_activated_cb,
48 bool* block_activation,
49 void* this_ptr);
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_