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

Copyright © 1997-2009 Jeroen van der Zijp