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

/home/jeroen/FOX/fox/fox-1.7.33/include/FXToggleButton.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                   T o g g l e    B u t t o n    W i d g e t                   *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1998,2012 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 #ifndef FXTOGGLEBUTTON_H
00022 #define FXTOGGLEBUTTON_H
00023 
00024 #ifndef FXLABEL_H
00025 #include "FXLabel.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00032 enum {
00033   TOGGLEBUTTON_AUTOGRAY = 0x00800000,       
00034   TOGGLEBUTTON_AUTOHIDE = 0x01000000,       
00035   TOGGLEBUTTON_TOOLBAR  = 0x02000000,       
00036   TOGGLEBUTTON_KEEPSTATE= 0x04000000,       
00037   TOGGLEBUTTON_NORMAL   = FRAME_RAISED|FRAME_THICK|JUSTIFY_NORMAL|ICON_BEFORE_TEXT
00038   };
00039 
00040 
00048 class FXAPI FXToggleButton : public FXLabel {
00049   FXDECLARE(FXToggleButton)
00050 protected:
00051   FXString  altlabel;
00052   FXIcon   *alticon;
00053   FXHotKey  althotkey;
00054   FXint     althotoff;
00055   FXString  alttip;
00056   FXString  althelp;
00057   FXuchar   state;
00058   FXuchar   down;
00059 protected:
00060   FXToggleButton();
00061   void press(FXuchar dn);
00062 private:
00063   FXToggleButton(const FXToggleButton&);
00064   FXToggleButton& operator=(const FXToggleButton&);
00065 public:
00066   long onPaint(FXObject*,FXSelector,void*);
00067   long onUpdate(FXObject*,FXSelector,void*);
00068   long onEnter(FXObject*,FXSelector,void*);
00069   long onLeave(FXObject*,FXSelector,void*);
00070   long onFocusIn(FXObject*,FXSelector,void*);
00071   long onFocusOut(FXObject*,FXSelector,void*);
00072   long onUngrabbed(FXObject*,FXSelector,void*);
00073   long onLeftBtnPress(FXObject*,FXSelector,void*);
00074   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00075   long onKeyPress(FXObject*,FXSelector,void*);
00076   long onKeyRelease(FXObject*,FXSelector,void*);
00077   long onHotKeyPress(FXObject*,FXSelector,void*);
00078   long onHotKeyRelease(FXObject*,FXSelector,void*);
00079   long onCheck(FXObject*,FXSelector,void*);
00080   long onUncheck(FXObject*,FXSelector,void*);
00081   long onQueryHelp(FXObject*,FXSelector,void*);
00082   long onQueryTip(FXObject*,FXSelector,void*);
00083   long onCmdSetValue(FXObject*,FXSelector,void*);
00084   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00085   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00086 public:
00087 
00089   FXToggleButton(FXComposite* p,const FXString& text1,const FXString& text2,FXIcon* icon1=NULL,FXIcon* icon2=NULL,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=TOGGLEBUTTON_NORMAL,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);
00090 
00092   virtual void create();
00093 
00095   virtual void detach();
00096 
00098   virtual FXbool canFocus() const;
00099 
00101   virtual FXint getDefaultWidth();
00102 
00104   virtual FXint getDefaultHeight();
00105 
00107   void setAltText(const FXString& text);
00108 
00110   FXString getAltText() const { return altlabel; }
00111 
00113   void setAltIcon(FXIcon* ic);
00114 
00116   FXIcon* getAltIcon() const { return alticon; }
00117 
00119   void setState(FXuchar s=TRUE,FXbool notify=false);
00120 
00122   FXuchar getState() const { return state; }
00123 
00125   void setAltHelpText(const FXString& text);
00126 
00128   FXString getAltHelpText() const { return althelp; }
00129 
00131   void setAltTipText(const FXString& text);
00132 
00134   FXString getAltTipText() const { return alttip; }
00135 
00137   void setToggleStyle(FXuint style);
00138 
00140   FXuint getToggleStyle() const;
00141 
00143   virtual void save(FXStream& store) const;
00144 
00146   virtual void load(FXStream& store);
00147 
00149   virtual ~FXToggleButton();
00150   };
00151 
00152 }
00153 
00154 #endif

Copyright © 1997-2011 Jeroen van der Zijp