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

FXRulerView.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                         R u l e r V i e w   W i d g e t                       *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2005,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXRulerView.h,v 1.15 2006/01/28 20:29:30 fox Exp $                       *
00023 ********************************************************************************/
00024 #ifndef FXRULERVIEW_H
00025 #define FXRULERVIEW_H
00026 
00027 #ifndef FXSCROLLAREA_H
00028 #include "FXScrollArea.h"
00029 #endif
00030 
00031 
00032 namespace FX {
00033 
00034 
00035 class FXRuler;
00036 class FXFrame;
00037 
00038 
00039 /**
00040 * The Ruler View provides viewing of a document with rulers.
00041 * It is intended to be subclassed in order to draw actual contents
00042 * and provide editing behavior for the document.
00043 * The ruler view itself simply manages the geometry of the document
00044 * being edited, and coordinates the movement of the ruler displays
00045 * as the document is being scrolled.
00046 */
00047 class FXRulerView : public FXScrollArea {
00048   FXDECLARE(FXRulerView)
00049 protected:
00050   FXRuler *hruler;      // Horizontal ruler
00051   FXRuler *vruler;      // Vertical ruler
00052   FXFrame *filler;      // Corner thingy
00053   FXColor  docColor;    // Color of document
00054   FXString tip;         // Tooltip text
00055   FXString help;        // Help text
00056 protected:
00057   FXRulerView();
00058   virtual void moveContents(FXint x,FXint y);
00059   virtual void drawBackground(FXDCWindow& dc);
00060   virtual void drawContents(FXDCWindow& dc);
00061 private:
00062   FXRulerView(const FXRulerView&);
00063   FXRulerView &operator=(const FXRulerView&);
00064 public:
00065   long onPaint(FXObject*,FXSelector,void*);
00066   long onMotion(FXObject*,FXSelector,void*);
00067   long onCmdSetHelp(FXObject*,FXSelector,void*);
00068   long onCmdGetHelp(FXObject*,FXSelector,void*);
00069   long onCmdSetTip(FXObject*,FXSelector,void*);
00070   long onCmdGetTip(FXObject*,FXSelector,void*);
00071   long onQueryHelp(FXObject*,FXSelector,void*);
00072   long onQueryTip(FXObject*,FXSelector,void*);
00073   long onDocChanged(FXObject*,FXSelector,void*);
00074 public:
00075   enum {
00076     ID_HRULER=FXScrollArea::ID_LAST,
00077     ID_VRULER,
00078     ID_LAST
00079     };
00080 public:
00081 
00082   /// Construct a rulerview window
00083   FXRulerView(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00084 
00085   /// Return viewport height
00086   virtual FXint getViewportHeight();
00087 
00088   /// Return viewport width
00089   virtual FXint getViewportWidth();
00090 
00091   /// Return content width
00092   virtual FXint getContentWidth();
00093 
00094   /// Return content height
00095   virtual FXint getContentHeight();
00096 
00097   /// Perform layout
00098   virtual void layout();
00099 
00100   /// Return a pointer to the horizontal ruler
00101   FXRuler* horizontalRuler() const { return hruler; }
00102 
00103   /// Return a pointer to the vertical ruler
00104   FXRuler* verticalRuler() const { return vruler; }
00105 
00106   /// Get document position X
00107   FXint getDocumentX() const;
00108 
00109   /// Get document position Y
00110   FXint getDocumentY() const;
00111 
00112   /// Set document width
00113   void setDocumentWidth(FXint w,FXbool notify=FALSE);
00114 
00115   /// Get document width
00116   FXint getDocumentWidth() const;
00117 
00118   /// Set document height
00119   void setDocumentHeight(FXint h,FXbool notify=FALSE);
00120 
00121   /// Get document height
00122   FXint getDocumentHeight() const;
00123 
00124   /// Set the current document color
00125   void setDocumentColor(FXColor clr);
00126 
00127   /// Get the current document color
00128   FXColor getDocumentColor() const { return docColor; }
00129 
00130   /// Change edge spacing around document
00131   void setHEdgeSpacing(FXint es,FXbool notify=FALSE);
00132   void setVEdgeSpacing(FXint es,FXbool notify=FALSE);
00133 
00134   /// Return edge spacing
00135   FXint getHEdgeSpacing() const;
00136   FXint getVEdgeSpacing() const;
00137 
00138   /// Change horizontal lower margin
00139   void setHMarginLower(FXint marg,FXbool notify=FALSE);
00140 
00141   /// Change horizontal upper margin
00142   void setHMarginUpper(FXint marg,FXbool notify=FALSE);
00143 
00144   /// Get horizontal lower margin
00145   FXint getHMarginLower() const;
00146 
00147   /// Get horizontal upper margin
00148   FXint getHMarginUpper() const;
00149 
00150   /// Change vertical lower margin
00151   void setVMarginLower(FXint marg,FXbool notify=FALSE);
00152 
00153   /// Change vertical upper margin
00154   void setVMarginUpper(FXint marg,FXbool notify=FALSE);
00155 
00156   /// Get vertical lower margin
00157   FXint getVMarginLower() const;
00158 
00159   /// Get vertical upper margin
00160   FXint getVMarginUpper() const;
00161 
00162   /// Set horizontal alignment; the default is RULER_ALIGN_NORMAL
00163   void setHAlignment(FXuint align,FXbool notify=FALSE);
00164 
00165   /// Return horizontal alignment
00166   FXuint getHAlignment() const;
00167 
00168   /// Set vertical alignment; the default is RULER_ALIGN_NORMAL
00169   void setVAlignment(FXuint align,FXbool notify=FALSE);
00170 
00171   /// Return vertical alignment
00172   FXuint getVAlignment() const;
00173 
00174   /// Set X arrow position, relative to document position
00175   void setArrowPosX(FXint x);
00176 
00177   /// Set X arrow position, relative to document position
00178   void setArrowPosY(FXint y);
00179 
00180   /// Get X arrow position in document
00181   FXint getArrowPosX() const;
00182 
00183   /// Get Y arrow position in document
00184   FXint getArrowPosY() const;
00185 
00186   /// Set the horizontal ruler font
00187   void setHRulerFont(FXFont *fnt,FXbool notify=FALSE);
00188 
00189   /// Get the horizontal ruler font
00190   FXFont* getHRulerFont() const;
00191 
00192   /// Set the vertical ruler font
00193   void setVRulerFont(FXFont *fnt,FXbool notify=FALSE);
00194 
00195   /// Get the vertical ruler font
00196   FXFont* getVRulerFont() const;
00197 
00198   /// Change document number placement
00199   void setHNumberTicks(FXint ticks,FXbool notify=FALSE);
00200   void setVNumberTicks(FXint ticks,FXbool notify=FALSE);
00201 
00202   /// Return document number placement
00203   FXint getHNumberTicks() const;
00204   FXint getVNumberTicks() const;
00205 
00206   /// Change document major ticks
00207   void setHMajorTicks(FXint ticks,FXbool notify=FALSE);
00208   void setVMajorTicks(FXint ticks,FXbool notify=FALSE);
00209 
00210   /// Return document major ticks
00211   FXint getHMajorTicks() const;
00212   FXint getVMajorTicks() const;
00213 
00214   /// Change document medium ticks
00215   void setHMediumTicks(FXint ticks,FXbool notify=FALSE);
00216   void setVMediumTicks(FXint ticks,FXbool notify=FALSE);
00217 
00218   /// Return document medium ticks
00219   FXint getHMediumTicks() const;
00220   FXint getVMediumTicks() const;
00221 
00222   /// Change document tiny ticks
00223   void setHTinyTicks(FXint ticks,FXbool notify=FALSE);
00224   void setVTinyTicks(FXint ticks,FXbool notify=FALSE);
00225 
00226   /// Return document tiny ticks
00227   FXint getHTinyTicks() const;
00228   FXint getVTinyTicks() const;
00229 
00230   /// Change pixel per tick spacing
00231   void setHPixelPerTick(FXdouble space,FXbool notify=FALSE);
00232   void setVPixelPerTick(FXdouble space,FXbool notify=FALSE);
00233 
00234   /// Return pixel per tick spacing
00235   FXdouble getHPixelPerTick() const;
00236   FXdouble getVPixelPerTick() const;
00237 
00238   /// Set ruler style
00239   void setHRulerStyle(FXuint style);
00240   void setVRulerStyle(FXuint style);
00241 
00242   /// Get ruler style
00243   FXuint getHRulerStyle() const;
00244   FXuint getVRulerStyle() const;
00245 
00246   /// Set the status line help text for the ruler view
00247   void setHelpText(const FXString& text){ help=text; }
00248 
00249   /// Get the status line help text for the ruler view
00250   const FXString& getHelpText() const { return help; }
00251 
00252   /// Set the tool tip message for the ruler view
00253   void setTipText(const FXString& text){ tip=text; }
00254 
00255   /// Get the tool tip message for the ruler view
00256   const FXString& getTipText() const { return tip; }
00257 
00258   /// Save list to a stream
00259   virtual void save(FXStream& store) const;
00260 
00261   /// Load list from a stream
00262   virtual void load(FXStream& store);
00263 
00264   /// Destroy
00265   virtual ~FXRulerView();
00266   };
00267 
00268 }
00269 
00270 #endif

Copyright © 1997-2005 Jeroen van der Zijp