![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
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,2002 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.25 2002/09/30 13:06:55 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 struct FXTimer; 00035 00036 00037 // Arrow style options 00038 enum { 00039 ARROW_NONE = 0, // No arrow 00040 ARROW_UP = 0x00080000, // Arrow points up 00041 ARROW_DOWN = 0x00100000, // Arrow points down 00042 ARROW_LEFT = 0x00200000, // Arrow points left 00043 ARROW_RIGHT = 0x00400000, // Arrow points right 00044 ARROW_REPEAT = 0x00800000, // Button repeats if held down 00045 ARROW_AUTOGRAY = 0x01000000, // Automatically gray out when not updated 00046 ARROW_AUTOHIDE = 0x02000000, // Automatically hide when not updated 00047 ARROW_TOOLBAR = 0x04000000, // Button is toolbar-style 00048 ARROW_NORMAL = FRAME_RAISED|FRAME_THICK|ARROW_UP 00049 }; 00050 00051 00052 /** 00053 * Button with an arrow; the arrow can point in any direction. 00054 * When clicked, the arrow button sends a SEL_COMMAND to its target. 00055 * When ARROW_REPEAT is passed, the arrow button sends a SEL_COMMAND 00056 * repeatedly while the button is pressed. 00057 */ 00058 class FXAPI FXArrowButton : public FXFrame { 00059 FXDECLARE(FXArrowButton) 00060 protected: 00061 FXColor arrowColor; // Arrow color 00062 FXint arrowSize; // Arrow size 00063 FXTimer *repeater; // Timer for auto-repeat 00064 FXString tip; // Tooltip value 00065 FXString help; // Help value 00066 FXbool state; // State of button 00067 FXbool fired; // Timer has fired 00068 protected: 00069 FXArrowButton(); 00070 private: 00071 FXArrowButton(const FXArrowButton&); 00072 FXArrowButton &operator=(const FXArrowButton&); 00073 public: 00074 long onPaint(FXObject*,FXSelector,void*); 00075 long onUpdate(FXObject*,FXSelector,void*); 00076 long onEnter(FXObject*,FXSelector,void*); 00077 long onLeave(FXObject*,FXSelector,void*); 00078 long onLeftBtnPress(FXObject*,FXSelector,void*); 00079 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00080 long onUngrabbed(FXObject*,FXSelector,void*); 00081 long onRepeat(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 onQueryHelp(FXObject*,FXSelector,void*); 00087 long onQueryTip(FXObject*,FXSelector,void*); 00088 public: 00089 enum { 00090 ID_REPEAT=FXFrame::ID_LAST, 00091 ID_LAST 00092 }; 00093 public: 00094 00095 /// Construct arrow button 00096 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); 00097 00098 /// Get default width 00099 virtual FXint getDefaultWidth(); 00100 00101 /// Get default height 00102 virtual FXint getDefaultHeight(); 00103 00104 /// Enable the button 00105 virtual void enable(); 00106 00107 /// Disable the button 00108 virtual void disable(); 00109 00110 /// Returns true because a button can receive focus 00111 virtual FXbool canFocus() const; 00112 00113 /// Set the button state (where TRUE means the button is down) 00114 void setState(FXbool s); 00115 00116 /// Get the button state (where TRUE means the button is down) 00117 FXbool getState() const { return state; } 00118 00119 /// Set status line help text for this arrow button 00120 void setHelpText(const FXString& text){ help=text; } 00121 00122 /// Get status line help text for this arrow button 00123 const FXString& getHelpText() const { return help; } 00124 00125 /// Set tool tip message for this arrow button 00126 void setTipText(const FXString& text){ tip=text; } 00127 00128 /// Get tool tip message for this arrow button 00129 const FXString& getTipText() const { return tip; } 00130 00131 /// Set the arrow style flags 00132 void setArrowStyle(FXuint style); 00133 00134 /// Get the arrow style flags 00135 FXuint getArrowStyle() const; 00136 00137 /// Set the default arrow size 00138 void setArrowSize(FXint size); 00139 00140 /// Get the default arrow size 00141 FXint getArrowSize() const { return arrowSize; } 00142 00143 /// Set the current justification mode. 00144 void setJustify(FXuint mode); 00145 00146 /// Get the current justification mode. 00147 FXuint getJustify() const; 00148 00149 /// Get the fill color for the arrow 00150 FXColor getArrowColor() const { return arrowColor; } 00151 00152 /// Set the fill color for the arrow 00153 void setArrowColor(FXColor clr); 00154 00155 /// Save label to a stream 00156 virtual void save(FXStream& store) const; 00157 00158 /// Load label from a stream 00159 virtual void load(FXStream& store); 00160 00161 /// Destructor 00162 virtual ~FXArrowButton(); 00163 }; 00164 00165 } 00166 00167 #endif