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
00061
00062
00063
class FXAPI FXRuler :
public FXFrame {
00064 FXDECLARE(FXRuler)
00065 protected:
00066 FXFont *font;
00067 FXint documentSize;
00068 FXint edgeSpacing;
00069 FXint marginLower;
00070 FXint marginUpper;
00071 FXint indentFirst;
00072 FXint indentLower;
00073 FXint indentUpper;
00074 FXdouble pixelPerTick;
00075 FXint numberTicks;
00076 FXint majorTicks;
00077 FXint mediumTicks;
00078 FXint tinyTicks;
00079 FXint arrowPos;
00080 FXColor textColor;
00081 FXint pos;
00082 FXint off;
00083
FXString tip;
00084
FXString help;
00085 FXuchar mode;
00086 protected:
00087 FXRuler();
00088 FXint picked(FXint x,FXint y);
00089
void drawLeftArrow(
FXDCWindow& dc,FXint x,FXint y);
00090
void drawRightArrow(
FXDCWindow& dc,FXint x,FXint y);
00091
void drawUpArrow(
FXDCWindow& dc,FXint x,FXint y);
00092
void drawDownArrow(
FXDCWindow& dc,FXint x,FXint y);
00093
void drawLeftMarker(
FXDCWindow& dc,FXint x,FXint y);
00094
void drawRightMarker(
FXDCWindow& dc,FXint x,FXint y);
00095
void drawUpMarker(
FXDCWindow& dc,FXint x,FXint y);
00096
void drawDownMarker(
FXDCWindow& dc,FXint x,FXint y);
00097 protected:
00098 enum{
00099 MOUSE_NONE,
00100 MOUSE_MARG_LOWER,
00101 MOUSE_MARG_UPPER,
00102 MOUSE_PARA_FIRST,
00103 MOUSE_PARA_LOWER,
00104 MOUSE_PARA_UPPER
00105 };
00106
private:
00107 FXRuler(
const FXRuler&);
00108 FXRuler &operator=(
const FXRuler&);
00109
public:
00110
long onPaint(
FXObject*,FXSelector,
void*);
00111
long onLeftBtnPress(
FXObject*,FXSelector,
void*);
00112 long onLeftBtnRelease(
FXObject*,FXSelector,
void*);
00113
long onMotion(
FXObject*,FXSelector,
void*);
00114
long onCmdSetValue(
FXObject*,FXSelector,
void*);
00115
long onCmdSetIntValue(
FXObject*,FXSelector,
void*);
00116
long onCmdGetIntValue(
FXObject*,FXSelector,
void*);
00117
long onCmdSetHelp(
FXObject*,FXSelector,
void*);
00118
long onCmdGetHelp(
FXObject*,FXSelector,
void*);
00119
long onCmdSetTip(
FXObject*,FXSelector,
void*);
00120
long onCmdGetTip(
FXObject*,FXSelector,
void*);
00121
long onQueryHelp(
FXObject*,FXSelector,
void*);
00122
long onQueryTip(
FXObject*,FXSelector,
void*);
00123
public:
00124
enum{
00125 ID_ARROW=FXFrame::ID_LAST,
00126 ID_LAST
00127 };
00128
public:
00129
00130
00131 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);
00132
00133
00134
virtual void create();
00135
00136
00137
virtual void detach();
00138
00139
00140
virtual FXint getDefaultWidth();
00141
00142
00143
virtual FXint getDefaultHeight();
00144
00145
00146
void setPosition(FXint pos);
00147
00148
00149 FXint getPosition()
const {
return pos; }
00150
00151
00152
void setDocumentSize(FXint size,FXbool notify=FALSE);
00153 FXint getDocumentSize()
const {
return documentSize; }
00154
00155
00156
void setEdgeSpacing(FXint space,FXbool notify=FALSE);
00157 FXint getEdgeSpacing()
const {
return edgeSpacing; }
00158
00159
00160
void setMarginLower(FXint mgn,FXbool notify=FALSE);
00161 FXint getMarginLower()
const {
return marginLower; }
00162
00163
00164
void setMarginUpper(FXint mgn,FXbool notify=FALSE);
00165 FXint getMarginUpper()
const {
return marginUpper; }
00166
00167
00168
void setIndentFirst(FXint ind,FXbool notify=FALSE);
00169 FXint getIndentFirst()
const {
return indentFirst; }
00170
00171
00172 void setIndentLower(FXint ind,FXbool notify=FALSE);
00173 FXint getIndentLower()
const {
return indentLower; }
00174
00175
00176
void setIndentUpper(FXint ind,FXbool notify=FALSE);
00177 FXint getIndentUpper()
const {
return indentUpper; }
00178
00179
00180
void setNumberTicks(FXint ticks,FXbool notify=FALSE);
00181 FXint getNumberTicks()
const {
return numberTicks; }
00182
00183
00184
void setMajorTicks(FXint ticks,FXbool notify=FALSE);
00185 FXint getMajorTicks()
const {
return majorTicks; }
00186
00187
00188
void setMediumTicks(FXint ticks,FXbool notify=FALSE);
00189 FXint getMediumTicks()
const {
return mediumTicks; }
00190
00191
00192
void setTinyTicks(FXint ticks,FXbool notify=FALSE);
00193 FXint getTinyTicks()
const {
return tinyTicks; }
00194
00195
00196 void setPixelPerTick(FXdouble space,FXbool notify=FALSE);
00197 FXdouble getPixelPerTick()
const {
return pixelPerTick; }
00198
00199
00200
void setFont(
FXFont *fnt);
00201
00202
00203
FXFont* getFont()
const {
return font; }
00204
00205
00206
void setValue(FXint value);
00207
00208
00209 FXint getValue()
const {
return arrowPos; }
00210
00211
00212
void setRulerStyle(FXuint style);
00213
00214
00215 FXuint getRulerStyle() const;
00216
00217
00218 FXColor getTextColor()
const {
return textColor; }
00219
00220
00221
void setTextColor(FXColor clr);
00222
00223
00224
void setHelpText(
const FXString& text);
00225
00226
00227
const FXString& getHelpText()
const {
return help; }
00228
00229
00230
void setTipText(
const FXString& text);
00231
00232
00233
const FXString& getTipText()
const {
return tip; }
00234
00235
00236
virtual void save(FXStream& store)
const;
00237
00238
00239
virtual void load(FXStream& store);
00240
00241
00242
virtual ~FXRuler();
00243 };
00244
00245 }
00246
00247
#endif