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,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.14 2002/01/18 22:42:54 jeroen Exp $                   *
00023 ********************************************************************************/
00024 #ifndef FXOPTIONMENU_H
00025 #define FXOPTIONMENU_H
00026 
00027 #ifndef FXLABEL_H
00028 #include "FXLabel.h"
00029 #endif
00030 
00031 
00032 
00033 class FXPopup;
00034 
00035 
00036 /// Option Menu Button
00037 class FXAPI FXOption : public FXLabel {
00038   FXDECLARE(FXOption)
00039 protected:
00040   FXOption(){}
00041 private:
00042   FXOption(const FXOption&);
00043   FXOption &operator=(const FXOption&);
00044 public:
00045   long onPaint(FXObject*,FXSelector,void*);
00046   long onEnter(FXObject*,FXSelector,void*);
00047   long onLeave(FXObject*,FXSelector,void*);
00048   long onLeftBtnPress(FXObject*,FXSelector,void*);
00049   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00050   long onKeyPress(FXObject*,FXSelector,void*);
00051   long onKeyRelease(FXObject*,FXSelector,void*);
00052   long onHotKeyPress(FXObject*,FXSelector,void*);
00053   long onHotKeyRelease(FXObject*,FXSelector,void*);
00054 public:
00055 
00056   /// Constructor
00057   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);
00058 
00059   /// Return default width
00060   virtual FXint getDefaultWidth();
00061 
00062   /// Return default height
00063   virtual FXint getDefaultHeight();
00064 
00065   /// Returns true because a menu button can receive focus
00066   virtual FXbool canFocus() const;
00067 
00068   /// Set focus to this window
00069   virtual void setFocus();
00070 
00071   /// Remove the focus from this window
00072   virtual void killFocus();
00073 
00074   /// Destructor
00075   virtual ~FXOption();
00076   };
00077 
00078 
00079 
00080 /// Option Menu
00081 class FXAPI FXOptionMenu : public FXLabel {
00082   FXDECLARE(FXOptionMenu)
00083 protected:
00084   FXPopup  *pane;
00085   FXOption *current;
00086 protected:
00087   FXOptionMenu(){}
00088   virtual void layout();
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   /// Remove the focus from this window
00123   virtual void killFocus();
00124 
00125   /// Return default width
00126   virtual FXint getDefaultWidth();
00127 
00128   /// Return default height
00129   virtual FXint getDefaultHeight();
00130 
00131   /// Return TRUE if the position is logically in the pane
00132   virtual FXbool contains(FXint parentx,FXint parenty) const;
00133 
00134   /// Set the current option
00135   void setCurrent(FXOption *win);
00136 
00137   /// Return the current option
00138   FXOption* getCurrent() const { return current; }
00139 
00140   /// Set the current option number
00141   void setCurrentNo(FXint no);
00142 
00143   /// Get the current option number
00144   FXint getCurrentNo() const;
00145 
00146   /// Set the pane which will be popped up
00147   void setPopup(FXPopup *pup);
00148 
00149   /// Return the pane which is poppup up
00150   FXPopup* getPopup() const { return pane; }
00151 
00152   /// Returns true because a option menu can receive focus
00153   virtual FXbool canFocus() const;
00154 
00155   /// Return TRUE if popped up
00156   FXbool isPopped() const;
00157 
00158   /// Save option menu to a stream
00159   virtual void save(FXStream& store) const;
00160 
00161   /// Load option menu from a stream
00162   virtual void load(FXStream& store);
00163 
00164   /// Destructor
00165   virtual ~FXOptionMenu();
00166   };
00167 
00168 
00169 #endif