#ifndef GUITOOLTIP_HEADER #define GUITOOLTIP_HEADER 1 //////////////////////////////////////////////////////////// //! rcsid="$Id: ToolTips.hh,v 1.4 2000/07/07 12:59:28 ees1cg Exp $" //! file="amma/GUI/GTK/ToolTips.hh" //! lib=GUI //! docentry="GUI.Widget" //! author="Charles Galambos" //! date="11/10/99" #include "amma/GUI/Widget.hh" extern "C" { typedef struct _GtkTooltips GtkTooltips; }; class GUIToolTipsC; //////////////////////////////////////// //! userlevel=Develop //: Tool tip set body. class GUIToolTipsBodyC : public DPEntityBodyC { public: GUIToolTipsBodyC(); //: Constructor. void Enable(); //: Enable tool tips. // Thread safe. void Disable(); //: Disable tool tips. // Thread safe. void GUIEnable(); //: Enable tool tips. // GUI Thread only. void GUIDisable(); //: Disable tool tips. // GUI Thread only. void SetDelay(RealT secs); //: Set tips delay. // Thread safe. void GUISetDelay(RealT secs); //: Set tips delay. // GUI Thread only. void AddToolTip(GUIWidgetC &widge,const char *text,const char *context = 0); //: Set tips delay. // Thread safe. void GUIAddToolTip(GUIWidgetC &widge,const char *text,const char *context = 0); //: Set tips delay. // GUI Thread only. BooleanT IsEnabled() const { return enabled; } //: Is this group of tool tips enabled ? protected: BooleanT Create(); //: Create the widget. void Destroy(); //: Undo all refrences. private: BooleanT enabled; GtkTooltips *widget; RealT delay; friend class GUIToolTipsC; }; //////////////////////////////////////// //! userlevel=Normal //: Tool tip set handle. class GUIToolTipsC : public DPEntityC { public: GUIToolTipsC() : DPEntityC(true) {} //: Default constructor. GUIToolTipsC(BooleanT bod) : DPEntityC(*new GUIToolTipsBodyC()) {} //: Constructor. protected: GUIToolTipsC(GUIToolTipsBodyC &bod) : DPEntityC(bod) {} //: Body Constructor. GUIToolTipsBodyC &Body() { return dynamic_cast(DPEntityC::Body ()); } //: Access body. const GUIToolTipsBodyC &Body() const { return dynamic_cast(DPEntityC::Body()); } //: Access body. void GUIEnable() { Body().GUIEnable(); } //: Enable tool tips. // GUI Thread only. void GUIDisable() { Body().GUIDisable(); } //: Disable tool tips. // GUI Thread only. void GUISetDelay(RealT &secs) { Body().GUISetDelay(secs); } //: Set tips delay. void GUIAddToolTip(GUIWidgetC &widge,char *&text,char *&context) { Body().GUIAddToolTip(widge,text,context); } //: Set tips delay. // GUI Thread only. public: BooleanT Create() { return Body().Create(); } //: Create the widget. void Enable() { Body().Enable(); } //: Enable tool tips. // Thread safe. void Disable() { Body().Disable(); } //: Disable tool tips. // Thread safe. void SetDelay(RealT &secs) { Body().SetDelay(secs); } //: Set tips delay. // Thread safe. void AddToolTip(GUIWidgetC &widge,const char *text,const char *context = 0) { Body().AddToolTip(widge,text,context); } //: Set tips delay. // Thread safe. void ShowToolTips(BooleanT &state) { if(state) Enable(); else Disable(); } //: Show tool tips ? // TRUE= yes. BooleanT IsEnabled() const { return Body().IsEnabled(); } //: Is this group of tool tips enabled ? friend class GUIToolTipsBodyC; }; extern GUIToolTipsC guiGlobalToolTips; #endif