KWWidgets
|
00001 /*========================================================================= 00002 00003 Module: $RCSfile: vtkKWDialog.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 vtkKWDialog - dialog box superclass 00015 // .SECTION Description 00016 // A generic superclass for dialog boxes. 00017 // This is a toplevel that is modal by default, and centered in its 00018 // master window (or on screen) 00019 00020 #ifndef __vtkKWDialog_h 00021 #define __vtkKWDialog_h 00022 00023 #include "vtkKWTopLevel.h" 00024 00025 class KWWidgets_EXPORT vtkKWDialog : public vtkKWTopLevel 00026 { 00027 public: 00028 static vtkKWDialog* New(); 00029 vtkTypeRevisionMacro(vtkKWDialog,vtkKWTopLevel); 00030 void PrintSelf(ostream& os, vtkIndent indent); 00031 00032 // Description: 00033 // Invoke the dialog, display it and enter an event loop until the user 00034 // confirms or cancels the dialog. 00035 // Create() will be called automatically by PreInvoke() if the dialog 00036 // has not been Create'd() yet. 00037 // Note that a dialog is a modal toplevel by default. 00038 // This method returns 0 if the dialog was killed or 00039 // canceled, 1 otherwise. The status can be further refined 00040 // by querying GetStatus(). 00041 virtual int Invoke(); 00042 00043 // Description: 00044 // Display the dialog. 00045 // Create() will be called automatically if the dialog 00046 // has not been Create'd() yet. 00047 // Note that a dialog is a modal toplevel by default. 00048 virtual void Display(); 00049 00050 // Description: 00051 // Status of the dialog (active e.g. displayed, canceled, OK'ed) 00052 //BTX 00053 enum 00054 { 00055 StatusActive = 0, 00056 StatusCanceled = 1, 00057 StatusOK = 2 00058 }; 00059 //ETX 00060 int GetStatus() { return this->Done; }; 00061 00062 // Description: 00063 // Return frame to pack into. 00064 vtkKWWidget* GetFrame() { return this; } 00065 00066 // Description: 00067 // Play beep when the dialog is displayed 00068 vtkSetClampMacro(Beep, int, 0, 1); 00069 vtkBooleanMacro(Beep, int); 00070 vtkGetMacro(Beep, int); 00071 00072 // Description: 00073 // Callback. Cancel the action and close this dialog 00074 virtual void Cancel(); 00075 00076 // Description: 00077 // Callback. Confirm the action and close this dialog 00078 virtual void OK(); 00079 00080 // Description: 00081 // Dialog can be also used by performing individual steps of Invoke. These 00082 // steps are initialize: PreInvoke(), finalize: PostInvoke(), and check if 00083 // user responded IsUserDoneWithDialog(). Use this method only if you 00084 // want to bypass the event loop used in Invoke() by creating your own 00085 // and checking for IsUserDoneWithDialog(). 00086 virtual int PreInvoke(); 00087 virtual void PostInvoke(); 00088 virtual int IsUserDoneWithDialog(); 00089 00090 protected: 00091 vtkKWDialog(); 00092 ~vtkKWDialog() {}; 00093 00094 // Description: 00095 // Create the widget. 00096 virtual void CreateWidget(); 00097 00098 int Done; 00099 int Beep; 00100 00101 private: 00102 vtkKWDialog(const vtkKWDialog&); // Not implemented 00103 void operator=(const vtkKWDialog&); // Not Implemented 00104 }; 00105 00106 #endif