Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

ui-items-stock.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2000-2002 The libgnomeuimm development team
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public
00015  * License along with this library; if not, write to the Free
00016  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017  *
00018  */
00019 
00020 
00021 #ifndef LIBGNOMEUIMM_UI_ITEMS_STOCK_H
00022 #define LIBGNOMEUIMM_UI_ITEMS_STOCK_H
00023 
00024 #include <libgnomeuimm/ui-items-derived.h>
00025 
00026 namespace Gnome
00027 {
00028 
00029 namespace UI
00030 {
00031 
00032 namespace Items
00033 {
00034   
00035 // configurable item (base for stock)
00036 class ConfigureItem: public Item
00037 {
00038 public:
00039   ~ConfigureItem() {}
00040 protected:
00041   ConfigureItem() {}
00042   void init(const Callback &cv, GnomeUIInfoConfigurableTypes ct);
00043   void init(const Callback &cv, GnomeUIInfoConfigurableTypes ct, const Glib::ustring& strLabel, const Glib::ustring& strHint);
00044   void init(const CallbackWithWidget &cv, GnomeUIInfoConfigurableTypes ct);
00045   void init(const CallbackWithWidget &cv, GnomeUIInfoConfigurableTypes ct, const Glib::ustring& strLabel, const Glib::ustring& strHint);
00046 };
00047 
00048 } // namespace Items
00049 
00050 
00051 
00052 // Stock MenuIrems
00053 //   These all operate both a menu element for gtkmm and as Items::Info for
00054 //   libgnomeuimm.  They must be static or in a container and thus can not
00055 //   be newed.
00056 namespace MenuItems
00057 {
00058 
00059 // Macro to create stock menu item:
00060 #define STOCK_MENU_ITEM(X, Y) \
00061   struct X : public Items::ConfigureItem \
00062   { \
00063     X(const Callback& cb) \
00064     { \
00065      init(cb, Y); \
00066     } \
00067     X(const CallbackWithWidget& cb = CallbackWithWidget()) \
00068     { \
00069      init(cb, Y); \
00070     } \
00071     ~X() {} \
00072   }
00073 
00074 // To create stock menu items that need label and hint (e.g. 'New'):
00075 #define STOCK_MENU_ITEM_EXTRA(X, Y) \
00076   struct X : public Items::ConfigureItem \
00077   { \
00078     X(const Glib::ustring& strLabel, const Glib::ustring& strHint, const Callback& cb) \
00079     { \
00080      init(cb, Y, strLabel, strHint); \
00081     } \
00082     X(const Glib::ustring& strLabel, const Glib::ustring& strHint, const CallbackWithWidget& cb = CallbackWithWidget()) \
00083     { \
00084      init(cb, Y, strLabel, strHint); \
00085     } \
00086     ~X() {} \
00087   }
00088 
00089 /* File Menu */
00090 STOCK_MENU_ITEM_EXTRA(New,GNOME_APP_CONFIGURABLE_ITEM_NEW); //Needs label and tip
00091 
00092 STOCK_MENU_ITEM(Open,GNOME_APP_CONFIGURABLE_ITEM_OPEN);
00093 STOCK_MENU_ITEM(Save,GNOME_APP_CONFIGURABLE_ITEM_SAVE);
00094 STOCK_MENU_ITEM(SaveAs,GNOME_APP_CONFIGURABLE_ITEM_SAVE_AS);
00095 STOCK_MENU_ITEM(Revert,GNOME_APP_CONFIGURABLE_ITEM_REVERT);
00096 STOCK_MENU_ITEM(Print,GNOME_APP_CONFIGURABLE_ITEM_PRINT);
00097 STOCK_MENU_ITEM(PrintSetup,GNOME_APP_CONFIGURABLE_ITEM_PRINT_SETUP);
00098 STOCK_MENU_ITEM(Close,GNOME_APP_CONFIGURABLE_ITEM_CLOSE);
00099 STOCK_MENU_ITEM(Exit,GNOME_APP_CONFIGURABLE_ITEM_EXIT);
00100 
00101 /* Edit menu */
00102 STOCK_MENU_ITEM(Cut,GNOME_APP_CONFIGURABLE_ITEM_CUT);
00103 STOCK_MENU_ITEM(Copy,GNOME_APP_CONFIGURABLE_ITEM_COPY);
00104 STOCK_MENU_ITEM(Paste,GNOME_APP_CONFIGURABLE_ITEM_PASTE);
00105 STOCK_MENU_ITEM(SelectAll,GNOME_APP_CONFIGURABLE_ITEM_SELECT_ALL);
00106 STOCK_MENU_ITEM(Clear,GNOME_APP_CONFIGURABLE_ITEM_CLEAR);
00107 STOCK_MENU_ITEM(Undo,GNOME_APP_CONFIGURABLE_ITEM_UNDO);
00108 STOCK_MENU_ITEM(Redo,GNOME_APP_CONFIGURABLE_ITEM_REDO);
00109 STOCK_MENU_ITEM(Find,GNOME_APP_CONFIGURABLE_ITEM_FIND);
00110 STOCK_MENU_ITEM(FindAgain,GNOME_APP_CONFIGURABLE_ITEM_FIND_AGAIN);
00111 STOCK_MENU_ITEM(Replace,GNOME_APP_CONFIGURABLE_ITEM_REPLACE);
00112 STOCK_MENU_ITEM(Properties,GNOME_APP_CONFIGURABLE_ITEM_PROPERTIES);
00113 
00114 /* Settings menu */
00115 STOCK_MENU_ITEM(Preferences,GNOME_APP_CONFIGURABLE_ITEM_PREFERENCES);
00116 
00117 /* Windows menu */
00118 STOCK_MENU_ITEM(NewWindow,GNOME_APP_CONFIGURABLE_ITEM_NEW_WINDOW);
00119 STOCK_MENU_ITEM(CloseWindow,GNOME_APP_CONFIGURABLE_ITEM_CLOSE_WINDOW);
00120 
00121 /* Help menu */
00122 STOCK_MENU_ITEM(About,GNOME_APP_CONFIGURABLE_ITEM_ABOUT);
00123 
00124 /* Game menu */
00125 STOCK_MENU_ITEM(NewGame,GNOME_APP_CONFIGURABLE_ITEM_NEW_GAME);
00126 STOCK_MENU_ITEM(PauseGame,GNOME_APP_CONFIGURABLE_ITEM_PAUSE_GAME);
00127 STOCK_MENU_ITEM(RestartGame,GNOME_APP_CONFIGURABLE_ITEM_RESTART_GAME);
00128 STOCK_MENU_ITEM(UndoMove,GNOME_APP_CONFIGURABLE_ITEM_UNDO_MOVE);
00129 STOCK_MENU_ITEM(RedoMove,GNOME_APP_CONFIGURABLE_ITEM_REDO_MOVE);
00130 STOCK_MENU_ITEM(Hint,GNOME_APP_CONFIGURABLE_ITEM_HINT);
00131 STOCK_MENU_ITEM(Scores,GNOME_APP_CONFIGURABLE_ITEM_SCORES);
00132 STOCK_MENU_ITEM(EndGame,GNOME_APP_CONFIGURABLE_ITEM_END_GAME);
00133 #undef STOCK_MENU_ITEM
00134 
00135 } //namespace MenuItems
00136 
00137 
00138 namespace Menus
00139 {
00140 
00141 /* Some standard menus */
00142 
00143 
00144 // New: If you have more than one New type then use this tree:
00145 struct New : public Items::Menu
00146 {
00147   New(const Items::Array<Info>& tree);
00148   ~New() {}
00149 };
00150 
00151 
00152 //Other menus:
00153 #define STOCK_MENU(X,Y) \
00154 struct X : public Items::Menu \
00155 { \
00156   X(const Items::Array<Info>& tree = Items::Array<Info>()) \
00157   : Items::Menu(Y,tree) \
00158   {} \
00159   ~X() \
00160   {} \
00161 }
00162 
00163 STOCK_MENU(File,"_File");
00164 STOCK_MENU(Files,"Fi_les");
00165 STOCK_MENU(Edit,"_Edit");
00166 STOCK_MENU(View,"_View");
00167 STOCK_MENU(Help,"_Help");
00168 STOCK_MENU(Game,"_Game");
00169 STOCK_MENU(Settings,"_Settings");
00170 STOCK_MENU(Windows,"_Windows");
00171 #undef STOCK_MENU
00172 
00173 } // namespace Menus
00174 
00175 
00176 } // namespace UI
00177 } // namespace Gnome
00178 
00179 #endif //LIBGNOMEUIMM_UI_ITEMS_STOCK_H

Generated on Sun Sep 11 19:04:58 2005 for libgnomeuimm by  doxygen 1.4.4