KWWidgets
vtkKWPopupButton.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWPopupButton.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 vtkKWPopupButton - a button that triggers a popup
15 // .SECTION Description
16 // The vtkKWPopupButton class creates a push button that
17 // will popup a window. User widgets should be inserted inside
18 // the PopupFrame ivar.
19 
20 #ifndef __vtkKWPopupButton_h
21 #define __vtkKWPopupButton_h
22 
23 #include "vtkKWPushButton.h"
24 
25 class vtkKWFrame;
26 class vtkKWTopLevel;
27 
29 {
30 public:
31  static vtkKWPopupButton* New();
32  vtkTypeRevisionMacro(vtkKWPopupButton, vtkKWPushButton);
33  void PrintSelf(ostream& os, vtkIndent indent);
34 
35  // Description:
36  // Access to sub-widgets.
37  // The PopupFrame widget is the place to put your own sub-widgets.
38  vtkGetObjectMacro(PopupTopLevel, vtkKWTopLevel);
39  vtkGetObjectMacro(PopupFrame, vtkKWFrame);
40  vtkGetObjectMacro(PopupCloseButton, vtkKWPushButton);
41 
42  // Description:
43  // Set the popup title.
44  virtual void SetPopupTitle(const char* title);
45 
46  // Description:
47  // Update the "enable" state of the object and its internal parts.
48  // Depending on different Ivars (this->Enabled, the application's
49  // Limited Edition Mode, etc.), the "enable" state of the object is updated
50  // and propagated to its internal parts/subwidgets. This will, for example,
51  // enable/disable parts of the widget UI, enable/disable the visibility
52  // of 3D widgets, etc.
53  virtual void UpdateEnableState();
54 
55  // Description:
56  // Specifies a command to associate with the widget. This command is
57  // typically invoked when the popup is withdrawn.
58  // The 'object' argument is the object that will have the method called on
59  // it. The 'method' argument is the name of the method to be called and any
60  // arguments in string form. If the object is NULL, the method is still
61  // evaluated as a simple command.
62  virtual void SetWithdrawCommand(vtkObject *object, const char* command);
63 
64  // Description:
65  // Callbacks. Internal, do not use.
66  virtual void DisplayPopupCallback();
67  virtual void WithdrawPopupCallback();
68 
69 protected:
72 
73  // Description:
74  // Create the widget.
75  virtual void CreateWidget();
76 
77  vtkKWTopLevel *PopupTopLevel;
78  vtkKWFrame *PopupFrame;
79  vtkKWPushButton *PopupCloseButton;
80 
81  char* WithdrawCommand;
82  virtual void InvokeWithdrawCommand();
83 
84  virtual void Bind();
85  virtual void UnBind();
86 
87 private:
88  vtkKWPopupButton(const vtkKWPopupButton&); // Not implemented
89  void operator=(const vtkKWPopupButton&); // Not implemented
90 };
91 
92 #endif
93