![]() |
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,2002 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (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 GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXOptionMenu.h,v 1.16 2002/03/12 07:11:30 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXOPTIONMENU_H 00025 #define FXOPTIONMENU_H 00026 00027 #ifndef FXLABEL_H 00028 #include "FXLabel.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 class FXPopup; 00035 00036 00037 /// Option Menu Button 00038 class FXAPI FXOption : public FXLabel { 00039 FXDECLARE(FXOption) 00040 protected: 00041 FXOption(){} 00042 private: 00043 FXOption(const FXOption&); 00044 FXOption &operator=(const FXOption&); 00045 public: 00046 long onPaint(FXObject*,FXSelector,void*); 00047 long onEnter(FXObject*,FXSelector,void*); 00048 long onLeave(FXObject*,FXSelector,void*); 00049 long onLeftBtnPress(FXObject*,FXSelector,void*); 00050 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00051 long onKeyPress(FXObject*,FXSelector,void*); 00052 long onKeyRelease(FXObject*,FXSelector,void*); 00053 long onHotKeyPress(FXObject*,FXSelector,void*); 00054 long onHotKeyRelease(FXObject*,FXSelector,void*); 00055 public: 00056 00057 /// Constructor 00058 FXOption(FXComposite* p,const FXString& text,FXIcon* ic=NULL,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=JUSTIFY_NORMAL|ICON_BEFORE_TEXT|MENUBUTTON_DOWN,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); 00059 00060 /// Return default width 00061 virtual FXint getDefaultWidth(); 00062 00063 /// Return default height 00064 virtual FXint getDefaultHeight(); 00065 00066 /// Returns true because a menu button can receive focus 00067 virtual FXbool canFocus() const; 00068 00069 /// Set focus to this window 00070 virtual void setFocus(); 00071 00072 /// Remove the focus from this window 00073 virtual void killFocus(); 00074 00075 /// Destructor 00076 virtual ~FXOption(); 00077 }; 00078 00079 00080 00081 /// Option Menu 00082 class FXAPI FXOptionMenu : public FXLabel { 00083 FXDECLARE(FXOptionMenu) 00084 protected: 00085 FXPopup *pane; 00086 FXOption *current; 00087 protected: 00088 FXOptionMenu(){} 00089 virtual void layout(); 00090 private: 00091 FXOptionMenu(const FXOptionMenu&); 00092 FXOptionMenu &operator=(const FXOptionMenu&); 00093 public: 00094 long onPaint(FXObject*,FXSelector,void*); 00095 long onLeftBtnPress(FXObject*,FXSelector,void*); 00096 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00097 long onFocusIn(FXObject*,FXSelector,void*); 00098 long onFocusOut(FXObject*,FXSelector,void*); 00099 long onMotion(FXObject*,FXSelector,void*); 00100 long onKeyPress(FXObject*,FXSelector,void*); 00101 long onKeyRelease(FXObject*,FXSelector,void*); 00102 long onCmdPost(FXObject*,FXSelector,void*); 00103 long onCmdUnpost(FXObject*,FXSelector,void*); 00104 long onQueryHelp(FXObject*,FXSelector,void*); 00105 long onQueryTip(FXObject*,FXSelector,void*); 00106 long onCmdSetValue(FXObject*,FXSelector,void*); 00107 long onCmdSetIntValue(FXObject*,FXSelector,void*); 00108 long onCmdGetIntValue(FXObject*,FXSelector,void*); 00109 public: 00110 00111 /// Constructor 00112 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); 00113 00114 /// Create server-side resources 00115 virtual void create(); 00116 00117 /// Detach server-side resources 00118 virtual void detach(); 00119 00120 /// Delete server-side resources 00121 virtual void destroy(); 00122 00123 /// Remove the focus from this window 00124 virtual void killFocus(); 00125 00126 /// Return default width 00127 virtual FXint getDefaultWidth(); 00128 00129 /// Return default height 00130 virtual FXint getDefaultHeight(); 00131 00132 /// Return TRUE if the position is logically in the pane 00133 virtual FXbool contains(FXint parentx,FXint parenty) const; 00134 00135 /// Set the current option 00136 void setCurrent(FXOption *win); 00137 00138 /// Return the current option 00139 FXOption* getCurrent() const { return current; } 00140 00141 /// Set the current option number 00142 void setCurrentNo(FXint no); 00143 00144 /// Get the current option number 00145 FXint getCurrentNo() const; 00146 00147 /// Set the pane which will be popped up 00148 void setPopup(FXPopup *pup); 00149 00150 /// Return the pane which is poppup up 00151 FXPopup* getPopup() const { return pane; } 00152 00153 /// Returns true because a option menu can receive focus 00154 virtual FXbool canFocus() const; 00155 00156 /// Return TRUE if popped up 00157 FXbool isPopped() const; 00158 00159 /// Save option menu to a stream 00160 virtual void save(FXStream& store) const; 00161 00162 /// Load option menu from a stream 00163 virtual void load(FXStream& store); 00164 00165 /// Destructor 00166 virtual ~FXOptionMenu(); 00167 }; 00168 00169 } 00170 00171 #endif