KWWidgets
debian/tmp/usr/include/KWWidgets/vtkKWSplitFrame.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWSplitFrame.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 vtkKWSplitFrame - A Frame that contains two adjustable sub frames.
15 // .SECTION Description
16 // The split frame allows the use to select the size of the two frames.
17 // It uses a separator that can be dragged interactively.
18 
19 
20 #ifndef __vtkKWSplitFrame_h
21 #define __vtkKWSplitFrame_h
22 
23 #include "vtkKWCompositeWidget.h"
24 
25 class vtkKWFrame;
26 class vtkKWPushButton;
27 
29 {
30 public:
31  static vtkKWSplitFrame* New();
32  vtkTypeRevisionMacro(vtkKWSplitFrame,vtkKWCompositeWidget);
33  void PrintSelf(ostream& os, vtkIndent indent);
34 
35  // Description:
36  // Get Frame1. In horizontal orientation, this is the one on the left of the
37  // separator. In vertical orientation, the one at the bottom.
38  // Both Frame1 and Frame2 position can be swapped using the SetFrameLayout
39  // method.
40  vtkKWFrame *GetFrame1() {return this->Frame1;};
41 
42  // Description:
43  // Get Frame2. In horizontal orientation, this is the one on the right of the
44  // separator. In vertical orientation, the one at the top.
45  // Both Frame1 and Frame2 position can be swapped using the SetFrameLayout
46  // method.
47  vtkKWFrame *GetFrame2() {return this->Frame2;};
48 
49  // Description:
50  // Set/Get the orientation of the split frame.
51  // If horizontal, Frame1 is on the left of the separator, Frame2 on the
52  // right. If Vertical, Frame1 is below the separator, Frame2 is on top.
53  // Both Frame1 and Frame2 position can be swapped using the SetFrameLayout
54  // method.
55  //BTX
56  enum
57  {
58  OrientationHorizontal = 0,
59  OrientationVertical
60  };
61  //ETX
62  virtual void SetOrientation(int);
63  vtkGetMacro(Orientation, int);
64  virtual void SetOrientationToHorizontal()
65  { this->SetOrientation(vtkKWSplitFrame::OrientationHorizontal); };
66  virtual void SetOrientationToVertical()
67  { this->SetOrientation(vtkKWSplitFrame::OrientationVertical); };
68 
69  // Description:
70  // Set/Get the frame layout.
71  // If set to Default, depending on the orientation, Frame1 is on the left
72  // (respectively bottom) of the separator, Frame2 on the right (top).
73  // If set to Swapped, Frame1 and Frame2 position are exchanged.
74  //BTX
75  enum
76  {
77  FrameLayoutDefault = 0,
78  FrameLayoutSwapped
79  };
80  //ETX
81  virtual void SetFrameLayout(int);
82  vtkGetMacro(FrameLayout, int);
83  virtual void SetFrameLayoutToDefault()
84  { this->SetFrameLayout(vtkKWSplitFrame::FrameLayoutDefault); };
85  virtual void SetFrameLayoutToSwapped()
86  { this->SetFrameLayout(vtkKWSplitFrame::FrameLayoutSwapped); };
87 
88  // Description:
89  // Set/Get which frame is automatically expanded when the whole widget
90  // is resized. By default, Frame2 (i.e. right or top frame)
91  //BTX
92  enum
93  {
94  ExpandableFrame1 = 0,
96  ExpandableFrameBoth
97  };
98  //ETX
99  vtkSetClampMacro(ExpandableFrame, int,
102  vtkGetMacro(ExpandableFrame, int);
103  virtual void SetExpandableFrameToFrame1()
104  { this->SetExpandableFrame(vtkKWSplitFrame::ExpandableFrame1); };
105  virtual void SetExpandableFrameToFrame2()
106  { this->SetExpandableFrame(vtkKWSplitFrame::ExpandableFrame2); };
107  virtual void SetExpandableFrameToBothFrames()
108  { this->SetExpandableFrame(vtkKWSplitFrame::ExpandableFrameBoth); };
109 
110  // Description:
111  // Set/Get The minimum size, size and visibility of Frame1.
112  vtkGetMacro(Frame1MinimumSize, int);
113  virtual void SetFrame1MinimumSize(int minSize);
114  vtkGetMacro(Frame1Size, int);
115  virtual void SetFrame1Size(int size);
116  vtkGetMacro(Frame1Visibility, int);
117  virtual void SetFrame1Visibility(int flag);
118  vtkBooleanMacro(Frame1Visibility, int);
119 
120  // Description:
121  // Set/Get The minimum size, size and visibility of Frame2.
122  vtkGetMacro(Frame2MinimumSize, int);
123  virtual void SetFrame2MinimumSize(int minSize);
124  vtkGetMacro(Frame2Size, int);
125  virtual void SetFrame2Size(int size);
126  vtkGetMacro(Frame2Visibility, int);
127  virtual void SetFrame2Visibility(int flag);
128  vtkBooleanMacro(Frame2Visibility, int);
129 
130  // Description:
131  // Set the size of both frames by setting the relative position of the
132  // separator. This will not work until the widget has been mapped on screen.
133  virtual void SetSeparatorPosition(double pos);
134  virtual double GetSeparatorPosition();
135 
136  // Description:
137  // Set/Get the separator narrow dimension.
138  // If the size is 0, then the two frames cannot be adjusted by the user.
139  virtual void SetSeparatorSize(int size);
140  vtkGetMacro(SeparatorSize, int);
141 
142  // Description:
143  // Set/Get the separator narrow margin, i.e. the empty space around the
144  // separator itself.
145  virtual void SetSeparatorMargin(int size);
146  vtkGetMacro(SeparatorMargin, int);
147 
148  // Description:
149  // Set/Get the visibility of the separator.
150  virtual void SetSeparatorVisibility(int flag);
151  vtkGetMacro(SeparatorVisibility, int);
152  vtkBooleanMacro(SeparatorVisibility, int);
153 
154  // Description:
155  // Update the "enable" state of the object and its internal parts.
156  // Depending on different Ivars (this->Enabled, the application's
157  // Limited Edition Mode, etc.), the "enable" state of the object is updated
158  // and propagated to its internal parts/subwidgets. This will, for example,
159  // enable/disable parts of the widget UI, enable/disable the visibility
160  // of 3D widgets, etc.
161  virtual void UpdateEnableState();
162 
163  // Description:
164  // Callbacks. Internal, do not use.
165  virtual void DragCallback();
166  virtual void ConfigureCallback();
167  virtual void Expand1ButtonCallback();
168  virtual void Expand2ButtonCallback();
169 
170  // Description:
171  // Events. Frame1VisibilityChangedEvent (respectively
172  // Frame2VisibilityChangedEvent) is invoked when the visibility
173  // status of frame 1 (respectively frame 2) is changed.
174  // FrameVisibilityChangedEvent in both cases.
175  //BTX
176  enum
177  {
178  FrameVisibilityChangedEvent = 10000,
180  Frame2VisibilityChangedEvent
181  };
182  //ETX
183 
184 protected:
185  vtkKWSplitFrame();
186  ~vtkKWSplitFrame();
187 
188  // Description:
189  // Create the widget.
190  virtual void CreateWidget();
191 
192  virtual int GetTotalSeparatorSize();
193  virtual void UpdateExpandButtonsEnableState();
194 
197 
202 
203  int Size;
206 
210 
213 
216 
220 
221  // Reset the actual windows to match our size IVars.
222 
223  virtual void Pack();
224  virtual void AddBindings();
225  virtual void RemoveBindings();
226  virtual void AddSeparatorBindings();
227  virtual void RemoveSeparatorBindings();
228  virtual void ReConfigure();
229  virtual int GetInternalMarginHorizontal();
230  virtual int GetInternalMarginVertical();
231  virtual void ConfigureSeparator();
232  virtual void ConfigureExpandButtons();
233 
234 private:
235  vtkKWSplitFrame(const vtkKWSplitFrame&); // Not implemented
236  void operator=(const vtkKWSplitFrame&); // Not implemented
237 };
238 
239 
240 #endif
241 
242 
243