FXDial.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                              D i a l   W i d g e t                            *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1998,2006 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: FXDial.h,v 1.35 2006/01/22 17:58:00 fox Exp $                            *
00023 ********************************************************************************/
00024 #ifndef FXDIAL_H
00025 #define FXDIAL_H
00026 
00027 #ifndef FXFRAME_H
00028 #include "FXFrame.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 // Dial style options
00035 enum {
00036   DIAL_VERTICAL   = 0,                            // Vertically oriented
00037   DIAL_HORIZONTAL = 0x00008000,                   // Horizontal oriented
00038   DIAL_CYCLIC     = 0x00010000,                   // Value wraps around
00039   DIAL_HAS_NOTCH  = 0x00020000,                   // Dial has a Center Notch
00040   DIAL_NORMAL     = DIAL_VERTICAL
00041   };
00042 
00043 
00054 class FXAPI FXDial : public FXFrame {
00055   FXDECLARE(FXDial)
00056 protected:
00057   FXint         range[2];       // Reported data range
00058   FXColor       notchColor;     // Main notch color
00059   FXint         notchangle;     // Angle of main notch
00060   FXint         notchspacing;   // Angle between notches
00061   FXint         notchoffset;    // Notch offset
00062   FXint         dragpoint;      // Place where clicked
00063   FXint         dragpos;        // Value where clicked
00064   FXint         incr;           // Rate of change/revolution
00065   FXint         pos;            // Reported data position
00066   FXString      help;           // Help string
00067   FXString      tip;            // Tip string
00068 protected:
00069   FXDial();
00070 private:
00071   FXDial(const FXDial&);
00072   FXDial &operator=(const FXDial&);
00073 public:
00074   long onPaint(FXObject*,FXSelector,void*);
00075   long onMotion(FXObject*,FXSelector,void*);
00076   long onMouseWheel(FXObject*,FXSelector,void*);
00077   long onLeftBtnPress(FXObject*,FXSelector,void* );
00078   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00079   long onKeyPress(FXObject*,FXSelector,void*);
00080   long onKeyRelease(FXObject*,FXSelector,void*);
00081   long onUngrabbed(FXObject*,FXSelector,void*);
00082   long onCmdSetValue(FXObject*,FXSelector,void*);
00083   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00084   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00085   long onCmdSetRealValue(FXObject*,FXSelector,void*);
00086   long onCmdGetRealValue(FXObject*,FXSelector,void*);
00087   long onCmdSetIntRange(FXObject*,FXSelector,void*);
00088   long onCmdGetIntRange(FXObject*,FXSelector,void*);
00089   long onCmdSetRealRange(FXObject*,FXSelector,void*);
00090   long onCmdGetRealRange(FXObject*,FXSelector,void*);
00091   long onCmdSetHelp(FXObject*,FXSelector,void*);
00092   long onCmdGetHelp(FXObject*,FXSelector,void*);
00093   long onCmdSetTip(FXObject*,FXSelector,void*);
00094   long onCmdGetTip(FXObject*,FXSelector,void*);
00095   long onQueryHelp(FXObject*,FXSelector,void*);
00096   long onQueryTip(FXObject*,FXSelector,void*);
00097 public:
00098 
00100   FXDial(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=DIAL_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);
00101 
00103   virtual FXint getDefaultWidth();
00104 
00106   virtual FXint getDefaultHeight();
00107 
00109   virtual bool canFocus() const;
00110 
00112   void setValue(FXint value,FXbool notify=FALSE);
00113 
00115   FXint getValue() const { return pos; }
00116 
00118   void setRange(FXint lo,FXint hi,FXbool notify=FALSE);
00119 
00121   void getRange(FXint& lo,FXint& hi) const { lo=range[0]; hi=range[1]; }
00122 
00130   void setRevolutionIncrement(FXint i);
00131 
00133   FXint getRevolutionIncrement() const { return incr; }
00134 
00140   void setNotchSpacing(FXint spacing);
00141 
00143   FXint getNotchSpacing() const { return notchspacing; }
00144 
00150   void setNotchOffset(FXint offset);
00151 
00153   FXint getNotchOffset() const { return notchoffset; }
00154 
00156   void setDialStyle(FXuint opts);
00157 
00159   FXuint getDialStyle() const;
00160 
00162   void setNotchColor(FXColor clr);
00163 
00165   FXColor getNotchColor() const { return notchColor; }
00166 
00168   void setHelpText(const FXString& text);
00169 
00171   const FXString& getHelpText() const { return help; }
00172 
00174   void setTipText(const FXString& text);
00175 
00177   const FXString& getTipText() const { return tip; }
00178 
00180   virtual void save(FXStream& store) const;
00181 
00183   virtual void load(FXStream& store);
00184   };
00185 
00186 }
00187 
00188 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:20 2009 for TnFOX by doxygen v1.4.7