00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FXGAUGE_H
00022 #define FXGAUGE_H
00023
00024 #ifndef FXFRAME_H
00025 #include "FXFrame.h"
00026 #endif
00027
00028
00030
00031
00032 namespace FX {
00033
00034
00036 enum {
00037 GAUGE_NORMAL = 0,
00038 GAUGE_PIVOT_CENTER = 0x00008000,
00039 GAUGE_PIVOT_INSIDE = 0x00010000,
00040 GAUGE_ELLIPTICAL = 0x00020000,
00041 GAUGE_CYCLIC = 0x00040000
00042 };
00043
00044
00048 class FXAPI FXGauge : public FXFrame {
00049 FXDECLARE(FXGauge)
00050 protected:
00051 struct Indicator {
00052 FXdouble radius;
00053 FXdouble ratio;
00054 FXColor color;
00055 FXbool shown;
00056 };
00057 protected:
00058 FXString caption;
00059 FXFont *numberFont;
00060 FXFont *captionFont;
00061 Indicator indicator[3];
00062 FXint startAngle;
00063 FXint sweepAngle;
00064 FXdouble range[2];
00065 FXdouble value;
00066 FXdouble innerRadius;
00067 FXdouble majorTickDelta;
00068 FXdouble minorTickDelta;
00069 FXColor majorTickColor;
00070 FXColor minorTickColor;
00071 FXshort majorTickSize;
00072 FXshort minorTickSize;
00073 FXColor faceColor;
00074 FXColor arcColor;
00075 FXshort arcWeight;
00076 FXString help;
00077 FXString tip;
00078 protected:
00079 FXGauge();
00080 void drawPointer(FXDCWindow& dc,FXdouble ang,FXint xx,FXint yy,FXint ww,FXint hh,FXint cx,FXint cy,FXint rx,FXint ry,FXint p) const;
00081 void drawGauge(FXDCWindow& dc,FXint xx,FXint yy,FXint ww,FXint hh,FXint cx,FXint cy,FXint rx,FXint ry) const;
00082 private:
00083 FXGauge(const FXGauge&);
00084 FXGauge &operator=(const FXGauge&);
00085 public:
00086 long onPaint(FXObject*,FXSelector,void*);
00087 long onQueryHelp(FXObject*,FXSelector,void*);
00088 long onQueryTip(FXObject*,FXSelector,void*);
00089 long onCmdSetValue(FXObject*,FXSelector,void*);
00090 long onCmdSetIntValue(FXObject*,FXSelector,void*);
00091 long onCmdGetIntValue(FXObject*,FXSelector,void*);
00092 long onCmdSetRealValue(FXObject*,FXSelector,void*);
00093 long onCmdGetRealValue(FXObject*,FXSelector,void*);
00094 long onCmdSetLongValue(FXObject*,FXSelector,void*);
00095 long onCmdGetLongValue(FXObject*,FXSelector,void*);
00096 long onCmdSetIntRange(FXObject*,FXSelector,void*);
00097 long onCmdGetIntRange(FXObject*,FXSelector,void*);
00098 long onCmdSetRealRange(FXObject*,FXSelector,void*);
00099 long onCmdGetRealRange(FXObject*,FXSelector,void*);
00100 long onCmdSetHelp(FXObject*,FXSelector,void*);
00101 long onCmdGetHelp(FXObject*,FXSelector,void*);
00102 long onCmdSetTip(FXObject*,FXSelector,void*);
00103 long onCmdGetTip(FXObject*,FXSelector,void*);
00104 public:
00105
00107 FXGauge(FXComposite* p,FXuint opts=FRAME_NORMAL,FXint startang=180,FXint sweepang=-180,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);
00108
00110 virtual FXint getDefaultWidth();
00111
00113 virtual FXint getDefaultHeight();
00114
00116 void setCaption(const FXString& text);
00117
00119 FXString getCaption() const { return caption; }
00120
00122 void setStartAngle(FXint degrees);
00123
00125 FXint getStartAngle() const { return startAngle; }
00126
00128 void setSweepAngle(FXint degrees);
00129
00131 FXint getSweepAngle() const { return sweepAngle; }
00132
00134 void setValue(FXdouble v,FXbool notify=false);
00135
00137 FXdouble getValue() const { return value; }
00138
00140 void setRange(FXdouble lo,FXdouble hi,FXbool notify=false);
00141
00143 void getRange(FXdouble& lo,FXdouble& hi) const { lo=range[0]; hi=range[1]; }
00144
00146 void setMajorTickDelta(FXdouble delta);
00147
00149 FXdouble getMajorTickDelta() const { return majorTickDelta; }
00150
00152 void setMinorTickDelta(FXdouble delta);
00153
00155 FXdouble getMinorTickDelta() const { return minorTickDelta; }
00156
00158 void setGaugeStyle(FXuint style);
00159
00161 FXuint getGaugeStyle() const;
00162
00164 void setNumberFont(FXFont* fnt);
00165
00167 FXFont* getNumberFont() const { return numberFont; }
00168
00170 void setCaptionFont(FXFont* fnt);
00171
00173 FXFont* getCaptionFont() const { return captionFont; }
00174
00176 void setHelpText(const FXString& text){ help=text; }
00177
00179 const FXString& getHelpText() const { return help; }
00180
00182 void setTipText(const FXString& text){ tip=text; }
00183
00185 const FXString& getTipText() const { return tip; }
00186
00188 virtual void save(FXStream& store) const;
00189
00191 virtual void load(FXStream& store);
00192
00194 virtual ~FXGauge();
00195 };
00196
00197
00198 }
00199
00200 #endif