KWWidgets
debian/tmp/usr/include/KWWidgets/vtkKWFrameWithLabel.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWFrameWithLabel.h,v $
4 
5  Copyright (c) Kitware, Inc.
6  All rights reserved.
7  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 // .NAME vtkKWFrameWithLabel - a frame with a grooved border and a label
15 // .SECTION Description
16 // The vtkKWFrameWithLabel creates a frame with a grooved border, and a label
17 // embedded in the upper left corner of the grooved border.
18 
19 
20 #ifndef __vtkKWFrameWithLabel_h
21 #define __vtkKWFrameWithLabel_h
22 
23 #include "vtkKWCompositeWidget.h"
24 
25 class vtkKWFrame;
26 class vtkKWIcon;
27 class vtkKWLabel;
29 
31 {
32 public:
33  static vtkKWFrameWithLabel* New();
35  void PrintSelf(ostream& os, vtkIndent indent);
36 
37  // Description:
38  // Set the label for the frame.
39  void SetLabelText(const char *);
40 
41  // Description:
42  // Get the internal frame.
43  vtkGetObjectMacro(Frame, vtkKWFrame);
44 
45  // Description:
46  // Get the internal frame containing the label.
47  vtkGetObjectMacro(LabelFrame, vtkKWFrame);
48 
49  // Description:
50  // Get the label (frame title).
51  virtual vtkKWLabel *GetLabel();
52 
53  // Description:
54  // Collapse/expand the frame.
55  virtual void CollapseFrame();
56  virtual void ExpandFrame();
57  virtual int IsFrameCollapsed();
58 
59  // Description:
60  // Set/Get if the frame can be collapsed, i.e. display a button that will
61  // let the user collapse the frame. On by default.
62  vtkSetMacro(AllowFrameToCollapse, int);
63  vtkBooleanMacro(AllowFrameToCollapse, int);
64  vtkGetMacro(AllowFrameToCollapse, int);
65 
66  // Description:
67  // Globally Set/Get if the frame can be collapsed.
68  // NOTE: this is a *static* method that defines the behaviour for *all*
69  // instances of this class to be created afterwards. This is typically
70  // called in your application class or your main executable, before
71  // creating any UI; this will ensure all instances have a consistent look.
72  // By default it is globally enabled.
73  static int GetDefaultAllowFrameToCollapse();
74  static void SetDefaultAllowFrameToCollapse(int);
75  static void DefaultAllowFrameToCollapseOn()
77  static void DefaultAllowFrameToCollapseOff()
79 
80  // Description:
81  // Globally override the case of the label to ensure GUI consistency.
82  // This will change the label when SetLabelText() is called.
83  // NOTE: this is a *static* method that defines the behaviour for *all*
84  // instances of this class to be created afterwards. This is typically
85  // called in your application class or your main executable, before
86  // creating any UI; this will ensure all instances have a consistent look.
87  // Defaults to LabelCaseUppercaseFirst.
88  //BTX
89  enum
90  {
91  LabelCaseUserSpecified = 0,
93  LabelCaseLowercaseFirst
94  };
95  //ETX
96  static void SetDefaultLabelCase(int v);
97  static int GetDefaultLabelCase();
98  static void SetDefaultLabelCaseToUserSpecified()
101  static void SetDefaultLabelCaseToUppercaseFirst()
104  static void SetDefaultLabelCaseToLowercaseFirst()
107 
108  // Description:
109  // Globally enable or disable the font weight of the label.
110  // NOTE: this is a *static* method that defines the behaviour for *all*
111  // instances of this class to be created afterwards. This is typically
112  // called in your application class or your main executable, before
113  // creating any UI; this will ensure all instances have a consistent look.
114  // By default it is set to bold.
115  //BTX
116  enum
117  {
118  LabelFontWeightNormal = 0,
119  LabelFontWeightBold
120  };
121  //ETX
122  static void SetDefaultLabelFontWeight(int v);
123  static int GetDefaultLabelFontWeight();
124  static void SetDefaultLabelFontWeightToNormal()
127  static void SetDefaultLabelFontWeightToBold()
130 
131  // Description:
132  // Set/Get the visibility of a special icon (lock) when the application
133  // is in Limited Edition Mode and the label frame is disabled.
134  virtual void SetLimitedEditionModeIconVisibility(int);
135  vtkBooleanMacro(LimitedEditionModeIconVisibility, int);
136  vtkGetMacro(LimitedEditionModeIconVisibility, int);
137 
138  // Description:
139  // Set/Get if the packing options should be changed automatically when
140  // the frame is collapsed/uncollapsed. This if OFF by default.
141  // WARNING: turning this option will modify the -expand attribute in the
142  // packing options automatically. Packing is usually the responsibility of
143  // the user, and no widget instance would usually change its own packing
144  // option automatically, since this could be considered pulling the rug out
145  // from under the user's feet. However, in some very specific case (say,
146  // when packing a vtkKWMultiColumnList), you would want the widget packed
147  // inside the frame with label to expand automatically. This can not be
148  // done without allowing the vtkKWFrameWithLabel instance to expand
149  // automatically as well, which is not compatible with the "collapsed" more.
150  // To work around this, the -expand flag of the vtkKWFrameWithLabel has
151  // to be changed automatically back and forth each time the frame is
152  // collapsed/uncollapsed. Turning this variable ON will take care of it.
153  vtkSetMacro(ChangePackingOnCollapse, int);
154  vtkBooleanMacro(ChangePackingOnCollapse, int);
155  vtkGetMacro(ChangePackingOnCollapse, int);
156 
157  // Description:
158  // Update the "enable" state of the object and its internal parts.
159  // Depending on different Ivars (this->Enabled, the application's
160  // Limited Edition Mode, etc.), the "enable" state of the object is updated
161  // and propagated to its internal parts/subwidgets. This will, for example,
162  // enable/disable parts of the widget UI, enable/disable the visibility
163  // of 3D widgets, etc.
164  virtual void UpdateEnableState();
165 
166  // Description:
167  // Get the drag and drop framework.
168  // Override the superclass to allow the frame to be dragged using
169  // the label.
171 
172  // Description:
173  // Override parent's SetWidth/SetHeight to propagate to internal frames.
174  // A frame's size can be set explicitly, until something else is packed
175  // inside.
176  virtual void SetWidth(int);
177  virtual int GetWidth();
178  virtual void SetHeight(int);
179  virtual int GetHeight();
180 
181  // Description:
182  // Get the internal frame responsible for drawing the collapsible border.
183  vtkGetObjectMacro(CollapsibleFrame, vtkKWFrame);
184 
185  // Description:
186  // Callbacks. Internal, do not use.
187  virtual void AdjustMarginCallback();
188  virtual void CollapseButtonCallback();
189  virtual void LabelDoubleClickCallback();
190 
191 protected:
194 
195  // Description:
196  // Create the widget.
197  virtual void CreateWidget();
198 
207 
211 
214  static int DefaultLabelCase;
215 
216  virtual vtkKWLabel *GetLabelIcon();
217 
218 private:
219  vtkKWFrameWithLabel(const vtkKWFrameWithLabel&); // Not implemented
220  void operator=(const vtkKWFrameWithLabel&); // Not implemented
221 };
222 
223 #endif
224