Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
|
00001 /******************************************************************************** 00002 * * 00003 * R e a l - V a l u e d S p i n n e r W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 2003,2006 by Bill Baxter. 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: FXRealSpinner.h,v 1.16 2006/02/10 03:53:47 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXREALSPINNER_H 00025 #define FXREALSPINNER_H 00026 00027 #ifndef FXPACKER_H 00028 #include "FXPacker.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 /// RealSpinner Options 00035 enum { 00036 REALSPIN_NORMAL = 0, /// Normal, non-cyclic 00037 REALSPIN_CYCLIC = 0x00020000, /// Cyclic spinner 00038 REALSPIN_NOTEXT = 0x00040000, /// No text visible 00039 REALSPIN_NOMAX = 0x00080000, /// Spin all the way up to infinity 00040 REALSPIN_NOMIN = 0x00100000, /// Spin all the way down to -infinity 00041 REALSPIN_LOG = 0x00200000 /// Logarithmic rather than linear 00042 }; 00043 00044 00045 class FXTextField; 00046 class FXDial; 00047 00048 00049 /// Spinner control 00050 class FXAPI FXRealSpinner : public FXPacker { 00051 FXDECLARE(FXRealSpinner) 00052 protected: 00053 FXTextField *textField; // Text field 00054 FXArrowButton *upButton; // The up button 00055 FXArrowButton *downButton; // The down button 00056 FXdouble range[2]; // Reported data range 00057 FXdouble incr; // Increment 00058 FXdouble gran; // Granularity 00059 FXdouble pos; // Current position 00060 protected: 00061 FXRealSpinner(); 00062 private: 00063 FXRealSpinner(const FXRealSpinner&); 00064 FXRealSpinner& operator=(const FXRealSpinner&); 00065 public: 00066 long onUpdIncrement(FXObject*,FXSelector,void*); 00067 long onCmdIncrement(FXObject*,FXSelector,void*); 00068 long onUpdDecrement(FXObject*,FXSelector,void*); 00069 long onCmdDecrement(FXObject*,FXSelector,void*); 00070 long onCmdEntry(FXObject*,FXSelector,void*); 00071 long onChgEntry(FXObject*,FXSelector,void*); 00072 long onWheelEntry(FXObject*,FXSelector,void*); 00073 long onKeyPress(FXObject*,FXSelector,void*); 00074 long onKeyRelease(FXObject*,FXSelector,void*); 00075 long onCmdSetValue(FXObject*,FXSelector,void*); 00076 long onCmdSetIntValue(FXObject*,FXSelector,void*); 00077 long onCmdGetIntValue(FXObject*,FXSelector,void*); 00078 long onCmdSetIntRange(FXObject*,FXSelector,void*); 00079 long onCmdGetIntRange(FXObject*,FXSelector,void*); 00080 long onCmdSetRealValue(FXObject*,FXSelector,void*); 00081 long onCmdGetRealValue(FXObject*,FXSelector,void*); 00082 long onCmdSetRealRange(FXObject*,FXSelector,void*); 00083 long onCmdGetRealRange(FXObject*,FXSelector,void*); 00084 long onFocusSelf(FXObject*,FXSelector,void*); 00085 public: 00086 enum{ 00087 ID_INCREMENT=FXPacker::ID_LAST, 00088 ID_DECREMENT, 00089 ID_ENTRY, 00090 ID_LAST 00091 }; 00092 public: 00093 00094 /// Construct a spinner 00095 FXRealSpinner(FXComposite *p,FXint cols,FXObject *tgt=NULL,FXSelector sel=0,FXuint opts=REALSPIN_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); 00096 00097 /// Perform layout 00098 virtual void layout(); 00099 00100 /// Disable spinner 00101 virtual void disable(); 00102 00103 /// Enable spinner 00104 virtual void enable(); 00105 00106 /// Return default width 00107 virtual FXint getDefaultWidth(); 00108 00109 /// Return default height 00110 virtual FXint getDefaultHeight(); 00111 00112 /// Increment spinner 00113 void increment(FXbool notify=FALSE); 00114 00115 /// Increment spinner by certain amount 00116 void incrementByAmount(FXdouble amount,FXbool notify=FALSE); 00117 00118 /// Decrement spinner 00119 void decrement(FXbool notify=FALSE); 00120 00121 /// Decrement spinner by certain amount 00122 void decrementByAmount(FXdouble amount, FXbool notify=FALSE); 00123 00124 /// Return TRUE if in cyclic mode 00125 FXbool isCyclic() const; 00126 00127 /// Set to cyclic mode, i.e. wrap around at maximum/minimum 00128 void setCyclic(FXbool cyclic); 00129 00130 /// Return TRUE if text is visible 00131 FXbool isTextVisible() const; 00132 00133 /// Set text visible flag 00134 void setTextVisible(FXbool shown); 00135 00136 /// Change current value 00137 virtual void setValue(FXdouble value,FXbool notify=FALSE); 00138 00139 /// Return current value 00140 FXdouble getValue() const { return pos; } 00141 00142 /// Change the spinner's range 00143 void setRange(FXdouble lo,FXdouble hi,FXbool notify=FALSE); 00144 00145 /// Get the spinner's current range 00146 void getRange(FXdouble& lo,FXdouble& hi) const { lo=range[0]; hi=range[1]; } 00147 00148 /// Change spinner increment 00149 void setIncrement(FXdouble increment); 00150 00151 /// Return spinner increment 00152 FXdouble getIncrement() const { return incr; } 00153 00154 /// Change spinner granularity 00155 void setGranularity(FXdouble gr); 00156 00157 /// Return spinner granularity 00158 FXdouble getGranularity() const { return gran; } 00159 00160 /// Set the text font 00161 void setFont(FXFont *fnt); 00162 00163 /// Get the text font 00164 FXFont *getFont() const; 00165 00166 /// Set the status line help text for this spinner 00167 void setHelpText(const FXString& text); 00168 00169 /// Get the status line help text for this spinner 00170 const FXString& getHelpText() const; 00171 00172 /// Set the tool tip message for this spinner 00173 void setTipText(const FXString& text); 00174 00175 /// Get the tool tip message for this spinner 00176 const FXString& getTipText() const; 00177 00178 /// Change spinner style 00179 void setSpinnerStyle(FXuint style); 00180 00181 /// Return current spinner style 00182 FXuint getSpinnerStyle() const; 00183 00184 /// Allow editing of the text field 00185 void setEditable(FXbool edit=TRUE); 00186 00187 /// Return TRUE if text field is editable 00188 FXbool isEditable() const; 00189 00190 /// Change color of the up arrow 00191 void setUpArrowColor(FXColor clr); 00192 00193 /// Return color of the up arrow 00194 FXColor getUpArrowColor() const; 00195 00196 /// Change color of the down arrow 00197 void setDownArrowColor(FXColor clr); 00198 00199 /// Return color of the the down arrow 00200 FXColor getDownArrowColor() const; 00201 00202 /// Change text color 00203 void setTextColor(FXColor clr); 00204 00205 /// Return text color 00206 FXColor getTextColor() const; 00207 00208 /// Change selected background color 00209 void setSelBackColor(FXColor clr); 00210 00211 /// Return selected background color 00212 FXColor getSelBackColor() const; 00213 00214 /// Change selected text color 00215 void setSelTextColor(FXColor clr); 00216 00217 /// Return selected text color 00218 FXColor getSelTextColor() const; 00219 00220 /// Changes the cursor color 00221 void setCursorColor(FXColor clr); 00222 00223 /// Return the cursor color 00224 FXColor getCursorColor() const; 00225 00226 /// Change width of text field in terms of number of columns * `m' 00227 void setNumColumns(FXint cols); 00228 00229 /// Return number of columns 00230 FXint getNumColumns() const; 00231 00232 /// Save spinner to a stream 00233 virtual void save(FXStream& store) const; 00234 00235 /// Load spinner from a stream 00236 virtual void load(FXStream& store); 00237 00238 /// Destructor 00239 virtual ~FXRealSpinner(); 00240 }; 00241 00242 } 00243 00244 #endif
Copyright © 1997-2005 Jeroen van der Zijp |