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

/home/jeroen/FOX/fox/fox-1.7.33/include/FXButton.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                           B u t t o n   W i d g e t                           *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,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 FXBUTTON_H
00022 #define FXBUTTON_H
00023 
00024 #ifndef FXLABEL_H
00025 #include "FXLabel.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00032 enum {
00033   STATE_UP        = 0,      
00034   STATE_DOWN      = 1,      
00035   STATE_ENGAGED   = 2,      
00036   STATE_UNCHECKED = STATE_UP,   
00037   STATE_CHECKED   = STATE_ENGAGED 
00038   };
00039 
00040 
00042 enum {
00043   BUTTON_AUTOGRAY  = 0x00800000,  
00044   BUTTON_AUTOHIDE  = 0x01000000,  
00045   BUTTON_TOOLBAR   = 0x02000000,  
00046   BUTTON_DEFAULT   = 0x04000000,  
00047   BUTTON_INITIAL   = 0x08000000,  
00048   BUTTON_NORMAL    = (FRAME_RAISED|FRAME_THICK|JUSTIFY_NORMAL|ICON_BEFORE_TEXT)
00049   };
00050 
00051 
00070 class FXAPI FXButton : public FXLabel {
00071   FXDECLARE(FXButton)
00072 protected:
00073   FXuchar  state;
00074 protected:
00075   FXButton();
00076 private:
00077   FXButton(const FXButton&);
00078   FXButton& operator=(const FXButton&);
00079 public:
00080   long onPaint(FXObject*,FXSelector,void*);
00081   long onUpdate(FXObject*,FXSelector,void*);
00082   long onEnter(FXObject*,FXSelector,void*);
00083   long onLeave(FXObject*,FXSelector,void*);
00084   long onFocusIn(FXObject*,FXSelector,void*);
00085   long onFocusOut(FXObject*,FXSelector,void*);
00086   long onUngrabbed(FXObject*,FXSelector,void*);
00087   long onLeftBtnPress(FXObject*,FXSelector,void*);
00088   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00089   long onKeyPress(FXObject*,FXSelector,void*);
00090   long onKeyRelease(FXObject*,FXSelector,void*);
00091   long onHotKeyPress(FXObject*,FXSelector,void*);
00092   long onHotKeyRelease(FXObject*,FXSelector,void*);
00093   long onCheck(FXObject*,FXSelector,void*);
00094   long onUncheck(FXObject*,FXSelector,void*);
00095   long onCmdSetValue(FXObject*,FXSelector,void*);
00096   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00097   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00098 public:
00099 
00101   FXButton(FXComposite* p,const FXString& text,FXIcon* ic=NULL,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=BUTTON_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);
00102 
00104   virtual FXbool canFocus() const;
00105 
00107   virtual void setFocus();
00108 
00110   virtual void killFocus();
00111 
00113   virtual void setDefault(FXuchar flag=TRUE);
00114 
00116   void setState(FXuint s);
00117 
00119   FXuint getState() const { return state; }
00120 
00122   void setButtonStyle(FXuint style);
00123 
00125   FXuint getButtonStyle() const;
00126 
00127   };
00128 
00129 }
00130 
00131 #endif

Copyright © 1997-2011 Jeroen van der Zijp