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

/home/jeroen/FOX/fox/fox-1.7.33/include/FXDial.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                              D i a l   W i d g e t                            *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1998,2012 by Jeroen van der Zijp.   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 FXDIAL_H
00022 #define FXDIAL_H
00023 
00024 #ifndef FXFRAME_H
00025 #include "FXFrame.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00031 // Dial style options
00032 enum {
00033   DIAL_VERTICAL   = 0,                            // Vertically oriented
00034   DIAL_HORIZONTAL = 0x00008000,                   // Horizontal oriented
00035   DIAL_CYCLIC     = 0x00010000,                   // Value wraps around
00036   DIAL_HAS_NOTCH  = 0x00020000,                   // Dial has a Center Notch
00037   DIAL_NORMAL     = DIAL_VERTICAL
00038   };
00039 
00040 
00051 class FXAPI FXDial : public FXFrame {
00052   FXDECLARE(FXDial)
00053 protected:
00054   FXint         notchAngle;     // Angle of main notch
00055   FXint         notchSpacing;   // Angle between notches
00056   FXint         notchOffset;    // Notch offset
00057   FXColor       notchColor;     // Main notch color
00058   FXint         dragPoint;      // Place where clicked
00059   FXint         dragPos;        // Value where clicked
00060   FXint         range[2];       // Reported data range
00061   FXint         incr;           // Rate of change/revolution
00062   FXint         pos;            // Reported data position
00063   FXString      help;           // Help string
00064   FXString      tip;            // Tip string
00065 protected:
00066   FXDial();
00067 private:
00068   FXDial(const FXDial&);
00069   FXDial &operator=(const FXDial&);
00070 public:
00071   long onPaint(FXObject*,FXSelector,void*);
00072   long onMotion(FXObject*,FXSelector,void*);
00073   long onMouseWheel(FXObject*,FXSelector,void*);
00074   long onLeftBtnPress(FXObject*,FXSelector,void* );
00075   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00076   long onKeyPress(FXObject*,FXSelector,void*);
00077   long onKeyRelease(FXObject*,FXSelector,void*);
00078   long onUngrabbed(FXObject*,FXSelector,void*);
00079   long onCmdSetValue(FXObject*,FXSelector,void*);
00080   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00081   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00082   long onCmdSetLongValue(FXObject*,FXSelector,void*);
00083   long onCmdGetLongValue(FXObject*,FXSelector,void*);
00084   long onCmdSetRealValue(FXObject*,FXSelector,void*);
00085   long onCmdGetRealValue(FXObject*,FXSelector,void*);
00086   long onCmdSetIntRange(FXObject*,FXSelector,void*);
00087   long onCmdGetIntRange(FXObject*,FXSelector,void*);
00088   long onCmdSetRealRange(FXObject*,FXSelector,void*);
00089   long onCmdGetRealRange(FXObject*,FXSelector,void*);
00090   long onCmdSetHelp(FXObject*,FXSelector,void*);
00091   long onCmdGetHelp(FXObject*,FXSelector,void*);
00092   long onCmdSetTip(FXObject*,FXSelector,void*);
00093   long onCmdGetTip(FXObject*,FXSelector,void*);
00094   long onQueryHelp(FXObject*,FXSelector,void*);
00095   long onQueryTip(FXObject*,FXSelector,void*);
00096 public:
00097 
00099   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);
00100 
00102   virtual FXint getDefaultWidth();
00103 
00105   virtual FXint getDefaultHeight();
00106 
00108   virtual FXbool canFocus() const;
00109 
00111   void setValue(FXint value,FXbool notify=false);
00112 
00114   FXint getValue() const { return pos; }
00115 
00117   void setRange(FXint lo,FXint hi,FXbool notify=false);
00118 
00120   void getRange(FXint& lo,FXint& hi) const { lo=range[0]; hi=range[1]; }
00121 
00129   void setRevolutionIncrement(FXint i);
00130 
00132   FXint getRevolutionIncrement() const { return incr; }
00133 
00139   void setNotchSpacing(FXint spacing);
00140 
00142   FXint getNotchSpacing() const { return notchSpacing; }
00143 
00149   void setNotchOffset(FXint offset);
00150 
00152   FXint getNotchOffset() const { return notchOffset; }
00153 
00155   void setDialStyle(FXuint opts);
00156 
00158   FXuint getDialStyle() const;
00159 
00161   void setNotchColor(FXColor clr);
00162 
00164   FXColor getNotchColor() const { return notchColor; }
00165 
00167   void setHelpText(const FXString& text);
00168 
00170   const FXString& getHelpText() const { return help; }
00171 
00173   void setTipText(const FXString& text);
00174 
00176   const FXString& getTipText() const { return tip; }
00177 
00179   virtual void save(FXStream& store) const;
00180 
00182   virtual void load(FXStream& store);
00183   };
00184 
00185 }
00186 
00187 #endif

Copyright © 1997-2011 Jeroen van der Zijp