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

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWTopLevel.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 vtkKWTopLevel - toplevel superclass
00015 // .SECTION Description
00016 // A generic superclass for toplevel.
00017 
00018 #ifndef __vtkKWTopLevel_h
00019 #define __vtkKWTopLevel_h
00020 
00021 #include "vtkKWCoreWidget.h"
00022 
00023 class vtkKWMenu;
00024 class vtkKWTclInteractor;
00025 
00026 class KWWidgets_EXPORT vtkKWTopLevel : public vtkKWCoreWidget
00027 {
00028 public:
00029   static vtkKWTopLevel* New();
00030   vtkTypeRevisionMacro(vtkKWTopLevel,vtkKWCoreWidget);
00031   void PrintSelf(ostream& os, vtkIndent indent);
00032 
00033   // Description:
00034   // Class of the window. Used to group several windows under the same class
00035   // (they will, for example, de-iconify together).
00036   // Make sure you set it before a call to Create().
00037   vtkSetStringMacro(WindowClass);
00038   vtkGetStringMacro(WindowClass);
00039 
00040   // Description:
00041   // Set the widget/window to which this toplevel will be slave.
00042   // If set, this toplevel will always be on top of the master
00043   // window and will minimize with it (assuming that the windowing
00044   // system supports this).
00045   // For convenience purposes, the MasterWindow does not have to be a
00046   // toplevel, it can be a plain widget (its toplevel will be found
00047   // at runtime).
00048   // Has to be called before Create().
00049   virtual void SetMasterWindow(vtkKWWidget* win);
00050   vtkGetObjectMacro(MasterWindow, vtkKWWidget);
00051 
00052   // Description:
00053   // Get the application instance for this object.
00054   // Override the superclass to try to retrieve the masterwindow's application
00055   // if it was not set already.
00056   virtual vtkKWApplication* GetApplication();
00057 
00058   // Description:
00059   // Display the toplevel. Hide it with the Withdraw() method.
00060   // This also call DeIconify(), Focus() and Raise()
00061   virtual void Display();
00062 
00063   // Description:
00064   // Arranges for window to be withdrawn from the screen. This causes the
00065   // window to be unmapped and forgotten about by the window manager.
00066   virtual void Withdraw();
00067 
00068   // Description:
00069   // Inform the window manager that this toplevel should be modal.
00070   // If it is set, Display() will bring up the toplevel and grab it.
00071   // Withdraw() will bring down the toplevel, and release the grab.
00072   vtkSetClampMacro(Modal, int, 0, 1);
00073   vtkBooleanMacro(Modal, int);
00074   vtkGetMacro(Modal, int);
00075 
00076   // Description:
00077   // Set/Get the background color of the widget.
00078   virtual void GetBackgroundColor(double *r, double *g, double *b);
00079   virtual double* GetBackgroundColor();
00080   virtual void SetBackgroundColor(double r, double g, double b);
00081   virtual void SetBackgroundColor(double rgb[3])
00082     { this->SetBackgroundColor(rgb[0], rgb[1], rgb[2]); };
00083   
00084   // Description:
00085   // Set/Get the border width, a non-negative value indicating the width of
00086   // the 3-D border to draw around the outside of the widget (if such a border
00087   // is being drawn; the Relief option typically determines this).
00088   virtual void SetBorderWidth(int);
00089   virtual int GetBorderWidth();
00090   
00091   // Description:
00092   // Set/Get the highlight thickness, a non-negative value indicating the
00093   // width of the highlight rectangle to draw around the outside of the
00094   // widget when it has the input focus.
00095   virtual void SetHighlightThickness(int);
00096   virtual int GetHighlightThickness();
00097   
00098   // Description:
00099   // Set/Get the 3-D effect desired for the widget. 
00100   // The value indicates how the interior of the widget should appear
00101   // relative to its exterior. 
00102   // Valid constants can be found in vtkKWOptions::ReliefType.
00103   virtual void SetRelief(int);
00104   virtual int GetRelief();
00105   virtual void SetReliefToRaised();
00106   virtual void SetReliefToSunken();
00107   virtual void SetReliefToFlat();
00108   virtual void SetReliefToRidge();
00109   virtual void SetReliefToSolid();
00110   virtual void SetReliefToGroove();
00111 
00112   // Description:
00113   // Set/Get the padding that will be applied around each widget (in pixels).
00114   // Specifies a non-negative value indicating how much extra space to request
00115   // for the widget in the X and Y-direction. When computing how large a
00116   // window it needs, the widget will add this amount to the width it would
00117   // normally need (as determined by the width of the things displayed
00118   // in the widget); if the geometry manager can satisfy this request, the 
00119   // widget will end up with extra internal space around what it displays 
00120   // inside. 
00121   virtual void SetPadX(int);
00122   virtual int GetPadX();
00123   virtual void SetPadY(int);
00124   virtual int GetPadY();
00125 
00126   // Description:
00127   // Set/Get the position this toplevel should be centered at when Display()
00128   // is called. The default setting, Default, is to not set/change the
00129   // position at all and let the user or the window manager place the toplevel.
00130   // If set to MasterWindowCenter, the toplevel is centered inside its master 
00131   // window ; if  the MasterWindow ivar is not set, it is centered on the
00132   // screen, which is similar to the ScreenCenter setting. If set to 
00133   // Pointer, the toplevel is centered at the current mouse position.
00134   // On some sytem, the default setting can lead the window manager to
00135   // place the window at the upper left corner (0, 0) the first time it
00136   // is displayed. Since this can be fairly annoying, the 
00137   // MasterWindowCenterFirst and ScreenCenterFirst can be used to center
00138   // the toplevel relative to the master window or the screen only the
00139   // first time it is displayed (after that, the toplevel will be displayed
00140   // wherever it was left).
00141   //BTX
00142   enum
00143   {
00144     DisplayPositionDefault                 = 0,
00145     DisplayPositionMasterWindowCenter      = 1,
00146     DisplayPositionMasterWindowCenterFirst = 2,
00147     DisplayPositionScreenCenter            = 3,
00148     DisplayPositionScreenCenterFirst       = 4,
00149     DisplayPositionPointer                 = 5
00150   };
00151   //ETX
00152   vtkSetClampMacro(DisplayPosition, int, 
00153                    vtkKWTopLevel::DisplayPositionDefault, 
00154                    vtkKWTopLevel::DisplayPositionPointer);
00155   vtkGetMacro(DisplayPosition, int);
00156   virtual void SetDisplayPositionToDefault() 
00157     { this->SetDisplayPosition(
00158       vtkKWTopLevel::DisplayPositionDefault); };
00159   virtual void SetDisplayPositionToMasterWindowCenter() 
00160     { this->SetDisplayPosition(
00161       vtkKWTopLevel::DisplayPositionMasterWindowCenter); };
00162   virtual void SetDisplayPositionToMasterWindowCenterFirst() 
00163     { this->SetDisplayPosition(
00164       vtkKWTopLevel::DisplayPositionMasterWindowCenterFirst); };
00165   virtual void SetDisplayPositionToScreenCenter() 
00166     { this->SetDisplayPosition(
00167       vtkKWTopLevel::DisplayPositionScreenCenter); };
00168   virtual void SetDisplayPositionToScreenCenterFirst() 
00169     { this->SetDisplayPosition(
00170       vtkKWTopLevel::DisplayPositionScreenCenterFirst); };
00171   virtual void SetDisplayPositionToPointer() 
00172     { this->SetDisplayPosition(
00173       vtkKWTopLevel::DisplayPositionPointer); };
00174 
00175   // Description:
00176   // Arrange for the toplevel to be displayed in normal (non-iconified) form.
00177   // This is done by mapping the window.
00178   virtual void DeIconify();
00179 
00180   // Description:
00181   // Set the title of the toplevel.
00182   virtual void SetTitle(const char *);
00183   vtkGetStringMacro(Title);
00184 
00185   // Description:
00186   // Set the title to the same title as another widget's toplevel.
00187   virtual void SetTitleToTopLevelTitle(vtkKWWidget*);
00188 
00189   // Description:
00190   // Set/Get the window position in screen pixel coordinates. No effect if
00191   // called before Create()
00192   // Return 1 on success, 0 otherwise.
00193   virtual int SetPosition(int x, int y);
00194   virtual int GetPosition(int *x, int *y);
00195 
00196   // Description:
00197   // Set/Get the window size in pixels.  No effect if called before Create()
00198   // This will in turn call GetWidget() and GetHeight()
00199   // Return 1 on success, 0 otherwise.
00200   virtual int SetSize(int w, int h);
00201   virtual int GetSize(int *w, int *h);
00202 
00203   // Description:
00204   // Get the width/height of the toplevel.
00205   virtual int GetWidth();
00206   virtual int GetHeight();
00207 
00208   // Description:
00209   // Set/Get the minimum window size. 
00210   // For gridded windows the dimensions are specified in grid units; 
00211   // otherwise they are specified in pixel units. The window manager will
00212   // restrict the window's dimensions to be greater than or equal to width
00213   // and height.
00214   // No effect if called before Create()
00215   // Return 1 on success, 0 otherwise.
00216   virtual int SetMinimumSize(int w, int h);
00217   virtual int GetMinimumSize(int *w, int *h);
00218 
00219   // Description:
00220   // Set/Get the window size and position in screen pixel
00221   // coordinates as a geometry format wxh+x+y (ex: 800x700+20+50). 
00222   // No effect if called before Create()
00223   // SetGeometry will return 1 on success, 0 otherwise.
00224   // GetGeometry will return the geometry in a temporary buffer on success
00225   // (copy the value to another string buffer as soon as possible), or NULL
00226   // otherwise
00227   virtual int SetGeometry(const char *);
00228   virtual const char* GetGeometry();
00229 
00230   // Description:
00231   // Arranges for window to be maximized.
00232   // Windows only.
00233   virtual void Maximize();
00234 
00235   // Description:
00236   // Set/Get if the toplevel should be displayed without decorations (i.e.
00237   // ignored by the window manager). Default to 0. If not decorated, the
00238   // toplevel will usually be displayed without a title bar, resizing handles,
00239   // etc.
00240   virtual void SetHideDecoration(int);
00241   vtkGetMacro(HideDecoration, int);
00242   vtkBooleanMacro(HideDecoration, int);
00243 
00244   // Description:
00245   // Get the menu associated to this toplevel.
00246   // Note that this menu is created on the fly to lower the footprint
00247   // of this object. 
00248   vtkKWMenu *GetMenu();
00249 
00250   // Description:
00251   // Specifies a command to associate with the widget. This command is 
00252   // typically invoked when the user closes the window using the
00253   // window manager.
00254   // The 'object' argument is the object that will have the method called on
00255   // it. The 'method' argument is the name of the method to be called and any
00256   // arguments in string form. If the object is NULL, the method is still
00257   // evaluated as a simple command. 
00258   virtual void SetDeleteWindowProtocolCommand(
00259     vtkObject *object, const char *method);
00260 
00261   // Description:
00262   // Set the name inside the icon associated to this window/toplevel.
00263   virtual void SetIconName(const char *name);
00264 
00265   // Description:
00266   // Set whether or not the user may interactively resize the toplevel window.
00267   // The parameters are boolean values that determine whether the width and
00268   // height of the window may be modified by the user.
00269   // No effect if called before Create()
00270   virtual void SetResizable(int w, int h);
00271 
00272   // Description:
00273   // Get/display the tcl interactor.
00274   // Kept for compatibility purposes, use vtkKWApplication instead.
00275   virtual vtkKWTclInteractor* GetTclInteractor();
00276   virtual void DisplayTclInteractor();
00277   
00278   // Description:
00279   // Update the "enable" state of the object and its internal parts.
00280   // Depending on different Ivars (this->Enabled, the application's 
00281   // Limited Edition Mode, etc.), the "enable" state of the object is updated
00282   // and propagated to its internal parts/subwidgets. This will, for example,
00283   // enable/disable parts of the widget UI, enable/disable the visibility
00284   // of 3D widgets, etc.
00285   virtual void UpdateEnableState();
00286 
00287   // Description:
00288   // Events. 
00289   // WithdrawEvent is called when the toplevel has been withdrawn, as a result
00290   // of calling the Withdraw() method. DisplayEvent is called when the 
00291   // toplevel has been displayed by calling the Display() method.
00292   //BTX
00293   enum
00294   {
00295     DisplayEvent = 5500,
00296     WithdrawEvent
00297   };
00298   //ETX
00299 
00300 protected:
00301   vtkKWTopLevel();
00302   ~vtkKWTopLevel();
00303 
00304   // Description:
00305   // Create the widget.
00306   // Make sure WindowClass is set before calling this method (if needed).
00307   // If MasterWindow is set and is a vtkKWTopLevel, its class will be used
00308   // to set our own WindowClass.
00309   // Withdraw() is called at the end of the creation.
00310   virtual void CreateWidget();
00311 
00312   vtkKWWidget *MasterWindow;
00313   vtkKWMenu   *Menu;
00314 
00315   char *Title;
00316   char *WindowClass;
00317 
00318   int HideDecoration;
00319   int Modal;
00320   int DisplayPosition;
00321 
00322   // Description:
00323   // Get the width/height of the toplevel as requested
00324   // by the window manager. Not exposed in public since it is so Tk
00325   // related. Is is usually used to get the geometry of a window before
00326   // it is mapped to screen, as requested by the geometry manager.
00327   virtual int GetRequestedWidth();
00328   virtual int GetRequestedHeight();
00329 
00330   // Description:
00331   // Compute the display position (centered or at pointer)
00332   // Return 1 on success, 0 otherwise
00333   virtual int ComputeDisplayPosition(int *x, int *y);
00334 
00335   // Description:
00336   // Setup transient, protocol, title and other settings right after
00337   // the widget has been created. This can be used by subclass that
00338   // really need to create the toplevel manually, but want to have
00339   // the ivar setup properly
00340   virtual void PostCreate();
00341 
00342 private:
00343   vtkKWTopLevel(const vtkKWTopLevel&); // Not implemented
00344   void operator=(const vtkKWTopLevel&); // Not Implemented
00345 };
00346 
00347 #endif

Generated by  doxygen 1.6.2