Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXOptionMenu.h

00001 /******************************************************************************** 00002 * * 00003 * O p t i o n M e n u * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1997,2004 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.23 2004/02/08 17:17:34 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,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 private: 00090 FXOptionMenu(const FXOptionMenu&); 00091 FXOptionMenu &operator=(const FXOptionMenu&); 00092 public: 00093 long onPaint(FXObject*,FXSelector,void*); 00094 long onLeftBtnPress(FXObject*,FXSelector,void*); 00095 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00096 long onFocusIn(FXObject*,FXSelector,void*); 00097 long onFocusOut(FXObject*,FXSelector,void*); 00098 long onMotion(FXObject*,FXSelector,void*); 00099 long onKeyPress(FXObject*,FXSelector,void*); 00100 long onKeyRelease(FXObject*,FXSelector,void*); 00101 long onCmdPost(FXObject*,FXSelector,void*); 00102 long onCmdUnpost(FXObject*,FXSelector,void*); 00103 long onQueryHelp(FXObject*,FXSelector,void*); 00104 long onQueryTip(FXObject*,FXSelector,void*); 00105 long onCmdSetValue(FXObject*,FXSelector,void*); 00106 long onCmdSetIntValue(FXObject*,FXSelector,void*); 00107 long onCmdGetIntValue(FXObject*,FXSelector,void*); 00108 public: 00109 00110 /// Constructor 00111 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); 00112 00113 /// Create server-side resources 00114 virtual void create(); 00115 00116 /// Detach server-side resources 00117 virtual void detach(); 00118 00119 /// Delete server-side resources 00120 virtual void destroy(); 00121 00122 /// Perform layout 00123 virtual void layout(); 00124 00125 /// Remove the focus from this window 00126 virtual void killFocus(); 00127 00128 /// Return default width 00129 virtual FXint getDefaultWidth(); 00130 00131 /// Return default height 00132 virtual FXint getDefaultHeight(); 00133 00134 /// Return TRUE if the position is logically in the pane 00135 virtual FXbool contains(FXint parentx,FXint parenty) const; 00136 00137 /// Set the current option 00138 void setCurrent(FXOption *win,FXbool notify=FALSE); 00139 00140 /// Return the current option 00141 FXOption* getCurrent() const { return current; } 00142 00143 /// Set the current option number 00144 void setCurrentNo(FXint no,FXbool notify=FALSE); 00145 00146 /// Get the current option number 00147 FXint getCurrentNo() const; 00148 00149 /// Get number of options 00150 FXint getNumOptions() const; 00151 00152 /// Set the pane which will be popped up 00153 void setMenu(FXPopup *pup); 00154 00155 /// Return the pane which is poppup up 00156 FXPopup* getMenu() const { return pane; } 00157 00158 /// Returns true because a option menu can receive focus 00159 virtual FXbool canFocus() const; 00160 00161 /// Return TRUE if popped up 00162 FXbool isPopped() const; 00163 00164 /// Save option menu to a stream 00165 virtual void save(FXStream& store) const; 00166 00167 /// Load option menu from a stream 00168 virtual void load(FXStream& store); 00169 00170 /// Destructor 00171 virtual ~FXOptionMenu(); 00172 }; 00173 00174 } 00175 00176 #endif

Copyright © 1997-2004 Jeroen van der Zijp