#ifndef GUIRULER_HEADER #define GUIRULER_HEADER 1 /////////////////////////////////////////////////////////////// //! rcsid="$Id: Ruler.hh,v 1.4 2000/07/07 12:59:23 ees1cg Exp $" //! file="amma/GUI/GTK/Ruler.hh" //! lib=GUI //! docentry="GUI.Widget" //! author="Charles Galambos" //! date="23/09/99" #include "amma/GUI/Widget.hh" //! userlevel=Develop //: Ruler body. class GUIRulerBodyC : public GUIWidgetBodyC { public: GUIRulerBodyC(BooleanT nVert,RealT nlower,RealT nupper,RealT npos,RealT nmaxSize) : vert(nVert), lower(nlower), upper(nupper), position(npos), max_size(nmaxSize) {} //: Ruler body BooleanT GUIAttachTo(GUIWidgetC &widge); //: Get motion events from widge. // GUI Thread only. void GUISetRange(RealT lower,RealT upper); //: Set range of ruler. // GUI Thread only. protected: virtual BooleanT Create(); //: Create widget BooleanT vert; // TRUE = Vertical. RealT lower; // The upper limit of the ruler (in points) RealT upper; // The lower limit of the ruler RealT position; // The position of the mark on the ruler RealT max_size; // The maximum size of the ruler }; //! userlevel=Normal //: Ruler . class GUIRulerC : public GUIWidgetC { public: GUIRulerC() : DPEntityC(true) {} //: Default constructor. // Creates an invalid handle. GUIRulerC(BooleanT nVert,RealT nlower = 0,RealT nupper = 1,RealT npos = 0.5,RealT nmaxSize = 1) : DPEntityC(* new GUIRulerBodyC(nVert,nlower,nupper,npos,nmaxSize)) {} //: Constructor. protected: GUIRulerBodyC &Body() { return dynamic_cast(DPEntityC::Body()); } //: Access body. const GUIRulerBodyC &Body() const { return dynamic_cast(DPEntityC::Body()); } //: Access body. void GUIAttachTo(GUIWidgetC &widge) { Body().GUIAttachTo(widge); } //: Get motion events from widge. // GUI Thread only. void GUISetRange(RealT &lower,RealT &upper) { Body().GUISetRange(lower,upper); } //: Set range of ruler. // GUI Thread only. public: BooleanT AttachTo(GUIWidgetC &widge); //: Get motion events from 'widge', for ruler position. // Thread safe. void SetRange(RealT lower,RealT upper); //: Set range for ruler. // Thread safe. }; #endif