![]() |
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.22 2002/01/18 22:42:51 jeroen Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXARROWBUTTON_H 00025 #define FXARROWBUTTON_H 00026 00027 #ifndef FXFRAME_H 00028 #include "FXFrame.h" 00029 #endif 00030 00031 00032 struct FXTimer; 00033 00034 00035 // Arrow style options 00036 enum { 00037 ARROW_NONE = 0, // No arrow 00038 ARROW_UP = 0x00080000, // Arrow points up 00039 ARROW_DOWN = 0x00100000, // Arrow points down 00040 ARROW_LEFT = 0x00200000, // Arrow points left 00041 ARROW_RIGHT = 0x00400000, // Arrow points right 00042 ARROW_REPEAT = 0x00800000, // Button repeats if held down 00043 ARROW_AUTOGRAY = 0x01000000, // Automatically gray out when not updated 00044 ARROW_AUTOHIDE = 0x02000000, // Automatically hide when not updated 00045 ARROW_TOOLBAR = 0x04000000, // 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 */ 00056 class FXAPI FXArrowButton : public FXFrame { 00057 FXDECLARE(FXArrowButton) 00058 protected: 00059 FXColor arrowColor; // Arrow color 00060 FXint arrowSize; // Arrow size 00061 FXTimer *repeater; // Timer for auto-repeat 00062 FXString tip; // Tooltip value 00063 FXString help; // Help value 00064 FXbool state; // State of button 00065 FXbool fired; // Timer has fired 00066 protected: 00067 FXArrowButton(); 00068 private: 00069 FXArrowButton(const FXArrowButton&); 00070 FXArrowButton &operator=(const FXArrowButton&); 00071 public: 00072 long onPaint(FXObject*,FXSelector,void*); 00073 long onUpdate(FXObject*,FXSelector,void*); 00074 long onEnter(FXObject*,FXSelector,void*); 00075 long onLeave(FXObject*,FXSelector,void*); 00076 long onLeftBtnPress(FXObject*,FXSelector,void*); 00077 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00078 long onUngrabbed(FXObject*,FXSelector,void*); 00079 long onRepeat(FXObject*,FXSelector,void*); 00080 long onKeyPress(FXObject*,FXSelector,void*); 00081 long onKeyRelease(FXObject*,FXSelector,void*); 00082 long onHotKeyPress(FXObject*,FXSelector,void*); 00083 long onHotKeyRelease(FXObject*,FXSelector,void*); 00084 long onQueryHelp(FXObject*,FXSelector,void*); 00085 long onQueryTip(FXObject*,FXSelector,void*); 00086 public: 00087 enum { 00088 ID_REPEAT=FXFrame::ID_LAST, 00089 ID_LAST 00090 }; 00091 public: 00092 00093 /// Construct arrow button 00094 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); 00095 00096 /// Get default width 00097 virtual FXint getDefaultWidth(); 00098 00099 /// Get default height 00100 virtual FXint getDefaultHeight(); 00101 00102 /// Enable the button 00103 virtual void enable(); 00104 00105 /// Disable the button 00106 virtual void disable(); 00107 00108 /// Returns true because a button can receive focus 00109 virtual FXbool canFocus() const; 00110 00111 /// Set the button state (where TRUE means the button is down) 00112 void setState(FXbool s); 00113 00114 /// Get the button state (where TRUE means the button is down) 00115 FXbool getState() const { return state; } 00116 00117 /// Set status line help text for this arrow button 00118 void setHelpText(const FXString& text){ help=text; } 00119 00120 /// Get status line help text for this arrow button 00121 FXString getHelpText() const { return help; } 00122 00123 /// Set tool tip message for this arrow button 00124 void setTipText(const FXString& text){ tip=text; } 00125 00126 /// Get tool tip message for this arrow button 00127 FXString getTipText() const { return tip; } 00128 00129 /// Set the arrow style flags 00130 void setArrowStyle(FXuint style); 00131 00132 /// Get the arrow style flags 00133 FXuint getArrowStyle() const; 00134 00135 /// Set the default arrow size 00136 void setArrowSize(FXint size); 00137 00138 /// Get the default arrow size 00139 FXint getArrowSize() const { return arrowSize; } 00140 00141 /// Set the current justification mode. 00142 void setJustify(FXuint mode); 00143 00144 /// Get the current justification mode. 00145 FXuint getJustify() const; 00146 00147 /// Get the fill color for the arrow 00148 FXColor getArrowColor() const { return arrowColor; } 00149 00150 /// Set the fill color for the arrow 00151 void setArrowColor(FXColor clr); 00152 00153 /// Save label to a stream 00154 virtual void save(FXStream& store) const; 00155 00156 /// Load label from a stream 00157 virtual void load(FXStream& store); 00158 00159 /// Destructor 00160 virtual ~FXArrowButton(); 00161 }; 00162 00163 00164 #endif