libgnomeuimm  2.28.0
ui-items-stock.h
Go to the documentation of this file.
1 /*
2  * Copyright 2000-2002 The libgnomeuimm development team
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free
16  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  *
18  */
19 
20 
21 #ifndef LIBGNOMEUIMM_UI_ITEMS_STOCK_H
22 #define LIBGNOMEUIMM_UI_ITEMS_STOCK_H
23 
25 
26 namespace Gnome
27 {
28 
29 namespace UI
30 {
31 
32 namespace Items
33 {
34 
35 // configurable item (base for stock)
36 class ConfigureItem: public Item
37 {
38 public:
40 protected:
42  void init(const Callback &cv, GnomeUIInfoConfigurableTypes ct);
43  void init(const Callback &cv, GnomeUIInfoConfigurableTypes ct, const Glib::ustring& strLabel, const Glib::ustring& strHint);
44 };
45 
46 } // namespace Items
47 
48 
49 
50 // Stock MenuIrems
51 // These all operate both a menu element for gtkmm and as Items::Info for
52 // libgnomeuimm. They must be static or in a container and thus can not
53 // be newed.
54 namespace MenuItems
55 {
56 
57 // Macro to create stock menu item:
58 #define STOCK_MENU_ITEM(X, Y) \
59  struct X : public Items::ConfigureItem \
60  { \
61  X(const Callback& cb = Callback()) \
62  { \
63  init(cb, Y); \
64  } \
65  ~X() {} \
66  }
67 
68 // To create stock menu items that need label and hint (e.g. 'New'):
69 #define STOCK_MENU_ITEM_EXTRA(X, Y) \
70  struct X : public Items::ConfigureItem \
71  { \
72  X(const Glib::ustring& strLabel, const Glib::ustring& strHint, const Callback& cb = Callback()) \
73  { \
74  init(cb, Y, strLabel, strHint); \
75  } \
76  ~X() {} \
77  }
78 
79 /* File Menu */
80 STOCK_MENU_ITEM_EXTRA(New,GNOME_APP_CONFIGURABLE_ITEM_NEW); //Needs label and tip
81 
82 STOCK_MENU_ITEM(Open,GNOME_APP_CONFIGURABLE_ITEM_OPEN);
83 STOCK_MENU_ITEM(Save,GNOME_APP_CONFIGURABLE_ITEM_SAVE);
84 STOCK_MENU_ITEM(SaveAs,GNOME_APP_CONFIGURABLE_ITEM_SAVE_AS);
85 STOCK_MENU_ITEM(Revert,GNOME_APP_CONFIGURABLE_ITEM_REVERT);
86 STOCK_MENU_ITEM(Print,GNOME_APP_CONFIGURABLE_ITEM_PRINT);
87 STOCK_MENU_ITEM(PrintSetup,GNOME_APP_CONFIGURABLE_ITEM_PRINT_SETUP);
88 STOCK_MENU_ITEM(Close,GNOME_APP_CONFIGURABLE_ITEM_CLOSE);
89 STOCK_MENU_ITEM(Exit,GNOME_APP_CONFIGURABLE_ITEM_EXIT);
90 
91 /* Edit menu */
92 STOCK_MENU_ITEM(Cut,GNOME_APP_CONFIGURABLE_ITEM_CUT);
93 STOCK_MENU_ITEM(Copy,GNOME_APP_CONFIGURABLE_ITEM_COPY);
94 STOCK_MENU_ITEM(Paste,GNOME_APP_CONFIGURABLE_ITEM_PASTE);
95 STOCK_MENU_ITEM(SelectAll,GNOME_APP_CONFIGURABLE_ITEM_SELECT_ALL);
96 STOCK_MENU_ITEM(Clear,GNOME_APP_CONFIGURABLE_ITEM_CLEAR);
97 STOCK_MENU_ITEM(Undo,GNOME_APP_CONFIGURABLE_ITEM_UNDO);
98 STOCK_MENU_ITEM(Redo,GNOME_APP_CONFIGURABLE_ITEM_REDO);
99 STOCK_MENU_ITEM(Find,GNOME_APP_CONFIGURABLE_ITEM_FIND);
100 STOCK_MENU_ITEM(FindAgain,GNOME_APP_CONFIGURABLE_ITEM_FIND_AGAIN);
101 STOCK_MENU_ITEM(Replace,GNOME_APP_CONFIGURABLE_ITEM_REPLACE);
102 STOCK_MENU_ITEM(Properties,GNOME_APP_CONFIGURABLE_ITEM_PROPERTIES);
103 
104 /* Settings menu */
105 STOCK_MENU_ITEM(Preferences,GNOME_APP_CONFIGURABLE_ITEM_PREFERENCES);
106 
107 /* Windows menu */
108 STOCK_MENU_ITEM(NewWindow,GNOME_APP_CONFIGURABLE_ITEM_NEW_WINDOW);
109 STOCK_MENU_ITEM(CloseWindow,GNOME_APP_CONFIGURABLE_ITEM_CLOSE_WINDOW);
110 
111 /* Help menu */
112 STOCK_MENU_ITEM(About,GNOME_APP_CONFIGURABLE_ITEM_ABOUT);
113 
114 /* Game menu */
115 STOCK_MENU_ITEM(NewGame,GNOME_APP_CONFIGURABLE_ITEM_NEW_GAME);
116 STOCK_MENU_ITEM(PauseGame,GNOME_APP_CONFIGURABLE_ITEM_PAUSE_GAME);
117 STOCK_MENU_ITEM(RestartGame,GNOME_APP_CONFIGURABLE_ITEM_RESTART_GAME);
118 STOCK_MENU_ITEM(UndoMove,GNOME_APP_CONFIGURABLE_ITEM_UNDO_MOVE);
119 STOCK_MENU_ITEM(RedoMove,GNOME_APP_CONFIGURABLE_ITEM_REDO_MOVE);
120 STOCK_MENU_ITEM(Hint,GNOME_APP_CONFIGURABLE_ITEM_HINT);
121 STOCK_MENU_ITEM(Scores,GNOME_APP_CONFIGURABLE_ITEM_SCORES);
122 STOCK_MENU_ITEM(EndGame,GNOME_APP_CONFIGURABLE_ITEM_END_GAME);
123 #undef STOCK_MENU_ITEM
124 
125 } //namespace MenuItems
126 
127 
128 namespace Menus
129 {
130 
131 /* Some standard menus */
132 
133 
134 // New: If you have more than one New type then use this tree:
135 struct New : public Items::Menu
136 {
137  New(const Items::Array<Info>& tree);
138  ~New() {}
139 };
140 
141 
142 //Other menus:
143 #define STOCK_MENU(X,Y) \
144 struct X : public Items::Menu \
145 { \
146  X(const Items::Array<Info>& tree = Items::Array<Info>()) \
147  : Items::Menu(Y,tree) \
148  {} \
149  ~X() \
150  {} \
151 }
152 
153 STOCK_MENU(File,"_File");
154 STOCK_MENU(Files,"Fi_les");
155 STOCK_MENU(Edit,"_Edit");
156 STOCK_MENU(View,"_View");
157 STOCK_MENU(Help,"_Help");
158 STOCK_MENU(Game,"_Game");
159 STOCK_MENU(Settings,"_Settings");
160 STOCK_MENU(Windows,"_Windows");
161 #undef STOCK_MENU
162 
163 } // namespace Menus
164 
165 
166 } // namespace UI
167 } // namespace Gnome
168 
169 #endif //LIBGNOMEUIMM_UI_ITEMS_STOCK_H
Gnome
Definition: about.h:46
Gnome::UI::Items::ConfigureItem
Definition: ui-items-stock.h:37
Gnome::UI::Items::ConfigureItem::~ConfigureItem
~ConfigureItem()
Definition: ui-items-stock.h:39
Gnome::UI::Items::SubTree
Definition: app-helper.h:120
ui-items-derived.h
Gnome::UI::Items::Info::Callback
sigc::slot< void > Callback
Definition: app-helper.h:94
Gnome::UI::Items::ConfigureItem::init
void init(const Callback &cv, GnomeUIInfoConfigurableTypes ct)
Gnome::UI::MenuItems::STOCK_MENU_ITEM
STOCK_MENU_ITEM(Open, GNOME_APP_CONFIGURABLE_ITEM_OPEN)
Gnome::UI::Menus::New::~New
~New()
Definition: ui-items-stock.h:138
Gnome::UI::About
Small window for displaying brief info about the application.
Definition: about.h:67
Gnome::UI::Items::Item
Represents menu items and toolbar items.
Definition: ui-items-derived.h:46
Gnome::UI::Items::ConfigureItem::ConfigureItem
ConfigureItem()
Definition: ui-items-stock.h:41
Gnome::UI::Items::Array
Definition: app-helper.h:49
Gnome::UI::Menus::STOCK_MENU
STOCK_MENU(File,"_File")
Gnome::UI::Menus::New
Definition: ui-items-stock.h:136
Gnome::UI::MenuItems::STOCK_MENU_ITEM_EXTRA
STOCK_MENU_ITEM_EXTRA(New, GNOME_APP_CONFIGURABLE_ITEM_NEW)
Gnome::UI::Items::ConfigureItem::init
void init(const Callback &cv, GnomeUIInfoConfigurableTypes ct, const Glib::ustring &strLabel, const Glib::ustring &strHint)
Gnome::UI::Menus::New::New
New(const Items::Array< Info > &tree)