Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

/home/jeroen/FOX/fox/fox-1.7.33/include/FXSpinner.h
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,2012 by Lyle Johnson.   All Rights Reserved.               *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (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                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FXSPINNER_H
00022 #define FXSPINNER_H
00023 
00024 #ifndef FXPACKER_H
00025 #include "FXPacker.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00032 enum {
00033   SPIN_NORMAL  =  0,                
00034   SPIN_CYCLIC  =  0x00020000,       
00035   SPIN_NOTEXT  =  0x00040000,       
00036   SPIN_NOMAX   =  0x00080000,       
00037   SPIN_NOMIN   =  0x00100000        
00038   };
00039 
00040 
00041 class FXTextField;
00042 class FXArrowButton;
00043 
00044 
00046 class FXAPI FXSpinner : public FXPacker {
00047   FXDECLARE(FXSpinner)
00048 protected:
00049   FXTextField   *textField;         // Text field
00050   FXArrowButton *upButton;          // The up button
00051   FXArrowButton *downButton;        // The down button
00052   FXint          range[2];          // Reported data range
00053   FXint          incr;              // Increment
00054   FXint          pos;               // Current position
00055 protected:
00056   FXSpinner();
00057 private:
00058   FXSpinner(const FXSpinner&);
00059   FXSpinner& operator=(const FXSpinner&);
00060 public:
00061   long onUpdIncrement(FXObject*,FXSelector,void*);
00062   long onCmdIncrement(FXObject*,FXSelector,void*);
00063   long onUpdDecrement(FXObject*,FXSelector,void*);
00064   long onCmdDecrement(FXObject*,FXSelector,void*);
00065   long onUpdEntry(FXObject*,FXSelector,void*);
00066   long onChgEntry(FXObject*,FXSelector,void*);
00067   long onCmdEntry(FXObject*,FXSelector,void*);
00068   long onWheelEntry(FXObject*,FXSelector,void*);
00069   long onKeyPress(FXObject*,FXSelector,void*);
00070   long onKeyRelease(FXObject*,FXSelector,void*);
00071   long onCmdSetValue(FXObject*,FXSelector,void*);
00072   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00073   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00074   long onCmdSetLongValue(FXObject*,FXSelector,void*);
00075   long onCmdGetLongValue(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 flag);
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

Copyright © 1997-2011 Jeroen van der Zijp