debian/tmp/usr/include/KWWidgets/vtkKWMessageDialog.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWMessageDialog.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 vtkKWMessageDialog - a message dialog superclass
00015 // .SECTION Description
00016 // A generic superclass for MessageDialog boxes.
00017 
00018 #ifndef __vtkKWMessageDialog_h
00019 #define __vtkKWMessageDialog_h
00020 
00021 #include "vtkKWDialog.h"
00022 
00023 class vtkKWApplication;
00024 class vtkKWCheckButton;
00025 class vtkKWFrame;
00026 class vtkKWMessage;
00027 class vtkKWLabel;
00028 class vtkKWPushButton;
00029 
00030 class KWWidgets_EXPORT vtkKWMessageDialog : public vtkKWDialog
00031 {
00032 public:
00033   static vtkKWMessageDialog* New();
00034   vtkTypeRevisionMacro(vtkKWMessageDialog,vtkKWDialog);
00035   void PrintSelf(ostream& os, vtkIndent indent);
00036 
00037   // Description:
00038   // Set the text of the message
00039   virtual void SetText(const char *);
00040 
00041   // Description:
00042   // Set/Get the width of the message, in pixels)
00043   virtual void SetTextWidth(int);
00044   virtual int GetTextWidth();
00045 
00046   // Description:
00047   // Status of the dialog. This subclass defines a new 'Other' status on
00048   // top of the usual one (active e.g. displayed, canceled, OK'ed). This
00049   // status is triggered by pressing the 'Other' button.
00050   //BTX
00051   enum 
00052   {
00053     StatusOther = 100
00054   };
00055   //ETX
00056 
00057   // Description:
00058   // Set the style of the message box.
00059   // No effect if called after Create()
00060   //BTX
00061   enum 
00062   {
00063     StyleMessage = 0,
00064     StyleYesNo,
00065     StyleOkCancel,
00066     StyleOkOtherCancel,
00067     StyleCancel
00068   };
00069   //ETX
00070   virtual void SetStyle(int);
00071   vtkGetMacro(Style,int);
00072   void SetStyleToMessage();
00073   void SetStyleToYesNo();
00074   void SetStyleToOkCancel();
00075   void SetStyleToOkOtherCancel();
00076   void SetStyleToCancel();
00077 
00078   // Description:
00079   // Set different options for the dialog.
00080   //BTX
00081   enum 
00082   {
00083     RememberYes     = 0x00002,
00084     RememberNo      = 0x00004,
00085     ErrorIcon       = 0x00008,
00086     WarningIcon     = 0x00010,
00087     QuestionIcon    = 0x00020,
00088     YesDefault      = 0x00040,
00089     NoDefault       = 0x00080,
00090     OkDefault       = 0x00100,
00091     CancelDefault   = 0x00200,
00092     Beep            = 0x00400,
00093     PackVertically  = 0x00800,
00094     InvokeAtPointer = 0x01000,
00095     CustomIcon      = 0x02000,
00096     Resizable       = 0x04000
00097   };
00098   //ETX
00099   vtkSetMacro(Options, int);
00100   vtkGetMacro(Options, int);
00101 
00102   // Description:
00103   // The label displayed on the OK button. Only used when
00104   // the style is OkCancel.
00105   vtkSetStringMacro(OKButtonText);
00106   vtkGetStringMacro(OKButtonText);
00107 
00108   // Description:
00109   // The label displayed on the cancel button. Only used when
00110   // the style is OkCancel.
00111   vtkSetStringMacro(CancelButtonText);
00112   vtkGetStringMacro(CancelButtonText);
00113 
00114   // Description:
00115   // The label displayed on the other button. Only used when
00116   // the style is OkOtherCancel.
00117   vtkSetStringMacro(OtherButtonText);
00118   vtkGetStringMacro(OtherButtonText);
00119 
00120   // Description:
00121   // Utility methods to create various dialog windows.
00122   // icon is a enumerated icon type described in vtkKWIcon.
00123   // title is a title string of the dialog. name is the dialog name
00124   // used for the registry. message is the text message displayed
00125   // in the dialog. masterwin is a pointer to a widget belonging to the window
00126   // you want this message dialog to be a child of (or the window directly).
00127   static void PopupMessage(vtkKWApplication *app, 
00128                            vtkKWWidget *masterWin,
00129                            const char* title, 
00130                            const char* message, int options = 0);
00131   static int PopupYesNo(vtkKWApplication *app,  
00132                         vtkKWWidget *masterWin,
00133                         const char* title, 
00134                         const char* message, int options = 0);
00135   static int PopupYesNo(vtkKWApplication *app,  
00136                         vtkKWWidget *masterWin, 
00137                         const char* name, 
00138                         const char* title, const char* message, 
00139                         int options = 0);
00140   static int PopupOkCancel(vtkKWApplication *app, 
00141                            vtkKWWidget *masterWin,
00142                            const char* title, 
00143                            const char* message, int options = 0);
00144 
00145   // Description:
00146   // Retrieve the frame where the message is.
00147   vtkGetObjectMacro(TopFrame, vtkKWFrame);
00148   vtkGetObjectMacro(MessageDialogFrame, vtkKWFrame);
00149   vtkGetObjectMacro(BottomFrame, vtkKWFrame);
00150   vtkGetObjectMacro(Icon, vtkKWLabel);
00151 
00152   // Description:
00153   // Accessor for OK and cancel button
00154   vtkGetObjectMacro(OKButton, vtkKWPushButton);
00155   vtkGetObjectMacro(CancelButton, vtkKWPushButton);
00156   vtkGetObjectMacro(OtherButton, vtkKWPushButton);
00157 
00158   // Description:
00159   // Set or get the message dialog name. This name is use to save/restore
00160   // information about this specific dialog in the registry (for example,
00161   // bypass the dialog altogether by clicking on a specific button 
00162   // automatically). 
00163   // This should not be confused with
00164   // the message dialog title that can be set using the superclass
00165   // SetTitle() method. 
00166   vtkSetStringMacro(DialogName);
00167   vtkGetStringMacro(DialogName);
00168 
00169   // Description:
00170   // Store/retrieve a message dialog response for a given application 
00171   // in/from the registry.
00172   // This can be used to prevent the user from answering the same question
00173   // again and again (for ex: "Are you sure you want to exit the application").
00174   // 'dialogname' is the name of a dialog (most likely its DialogName ivar).
00175   // The 'response' is arbitrary but most likely the value returned by a
00176   // call to Invoke() on the dialog.
00177   static int RestoreMessageDialogResponseFromRegistry(
00178     vtkKWApplication *app, const char *dialogname);
00179   static void SaveMessageDialogResponseToRegistry(
00180     vtkKWApplication *app, const char *dialogname, int response);
00181 
00182   // Description:
00183   // Display the dialog. 
00184   // Override the superclass to set up keybindings and options
00185   virtual void Display();
00186 
00187   // Description:
00188   // Dialog can be also used by performing individual steps of Invoke. These
00189   // steps are initialize: PreInvoke(), finalize: PostInvoke(), and check if
00190   // user responded IsUserDoneWithDialog(). Use this method only if you
00191   // want to bypass the event loop used in Invoke() by creating your own
00192   // and checking for IsUserDoneWithDialog().
00193   // Override the superclass to handle DialogName
00194   virtual int PreInvoke();
00195   virtual void PostInvoke();
00196 
00197   // Description::
00198   // Callback. Close this Dialog (for the third button)
00199   virtual void Other();
00200 
00201   // Description:
00202   // Set the icon on the message dialog.
00203   // Legacy. Do not call anymore. Is called automatically by Create().
00204   virtual void SetIcon();
00205 
00206 protected:
00207   vtkKWMessageDialog();
00208   ~vtkKWMessageDialog();
00209 
00210   // Description:
00211   // Create the widget.
00212   virtual void CreateWidget();
00213 
00214   int             Style;
00215   int             Default;
00216   int             Options;
00217   char            *DialogName;
00218   char            *DialogText;
00219 
00220   vtkSetStringMacro(DialogText);
00221   vtkGetStringMacro(DialogText);
00222 
00223   vtkKWFrame       *TopFrame;
00224   vtkKWFrame       *MessageDialogFrame;
00225   vtkKWFrame       *BottomFrame;
00226   vtkKWMessage     *Message;
00227   vtkKWFrame       *ButtonFrame;
00228   vtkKWPushButton  *OKButton;
00229   vtkKWPushButton  *CancelButton;  
00230   vtkKWPushButton  *OtherButton;  
00231   vtkKWLabel       *Icon;
00232   vtkKWFrame       *OKFrame;
00233   vtkKWFrame       *CancelFrame;
00234   vtkKWFrame       *OtherFrame;
00235   vtkKWCheckButton *CheckButton;
00236 
00237   // Description:
00238   // Get the value of the check box for remembering the answer from
00239   // the user.
00240   int GetRememberMessage();
00241   
00242   char* OKButtonText;
00243   char* CancelButtonText;
00244   char* OtherButtonText;
00245 
00246   // Description:
00247   // Update the buttons or message
00248   virtual void UpdateButtons();
00249   virtual void PackButtons();
00250   virtual void UpdateMessage();
00251 
00252   // Description:
00253   // Pack
00254   virtual void Pack();
00255 
00256 private:
00257   vtkKWMessageDialog(const vtkKWMessageDialog&); // Not implemented
00258   void operator=(const vtkKWMessageDialog&); // Not implemented
00259 };
00260 
00261 
00262 #endif

Generated on Sat Dec 12 16:04:54 2009 for KWWidgets by  doxygen 1.6.1