KWWidgets
vtkKWDialog.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWDialog.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 vtkKWDialog - dialog box superclass
15 // .SECTION Description
16 // A generic superclass for dialog boxes.
17 // This is a toplevel that is modal by default, and centered in its
18 // master window (or on screen)
19 
20 #ifndef __vtkKWDialog_h
21 #define __vtkKWDialog_h
22 
23 #include "vtkKWTopLevel.h"
24 
26 {
27 public:
28  static vtkKWDialog* New();
29  vtkTypeRevisionMacro(vtkKWDialog,vtkKWTopLevel);
30  void PrintSelf(ostream& os, vtkIndent indent);
31 
32  // Description:
33  // Invoke the dialog, display it and enter an event loop until the user
34  // confirms or cancels the dialog.
35  // Create() will be called automatically by PreInvoke() if the dialog
36  // has not been Create'd() yet.
37  // Note that a dialog is a modal toplevel by default.
38  // This method returns 0 if the dialog was killed or
39  // canceled, 1 otherwise. The status can be further refined
40  // by querying GetStatus().
41  virtual int Invoke();
42 
43  // Description:
44  // Display the dialog.
45  // Create() will be called automatically if the dialog
46  // has not been Create'd() yet.
47  // Note that a dialog is a modal toplevel by default.
48  virtual void Display();
49 
50  // Description:
51  // Status of the dialog (active e.g. displayed, canceled, OK'ed)
52  //BTX
53  enum
54  {
55  StatusActive = 0,
56  StatusCanceled = 1,
57  StatusOK = 2
58  };
59  //ETX
60  int GetStatus() { return this->Done; };
61 
62  // Description:
63  // Return frame to pack into.
64  vtkKWWidget* GetFrame() { return this; }
65 
66  // Description:
67  // Play beep when the dialog is displayed
68  vtkSetClampMacro(Beep, int, 0, 1);
69  vtkBooleanMacro(Beep, int);
70  vtkGetMacro(Beep, int);
71 
72  // Description:
73  // Callback. Cancel the action and close this dialog
74  virtual void Cancel();
75 
76  // Description:
77  // Callback. Confirm the action and close this dialog
78  virtual void OK();
79 
80  // Description:
81  // Dialog can be also used by performing individual steps of Invoke. These
82  // steps are initialize: PreInvoke(), finalize: PostInvoke(), and check if
83  // user responded IsUserDoneWithDialog(). Use this method only if you
84  // want to bypass the event loop used in Invoke() by creating your own
85  // and checking for IsUserDoneWithDialog().
86  virtual int PreInvoke();
87  virtual void PostInvoke();
88  virtual int IsUserDoneWithDialog();
89 
90 protected:
91  vtkKWDialog();
93 
94  // Description:
95  // Create the widget.
96  virtual void CreateWidget();
97 
98  int Done;
99  int Beep;
100 
101 private:
102  vtkKWDialog(const vtkKWDialog&); // Not implemented
103  void operator=(const vtkKWDialog&); // Not Implemented
104 };
105 
106 #endif