vdk 2.4.0
|
00001 /* 00002 * =========================== 00003 * VDK Visual Development Kit 00004 * Version 0.4 00005 * Revision 0.2 00006 * October 1998 00007 * =========================== 00008 * 00009 * Copyright (C) 1998, Mario Motta 00010 * Developed by Mario Motta <mmotta@guest.net> 00011 * 00012 * This library is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Library General Public 00014 * License as published by the Free Software Foundation; either 00015 * version 2 of the License, or (at your option) any later version. 00016 * 00017 * This library is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 * Library General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU Library General Public 00023 * License along with this library; if not, write to the Free Software 00024 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00025 * 02111-1307, USA. 00026 */ 00027 00028 #ifndef MENU_H 00029 #define MENU_H 00030 #include <vdk/widcontain.h> 00031 #include <vdk/dlist.h> 00032 #include <vdk/vdktypes.h> 00033 #include <vdk/rawpixmap.h> 00034 #include <gdk/gdkkeysyms.h> 00035 class VDKForms; 00036 class VDKMenubar; 00037 class VDKOptionMenu; 00038 00067 class VDKMenu: public VDKObjectContainer 00068 { 00069 protected: 00070 GtkAccelGroup *accel_group; 00071 public: 00076 VDKMenu(VDKForm* owner); 00080 virtual ~VDKMenu(); 00084 void Separator(); 00085 virtual void SetFont(VDKFont* font); 00089 void Popup(guint button = 0, guint32 activate_time = 0); 00090 void Add(VDKObject* wid, int justify = l_justify, 00091 int expand = true, int fill = true , int padding = false); 00095 GtkAccelGroup *AccelGroup() { return accel_group; } 00096 }; 00097 00116 class VDKMenuItem: public VDKObject 00117 { 00118 protected: 00119 VDKObjectSignal s_activated; 00120 VDKMenu* menu; 00121 GtkWidget *box,*lbl,*pixmapWidget, *tickWidget; 00122 GdkPixmap* pixmap,*tickPixmap; 00123 bool ticked; 00124 guint accelerator_key; 00125 guint8 modkey; 00126 public: 00130 __rwproperty(VDKMenuItem,bool) Checked; 00134 __rwproperty(VDKMenuItem,const char*) Caption; 00151 VDKMenuItem(VDKMenu* menu , 00152 const char* prompt = NULL, 00153 char** pixmap = NULL, 00154 guint key = GDK_VoidSymbol, 00155 guint8 modkey = GDK_MOD1_MASK, 00156 bool accel = true); 00167 VDKMenuItem(VDKMenubar* bar, 00168 const char* prompt = NULL, char** pixmap = NULL, 00169 int align = l_justify, 00170 guint key = GDK_VoidSymbol, 00171 guint8 modkey = GDK_MOD1_MASK, 00172 bool accel = true); 00176 VDKMenuItem(VDKForm* owner, 00177 const char* prompt = NULL, char** pixmap = NULL, 00178 int align = l_justify, 00179 guint key = GDK_VoidSymbol, 00180 guint8 modkey = GDK_MOD1_MASK, 00181 bool accel = true); 00185 virtual ~VDKMenuItem(); 00186 00187 void SetCaption(const char* str); 00191 guint AccKey() { return accelerator_key; } 00195 guint8 ModKey() { return modkey; } 00196 00197 const char* GetCaption (); 00203 void Add(VDKMenu* submenu); 00204 void Tick(bool flag); 00205 virtual void SetFont(VDKFont* font); 00206 void SetPixmap(VDKRawPixmap* newpix); 00207 }; 00208 00213 class VDKMenubar: public VDKObjectContainer 00214 { 00215 protected: 00216 GtkAccelGroup *accel_group; 00217 void SetShadow(int shadow) 00218 { 00219 // gtk_menu_bar_set_shadow_type(GTK_MENU_BAR(widget),(GtkShadowType) shadow); 00220 // gtk_object_set(GTK_OBJECT(widget), "shadow_type", shadow, NULL); 00221 } 00222 public: 00226 __rwproperty(VDKMenubar, int) Shadow; 00231 VDKMenubar(VDKForm* owner); 00235 ~VDKMenubar(); 00242 virtual void SetFont(VDKFont* font); 00249 void Add(VDKObject* menu_item, int justify = l_justify, 00250 int expand = true, int fill = true , int padding = false); 00254 GtkAccelGroup *AccelGroup() { return accel_group; } 00255 }; 00256 00260 class VDKOptionMenu: public VDKObject 00261 { 00262 public: 00263 VDKOptionMenu(VDKForm* owner); 00264 ~VDKOptionMenu(); 00268 void Add(VDKMenu* menu); 00269 virtual void SetFont(VDKFont* ) {} 00270 }; 00271 00272 00273 #endif 00274