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