![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * O p t i o n M e n u * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1997,2009 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU Lesser General Public License as published by * 00010 * the Free Software Foundation; either version 3 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public License * 00019 * along with this program. If not, see <http://www.gnu.org/licenses/> * 00020 ********************************************************************************* 00021 * $Id: FXOptionMenu.h,v 1.37 2009/01/06 13:07:26 fox Exp $ * 00022 ********************************************************************************/ 00023 #ifndef FXOPTIONMENU_H 00024 #define FXOPTIONMENU_H 00025 00026 #ifndef FXLABEL_H 00027 #include "FXLabel.h" 00028 #endif 00029 00030 namespace FX { 00031 00032 00033 class FXPopup; 00034 00035 00036 /// Option Menu Button flags 00037 enum { 00038 OPTIONMENU_TOOLBAR = 0x00800000, /// Toolbar style button [flat look] 00039 OPTIONMENU_NOGLYPH = 0x01000000, /// Do not display a glyph 00040 }; 00041 00042 00043 /// Option Menu Button 00044 class FXAPI FXOption : public FXLabel { 00045 FXDECLARE(FXOption) 00046 protected: 00047 FXColor selbackColor; 00048 FXColor seltextColor; 00049 protected: 00050 FXOption(); 00051 private: 00052 FXOption(const FXOption&); 00053 FXOption &operator=(const FXOption&); 00054 public: 00055 long onPaint(FXObject*,FXSelector,void*); 00056 long onEnter(FXObject*,FXSelector,void*); 00057 long onLeave(FXObject*,FXSelector,void*); 00058 long onLeftBtnPress(FXObject*,FXSelector,void*); 00059 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00060 long onKeyPress(FXObject*,FXSelector,void*); 00061 long onKeyRelease(FXObject*,FXSelector,void*); 00062 long onHotKeyPress(FXObject*,FXSelector,void*); 00063 long onHotKeyRelease(FXObject*,FXSelector,void*); 00064 public: 00065 00066 /// Constructor 00067 FXOption(FXComposite* p,const FXString& text,FXIcon* ic=NULL,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=JUSTIFY_NORMAL|ICON_BEFORE_TEXT,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD); 00068 00069 /// Return default width 00070 virtual FXint getDefaultWidth(); 00071 00072 /// Return default height 00073 virtual FXint getDefaultHeight(); 00074 00075 /// Returns true because a menu button can receive focus 00076 virtual FXbool canFocus() const; 00077 00078 /// Set focus to this window 00079 virtual void setFocus(); 00080 00081 /// Remove the focus from this window 00082 virtual void killFocus(); 00083 00084 /// Return the selection background color 00085 void setSelBackColor(FXColor clr); 00086 00087 /// Return the selection background color 00088 FXColor getSelBackColor() const { return selbackColor; } 00089 00090 /// Return the selection text color 00091 void setSelTextColor(FXColor clr); 00092 00093 /// Return the selection text color 00094 FXColor getSelTextColor() const { return seltextColor; } 00095 00096 /// Destructor 00097 virtual ~FXOption(); 00098 }; 00099 00100 00101 00102 /// Option Menu 00103 class FXAPI FXOptionMenu : public FXLabel { 00104 FXDECLARE(FXOptionMenu) 00105 protected: 00106 FXPopup *pane; 00107 FXOption *current; 00108 protected: 00109 FXOptionMenu(){} 00110 private: 00111 FXOptionMenu(const FXOptionMenu&); 00112 FXOptionMenu &operator=(const FXOptionMenu&); 00113 public: 00114 long onPaint(FXObject*,FXSelector,void*); 00115 long onLeftBtnPress(FXObject*,FXSelector,void*); 00116 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00117 long onEnter(FXObject*,FXSelector,void*); 00118 long onLeave(FXObject*,FXSelector,void*); 00119 long onFocusIn(FXObject*,FXSelector,void*); 00120 long onFocusOut(FXObject*,FXSelector,void*); 00121 long onMotion(FXObject*,FXSelector,void*); 00122 long onKeyPress(FXObject*,FXSelector,void*); 00123 long onKeyRelease(FXObject*,FXSelector,void*); 00124 long onCmdPost(FXObject*,FXSelector,void*); 00125 long onCmdUnpost(FXObject*,FXSelector,void*); 00126 long onQueryHelp(FXObject*,FXSelector,void*); 00127 long onQueryTip(FXObject*,FXSelector,void*); 00128 long onCmdSetValue(FXObject*,FXSelector,void*); 00129 long onCmdSetIntValue(FXObject*,FXSelector,void*); 00130 long onCmdGetIntValue(FXObject*,FXSelector,void*); 00131 long onMouseWheel(FXObject*,FXSelector,void*); 00132 public: 00133 00134 /// Constructor 00135 FXOptionMenu(FXComposite* p,FXPopup* pup=NULL,FXuint opts=JUSTIFY_NORMAL|ICON_BEFORE_TEXT,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD); 00136 00137 /// Create server-side resources 00138 virtual void create(); 00139 00140 /// Detach server-side resources 00141 virtual void detach(); 00142 00143 /// Delete server-side resources 00144 virtual void destroy(); 00145 00146 /// Perform layout 00147 virtual void layout(); 00148 00149 /// Remove the focus from this window 00150 virtual void killFocus(); 00151 00152 /// Return default width 00153 virtual FXint getDefaultWidth(); 00154 00155 /// Return default height 00156 virtual FXint getDefaultHeight(); 00157 00158 /// Return true if the position is logically in the pane 00159 virtual FXbool contains(FXint parentx,FXint parenty) const; 00160 00161 /// Return the option item at the given index 00162 FXOption *getItem(FXint index) const; 00163 00164 /// Set the current option 00165 void setCurrent(FXOption *win,FXbool notify=false); 00166 00167 /// Return the current option 00168 FXOption* getCurrent() const { return current; } 00169 00170 /// Set the current option number 00171 void setCurrentNo(FXint no,FXbool notify=false); 00172 00173 /// Get the current option number 00174 FXint getCurrentNo() const; 00175 00176 /// Get number of options 00177 FXint getNumOptions() const; 00178 00179 /// Set the pane which will be popped up 00180 void setMenu(FXPopup *pup); 00181 00182 /// Return the pane which is poppup up 00183 FXPopup* getMenu() const { return pane; } 00184 00185 /// Returns true because a option menu can receive focus 00186 virtual FXbool canFocus() const; 00187 00188 /// Return true if popped up 00189 FXbool isPopped() const; 00190 00191 /// Save option menu to a stream 00192 virtual void save(FXStream& store) const; 00193 00194 /// Load option menu from a stream 00195 virtual void load(FXStream& store); 00196 00197 /// Destructor 00198 virtual ~FXOptionMenu(); 00199 }; 00200 00201 } 00202 00203 #endif
![]() |