KWWidgets
vtkKWBalloonHelpManager.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWBalloonHelpManager.h,v $
4 
5  Copyright (c) Kitware, Inc.
6  All rights reserved.
7  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 // .NAME vtkKWBalloonHelpManager - a "balloon help " manager class
15 // .SECTION Description
16 // vtkKWBalloonHelpManager is a class that provides functionality
17 // to display balloon help (tooltips) for an application.
18 // An instance of this class is created in the vtkKWApplication class.
19 // When the balloon help string of a vtkKWWidget is set, the balloon help
20 // manager instance of the widget's application is called to set up
21 // bindings automatically for this widget (see AddBindings()). These bindings
22 // will trigger the manager callbacks to display the balloon help string
23 // appropriately.
24 // .SECTION See Also
25 // vtkKWApplication vtkKWWidget
26 
27 #ifndef __vtkKWBalloonHelpManager_h
28 #define __vtkKWBalloonHelpManager_h
29 
30 #include "vtkKWObject.h"
31 
32 class vtkKWTopLevel;
33 class vtkKWLabel;
34 class vtkKWWidget;
35 
37 {
38 public:
39  static vtkKWBalloonHelpManager* New();
40  vtkTypeRevisionMacro(vtkKWBalloonHelpManager,vtkKWObject);
41  void PrintSelf(ostream& os, vtkIndent indent);
42 
43  // Description:
44  // Set/Get balloon help visibility for all the widgets bound to this helper.
45  virtual void SetVisibility(int);
46  vtkGetMacro(Visibility, int);
47  vtkBooleanMacro(Visibility, int);
48 
49  // Description:
50  // Set the delay for the balloon help in milliseconds.
51  vtkSetClampMacro(Delay, int, 0, 15000);
52  vtkGetMacro(Delay, int);
53 
54  // Description:
55  // Add/remove bindings for a given widget, effectively providing balloon help
56  // feature for this widget.
57  // On the widget side, one has to set the balloon help string or image.
58  virtual void AddBindings(vtkKWWidget *widget);
59  virtual void RemoveBindings(vtkKWWidget *widget);
60 
61  // Description:
62  // Set/Get if the balloon help is not displayed when the widget Enabled
63  // state is Off.
64  vtkSetMacro(IgnoreIfNotEnabled, int);
65  vtkGetMacro(IgnoreIfNotEnabled, int);
66  vtkBooleanMacro(IgnoreIfNotEnabled, int);
67 
68  // Description:
69  // Callbacks. Internal, do not use.
70  virtual void TriggerCallback(vtkKWWidget *widget);
71  virtual void DisplayCallback(vtkKWWidget *widget);
72  virtual void CancelCallback();
73  virtual void WithdrawCallback();
74 
75 protected:
78 
79  int Visibility;
80  int IgnoreIfNotEnabled;
81  int Delay;
82 
83  vtkKWTopLevel *TopLevel;
84  vtkKWLabel *Label;
85 
86  // Description:
87  // The widget which balloon help is currently being displayed or pending.
88  vtkKWWidget *CurrentWidget;
89  virtual void SetCurrentWidget(vtkKWWidget *widget);
90 
91  // Description:
92  // The Id of the Tk 'after' timer that will display the balloon help
93  // after some delay.
94  char *AfterTimerId;
95  vtkSetStringMacro(AfterTimerId);
96 
97  // Description:
98  // Create the UI.
99  virtual void CreateBalloon();
100 
101  // Description:
102  // Return true if the application is exiting, i.e. if it is not safe
103  // to perform anything (balloon help is an asynchronous process)
104  virtual int ApplicationInExit();
105 
106 private:
107  vtkKWBalloonHelpManager(const vtkKWBalloonHelpManager&); // Not implemented.
108  void operator=(const vtkKWBalloonHelpManager&); // Not implemented.
109 };
110 
111 #endif