SUMO - Simulation of Urban MObility
FXRealSpinDial.h
Go to the documentation of this file.
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 by Bill Baxter.    All Rights Reserved.               *
00007 *********************************************************************************
00008 * Based on FXSpinner.cpp                                                        *
00009 * Copyright (C) 1998,2003 by Lyle Johnson.   All Rights Reserved.               *
00010 *********************************************************************************
00011 * This library is free software; you can redistribute it and/or                 *
00012 * modify it under the terms of the GNU Lesser General Public                    *
00013 * License as published by the Free Software Foundation; either                  *
00014 * version 2.1 of the License, or (at your option) any later version.            *
00015 *                                                                               *
00016 * This library is distributed in the hope that it will be useful,               *
00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00019 * Lesser General Public License for more details.                               *
00020 *                                                                               *
00021 * You should have received a copy of the GNU Lesser General Public              *
00022 * License along with this library; if not, write to the Free Software           *
00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00024 *********************************************************************************
00025 * $Id: FXRealSpinDial.h 11451 2011-11-02 09:07:49Z behrisch $                     *
00026 ********************************************************************************/
00027 #ifndef FXREALSPINDIAL_H
00028 #define FXREALSPINDIAL_H
00029 
00030 
00031 // ===========================================================================
00032 // included modules
00033 // ===========================================================================
00034 #ifdef _MSC_VER
00035 #include <windows_config.h>
00036 #else
00037 #include <config.h>
00038 #endif
00039 
00040 #ifndef FXPACKER_H
00041 #include "FXPacker.h"
00042 #endif
00043 
00044 namespace FX {
00045 
00046 
00047 // Spinner Options
00048 enum {
00049     SPINDIAL_CYCLIC    =  SPIN_CYCLIC,   // Cyclic spinner
00050     SPINDIAL_NOTEXT    =  SPIN_NOTEXT,   // No text visible
00051     SPINDIAL_NOMAX     =  SPIN_NOMAX,    // Spin all the way up to infinity
00052     SPINDIAL_NOMIN     =  SPIN_NOMIN,    // Spin all the way down to -infinity
00053     SPINDIAL_LOG       =  0x00200000,    // Logarithmic rather than linear
00054     SPINDIAL_NODIAL    =  0x00400000,    // No dial visible
00055     SPINDIAL_NOBUTTONS =  0x00800000,    // No spinbuttons visible
00056     SPINDIAL_NORMAL    =  SPINDIAL_NOBUTTONS// Normal, non-cyclic, no buttons
00057 };
00058 
00059 enum {
00060     SPINDIAL_INC_NORMAL = 0,
00061     SPINDIAL_INC_FINE = -1,
00062     SPINDIAL_INC_COARSE = 1
00063 };
00064 
00065 class FXRealSpinDialText;
00066 class FXDial;
00067 
00068 
00070 class /*FXAPI*/ FXRealSpinDial : public FXPacker {
00071     FXDECLARE(FXRealSpinDial)
00072 protected:
00073     FXRealSpinDialText* textField; // Text field
00074     FXArrowButton* upButton;          // The up button
00075     FXArrowButton* downButton;        // The down button
00076     FXDial*        dial;              // The up/down dial
00077     FXdouble       range[2];          // Reported data range
00078     FXdouble       incr[3];           // Increments (fine,normal,coarse)
00079     FXdouble       pos;               // Current position
00080     FXint          dialpos;           // Current position of dial
00081     FXint          keystate;          // Current key modifiers
00082 protected:
00083     FXRealSpinDial();
00084 private:
00085     FXRealSpinDial(const FXRealSpinDial&);
00086     FXRealSpinDial& operator=(const FXRealSpinDial&);
00087 public:
00088     long onUpdDial(FXObject*, FXSelector, void*);
00089     long onChgDial(FXObject*, FXSelector, void*);
00090     long onCmdDial(FXObject*, FXSelector, void*);
00091     long onUpdIncrement(FXObject*, FXSelector, void*);
00092     long onCmdIncrement(FXObject*, FXSelector, void*);
00093     long onUpdDecrement(FXObject*, FXSelector, void*);
00094     long onCmdDecrement(FXObject*, FXSelector, void*);
00095     long onMouseWheel(FXObject*, FXSelector, void*);
00096     long onUpdEntry(FXObject*, FXSelector, void*);
00097     long onCmdEntry(FXObject*, FXSelector, void*);
00098     long onChgEntry(FXObject*, FXSelector, void*);
00099     long onKeyPress(FXObject*, FXSelector, void*);
00100     long onKeyRelease(FXObject*, FXSelector, void*);
00101     long onCmdSetValue(FXObject*, FXSelector, void*);
00102     long onCmdSetIntValue(FXObject*, FXSelector, void*);
00103     long onCmdGetIntValue(FXObject*, FXSelector, void*);
00104     long onCmdSetIntRange(FXObject*, FXSelector, void*);
00105     long onCmdGetIntRange(FXObject*, FXSelector, void*);
00106     long onCmdSetRealValue(FXObject*, FXSelector, void*);
00107     long onCmdGetRealValue(FXObject*, FXSelector, void*);
00108     long onCmdSetRealRange(FXObject*, FXSelector, void*);
00109     long onCmdGetRealRange(FXObject*, FXSelector, void*);
00110     long onMotion(FXObject*, FXSelector, void*);
00111     //long onDefault(FXObject*,FXSelector,void*);
00112 public:
00113     enum {
00114         ID_DIAL = FXPacker::ID_LAST,
00115         ID_INCREMENT,
00116         ID_DECREMENT,
00117         ID_ENTRY,
00118         ID_LAST
00119     };
00120 public:
00121 
00123     FXRealSpinDial(FXComposite* p, FXint cols, FXObject* tgt = NULL,
00124                    FXSelector sel = 0, FXuint opts = SPINDIAL_NORMAL,
00125                    FXint x = 0, FXint y = 0, FXint w = 0, FXint h = 0,
00126                    FXint pl = DEFAULT_PAD, FXint pr = DEFAULT_PAD, FXint pt = DEFAULT_PAD, FXint pb = DEFAULT_PAD
00127                   );
00128 
00130     virtual void create();
00131 
00133     virtual void layout();
00134 
00136     virtual void disable();
00137 
00139     virtual void enable();
00140 
00142     virtual FXint getDefaultWidth();
00143 
00145     virtual FXint getDefaultHeight();
00146 
00148     void increment(FXint incMode = SPINDIAL_INC_NORMAL);
00149 
00151     void decrement(FXint incMode = SPINDIAL_INC_NORMAL);
00152 
00154     FXbool isCyclic() const;
00155 
00157     void setCyclic(FXbool cyclic);
00158 
00160     FXbool isTextVisible() const;
00161 
00163     void setTextVisible(FXbool shown);
00164 
00166     FXbool isDialVisible() const;
00167 
00169     void setDialVisible(FXbool shown);
00170 
00172     virtual void setValue(FXdouble value);
00173 
00175     FXdouble getValue() const {
00176         return pos;
00177     }
00178 
00180     void setRange(FXdouble lo, FXdouble hi);
00181 
00183     void getRange(FXdouble& lo, FXdouble& hi) const {
00184         lo = range[0];
00185         hi = range[1];
00186     }
00187 
00189     void setIncrement(FXdouble increment);
00191     void setIncrements(FXdouble fine, FXdouble norm, FXdouble coarse);
00193     void setFineIncrement(FXdouble increment);
00195     void setCoarseIncrement(FXdouble increment);
00196 
00198     FXdouble getIncrement() const {
00199         return incr[1];
00200     }
00202     FXdouble getFineIncrement() const {
00203         return incr[0];
00204     }
00206     FXdouble getCoarseIncrement() const {
00207         return incr[-1];
00208     }
00209 
00211     void setFont(FXFont* fnt);
00212 
00214     FXFont* getFont() const;
00215 
00217     void setHelpText(const FXString& text);
00218 
00220     FXString getHelpText() const;
00221 
00223     void setTipText(const FXString& text);
00224 
00226     FXString getTipText() const;
00227 
00229     void setSpinnerStyle(FXuint style);
00230 
00232     FXuint getSpinnerStyle() const;
00233 
00235     void setEditable(FXbool edit = TRUE);
00236 
00238     FXbool isEditable() const;
00239 
00241     void setDialColor(FXColor clr);
00242 
00244     FXColor getDialColor() const;
00245 
00247     void setUpArrowColor(FXColor clr);
00248 
00250     FXColor getUpArrowColor() const;
00251 
00253     void setDownArrowColor(FXColor clr);
00254 
00256     FXColor getDownArrowColor() const;
00257 
00259     void setTextColor(FXColor clr);
00260 
00262     FXColor getTextColor() const;
00263 
00265     void setSelBackColor(FXColor clr);
00266 
00268     FXColor getSelBackColor() const;
00269 
00271     void setSelTextColor(FXColor clr);
00272 
00274     FXColor getSelTextColor() const;
00275 
00277     void setCursorColor(FXColor clr);
00278 
00280     FXColor getCursorColor() const;
00281 
00283     virtual void save(FXStream& store) const;
00284 
00286     virtual void load(FXStream& store);
00287 
00290     void setNumberFormat(FXint prec, FXbool bExp = FALSE);
00291 
00293     FXint getNumberFormatPrecision() const;
00294 
00296     FXbool getNumberFormatExponent() const;
00297 
00301     void setFormatString(const FXchar* fmt);
00302 
00304     FXString getNumberFormatString() const;
00305 
00307     void selectAll();
00308 
00309     const FXDial& getDial() const;
00310 
00312     virtual ~FXRealSpinDial();
00313 };
00314 
00315 }
00316 
00317 
00318 #endif //  FXREALSPINDIAL_H
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines