![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * S p i n 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: FXSpinner.h,v 1.26 2002/01/18 22:42:54 jeroen Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXSPINNER_H 00025 #define FXSPINNER_H 00026 00027 #ifndef FXPACKER_H 00028 #include "FXPacker.h" 00029 #endif 00030 00031 00032 00033 // Spinner Options 00034 enum { 00035 SPIN_NORMAL = 0, // Normal, non-cyclic 00036 SPIN_CYCLIC = 0x00020000, // Cyclic spinner 00037 SPIN_NOTEXT = 0x00040000, // No text visible 00038 SPIN_NOMAX = 0x00080000, // Spin all the way up to infinity 00039 SPIN_NOMIN = 0x00100000 // Spin all the way down to -infinity 00040 }; 00041 00042 00043 class FXTextField; 00044 class FXArrowButton; 00045 00046 00047 /// Spinner control 00048 class FXAPI FXSpinner : public FXPacker { 00049 FXDECLARE(FXSpinner) 00050 protected: 00051 FXTextField *textField; // Text field 00052 FXArrowButton *upButton; // The up button 00053 FXArrowButton *downButton; // The down button 00054 FXint range[2]; // Reported data range 00055 FXint incr; // Increment 00056 FXint pos; // Current position 00057 protected: 00058 FXSpinner(); 00059 virtual void layout(); 00060 private: 00061 FXSpinner(const FXSpinner&); 00062 FXSpinner& operator=(const FXSpinner&); 00063 public: 00064 long onUpdIncrement(FXObject*,FXSelector,void*); 00065 long onCmdIncrement(FXObject*,FXSelector,void*); 00066 long onUpdDecrement(FXObject*,FXSelector,void*); 00067 long onCmdDecrement(FXObject*,FXSelector,void*); 00068 long onCmdEntry(FXObject*,FXSelector,void*); 00069 long onChgEntry(FXObject*,FXSelector,void*); 00070 long onKeyPress(FXObject*,FXSelector,void*); 00071 long onKeyRelease(FXObject*,FXSelector,void*); 00072 long onCmdSetValue(FXObject*,FXSelector,void*); 00073 long onCmdSetIntValue(FXObject*,FXSelector,void*); 00074 long onCmdGetIntValue(FXObject*,FXSelector,void*); 00075 long onCmdSetIntRange(FXObject*,FXSelector,void*); 00076 long onCmdGetIntRange(FXObject*,FXSelector,void*); 00077 public: 00078 enum{ 00079 ID_INCREMENT=FXPacker::ID_LAST, 00080 ID_DECREMENT, 00081 ID_ENTRY, 00082 ID_LAST 00083 }; 00084 public: 00085 00086 /// Construct a spinner 00087 FXSpinner(FXComposite *p,FXint cols,FXObject *tgt=NULL,FXSelector sel=0,FXuint opts=SPIN_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); 00088 00089 /// Create server-side resources 00090 virtual void create(); 00091 00092 /// Disable spinner 00093 virtual void disable(); 00094 00095 /// Enable spinner 00096 virtual void enable(); 00097 00098 /// Return default width 00099 virtual FXint getDefaultWidth(); 00100 00101 /// Return default height 00102 virtual FXint getDefaultHeight(); 00103 00104 /// Increment spinner 00105 void increment(); 00106 00107 /// Decrement spinner 00108 void decrement(); 00109 00110 /// Return TRUE if in cyclic mode 00111 FXbool isCyclic() const; 00112 00113 /// Set to cyclic mode, i.e. wrap around at maximum/minimum 00114 void setCyclic(FXbool cyclic); 00115 00116 /// Return TRUE if text is visible 00117 FXbool isTextVisible() const; 00118 00119 /// Set text visible flag 00120 void setTextVisible(FXbool shown); 00121 00122 /// Change current value 00123 virtual void setValue(FXint value); 00124 00125 /// Return current value 00126 FXint getValue() const { return pos; } 00127 00128 /// Change the spinner's range 00129 void setRange(FXint lo,FXint hi); 00130 00131 /// Get the spinner's current range 00132 void getRange(FXint& lo,FXint& hi) const { lo=range[0]; hi=range[1]; } 00133 00134 /// Change spinner increment 00135 void setIncrement(FXint increment); 00136 00137 /// Return spinner increment 00138 FXint getIncrement() const { return incr; } 00139 00140 /// Set the text font 00141 void setFont(FXFont *fnt); 00142 00143 /// Get the text font 00144 FXFont *getFont() const; 00145 00146 /// Set the status line help text for this spinner 00147 void setHelpText(const FXString& text); 00148 00149 /// Get the status line help text for this spinner 00150 FXString getHelpText() const; 00151 00152 /// Set the tool tip message for this spinner 00153 void setTipText(const FXString& text); 00154 00155 /// Get the tool tip message for this spinner 00156 FXString getTipText() const; 00157 00158 /// Change spinner style 00159 void setSpinnerStyle(FXuint style); 00160 00161 /// Return current spinner style 00162 FXuint getSpinnerStyle() const; 00163 00164 /// Allow editing of the text field 00165 void setEditable(FXbool edit=TRUE); 00166 00167 /// Return TRUE if text field is editable 00168 FXbool isEditable() const; 00169 00170 /// Save spinner to a stream 00171 virtual void save(FXStream& store) const; 00172 00173 /// Load spinner from a stream 00174 virtual void load(FXStream& store); 00175 00176 /// Destructor 00177 virtual ~FXSpinner(); 00178 }; 00179 00180 #endif