FXArrowButton.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                     A r r o w   B u t t o n   W i d g e t                     *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1998,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: FXArrowButton.h,v 1.39 2006/01/22 17:57:58 fox Exp $                     *
00023 ********************************************************************************/
00024 #ifndef FXARROWBUTTON_H
00025 #define FXARROWBUTTON_H
00026 
00027 #ifndef FXFRAME_H
00028 #include "FXFrame.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 // Arrow style options
00035 enum {
00036   ARROW_NONE     = 0,       // No arrow
00037   ARROW_UP       = 0x00080000,  // Arrow points up
00038   ARROW_DOWN     = 0x00100000,  // Arrow points down
00039   ARROW_LEFT     = 0x00200000,  // Arrow points left
00040   ARROW_RIGHT    = 0x00400000,  // Arrow points right
00041   ARROW_AUTO     = 0x00800000,  // Automatically fire when hovering mouse over button
00042   ARROW_REPEAT   = 0x01000000,  // Button repeats if held down
00043   ARROW_AUTOGRAY = 0x02000000,  // Automatically gray out when not updated
00044   ARROW_AUTOHIDE = 0x04000000,  // Automatically hide when not updated
00045   ARROW_TOOLBAR  = 0x08000000,  // Button is toolbar-style
00046   ARROW_NORMAL   = FRAME_RAISED|FRAME_THICK|ARROW_UP
00047   };
00048 
00049 
00058 class FXAPI FXArrowButton : public FXFrame {
00059   FXDECLARE(FXArrowButton)
00060 protected:
00061   FXColor   arrowColor;     // Arrow color
00062   FXint     arrowSize;      // Arrow size
00063   FXString  tip;            // Tooltip value
00064   FXString  help;           // Help value
00065   FXbool    state;          // State of button
00066   FXbool    fired;          // Timer has fired
00067 protected:
00068   FXArrowButton();
00069 private:
00070   FXArrowButton(const FXArrowButton&);
00071   FXArrowButton &operator=(const FXArrowButton&);
00072 public:
00073   long onPaint(FXObject*,FXSelector,void*);
00074   long onUpdate(FXObject*,FXSelector,void*);
00075   long onEnter(FXObject*,FXSelector,void*);
00076   long onLeave(FXObject*,FXSelector,void*);
00077   long onLeftBtnPress(FXObject*,FXSelector,void*);
00078   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00079   long onUngrabbed(FXObject*,FXSelector,void*);
00080   long onRepeat(FXObject*,FXSelector,void*);
00081   long onAuto(FXObject*,FXSelector,void*);
00082   long onKeyPress(FXObject*,FXSelector,void*);
00083   long onKeyRelease(FXObject*,FXSelector,void*);
00084   long onHotKeyPress(FXObject*,FXSelector,void*);
00085   long onHotKeyRelease(FXObject*,FXSelector,void*);
00086   long onCmdSetHelp(FXObject*,FXSelector,void*);
00087   long onCmdGetHelp(FXObject*,FXSelector,void*);
00088   long onCmdSetTip(FXObject*,FXSelector,void*);
00089   long onCmdGetTip(FXObject*,FXSelector,void*);
00090   long onQueryHelp(FXObject*,FXSelector,void*);
00091   long onQueryTip(FXObject*,FXSelector,void*);
00092 public:
00093   enum {
00094     ID_REPEAT=FXFrame::ID_LAST,
00095     ID_AUTO,
00096     ID_LAST
00097     };
00098 public:
00099 
00101   FXArrowButton(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=ARROW_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 FXint getDefaultWidth();
00105 
00107   virtual FXint getDefaultHeight();
00108 
00110   virtual void enable();
00111 
00113   virtual void disable();
00114 
00116   virtual bool canFocus() const;
00117 
00119   void setState(FXbool s);
00120 
00122   FXbool getState() const { return state; }
00123 
00125   void setHelpText(const FXString& text){ help=text; }
00126 
00128   const FXString& getHelpText() const { return help; }
00129 
00131   void setTipText(const FXString& text){ tip=text; }
00132 
00134   const FXString& getTipText() const { return tip; }
00135 
00137   void setArrowStyle(FXuint style);
00138 
00140   FXuint getArrowStyle() const;
00141 
00143   void setArrowSize(FXint size);
00144 
00146   FXint getArrowSize() const { return arrowSize; }
00147 
00149   void setJustify(FXuint mode);
00150 
00152   FXuint getJustify() const;
00153 
00155   FXColor getArrowColor() const { return arrowColor; }
00156 
00158   void setArrowColor(FXColor clr);
00159 
00161   virtual void save(FXStream& store) const;
00162 
00164   virtual void load(FXStream& store);
00165 
00167   virtual ~FXArrowButton();
00168   };
00169 
00170 }
00171 
00172 #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