Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | 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 }; 00045 00046 } // namespace Items 00047 00048 00049 00050 // Stock MenuIrems 00051 // These all operate both a menu element for gtkmm and as Items::Info for 00052 // libgnomeuimm. They must be static or in a container and thus can not 00053 // be newed. 00054 namespace MenuItems 00055 { 00056 00057 // Macro to create stock menu item: 00058 #define STOCK_MENU_ITEM(X, Y) \ 00059 struct X : public Items::ConfigureItem \ 00060 { \ 00061 X(const Callback& cb = Callback()) \ 00062 { \ 00063 init(cb, Y); \ 00064 } \ 00065 ~X() {} \ 00066 } 00067 00068 // To create stock menu items that need label and hint (e.g. 'New'): 00069 #define STOCK_MENU_ITEM_EXTRA(X, Y) \ 00070 struct X : public Items::ConfigureItem \ 00071 { \ 00072 X(const Glib::ustring& strLabel, const Glib::ustring& strHint, const Callback& cb = Callback()) \ 00073 { \ 00074 init(cb, Y, strLabel, strHint); \ 00075 } \ 00076 ~X() {} \ 00077 } 00078 00079 /* File Menu */ 00080 STOCK_MENU_ITEM_EXTRA(New,GNOME_APP_CONFIGURABLE_ITEM_NEW); //Needs label and tip 00081 00082 STOCK_MENU_ITEM(Open,GNOME_APP_CONFIGURABLE_ITEM_OPEN); 00083 STOCK_MENU_ITEM(Save,GNOME_APP_CONFIGURABLE_ITEM_SAVE); 00084 STOCK_MENU_ITEM(SaveAs,GNOME_APP_CONFIGURABLE_ITEM_SAVE_AS); 00085 STOCK_MENU_ITEM(Revert,GNOME_APP_CONFIGURABLE_ITEM_REVERT); 00086 STOCK_MENU_ITEM(Print,GNOME_APP_CONFIGURABLE_ITEM_PRINT); 00087 STOCK_MENU_ITEM(PrintSetup,GNOME_APP_CONFIGURABLE_ITEM_PRINT_SETUP); 00088 STOCK_MENU_ITEM(Close,GNOME_APP_CONFIGURABLE_ITEM_CLOSE); 00089 STOCK_MENU_ITEM(Exit,GNOME_APP_CONFIGURABLE_ITEM_EXIT); 00090 00091 /* Edit menu */ 00092 STOCK_MENU_ITEM(Cut,GNOME_APP_CONFIGURABLE_ITEM_CUT); 00093 STOCK_MENU_ITEM(Copy,GNOME_APP_CONFIGURABLE_ITEM_COPY); 00094 STOCK_MENU_ITEM(Paste,GNOME_APP_CONFIGURABLE_ITEM_PASTE); 00095 STOCK_MENU_ITEM(SelectAll,GNOME_APP_CONFIGURABLE_ITEM_SELECT_ALL); 00096 STOCK_MENU_ITEM(Clear,GNOME_APP_CONFIGURABLE_ITEM_CLEAR); 00097 STOCK_MENU_ITEM(Undo,GNOME_APP_CONFIGURABLE_ITEM_UNDO); 00098 STOCK_MENU_ITEM(Redo,GNOME_APP_CONFIGURABLE_ITEM_REDO); 00099 STOCK_MENU_ITEM(Find,GNOME_APP_CONFIGURABLE_ITEM_FIND); 00100 STOCK_MENU_ITEM(FindAgain,GNOME_APP_CONFIGURABLE_ITEM_FIND_AGAIN); 00101 STOCK_MENU_ITEM(Replace,GNOME_APP_CONFIGURABLE_ITEM_REPLACE); 00102 STOCK_MENU_ITEM(Properties,GNOME_APP_CONFIGURABLE_ITEM_PROPERTIES); 00103 00104 /* Settings menu */ 00105 STOCK_MENU_ITEM(Preferences,GNOME_APP_CONFIGURABLE_ITEM_PREFERENCES); 00106 00107 /* Windows menu */ 00108 STOCK_MENU_ITEM(NewWindow,GNOME_APP_CONFIGURABLE_ITEM_NEW_WINDOW); 00109 STOCK_MENU_ITEM(CloseWindow,GNOME_APP_CONFIGURABLE_ITEM_CLOSE_WINDOW); 00110 00111 /* Help menu */ 00112 STOCK_MENU_ITEM(About,GNOME_APP_CONFIGURABLE_ITEM_ABOUT); 00113 00114 /* Game menu */ 00115 STOCK_MENU_ITEM(NewGame,GNOME_APP_CONFIGURABLE_ITEM_NEW_GAME); 00116 STOCK_MENU_ITEM(PauseGame,GNOME_APP_CONFIGURABLE_ITEM_PAUSE_GAME); 00117 STOCK_MENU_ITEM(RestartGame,GNOME_APP_CONFIGURABLE_ITEM_RESTART_GAME); 00118 STOCK_MENU_ITEM(UndoMove,GNOME_APP_CONFIGURABLE_ITEM_UNDO_MOVE); 00119 STOCK_MENU_ITEM(RedoMove,GNOME_APP_CONFIGURABLE_ITEM_REDO_MOVE); 00120 STOCK_MENU_ITEM(Hint,GNOME_APP_CONFIGURABLE_ITEM_HINT); 00121 STOCK_MENU_ITEM(Scores,GNOME_APP_CONFIGURABLE_ITEM_SCORES); 00122 STOCK_MENU_ITEM(EndGame,GNOME_APP_CONFIGURABLE_ITEM_END_GAME); 00123 #undef STOCK_MENU_ITEM 00124 00125 } //namespace MenuItems 00126 00127 00128 namespace Menus 00129 { 00130 00131 /* Some standard menus */ 00132 00133 00134 // New: If you have more than one New type then use this tree: 00135 struct New : public Items::Menu 00136 { 00137 New(const Items::Array<Info>& tree); 00138 ~New() {} 00139 }; 00140 00141 00142 //Other menus: 00143 #define STOCK_MENU(X,Y) \ 00144 struct X : public Items::Menu \ 00145 { \ 00146 X(const Items::Array<Info>& tree = Items::Array<Info>()) \ 00147 : Items::Menu(Y,tree) \ 00148 {} \ 00149 ~X() \ 00150 {} \ 00151 } 00152 00153 STOCK_MENU(File,"_File"); 00154 STOCK_MENU(Files,"Fi_les"); 00155 STOCK_MENU(Edit,"_Edit"); 00156 STOCK_MENU(View,"_View"); 00157 STOCK_MENU(Help,"_Help"); 00158 STOCK_MENU(Game,"_Game"); 00159 STOCK_MENU(Settings,"_Settings"); 00160 STOCK_MENU(Windows,"_Windows"); 00161 #undef STOCK_MENU 00162 00163 } // namespace Menus 00164 00165 00166 } // namespace UI 00167 } // namespace Gnome 00168 00169 #endif //LIBGNOMEUIMM_UI_ITEMS_STOCK_H

Generated on Mon Jul 5 15:34:13 2004 for libgnomeuimm by doxygen 1.3.7