KWWidgets
debian/tmp/usr/include/KWWidgets/vtkKWSpinButtons.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWSpinButtons.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 vtkKWSpinButtons - A set of spin-buttons.
00015 // .SECTION Description
00016 // This widget implements a small set of two buttons that can be used
00017 // to switch to the next or previous value of an external variable through
00018 // callbacks.
00019 // The buttons can be set to display up/down or left/right arrows, and laid
00020 // out vertically or horizontally.
00021 // The 'previous' button is mapped to the up/left arrow, the 'next' button
00022 // is mapped to the 'down/right' arrow.
00023 // .SECTION Thanks
00024 // This work is part of the National Alliance for Medical Image
00025 // Computing (NAMIC), funded by the National Institutes of Health
00026 // through the NIH Roadmap for Medical Research, Grant U54 EB005149.
00027 // Information on the National Centers for Biomedical Computing
00028 // can be obtained from http://nihroadmap.nih.gov/bioinformatics.
00029 
00030 #ifndef __vtkKWSpinButtons_h
00031 #define __vtkKWSpinButtons_h
00032 
00033 #include "vtkKWCompositeWidget.h"
00034 
00035 class vtkKWPushButton;
00036 
00037 class KWWidgets_EXPORT vtkKWSpinButtons : public vtkKWCompositeWidget
00038 {
00039 public:
00040   static vtkKWSpinButtons* New();
00041   vtkTypeRevisionMacro(vtkKWSpinButtons,vtkKWCompositeWidget);
00042   void PrintSelf(ostream& os, vtkIndent indent);
00043 
00044   // Description:
00045   // Get the buttons
00046   vtkGetObjectMacro(PreviousButton, vtkKWPushButton);
00047   vtkGetObjectMacro(NextButton, vtkKWPushButton);
00048 
00049   // Description:
00050   // Specifies the commands to associate to the next and previous 
00051   // buttons.
00052   // The 'object' argument is the object that will have the method called on
00053   // it. The 'method' argument is the name of the method to be called and any
00054   // arguments in string form. If the object is NULL, the method is still
00055   // evaluated as a simple command. 
00056   virtual void SetPreviousCommand(vtkObject *object, const char *method);
00057   virtual void SetNextCommand(vtkObject *object, const char *method);
00058 
00059   // Description:
00060   // Set/Get the arrow orientation of the spin buttons.
00061   // If set to horizontal, left/right arrows will be used. If set to
00062   // vertical, up/down arrows will be used.
00063   //BTX
00064   enum 
00065   {
00066     ArrowOrientationHorizontal = 0,
00067     ArrowOrientationVertical
00068   };
00069   //ETX
00070   virtual void SetArrowOrientation(int);
00071   vtkGetMacro(ArrowOrientation, int);
00072   virtual void SetArrowOrientationToHorizontal()
00073     { this->SetArrowOrientation(
00074       vtkKWSpinButtons::ArrowOrientationHorizontal); };
00075   virtual void SetArrowOrientationToVertical()
00076     { this->SetArrowOrientation(
00077       vtkKWSpinButtons::ArrowOrientationVertical); };
00078 
00079   // Description:
00080   // Set/Get the layout of the spin buttons.
00081   // If set to horizontal, the 'previous' button is packed to the 
00082   // left of the 'next' button. If set to vertical, the 'previous' button
00083   // is packed on top of the 'next' button.
00084   //BTX
00085   enum 
00086   {
00087     LayoutOrientationHorizontal = 0,
00088     LayoutOrientationVertical
00089   };
00090   //ETX
00091   virtual void SetLayoutOrientation(int);
00092   vtkGetMacro(LayoutOrientation, int);
00093   virtual void SetLayoutOrientationToHorizontal()
00094     { this->SetLayoutOrientation(
00095       vtkKWSpinButtons::LayoutOrientationHorizontal); };
00096   virtual void SetLayoutOrientationToVertical()
00097     { this->SetLayoutOrientation(
00098       vtkKWSpinButtons::LayoutOrientationVertical); };
00099 
00100   // Description:
00101   // Set/Get the padding that will be applied around each buttons.
00102   // (default to 0).
00103   virtual void SetButtonsPadX(int);
00104   vtkGetMacro(ButtonsPadX, int);
00105   virtual void SetButtonsPadY(int);
00106   vtkGetMacro(ButtonsPadY, int);
00107 
00108   // Description:
00109   // Set the buttons width/height.
00110   // No effects if called before Create()
00111   virtual void SetButtonsWidth(int w);
00112   virtual int GetButtonsWidth();
00113   virtual void SetButtonsHeight(int h);
00114   virtual int GetButtonsHeight();
00115 
00116   // Description:
00117   // Update the "enable" state of the object and its internal parts.
00118   // Depending on different Ivars (this->Enabled, the application's 
00119   // Limited Edition Mode, etc.), the "enable" state of the object is updated
00120   // and propagated to its internal parts/subwidgets. This will, for example,
00121   // enable/disable parts of the widget UI, enable/disable the visibility
00122   // of 3D widgets, etc.
00123   virtual void UpdateEnableState();
00124 
00125 protected:
00126   vtkKWSpinButtons();
00127   ~vtkKWSpinButtons();
00128 
00129   // Description:
00130   // Create the widget.
00131   virtual void CreateWidget();
00132   
00133   vtkKWPushButton *PreviousButton;
00134   vtkKWPushButton *NextButton;
00135 
00136   int ArrowOrientation;
00137   int LayoutOrientation;
00138 
00139   int ButtonsPadX;
00140   int ButtonsPadY;
00141 
00142   virtual void Pack();
00143   virtual void UpdateArrowOrientation();
00144 
00145 private:
00146   vtkKWSpinButtons(const vtkKWSpinButtons&); // Not implemented
00147   void operator=(const vtkKWSpinButtons&); // Not implemented
00148 };
00149 
00150 
00151 #endif
00152 
00153 
00154