00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef FXSPINNER_H
00025 #define FXSPINNER_H
00026
00027 #ifndef FXPACKER_H
00028 #include "FXPacker.h"
00029 #endif
00030
00031 namespace FX {
00032
00033
00035 enum {
00036 SPIN_NORMAL = 0,
00037 SPIN_CYCLIC = 0x00020000,
00038 SPIN_NOTEXT = 0x00040000,
00039 SPIN_NOMAX = 0x00080000,
00040 SPIN_NOMIN = 0x00100000
00041 };
00042
00043
00044 class FXTextField;
00045 class FXArrowButton;
00046
00047
00049 class FXAPI FXSpinner : public FXPacker {
00050 FXDECLARE(FXSpinner)
00051 protected:
00052 FXTextField *textField;
00053 FXArrowButton *upButton;
00054 FXArrowButton *downButton;
00055 FXint range[2];
00056 FXint incr;
00057 FXint pos;
00058 protected:
00059 FXSpinner();
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 onWheelEntry(FXObject*,FXSelector,void*);
00071 long onKeyPress(FXObject*,FXSelector,void*);
00072 long onKeyRelease(FXObject*,FXSelector,void*);
00073 long onCmdSetValue(FXObject*,FXSelector,void*);
00074 long onCmdSetIntValue(FXObject*,FXSelector,void*);
00075 long onCmdGetIntValue(FXObject*,FXSelector,void*);
00076 long onCmdSetIntRange(FXObject*,FXSelector,void*);
00077 long onCmdGetIntRange(FXObject*,FXSelector,void*);
00078 long onFocusSelf(FXObject*,FXSelector,void*);
00079 public:
00080 enum{
00081 ID_INCREMENT=FXPacker::ID_LAST,
00082 ID_DECREMENT,
00083 ID_ENTRY,
00084 ID_LAST
00085 };
00086 public:
00087
00089 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);
00090
00092 virtual void layout();
00093
00095 virtual void disable();
00096
00098 virtual void enable();
00099
00101 virtual FXint getDefaultWidth();
00102
00104 virtual FXint getDefaultHeight();
00105
00107 void increment(FXbool notify=FALSE);
00108
00110 void incrementByAmount(FXint amount,FXbool notify=FALSE);
00111
00113 void decrement(FXbool notify=FALSE);
00114
00116 void decrementByAmount(FXint amount, FXbool notify=FALSE);
00117
00119 FXbool isCyclic() const;
00120
00122 void setCyclic(FXbool cyclic);
00123
00125 FXbool isTextVisible() const;
00126
00128 void setTextVisible(FXbool shown);
00129
00131 virtual void setValue(FXint value,FXbool notify=FALSE);
00132
00134 FXint getValue() const { return pos; }
00135
00137 void setRange(FXint lo,FXint hi,FXbool notify=FALSE);
00138
00140 void getRange(FXint& lo,FXint& hi) const { lo=range[0]; hi=range[1]; }
00141
00143 void setIncrement(FXint increment);
00144
00146 FXint getIncrement() const { return incr; }
00147
00149 void setFont(FXFont *fnt);
00150
00152 FXFont *getFont() const;
00153
00155 void setHelpText(const FXString& text);
00156
00158 const FXString& getHelpText() const;
00159
00161 void setTipText(const FXString& text);
00162
00164 const FXString& getTipText() const;
00165
00167 void setSpinnerStyle(FXuint style);
00168
00170 FXuint getSpinnerStyle() const;
00171
00173 void setEditable(FXbool edit=TRUE);
00174
00176 FXbool isEditable() const;
00177
00179 void setUpArrowColor(FXColor clr);
00180
00182 FXColor getUpArrowColor() const;
00183
00185 void setDownArrowColor(FXColor clr);
00186
00188 FXColor getDownArrowColor() const;
00189
00191 void setTextColor(FXColor clr);
00192
00194 FXColor getTextColor() const;
00195
00197 void setSelBackColor(FXColor clr);
00198
00200 FXColor getSelBackColor() const;
00201
00203 void setSelTextColor(FXColor clr);
00204
00206 FXColor getSelTextColor() const;
00207
00209 void setCursorColor(FXColor clr);
00210
00212 FXColor getCursorColor() const;
00213
00215 void setNumColumns(FXint cols);
00216
00218 FXint getNumColumns() const;
00219
00221 virtual void save(FXStream& store) const;
00222
00224 virtual void load(FXStream& store);
00225
00227 virtual ~FXSpinner();
00228 };
00229
00230 }
00231
00232 #endif