FXButton.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                           B u t t o n   W i d g e t                           *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2006 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: FXButton.h,v 1.38 2006/01/22 17:57:59 fox Exp $                          *
00023 ********************************************************************************/
00024 #ifndef FXBUTTON_H
00025 #define FXBUTTON_H
00026 
00027 #ifndef FXLABEL_H
00028 #include "FXLabel.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00035 enum {
00036   STATE_UP        = 0,        
00037   STATE_DOWN      = 1,        
00038   STATE_ENGAGED   = 2,        
00039   STATE_UNCHECKED = STATE_UP,     
00040   STATE_CHECKED   = STATE_ENGAGED 
00041   };
00042 
00043 
00045 enum {
00046   BUTTON_AUTOGRAY  = 0x00800000,  
00047   BUTTON_AUTOHIDE  = 0x01000000,  
00048   BUTTON_TOOLBAR   = 0x02000000,  
00049   BUTTON_DEFAULT   = 0x04000000,  
00050   BUTTON_INITIAL   = 0x08000000,  
00051   BUTTON_DANGEROUS = 0x10000000,  
00052   BUTTON_NORMAL    = (FRAME_RAISED|FRAME_THICK|JUSTIFY_NORMAL|ICON_BEFORE_TEXT)
00053   };
00054 
00055 
00074 class FXAPI FXButton : public FXLabel {
00075   FXDECLARE(FXButton)
00076 protected:
00077   FXuchar  state;
00078 protected:
00079   FXButton();
00080   void drawButton(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
00081 private:
00082   FXButton(const FXButton&);
00083   FXButton& operator=(const FXButton&);
00084   inline FXColor tintBackground(FXColor color) const;
00085 public:
00086   long onPaint(FXObject*,FXSelector,void*);
00087   long onUpdate(FXObject*,FXSelector,void*);
00088   long onEnter(FXObject*,FXSelector,void*);
00089   long onLeave(FXObject*,FXSelector,void*);
00090   long onFocusIn(FXObject*,FXSelector,void*);
00091   long onFocusOut(FXObject*,FXSelector,void*);
00092   long onUngrabbed(FXObject*,FXSelector,void*);
00093   long onLeftBtnPress(FXObject*,FXSelector,void*);
00094   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00095   long onKeyPress(FXObject*,FXSelector,void*);
00096   long onKeyRelease(FXObject*,FXSelector,void*);
00097   long onHotKeyPress(FXObject*,FXSelector,void*);
00098   long onHotKeyRelease(FXObject*,FXSelector,void*);
00099   long onCheck(FXObject*,FXSelector,void*);
00100   long onUncheck(FXObject*,FXSelector,void*);
00101   long onCmdSetValue(FXObject*,FXSelector,void*);
00102   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00103   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00104 public:
00105 
00107   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);
00108 
00110   virtual bool canFocus() const;
00111 
00113   virtual void setFocus();
00114 
00116   virtual void killFocus();
00117 
00119   virtual void setDefault(FXbool enable=TRUE);
00120 
00122   void setState(FXuint s);
00123 
00125   FXuint getState() const { return state; }
00126 
00128   void setButtonStyle(FXuint style);
00129 
00131   FXuint getButtonStyle() const;
00132 
00133   };
00134 
00135 }
00136 
00137 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:19 2009 for TnFOX by doxygen v1.4.7