00001 /*========================================================================= 00002 00003 Module: $RCSfile: vtkKWBalloonHelpManager.h,v $ 00004 00005 Copyright (c) Kitware, Inc. 00006 All rights reserved. 00007 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 // .NAME vtkKWBalloonHelpManager - a "balloon help " manager class 00015 // .SECTION Description 00016 // vtkKWBalloonHelpManager is a class that provides functionality 00017 // to display balloon help (tooltips) for an application. 00018 // An instance of this class is created in the vtkKWApplication class. 00019 // When the balloon help string of a vtkKWWidget is set, the balloon help 00020 // manager instance of the widget's application is called to set up 00021 // bindings automatically for this widget (see AddBindings()). These bindings 00022 // will trigger the manager callbacks to display the balloon help string 00023 // appropriately. 00024 // .SECTION See Also 00025 // vtkKWApplication vtkKWWidget 00026 00027 #ifndef __vtkKWBalloonHelpManager_h 00028 #define __vtkKWBalloonHelpManager_h 00029 00030 #include "vtkKWObject.h" 00031 00032 class vtkKWTopLevel; 00033 class vtkKWLabel; 00034 class vtkKWWidget; 00035 00036 class KWWidgets_EXPORT vtkKWBalloonHelpManager : public vtkKWObject 00037 { 00038 public: 00039 static vtkKWBalloonHelpManager* New(); 00040 vtkTypeRevisionMacro(vtkKWBalloonHelpManager,vtkKWObject); 00041 void PrintSelf(ostream& os, vtkIndent indent); 00042 00043 // Description: 00044 // Set/Get balloon help visibility for all the widgets bound to this helper. 00045 virtual void SetVisibility(int); 00046 vtkGetMacro(Visibility, int); 00047 vtkBooleanMacro(Visibility, int); 00048 00049 // Description: 00050 // Set the delay for the balloon help in milliseconds. 00051 vtkSetClampMacro(Delay, int, 0, 15000); 00052 vtkGetMacro(Delay, int); 00053 00054 // Description: 00055 // Add/remove bindings for a given widget, effectively providing balloon help 00056 // feature for this widget. 00057 // On the widget side, one has to set the balloon help string or image. 00058 virtual void AddBindings(vtkKWWidget *widget); 00059 virtual void RemoveBindings(vtkKWWidget *widget); 00060 00061 // Description: 00062 // Set/Get if the balloon help is not displayed when the widget Enabled 00063 // state is Off. 00064 vtkSetMacro(IgnoreIfNotEnabled, int); 00065 vtkGetMacro(IgnoreIfNotEnabled, int); 00066 vtkBooleanMacro(IgnoreIfNotEnabled, int); 00067 00068 // Description: 00069 // Callbacks. Internal, do not use. 00070 virtual void TriggerCallback(vtkKWWidget *widget); 00071 virtual void DisplayCallback(vtkKWWidget *widget); 00072 virtual void CancelCallback(); 00073 virtual void WithdrawCallback(); 00074 00075 protected: 00076 vtkKWBalloonHelpManager(); 00077 ~vtkKWBalloonHelpManager(); 00078 00079 int Visibility; 00080 int IgnoreIfNotEnabled; 00081 int Delay; 00082 00083 vtkKWTopLevel *TopLevel; 00084 vtkKWLabel *Label; 00085 00086 // Description: 00087 // The widget which balloon help is currently being displayed or pending. 00088 vtkKWWidget *CurrentWidget; 00089 virtual void SetCurrentWidget(vtkKWWidget *widget); 00090 00091 // Description: 00092 // The Id of the Tk 'after' timer that will display the balloon help 00093 // after some delay. 00094 char *AfterTimerId; 00095 vtkSetStringMacro(AfterTimerId); 00096 00097 // Description: 00098 // Create the UI. 00099 virtual void CreateBalloon(); 00100 00101 // Description: 00102 // Return true if the application is exiting, i.e. if it is not safe 00103 // to perform anything (balloon help is an asynchronous process) 00104 virtual int ApplicationInExit(); 00105 00106 private: 00107 vtkKWBalloonHelpManager(const vtkKWBalloonHelpManager&); // Not implemented. 00108 void operator=(const vtkKWBalloonHelpManager&); // Not implemented. 00109 }; 00110 00111 #endif