Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXRulerView.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * R u l e r V i e w W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2005,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXRulerView.h,v 1.15 2006/01/28 20:29:30 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXRULERVIEW_H
25 #define FXRULERVIEW_H
26 
27 #ifndef FXSCROLLAREA_H
28 #include "FXScrollArea.h"
29 #endif
30 
31 
32 namespace FX {
33 
34 
35 class FXRuler;
36 class FXFrame;
37 
38 
39 /**
40 * The Ruler View provides viewing of a document with rulers.
41 * It is intended to be subclassed in order to draw actual contents
42 * and provide editing behavior for the document.
43 * The ruler view itself simply manages the geometry of the document
44 * being edited, and coordinates the movement of the ruler displays
45 * as the document is being scrolled.
46 */
47 class FXRulerView : public FXScrollArea {
49 protected:
50  FXRuler *hruler; // Horizontal ruler
51  FXRuler *vruler; // Vertical ruler
52  FXFrame *filler; // Corner thingy
53  FXColor docColor; // Color of document
54  FXString tip; // Tooltip text
55  FXString help; // Help text
56 protected:
57  FXRulerView();
58  virtual void moveContents(FXint x,FXint y);
59  virtual void drawBackground(FXDCWindow& dc);
60  virtual void drawContents(FXDCWindow& dc);
61 private:
62  FXRulerView(const FXRulerView&);
63  FXRulerView &operator=(const FXRulerView&);
64 public:
65  long onPaint(FXObject*,FXSelector,void*);
66  long onMotion(FXObject*,FXSelector,void*);
67  long onCmdSetHelp(FXObject*,FXSelector,void*);
68  long onCmdGetHelp(FXObject*,FXSelector,void*);
69  long onCmdSetTip(FXObject*,FXSelector,void*);
70  long onCmdGetTip(FXObject*,FXSelector,void*);
71  long onQueryHelp(FXObject*,FXSelector,void*);
72  long onQueryTip(FXObject*,FXSelector,void*);
73  long onDocChanged(FXObject*,FXSelector,void*);
74 public:
75  enum {
76  ID_HRULER=FXScrollArea::ID_LAST,
77  ID_VRULER,
78  ID_LAST
79  };
80 public:
81 
82  /// Construct a rulerview window
83  FXRulerView(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
84 
85  /// Return viewport height
86  virtual FXint getViewportHeight();
87 
88  /// Return viewport width
89  virtual FXint getViewportWidth();
90 
91  /// Return content width
92  virtual FXint getContentWidth();
93 
94  /// Return content height
95  virtual FXint getContentHeight();
96 
97  /// Perform layout
98  virtual void layout();
99 
100  /// Return a pointer to the horizontal ruler
101  FXRuler* horizontalRuler() const { return hruler; }
102 
103  /// Return a pointer to the vertical ruler
104  FXRuler* verticalRuler() const { return vruler; }
105 
106  /// Get document position X
107  FXint getDocumentX() const;
109  /// Get document position Y
110  FXint getDocumentY() const;
111 
112  /// Set document width
113  void setDocumentWidth(FXint w,FXbool notify=FALSE);
114 
115  /// Get document width
116  FXint getDocumentWidth() const;
117 
118  /// Set document height
119  void setDocumentHeight(FXint h,FXbool notify=FALSE);
120 
121  /// Get document height
122  FXint getDocumentHeight() const;
123 
124  /// Set the current document color
125  void setDocumentColor(FXColor clr);
126 
127  /// Get the current document color
128  FXColor getDocumentColor() const { return docColor; }
129 
130  /// Change edge spacing around document
131  void setHEdgeSpacing(FXint es,FXbool notify=FALSE);
132  void setVEdgeSpacing(FXint es,FXbool notify=FALSE);
133 
134  /// Return edge spacing
135  FXint getHEdgeSpacing() const;
136  FXint getVEdgeSpacing() const;
137 
138  /// Change horizontal lower margin
139  void setHMarginLower(FXint marg,FXbool notify=FALSE);
140 
141  /// Change horizontal upper margin
142  void setHMarginUpper(FXint marg,FXbool notify=FALSE);
143 
144  /// Get horizontal lower margin
145  FXint getHMarginLower() const;
146 
147  /// Get horizontal upper margin
148  FXint getHMarginUpper() const;
149 
150  /// Change vertical lower margin
151  void setVMarginLower(FXint marg,FXbool notify=FALSE);
152 
153  /// Change vertical upper margin
154  void setVMarginUpper(FXint marg,FXbool notify=FALSE);
155 
156  /// Get vertical lower margin
157  FXint getVMarginLower() const;
158 
159  /// Get vertical upper margin
160  FXint getVMarginUpper() const;
161 
162  /// Set horizontal alignment; the default is RULER_ALIGN_NORMAL
163  void setHAlignment(FXuint align,FXbool notify=FALSE);
164 
165  /// Return horizontal alignment
166  FXuint getHAlignment() const;
167 
168  /// Set vertical alignment; the default is RULER_ALIGN_NORMAL
169  void setVAlignment(FXuint align,FXbool notify=FALSE);
170 
171  /// Return vertical alignment
172  FXuint getVAlignment() const;
173 
174  /// Set X arrow position, relative to document position
175  void setArrowPosX(FXint x);
176 
177  /// Set X arrow position, relative to document position
178  void setArrowPosY(FXint y);
179 
180  /// Get X arrow position in document
181  FXint getArrowPosX() const;
182 
183  /// Get Y arrow position in document
184  FXint getArrowPosY() const;
185 
186  /// Set the horizontal ruler font
187  void setHRulerFont(FXFont *fnt,FXbool notify=FALSE);
188 
189  /// Get the horizontal ruler font
190  FXFont* getHRulerFont() const;
191 
192  /// Set the vertical ruler font
193  void setVRulerFont(FXFont *fnt,FXbool notify=FALSE);
194 
195  /// Get the vertical ruler font
196  FXFont* getVRulerFont() const;
197 
198  /// Change document number placement
199  void setHNumberTicks(FXint ticks,FXbool notify=FALSE);
200  void setVNumberTicks(FXint ticks,FXbool notify=FALSE);
201 
202  /// Return document number placement
203  FXint getHNumberTicks() const;
204  FXint getVNumberTicks() const;
205 
206  /// Change document major ticks
207  void setHMajorTicks(FXint ticks,FXbool notify=FALSE);
208  void setVMajorTicks(FXint ticks,FXbool notify=FALSE);
209 
210  /// Return document major ticks
211  FXint getHMajorTicks() const;
212  FXint getVMajorTicks() const;
213 
214  /// Change document medium ticks
215  void setHMediumTicks(FXint ticks,FXbool notify=FALSE);
216  void setVMediumTicks(FXint ticks,FXbool notify=FALSE);
217 
218  /// Return document medium ticks
219  FXint getHMediumTicks() const;
220  FXint getVMediumTicks() const;
221 
222  /// Change document tiny ticks
223  void setHTinyTicks(FXint ticks,FXbool notify=FALSE);
224  void setVTinyTicks(FXint ticks,FXbool notify=FALSE);
225 
226  /// Return document tiny ticks
228  FXint getVTinyTicks() const;
229 
230  /// Change pixel per tick spacing
231  void setHPixelPerTick(FXdouble space,FXbool notify=FALSE);
232  void setVPixelPerTick(FXdouble space,FXbool notify=FALSE);
234  /// Return pixel per tick spacing
235  FXdouble getHPixelPerTick() const;
237 
238  /// Set ruler style
239  void setHRulerStyle(FXuint style);
240  void setVRulerStyle(FXuint style);
241 
242  /// Get ruler style
243  FXuint getHRulerStyle() const;
244  FXuint getVRulerStyle() const;
245 
246  /// Set the status line help text for the ruler view
247  void setHelpText(const FXString& text){ help=text; }
248 
249  /// Get the status line help text for the ruler view
250  const FXString& getHelpText() const { return help; }
251 
252  /// Set the tool tip message for the ruler view
253  void setTipText(const FXString& text){ tip=text; }
254 
255  /// Get the tool tip message for the ruler view
256  const FXString& getTipText() const { return tip; }
257 
258  /// Save list to a stream
259  virtual void save(FXStream& store) const;
260 
261  /// Load list from a stream
262  virtual void load(FXStream& store);
263 
264  /// Destroy
265  virtual ~FXRulerView();
266  };
267 
268 }
269 
270 #endif
void setDocumentColor(FXColor clr)
Set the current document color.
void setDocumentHeight(FXint h, FXbool notify=FALSE)
Set document height.
void setHPixelPerTick(FXdouble space, FXbool notify=FALSE)
Change pixel per tick spacing.
FXint getHEdgeSpacing() const
Return edge spacing.
void setVRulerFont(FXFont *fnt, FXbool notify=FALSE)
Set the vertical ruler font.
FXint getHNumberTicks() const
Return document number placement.
The ruler widget is placed alongside a document to measure position and size of entities within the d...
Definition: FXRuler.h:85
FXint getDocumentY() const
Get document position Y.
The Frame widget provides borders around some contents.
Definition: FXFrame.h:73
Definition: FXWindow.h:241
unsigned int FXuint
Definition: fxdefs.h:396
FXint getVNumberTicks() const
FXint getArrowPosX() const
Get X arrow position in document.
FXint getHMediumTicks() const
Return document medium ticks.
FXuint FXSelector
Association key.
Definition: FXObject.h:53
void setHelpText(const FXString &text)
Set the status line help text for the ruler view.
Definition: FXRulerView.h:227
virtual FXint getViewportHeight()
Return viewport height.
void setHNumberTicks(FXint ticks, FXbool notify=FALSE)
Change document number placement.
void setArrowPosY(FXint y)
Set X arrow position, relative to document position.
FXuchar FXbool
Definition: fxdefs.h:393
FXuint getVAlignment() const
Return vertical alignment.
The Ruler View provides viewing of a document with rulers.
Definition: FXRulerView.h:47
virtual FXint getViewportWidth()
Return viewport width.
Base composite.
Definition: FXComposite.h:35
FXuint getHAlignment() const
Return horizontal alignment.
void setVMarginUpper(FXint marg, FXbool notify=FALSE)
Change vertical upper margin.
FXint getHMarginUpper() const
Get horizontal upper margin.
#define NULL
Definition: fxdefs.h:41
FXint getDocumentX() const
Get document position X.
FXdouble getVPixelPerTick() const
void setHMajorTicks(FXint ticks, FXbool notify=FALSE)
Change document major ticks.
FXuint FXColor
Definition: fxdefs.h:454
void setVRulerStyle(FXuint style)
FXint getHTinyTicks() const
Return document tiny ticks.
FXRulerView(FXComposite *p, FXObject *tgt=NULL, FXSelector sel=0, FXuint opts=0, FXint x=0, FXint y=0, FXint w=0, FXint h=0)
Construct a rulerview window.
FXFont * getVRulerFont() const
Get the vertical ruler font.
virtual FXint getContentWidth()
Return content width.
FXColor getDocumentColor() const
Get the current document color.
Definition: FXRulerView.h:108
FXFont * getHRulerFont() const
Get the horizontal ruler font.
virtual void load(FXStream &store)
Load list from a stream.
void setHMarginUpper(FXint marg, FXbool notify=FALSE)
Change horizontal upper margin.
const FXString & getTipText() const
Get the tool tip message for the ruler view.
Definition: FXRulerView.h:236
void setHRulerFont(FXFont *fnt, FXbool notify=FALSE)
Set the horizontal ruler font.
void setHAlignment(FXuint align, FXbool notify=FALSE)
Set horizontal alignment; the default is RULER_ALIGN_NORMAL.
FXint getVTinyTicks() const
double FXdouble
Definition: fxdefs.h:399
FXint getDocumentHeight() const
Get document height.
void setVAlignment(FXuint align, FXbool notify=FALSE)
Set vertical alignment; the default is RULER_ALIGN_NORMAL.
void setHMarginLower(FXint marg, FXbool notify=FALSE)
Change horizontal lower margin.
int FXint
Definition: fxdefs.h:397
void setVEdgeSpacing(FXint es, FXbool notify=FALSE)
FXuint getVRulerStyle() const
FXint getVMarginLower() const
Get vertical lower margin.
void setVMediumTicks(FXint ticks, FXbool notify=FALSE)
void setHTinyTicks(FXint ticks, FXbool notify=FALSE)
Change document tiny ticks.
void setVMarginLower(FXint marg, FXbool notify=FALSE)
Change vertical lower margin.
FXint getVMajorTicks() const
void setHEdgeSpacing(FXint es, FXbool notify=FALSE)
Change edge spacing around document.
void setTipText(const FXString &text)
Set the tool tip message for the ruler view.
Definition: FXRulerView.h:233
The scroll area widget manages a content area and a viewport area through which the content is viewed...
Definition: FXScrollArea.h:75
#define FALSE
Definition: fxdefs.h:35
FXint getHMarginLower() const
Get horizontal lower margin.
void setVMajorTicks(FXint ticks, FXbool notify=FALSE)
FXint getVEdgeSpacing() const
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
void setVNumberTicks(FXint ticks, FXbool notify=FALSE)
Window Device Context.
Definition: FXDCWindow.h:52
void setHRulerStyle(FXuint style)
Set ruler style.
virtual void layout()
Perform layout.
void setDocumentWidth(FXint w, FXbool notify=FALSE)
Set document width.
FXint getVMediumTicks() const
FXRuler * verticalRuler() const
Return a pointer to the vertical ruler.
Definition: FXRulerView.h:84
void setHMediumTicks(FXint ticks, FXbool notify=FALSE)
Change document medium ticks.
void setArrowPosX(FXint x)
Set X arrow position, relative to document position.
FXRuler * horizontalRuler() const
Return a pointer to the horizontal ruler.
Definition: FXRulerView.h:81
const FXString & getHelpText() const
Get the status line help text for the ruler view.
Definition: FXRulerView.h:230
virtual void save(FXStream &store) const
Save list to a stream.
FXdouble getHPixelPerTick() const
Return pixel per tick spacing.
FXint getDocumentWidth() const
Get document width.
void setVTinyTicks(FXint ticks, FXbool notify=FALSE)
FXint getArrowPosY() const
Get Y arrow position in document.
FXint getHMajorTicks() const
Return document major ticks.
FXuint getHRulerStyle() const
Get ruler style.
Font class.
Definition: FXFont.h:142
FXint getVMarginUpper() const
Get vertical upper margin.
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
virtual FXint getContentHeight()
Return content height.
virtual ~FXRulerView()
Destroy.
void setVPixelPerTick(FXdouble space, FXbool notify=FALSE)
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33

Copyright © 1997-2005 Jeroen van der Zijp