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

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 
00050 /**
00051 * Button with an arrow; the arrow can point in any direction.
00052 * When clicked, the arrow button sends a SEL_COMMAND to its target.
00053 * When ARROW_REPEAT is passed, the arrow button sends a SEL_COMMAND
00054 * repeatedly while the button is pressed.
00055 * The option ARROW_AUTO together with ARROW_REPEAT makes the arrow
00056 * button work in repeat mode simply by hovering the cursor over it.
00057 */
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 
00100   /// Construct arrow button
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 
00103   /// Get default width
00104   virtual FXint getDefaultWidth();
00105 
00106   /// Get default height
00107   virtual FXint getDefaultHeight();
00108 
00109   /// Enable the button
00110   virtual void enable();
00111 
00112   /// Disable the button
00113   virtual void disable();
00114 
00115   /// Returns true because a button can receive focus
00116   virtual bool canFocus() const;
00117 
00118   /// Set the button state (where TRUE means the button is down)
00119   void setState(FXbool s);
00120 
00121   /// Get the button state (where TRUE means the button is down)
00122   FXbool getState() const { return state; }
00123 
00124   /// Set status line help text for this arrow button
00125   void setHelpText(const FXString& text){ help=text; }
00126 
00127   /// Get status line help text for this arrow button
00128   const FXString& getHelpText() const { return help; }
00129 
00130   /// Set tool tip message for this arrow button
00131   void setTipText(const FXString& text){ tip=text; }
00132 
00133   /// Get tool tip message for this arrow button
00134   const FXString& getTipText() const { return tip; }
00135 
00136   /// Set the arrow style flags
00137   void setArrowStyle(FXuint style);
00138 
00139   /// Get the arrow style flags
00140   FXuint getArrowStyle() const;
00141 
00142   /// Set the default arrow size
00143   void setArrowSize(FXint size);
00144 
00145   /// Get the default arrow size
00146   FXint getArrowSize() const { return arrowSize; }
00147 
00148   /// Set the current justification mode.
00149   void setJustify(FXuint mode);
00150 
00151   /// Get the current justification mode.
00152   FXuint getJustify() const;
00153 
00154   /// Get the fill color for the arrow
00155   FXColor getArrowColor() const { return arrowColor; }
00156 
00157   /// Set the fill color for the arrow
00158   void setArrowColor(FXColor clr);
00159 
00160   /// Save label to a stream
00161   virtual void save(FXStream& store) const;
00162 
00163   /// Load label from a stream
00164   virtual void load(FXStream& store);
00165 
00166   /// Destructor
00167   virtual ~FXArrowButton();
00168   };
00169 
00170 }
00171 
00172 #endif

Copyright © 1997-2005 Jeroen van der Zijp