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
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 RULER_MARGIN_ADJUST = 0x00400000,
00051 RULER_ALIGN_CENTER = 0,
00052 RULER_ALIGN_LEFT = 0x00800000,
00053 RULER_ALIGN_RIGHT = 0x01000000,
00054 RULER_ALIGN_TOP = RULER_ALIGN_LEFT,
00055 RULER_ALIGN_BOTTOM = RULER_ALIGN_RIGHT,
00056 RULER_ALIGN_STRETCH = RULER_ALIGN_LEFT|RULER_ALIGN_RIGHT,
00057 RULER_ALIGN_NORMAL = RULER_ALIGN_CENTER
00058 };
00059
00060
00061 class FXFont;
00062
00063
00078 class FXAPI FXRuler : public FXFrame {
00079 FXDECLARE(FXRuler)
00080 protected:
00081 FXFont *font;
00082 FXint documentSize;
00083 FXint edgeSpacing;
00084 FXint marginLower;
00085 FXint marginUpper;
00086 FXint indentFirst;
00087 FXint indentLower;
00088 FXint indentUpper;
00089 FXdouble pixelPerTick;
00090 FXint numberTicks;
00091 FXint majorTicks;
00092 FXint mediumTicks;
00093 FXint tinyTicks;
00094 FXint arrowPos;
00095 FXColor textColor;
00096 FXint shift;
00097 FXint pos;
00098 FXint off;
00099 FXString tip;
00100 FXString help;
00101 FXuchar mode;
00102 protected:
00103 FXRuler();
00104 FXint picked(FXint x,FXint y);
00105 void drawLeftArrow(FXDCWindow& dc,FXint x,FXint y);
00106 void drawRightArrow(FXDCWindow& dc,FXint x,FXint y);
00107 void drawUpArrow(FXDCWindow& dc,FXint x,FXint y);
00108 void drawDownArrow(FXDCWindow& dc,FXint x,FXint y);
00109 void drawLeftMarker(FXDCWindow& dc,FXint x,FXint y);
00110 void drawRightMarker(FXDCWindow& dc,FXint x,FXint y);
00111 void drawUpMarker(FXDCWindow& dc,FXint x,FXint y);
00112 void drawDownMarker(FXDCWindow& dc,FXint x,FXint y);
00113 protected:
00114 enum{
00115 MOUSE_NONE,
00116 MOUSE_MARG_LOWER,
00117 MOUSE_MARG_UPPER,
00118 MOUSE_PARA_FIRST,
00119 MOUSE_PARA_LOWER,
00120 MOUSE_PARA_UPPER
00121 };
00122 private:
00123 FXRuler(const FXRuler&);
00124 FXRuler &operator=(const FXRuler&);
00125 public:
00126 long onPaint(FXObject*,FXSelector,void*);
00127 long onLeftBtnPress(FXObject*,FXSelector,void*);
00128 long onLeftBtnRelease(FXObject*,FXSelector,void*);
00129 long onMotion(FXObject*,FXSelector,void*);
00130 long onCmdSetValue(FXObject*,FXSelector,void*);
00131 long onCmdSetIntValue(FXObject*,FXSelector,void*);
00132 long onCmdGetIntValue(FXObject*,FXSelector,void*);
00133 long onCmdSetHelp(FXObject*,FXSelector,void*);
00134 long onCmdGetHelp(FXObject*,FXSelector,void*);
00135 long onCmdSetTip(FXObject*,FXSelector,void*);
00136 long onCmdGetTip(FXObject*,FXSelector,void*);
00137 long onQueryHelp(FXObject*,FXSelector,void*);
00138 long onQueryTip(FXObject*,FXSelector,void*);
00139 public:
00140 enum{
00141 ID_ARROW=FXFrame::ID_LAST,
00142 ID_LAST
00143 };
00144 public:
00145
00147 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);
00148
00150 virtual void layout();
00151
00153 virtual void create();
00154
00156 virtual void detach();
00157
00159 virtual FXint getDefaultWidth();
00160
00162 virtual FXint getDefaultHeight();
00163
00165 void setPosition(FXint pos,FXbool notify=FALSE);
00166
00168 FXint getPosition() const { return pos; }
00169
00171 void setContentSize(FXint size,FXbool notify=FALSE);
00172 FXint getContentSize() const;
00173
00175 FXint getDocumentLower() const;
00176
00178 FXint getDocumentUpper() const;
00179
00181 void setDocumentSize(FXint size,FXbool notify=FALSE);
00182 FXint getDocumentSize() const { return documentSize; }
00183
00185 void setEdgeSpacing(FXint space,FXbool notify=FALSE);
00186 FXint getEdgeSpacing() const { return edgeSpacing; }
00187
00189 void setMarginLower(FXint mgn,FXbool notify=FALSE);
00190 FXint getMarginLower() const { return marginLower; }
00191
00193 void setMarginUpper(FXint mgn,FXbool notify=FALSE);
00194 FXint getMarginUpper() const { return marginUpper; }
00195
00197 void setIndentFirst(FXint ind,FXbool notify=FALSE);
00198 FXint getIndentFirst() const { return indentFirst; }
00199
00201 void setIndentLower(FXint ind,FXbool notify=FALSE);
00202 FXint getIndentLower() const { return indentLower; }
00203
00205 void setIndentUpper(FXint ind,FXbool notify=FALSE);
00206 FXint getIndentUpper() const { return indentUpper; }
00207
00209 void setNumberTicks(FXint ticks,FXbool notify=FALSE);
00210 FXint getNumberTicks() const { return numberTicks; }
00211
00213 void setMajorTicks(FXint ticks,FXbool notify=FALSE);
00214 FXint getMajorTicks() const { return majorTicks; }
00215
00217 void setMediumTicks(FXint ticks,FXbool notify=FALSE);
00218 FXint getMediumTicks() const { return mediumTicks; }
00219
00221 void setTinyTicks(FXint ticks,FXbool notify=FALSE);
00222 FXint getTinyTicks() const { return tinyTicks; }
00223
00225 void setPixelPerTick(FXdouble space,FXbool notify=FALSE);
00226 FXdouble getPixelPerTick() const { return pixelPerTick; }
00227
00229 void setFont(FXFont *fnt,FXbool notify=FALSE);
00230
00232 FXFont* getFont() const { return font; }
00233
00235 void setValue(FXint value);
00236
00238 FXint getValue() const { return arrowPos; }
00239
00241 void setRulerStyle(FXuint style);
00242
00244 FXuint getRulerStyle() const;
00245
00247 void setRulerAlignment(FXuint alignment,FXbool notify=FALSE);
00248
00250 FXuint getRulerAlignment() const;
00251
00253 FXColor getTextColor() const { return textColor; }
00254
00256 void setTextColor(FXColor clr);
00257
00259 void setHelpText(const FXString& text){ help=text; }
00260
00262 const FXString& getHelpText() const { return help; }
00263
00265 void setTipText(const FXString& text){ tip=text; }
00266
00268 const FXString& getTipText() const { return tip; }
00269
00271 virtual void save(FXStream& store) const;
00272
00274 virtual void load(FXStream& store);
00275
00277 virtual ~FXRuler();
00278 };
00279
00280 }
00281
00282 #endif