00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef FXRULER_H
00025 #define FXRULER_H
00026
00027 #ifndef FXFRAME_H
00028 #include "FXFrame.h"
00029 #endif
00030
00031 namespace FX {
00032
00033
00034
00035 enum {
00036 RULER_NORMAL = 0,
00037 RULER_HORIZONTAL = 0,
00038 RULER_VERTICAL = 0x00008000,
00039 RULER_TICKS_OFF = 0,
00040 RULER_TICKS_TOP = 0x00010000,
00041 RULER_TICKS_BOTTOM = 0x00020000,
00042 RULER_TICKS_LEFT = RULER_TICKS_TOP,
00043 RULER_TICKS_RIGHT = RULER_TICKS_BOTTOM,
00044 RULER_TICKS_CENTER = RULER_TICKS_TOP|RULER_TICKS_BOTTOM,
00045 RULER_NUMBERS = 0x00040000,
00046 RULER_ARROW = 0x00080000,
00047 RULER_MARKERS = 0x00100000,
00048 RULER_METRIC = 0,
00049 RULER_ENGLISH = 0x00200000
00050 };
00051
00052
00053 class FXFont;
00054
00055
00056
00057
00058
00059
00060 class FXAPI FXRuler : public FXFrame {
00061 FXDECLARE(FXRuler)
00062 protected:
00063 FXFont *font;
00064 FXColor textColor;
00065 FXint lowerMargin;
00066 FXint upperMargin;
00067 FXint firstPara;
00068 FXint lowerPara;
00069 FXint upperPara;
00070 FXint docSpace;
00071 FXint docSize;
00072 FXint contentSize;
00073 FXint arrowPos;
00074 FXdouble pixelPerTick;
00075 FXint majorTicks;
00076 FXint mediumTicks;
00077 FXint tinyTicks;
00078 FXint shift;
00079 FXString tip;
00080 FXString help;
00081 protected:
00082 FXRuler();
00083 void drawLeftArrow(FXDCWindow& dc,FXint x,FXint y);
00084 void drawRightArrow(FXDCWindow& dc,FXint x,FXint y);
00085 void drawUpArrow(FXDCWindow& dc,FXint x,FXint y);
00086 void drawDownArrow(FXDCWindow& dc,FXint x,FXint y);
00087 void drawLeftMarker(FXDCWindow& dc,FXint x,FXint y);
00088 void drawRightMarker(FXDCWindow& dc,FXint x,FXint y);
00089 void drawUpMarker(FXDCWindow& dc,FXint x,FXint y);
00090 void drawDownMarker(FXDCWindow& dc,FXint x,FXint y);
00091
00092 private:
00093 FXRuler(const FXRuler&);
00094 FXRuler &operator=(const FXRuler&);
00095 public:
00096 long onPaint(FXObject*,FXSelector,void*);
00097 long onLeftBtnPress(FXObject*,FXSelector,void*);
00098 long onLeftBtnRelease(FXObject*,FXSelector,void*);
00099 long onMotion(FXObject*,FXSelector,void*);
00100 long onCmdSetValue(FXObject*,FXSelector,void*);
00101 long onCmdSetIntValue(FXObject*,FXSelector,void*);
00102 long onCmdGetIntValue(FXObject*,FXSelector,void*);
00103 long onCmdSetHelp(FXObject*,FXSelector,void*);
00104 long onCmdGetHelp(FXObject*,FXSelector,void*);
00105 long onCmdSetTip(FXObject*,FXSelector,void*);
00106 long onCmdGetTip(FXObject*,FXSelector,void*);
00107 long onQueryHelp(FXObject*,FXSelector,void*);
00108 long onQueryTip(FXObject*,FXSelector,void*);
00109 public:
00110 enum {
00111 ID_ARROW=FXFrame::ID_LAST,
00112 ID_LAST
00113 };
00114 public:
00115
00116
00117 FXRuler(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=RULER_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);
00118
00119
00120 virtual void create();
00121
00122
00123 virtual void detach();
00124
00125
00126 virtual FXint getDefaultWidth();
00127
00128
00129 virtual FXint getDefaultHeight();
00130
00131
00132 void setFont(FXFont *fnt);
00133
00134
00135 FXFont* getFont() const { return font; }
00136
00137
00138 void setValue(FXint value);
00139
00140
00141 FXint getValue() const { return arrowPos; }
00142
00143
00144 void setRulerStyle(FXuint style);
00145
00146
00147 FXuint getRulerStyle() const;
00148
00149
00150 FXColor getTextColor() const { return textColor; }
00151
00152
00153 void setTextColor(FXColor clr);
00154
00155
00156 void setHelpText(const FXString& text);
00157
00158
00159 FXString getHelpText() const { return help; }
00160
00161
00162 void setTipText(const FXString& text);
00163
00164
00165 FXString getTipText() const { return tip; }
00166
00167
00168 virtual void save(FXStream& store) const;
00169
00170
00171 virtual void load(FXStream& store);
00172
00173
00174 virtual ~FXRuler();
00175 };
00176
00177 }
00178
00179 #endif