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
26namespace Gnome
27{
28
29namespace UI
30{
31
32namespace Items
33{
34
35// configurable item (base for stock)
36class ConfigureItem: public Item
37{
38public:
40protected:
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.
54namespace 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 */
80STOCK_MENU_ITEM_EXTRA(New,GNOME_APP_CONFIGURABLE_ITEM_NEW); //Needs label and tip
81
82STOCK_MENU_ITEM(Open,GNOME_APP_CONFIGURABLE_ITEM_OPEN);
83STOCK_MENU_ITEM(Save,GNOME_APP_CONFIGURABLE_ITEM_SAVE);
84STOCK_MENU_ITEM(SaveAs,GNOME_APP_CONFIGURABLE_ITEM_SAVE_AS);
85STOCK_MENU_ITEM(Revert,GNOME_APP_CONFIGURABLE_ITEM_REVERT);
86STOCK_MENU_ITEM(Print,GNOME_APP_CONFIGURABLE_ITEM_PRINT);
87STOCK_MENU_ITEM(PrintSetup,GNOME_APP_CONFIGURABLE_ITEM_PRINT_SETUP);
88STOCK_MENU_ITEM(Close,GNOME_APP_CONFIGURABLE_ITEM_CLOSE);
89STOCK_MENU_ITEM(Exit,GNOME_APP_CONFIGURABLE_ITEM_EXIT);
90
91/* Edit menu */
92STOCK_MENU_ITEM(Cut,GNOME_APP_CONFIGURABLE_ITEM_CUT);
93STOCK_MENU_ITEM(Copy,GNOME_APP_CONFIGURABLE_ITEM_COPY);
94STOCK_MENU_ITEM(Paste,GNOME_APP_CONFIGURABLE_ITEM_PASTE);
95STOCK_MENU_ITEM(SelectAll,GNOME_APP_CONFIGURABLE_ITEM_SELECT_ALL);
96STOCK_MENU_ITEM(Clear,GNOME_APP_CONFIGURABLE_ITEM_CLEAR);
97STOCK_MENU_ITEM(Undo,GNOME_APP_CONFIGURABLE_ITEM_UNDO);
98STOCK_MENU_ITEM(Redo,GNOME_APP_CONFIGURABLE_ITEM_REDO);
99STOCK_MENU_ITEM(Find,GNOME_APP_CONFIGURABLE_ITEM_FIND);
100STOCK_MENU_ITEM(FindAgain,GNOME_APP_CONFIGURABLE_ITEM_FIND_AGAIN);
101STOCK_MENU_ITEM(Replace,GNOME_APP_CONFIGURABLE_ITEM_REPLACE);
102STOCK_MENU_ITEM(Properties,GNOME_APP_CONFIGURABLE_ITEM_PROPERTIES);
103
104/* Settings menu */
105STOCK_MENU_ITEM(Preferences,GNOME_APP_CONFIGURABLE_ITEM_PREFERENCES);
106
107/* Windows menu */
108STOCK_MENU_ITEM(NewWindow,GNOME_APP_CONFIGURABLE_ITEM_NEW_WINDOW);
109STOCK_MENU_ITEM(CloseWindow,GNOME_APP_CONFIGURABLE_ITEM_CLOSE_WINDOW);
110
111/* Help menu */
112STOCK_MENU_ITEM(About,GNOME_APP_CONFIGURABLE_ITEM_ABOUT);
113
114/* Game menu */
115STOCK_MENU_ITEM(NewGame,GNOME_APP_CONFIGURABLE_ITEM_NEW_GAME);
116STOCK_MENU_ITEM(PauseGame,GNOME_APP_CONFIGURABLE_ITEM_PAUSE_GAME);
117STOCK_MENU_ITEM(RestartGame,GNOME_APP_CONFIGURABLE_ITEM_RESTART_GAME);
118STOCK_MENU_ITEM(UndoMove,GNOME_APP_CONFIGURABLE_ITEM_UNDO_MOVE);
119STOCK_MENU_ITEM(RedoMove,GNOME_APP_CONFIGURABLE_ITEM_REDO_MOVE);
120STOCK_MENU_ITEM(Hint,GNOME_APP_CONFIGURABLE_ITEM_HINT);
121STOCK_MENU_ITEM(Scores,GNOME_APP_CONFIGURABLE_ITEM_SCORES);
122STOCK_MENU_ITEM(EndGame,GNOME_APP_CONFIGURABLE_ITEM_END_GAME);
123#undef STOCK_MENU_ITEM
124
125} //namespace MenuItems
126
127
128namespace Menus
129{
130
131/* Some standard menus */
132
133
134// New: If you have more than one New type then use this tree:
135struct New : public Items::Menu
136{
138 ~New() {}
139};
140
141
142//Other menus:
143#define STOCK_MENU(X,Y) \
144struct 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
153STOCK_MENU(File,"_File");
154STOCK_MENU(Files,"Fi_les");
155STOCK_MENU(Edit,"_Edit");
156STOCK_MENU(View,"_View");
157STOCK_MENU(Help,"_Help");
158STOCK_MENU(Game,"_Game");
159STOCK_MENU(Settings,"_Settings");
160STOCK_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
Small window for displaying brief info about the application.
Definition: about.h:67
Definition: app-helper.h:190
Definition: ui-items-stock.h:37
ConfigureItem()
Definition: ui-items-stock.h:41
~ConfigureItem()
Definition: ui-items-stock.h:39
void init(const Callback &cv, GnomeUIInfoConfigurableTypes ct, const Glib::ustring &strLabel, const Glib::ustring &strHint)
void init(const Callback &cv, GnomeUIInfoConfigurableTypes ct)
sigc::slot< void > Callback
Definition: app-helper.h:94
Represents menu items and toolbar items.
Definition: ui-items-derived.h:46
Definition: app-helper.h:120
STOCK_MENU_ITEM_EXTRA(New, GNOME_APP_CONFIGURABLE_ITEM_NEW)
STOCK_MENU_ITEM(Open, GNOME_APP_CONFIGURABLE_ITEM_OPEN)
STOCK_MENU(File,"_File")
Definition: about.h:46
Definition: ui-items-stock.h:136
~New()
Definition: ui-items-stock.h:138
New(const Items::Array< Info > &tree)