• Main Page
  • Classes
  • Files
  • Directories
  • File List
  • File Members

vtkKWFrameWithLabel.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWFrameWithLabel.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 vtkKWFrameWithLabel - a frame with a grooved border and a label
00015 // .SECTION Description
00016 // The vtkKWFrameWithLabel creates a frame with a grooved border, and a label
00017 // embedded in the upper left corner of the grooved border.
00018 
00019 
00020 #ifndef __vtkKWFrameWithLabel_h
00021 #define __vtkKWFrameWithLabel_h
00022 
00023 #include "vtkKWCompositeWidget.h"
00024 
00025 class vtkKWFrame;
00026 class vtkKWIcon;
00027 class vtkKWLabel;
00028 class vtkKWLabelWithLabel;
00029 
00030 class KWWidgets_EXPORT vtkKWFrameWithLabel : public vtkKWCompositeWidget
00031 {
00032 public:
00033   static vtkKWFrameWithLabel* New();
00034   vtkTypeRevisionMacro(vtkKWFrameWithLabel,vtkKWCompositeWidget);
00035   void PrintSelf(ostream& os, vtkIndent indent);
00036 
00037   // Description:
00038   // Set the label for the frame.
00039   void SetLabelText(const char *);
00040   
00041   // Description:
00042   // Get the internal frame.
00043   vtkGetObjectMacro(Frame, vtkKWFrame);
00044 
00045   // Description:
00046   // Get the internal frame containing the label.
00047   vtkGetObjectMacro(LabelFrame, vtkKWFrame);
00048 
00049   // Description:
00050   // Get the label (frame title).
00051   virtual vtkKWLabel *GetLabel();
00052 
00053   // Description:
00054   // Collapse/expand the frame.
00055   virtual void CollapseFrame();
00056   virtual void ExpandFrame();
00057   virtual int IsFrameCollapsed();
00058 
00059   // Description:
00060   // Set/Get if the frame can be collapsed, i.e. display a button that will
00061   // let the user collapse the frame. On by default.
00062   vtkSetMacro(AllowFrameToCollapse, int);
00063   vtkBooleanMacro(AllowFrameToCollapse, int);
00064   vtkGetMacro(AllowFrameToCollapse, int);
00065 
00066   // Description:
00067   // Globally Set/Get if the frame can be collapsed.
00068   // NOTE: this is a *static* method that defines the behaviour for *all*
00069   // instances of this class to be created afterwards. This is typically
00070   // called in your application class or your main executable, before 
00071   // creating any UI; this will ensure all instances have a consistent look.
00072   // By default it is globally enabled.
00073   static int GetDefaultAllowFrameToCollapse();
00074   static void SetDefaultAllowFrameToCollapse(int);
00075   static void DefaultAllowFrameToCollapseOn()
00076     { vtkKWFrameWithLabel::SetDefaultAllowFrameToCollapse(1); };
00077   static void DefaultAllowFrameToCollapseOff()
00078     { vtkKWFrameWithLabel::SetDefaultAllowFrameToCollapse(0); };
00079 
00080   // Description:
00081   // Globally override the case of the label to ensure GUI consistency.
00082   // This will change the label when SetLabelText() is called.
00083   // NOTE: this is a *static* method that defines the behaviour for *all*
00084   // instances of this class to be created afterwards. This is typically
00085   // called in your application class or your main executable, before 
00086   // creating any UI; this will ensure all instances have a consistent look.
00087   // Defaults to LabelCaseUppercaseFirst.
00088   //BTX
00089   enum
00090   {
00091     LabelCaseUserSpecified = 0,
00092     LabelCaseUppercaseFirst,
00093     LabelCaseLowercaseFirst
00094   };
00095   //ETX
00096   static void SetDefaultLabelCase(int v);
00097   static int GetDefaultLabelCase();
00098   static void SetDefaultLabelCaseToUserSpecified() 
00099     { vtkKWFrameWithLabel::SetDefaultLabelCase(
00100       vtkKWFrameWithLabel::LabelCaseUserSpecified);};
00101   static void SetDefaultLabelCaseToUppercaseFirst() 
00102     {vtkKWFrameWithLabel::SetDefaultLabelCase(
00103       vtkKWFrameWithLabel::LabelCaseUppercaseFirst);};
00104   static void SetDefaultLabelCaseToLowercaseFirst() 
00105     {vtkKWFrameWithLabel::SetDefaultLabelCase(
00106       vtkKWFrameWithLabel::LabelCaseLowercaseFirst);};
00107 
00108   // Description:
00109   // Globally enable or disable the font weight of the label.
00110   // NOTE: this is a *static* method that defines the behaviour for *all*
00111   // instances of this class to be created afterwards. This is typically
00112   // called in your application class or your main executable, before 
00113   // creating any UI; this will ensure all instances have a consistent look.
00114   // By default it is set to bold.
00115   //BTX
00116   enum
00117   {
00118     LabelFontWeightNormal = 0,
00119     LabelFontWeightBold
00120   };
00121   //ETX
00122   static void SetDefaultLabelFontWeight(int v);
00123   static int GetDefaultLabelFontWeight();
00124   static void SetDefaultLabelFontWeightToNormal() 
00125     { vtkKWFrameWithLabel::SetDefaultLabelFontWeight(
00126       vtkKWFrameWithLabel::LabelFontWeightNormal);};
00127   static void SetDefaultLabelFontWeightToBold() 
00128     {vtkKWFrameWithLabel::SetDefaultLabelFontWeight(
00129       vtkKWFrameWithLabel::LabelFontWeightBold);};
00130 
00131   // Description:
00132   // Set/Get the visibility of a special icon (lock) when the application
00133   // is in Limited Edition Mode and the label frame is disabled.
00134   virtual void SetLimitedEditionModeIconVisibility(int);
00135   vtkBooleanMacro(LimitedEditionModeIconVisibility, int);
00136   vtkGetMacro(LimitedEditionModeIconVisibility, int);
00137 
00138   // Description:
00139   // Set/Get if the packing options should be changed automatically when
00140   // the frame is collapsed/uncollapsed. This if OFF by default. 
00141   // WARNING: turning this option will modify the -expand attribute in the
00142   // packing options automatically. Packing is usually the responsibility of 
00143   // the user, and no widget instance would usually change its own packing
00144   // option automatically, since this could be considered pulling the rug out
00145   // from under the user's feet. However, in some very specific case (say,
00146   // when packing a vtkKWMultiColumnList), you would want the widget packed
00147   // inside the frame with label to expand automatically. This can not be
00148   // done without allowing the vtkKWFrameWithLabel instance to expand
00149   // automatically as well, which is not compatible with the "collapsed" more.
00150   // To work around this, the -expand flag of the vtkKWFrameWithLabel has
00151   // to be changed automatically back and forth each time the frame is
00152   // collapsed/uncollapsed. Turning this variable ON will take care of it.
00153   vtkSetMacro(ChangePackingOnCollapse, int);
00154   vtkBooleanMacro(ChangePackingOnCollapse, int);
00155   vtkGetMacro(ChangePackingOnCollapse, int);
00156 
00157   // Description:
00158   // Update the "enable" state of the object and its internal parts.
00159   // Depending on different Ivars (this->Enabled, the application's 
00160   // Limited Edition Mode, etc.), the "enable" state of the object is updated
00161   // and propagated to its internal parts/subwidgets. This will, for example,
00162   // enable/disable parts of the widget UI, enable/disable the visibility
00163   // of 3D widgets, etc.
00164   virtual void UpdateEnableState();
00165 
00166   // Description:
00167   // Get the drag and drop framework.
00168   // Override the superclass to allow the frame to be dragged using
00169   // the label.
00170   virtual vtkKWDragAndDropTargetSet* GetDragAndDropTargetSet();
00171 
00172   // Description:
00173   // Override parent's SetWidth/SetHeight to propagate to internal frames.
00174   // A frame's size can be set explicitly, until something else is packed
00175   // inside.
00176   virtual void SetWidth(int);
00177   virtual int GetWidth();
00178   virtual void SetHeight(int);
00179   virtual int GetHeight();
00180 
00181   // Description:
00182   // Get the internal frame responsible for drawing the collapsible border.
00183   vtkGetObjectMacro(CollapsibleFrame, vtkKWFrame);
00184 
00185   // Description:
00186   // Callbacks. Internal, do not use.
00187   virtual void AdjustMarginCallback();
00188   virtual void CollapseButtonCallback();
00189   virtual void LabelDoubleClickCallback();
00190 
00191 protected:
00192   vtkKWFrameWithLabel();
00193   ~vtkKWFrameWithLabel();
00194 
00195   // Description:
00196   // Create the widget.
00197   virtual void CreateWidget();
00198 
00199   vtkKWFrame          *Frame;
00200   vtkKWFrame          *LabelFrame;
00201   vtkKWLabelWithLabel *Label;
00202   vtkKWFrame          *ExternalMarginFrame;
00203   vtkKWFrame          *InternalMarginFrame;
00204   vtkKWFrame          *CollapsibleFrame;
00205   vtkKWLabel          *Icon;
00206   vtkKWIcon           *IconData;
00207 
00208   int AllowFrameToCollapse;
00209   int ChangePackingOnCollapse;
00210   int LimitedEditionModeIconVisibility;
00211 
00212   static int DefaultAllowFrameToCollapse;
00213   static int DefaultLabelFontWeight;
00214   static int DefaultLabelCase;
00215 
00216   virtual vtkKWLabel *GetLabelIcon();
00217 
00218 private:
00219   vtkKWFrameWithLabel(const vtkKWFrameWithLabel&); // Not implemented
00220   void operator=(const vtkKWFrameWithLabel&); // Not implemented
00221 };
00222 
00223 #endif
00224 

Generated on Mon Aug 16 2010 18:58:44 for KWWidgets by  doxygen 1.7.1