00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FXRULER_H
00022 #define FXRULER_H
00023
00024 #ifndef FXFRAME_H
00025 #include "FXFrame.h"
00026 #endif
00027
00028 namespace FX {
00029
00030
00032 enum {
00033 RULER_NORMAL = 0,
00034 RULER_HORIZONTAL = 0,
00035 RULER_VERTICAL = 0x00008000,
00036 RULER_TICKS_OFF = 0,
00037 RULER_TICKS_TOP = 0x00010000,
00038 RULER_TICKS_BOTTOM = 0x00020000,
00039 RULER_TICKS_LEFT = RULER_TICKS_TOP,
00040 RULER_TICKS_RIGHT = RULER_TICKS_BOTTOM,
00041 RULER_TICKS_CENTER = RULER_TICKS_TOP|RULER_TICKS_BOTTOM,
00042 RULER_NUMBERS = 0x00040000,
00043 RULER_ARROW = 0x00080000,
00044 RULER_MARKERS = 0x00100000,
00045 RULER_METRIC = 0,
00046 RULER_ENGLISH = 0x00200000,
00047 RULER_MARGIN_ADJUST = 0x00400000,
00048 RULER_ALIGN_CENTER = 0,
00049 RULER_ALIGN_LEFT = 0x00800000,
00050 RULER_ALIGN_RIGHT = 0x01000000,
00051 RULER_ALIGN_TOP = RULER_ALIGN_LEFT,
00052 RULER_ALIGN_BOTTOM = RULER_ALIGN_RIGHT,
00053 RULER_ALIGN_STRETCH = RULER_ALIGN_LEFT|RULER_ALIGN_RIGHT,
00054 RULER_ALIGN_NORMAL = RULER_ALIGN_CENTER
00055 };
00056
00057
00058 class FXFont;
00059
00060
00075 class FXAPI FXRuler : public FXFrame {
00076 FXDECLARE(FXRuler)
00077 protected:
00078 FXFont *font;
00079 FXint documentSize;
00080 FXint edgeSpacing;
00081 FXint marginLower;
00082 FXint marginUpper;
00083 FXint indentFirst;
00084 FXint indentLower;
00085 FXint indentUpper;
00086 FXdouble pixelPerTick;
00087 FXint numberTicks;
00088 FXint majorTicks;
00089 FXint mediumTicks;
00090 FXint tinyTicks;
00091 FXint arrowPos;
00092 FXColor textColor;
00093 FXint shift;
00094 FXint pos;
00095 FXint off;
00096 FXString tip;
00097 FXString help;
00098 FXuchar mode;
00099 protected:
00100 FXRuler();
00101 FXint picked(FXint x,FXint y);
00102 void drawLeftArrow(FXDCWindow& dc,FXint x,FXint y);
00103 void drawRightArrow(FXDCWindow& dc,FXint x,FXint y);
00104 void drawUpArrow(FXDCWindow& dc,FXint x,FXint y);
00105 void drawDownArrow(FXDCWindow& dc,FXint x,FXint y);
00106 void drawLeftMarker(FXDCWindow& dc,FXint x,FXint y);
00107 void drawRightMarker(FXDCWindow& dc,FXint x,FXint y);
00108 void drawUpMarker(FXDCWindow& dc,FXint x,FXint y);
00109 void drawDownMarker(FXDCWindow& dc,FXint x,FXint y);
00110 protected:
00111 enum{
00112 MOUSE_NONE,
00113 MOUSE_MARG_LOWER,
00114 MOUSE_MARG_UPPER,
00115 MOUSE_PARA_FIRST,
00116 MOUSE_PARA_LOWER,
00117 MOUSE_PARA_UPPER
00118 };
00119 private:
00120 FXRuler(const FXRuler&);
00121 FXRuler &operator=(const FXRuler&);
00122 public:
00123 long onPaint(FXObject*,FXSelector,void*);
00124 long onLeftBtnPress(FXObject*,FXSelector,void*);
00125 long onLeftBtnRelease(FXObject*,FXSelector,void*);
00126 long onMotion(FXObject*,FXSelector,void*);
00127 long onCmdSetValue(FXObject*,FXSelector,void*);
00128 long onCmdSetIntValue(FXObject*,FXSelector,void*);
00129 long onCmdGetIntValue(FXObject*,FXSelector,void*);
00130 long onCmdSetHelp(FXObject*,FXSelector,void*);
00131 long onCmdGetHelp(FXObject*,FXSelector,void*);
00132 long onCmdSetTip(FXObject*,FXSelector,void*);
00133 long onCmdGetTip(FXObject*,FXSelector,void*);
00134 long onQueryHelp(FXObject*,FXSelector,void*);
00135 long onQueryTip(FXObject*,FXSelector,void*);
00136 public:
00137 enum{
00138 ID_ARROW=FXFrame::ID_LAST,
00139 ID_LAST
00140 };
00141 public:
00142
00144 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);
00145
00147 virtual void layout();
00148
00150 virtual void create();
00151
00153 virtual void detach();
00154
00156 virtual FXint getDefaultWidth();
00157
00159 virtual FXint getDefaultHeight();
00160
00162 void setPosition(FXint pos,FXbool notify=false);
00163
00165 FXint getPosition() const { return pos; }
00166
00168 void setContentSize(FXint size,FXbool notify=false);
00169 FXint getContentSize() const;
00170
00172 FXint getDocumentLower() const;
00173
00175 FXint getDocumentUpper() const;
00176
00178 void setDocumentSize(FXint size,FXbool notify=false);
00179 FXint getDocumentSize() const { return documentSize; }
00180
00182 void setEdgeSpacing(FXint space,FXbool notify=false);
00183 FXint getEdgeSpacing() const { return edgeSpacing; }
00184
00186 void setMarginLower(FXint mgn,FXbool notify=false);
00187 FXint getMarginLower() const { return marginLower; }
00188
00190 void setMarginUpper(FXint mgn,FXbool notify=false);
00191 FXint getMarginUpper() const { return marginUpper; }
00192
00194 void setIndentFirst(FXint ind,FXbool notify=false);
00195 FXint getIndentFirst() const { return indentFirst; }
00196
00198 void setIndentLower(FXint ind,FXbool notify=false);
00199 FXint getIndentLower() const { return indentLower; }
00200
00202 void setIndentUpper(FXint ind,FXbool notify=false);
00203 FXint getIndentUpper() const { return indentUpper; }
00204
00206 void setNumberTicks(FXint ticks,FXbool notify=false);
00207 FXint getNumberTicks() const { return numberTicks; }
00208
00210 void setMajorTicks(FXint ticks,FXbool notify=false);
00211 FXint getMajorTicks() const { return majorTicks; }
00212
00214 void setMediumTicks(FXint ticks,FXbool notify=false);
00215 FXint getMediumTicks() const { return mediumTicks; }
00216
00218 void setTinyTicks(FXint ticks,FXbool notify=false);
00219 FXint getTinyTicks() const { return tinyTicks; }
00220
00222 void setPixelPerTick(FXdouble space,FXbool notify=false);
00223 FXdouble getPixelPerTick() const { return pixelPerTick; }
00224
00226 void setFont(FXFont *fnt,FXbool notify=false);
00227
00229 FXFont* getFont() const { return font; }
00230
00232 void setValue(FXint value);
00233
00235 FXint getValue() const { return arrowPos; }
00236
00238 void setRulerStyle(FXuint style);
00239
00241 FXuint getRulerStyle() const;
00242
00244 void setRulerAlignment(FXuint alignment,FXbool notify=false);
00245
00247 FXuint getRulerAlignment() const;
00248
00250 FXColor getTextColor() const { return textColor; }
00251
00253 void setTextColor(FXColor clr);
00254
00256 void setHelpText(const FXString& text){ help=text; }
00257
00259 const FXString& getHelpText() const { return help; }
00260
00262 void setTipText(const FXString& text){ tip=text; }
00263
00265 const FXString& getTipText() const { return tip; }
00266
00268 virtual void save(FXStream& store) const;
00269
00271 virtual void load(FXStream& store);
00272
00274 virtual ~FXRuler();
00275 };
00276
00277 }
00278
00279 #endif