/usr/include/KWWidgets/vtkKWScaleWithEntry.h is in libkwwidgets1-dev 1.0.0~cvs20100930-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | /*=========================================================================
Module: $RCSfile: vtkKWScaleWithEntry.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 vtkKWScaleWithEntry - a scale widget with a label and entry
// .SECTION Description
// A widget that represents a more complex scale (or slider) with options for
// positioning a label, displaying an entry, working in popup mode, etc.
// For a more lightweight widget, check vtkKWScale.
// The label position and visibility can be changed through the
// vtkKWWidgetWithLabel superclass methods (see SetLabelPosition).
// The default position for the label is on the left of the scale for
// horizontal scales, on the right (top corner) for vertical ones.
// The default position for the entry is on the right of the scale for
// horizontal scales, on the right (bottom corner) for vertical ones.
// Both label and entry are visible by default.
// For convenience purposes, an empty label is not displayed though (make
// sure you use the SetLabelText method to set the label).
// In popup mode, a small button replaces the scale. Pressing that button
// will popup a scale the user can interact with, until it leaves the scale
// focus, which will withdraw the popup automatically. In that mode, the
// label and entry position are always displayed side by side, horizontally.
// Many of the vtkKWScale methods have been added to this API for
// convenience purposes, but GetScale() can be used to retrieve the
// internal vtkKWScale and access the rest of the API.
// .SECTION See Also
// vtkKWScale vtkKWScaleWithLabel vtkKWWidgetWithLabel
#ifndef __vtkKWScaleWithEntry_h
#define __vtkKWScaleWithEntry_h
#include "vtkKWScaleWithLabel.h"
class vtkKWEntry;
class vtkKWLabel;
class vtkKWPushButton;
class vtkKWTopLevel;
class KWWidgets_EXPORT vtkKWScaleWithEntry : public vtkKWScaleWithLabel
{
public:
static vtkKWScaleWithEntry* New();
vtkTypeRevisionMacro(vtkKWScaleWithEntry,vtkKWScaleWithLabel);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Set the range for this scale.
virtual void SetRange(double min, double max);
virtual void SetRange(const double *range)
{ this->SetRange(range[0], range[1]); };
virtual double *GetRange();
virtual void GetRange(double &min, double &max);
virtual void GetRange(double range[2])
{ this->GetRange(range[0], range[1]); };
virtual double GetRangeMin() { return this->GetRange()[0]; };
virtual double GetRangeMax() { return this->GetRange()[1]; };
// Description:
// Set/Get the value of the scale.
virtual void SetValue(double v);
virtual double GetValue();
// Description:
// Set/Get the resolution of the slider.
virtual void SetResolution(double r);
virtual double GetResolution();
// Description:
// Turn on/off the automatic clamping of the end values when the
// user types a value beyond the range. Default is on.
virtual void SetClampValue(int);
virtual int GetClampValue();
vtkBooleanMacro(ClampValue, int);
// Description:
// Get the internal vtkKWScale.
// Retrive that object to set the resolution, range, value, etc.
virtual vtkKWScale* GetScale()
{ return this->GetWidget(); };
// Description:
// Set/Get whether to display the range of the scale.
// If the scale orientation is horizontal, the min is displayed on the
// left of the scale, the max range on the right. For vertical orientation,
// min is on top, max at the bottom. In popup mode, the range is
// displayed directly in the popup window using the same layout as above.
void SetRangeVisibility(int flag);
vtkGetMacro(RangeVisibility, int);
vtkBooleanMacro(RangeVisibility, int);
// Description:
// Set/Get the internal entry visibility (On by default).
// IMPORTANT: if you know you may not show the entry, try to
// set that flag as early as possible (ideally, before calling Create())
// in order to lower the footprint of the widget: the entry will not be
// allocated and created if there is no need to show it.
// Later on, you can still use that option to show the entry: it will be
// allocated and created on the fly.
virtual void SetEntryVisibility(int);
vtkBooleanMacro(EntryVisibility, int);
vtkGetMacro(EntryVisibility, int);
// Description:
// Set the contents label.
// IMPORTANT: this method will create the label on the fly, use it only if
// you are confident that you will indeed display the label.
// Override the superclass so that the label is packed/unpacked if the
// text value is an empty string.
virtual void SetLabelText(const char *);
// Description:
// Get the internal entry.
// IMPORTANT: the internal entry is "lazy created", i.e. it is neither
// allocated nor created until GetEntry() is called. This allows
// for a lower footprint and faster UI startup. Therefore, do *not* use
// GetEntry() to check if the entry exists, as it will automatically
// allocate the entry. Use HasEntry() instead.
virtual vtkKWEntry* GetEntry();
virtual int HasEntry();
// Description:
// Set/Get the entry width.
// IMPORTANT: this method will create the entry on the fly, use it only if
// you are confident that you will indeed display the entry.
virtual void SetEntryWidth(int width);
virtual int GetEntryWidth();
// Description:
// If supported, set the entry position in regards to the rest of
// the composite widget. Check the subclass for more information about
// what the Default position is, and if specific positions are supported.
// The default position for the entry is on the right of the scale for
// horizontal scales, on the right (bottom corner) for vertical ones.
// Remember that the label position and visibility can also be changed
// through the vtkKWWidgetWithLabel superclass methods (SetLabelPosition).
//BTX
enum
{
EntryPositionDefault = 0,
EntryPositionTop,
EntryPositionBottom,
EntryPositionLeft,
EntryPositionRight
};
//ETX
virtual void SetEntryPosition(int);
vtkGetMacro(EntryPosition, int);
virtual void SetEntryPositionToDefault()
{ this->SetEntryPosition(vtkKWScaleWithEntry::EntryPositionDefault); };
virtual void SetEntryPositionToTop()
{ this->SetEntryPosition(vtkKWScaleWithEntry::EntryPositionTop); };
virtual void SetEntryPositionToBottom()
{ this->SetEntryPosition(vtkKWScaleWithEntry::EntryPositionBottom); };
virtual void SetEntryPositionToLeft()
{ this->SetEntryPosition(vtkKWScaleWithEntry::EntryPositionLeft); };
virtual void SetEntryPositionToRight()
{ this->SetEntryPosition(vtkKWScaleWithEntry::EntryPositionRight); };
// Description:
// Set both the label and entry position to the top of the scale
// (label in the left corner, entry in the right corner)
virtual void SetLabelAndEntryPositionToTop();
// Description:
// Set/Get a popup scale.
// WARNING: must be set *before* Create() is called.
vtkSetMacro(PopupMode, int);
vtkGetMacro(PopupMode, int);
vtkBooleanMacro(PopupMode, int);
vtkGetObjectMacro(PopupPushButton, vtkKWPushButton);
// Description:
// Set/Get the entry expansion flag. This flag is only used if PopupMode
// mode is On. In that case, the default behaviour is to provide a widget
// as compact as possible, i.e. the Entry won't be expanded if the widget
// grows. Set ExpandEntry to On to override this behaviour.
virtual void SetExpandEntry(int flag);
vtkGetMacro(ExpandEntry, int);
vtkBooleanMacro(ExpandEntry, int);
// Description:
// Set/Get the orientation type.
// For widgets that can lay themselves out with either a horizontal or
// vertical orientation, such as scales, this option specifies which
// orientation should be used.
// Valid constants can be found in vtkKWOptions::OrientationType.
virtual void SetOrientation(int);
virtual int GetOrientation();
virtual void SetOrientationToHorizontal();
virtual void SetOrientationToVertical();
// Description
// Set/Get the desired long dimension of the scale.
// For vertical scales this is the scale's height, for horizontal scales
// it is the scale's width. In pixel.
virtual void SetLength(int length);
virtual int GetLength();
// Description:
// Specifies commands to associate with the widget.
// 'Command' is invoked when the widget value is changing (i.e. during
// user interaction).
// 'StartCommand' is invoked at the beginning of a user interaction with
// the widget (when a mouse button is pressed over the widget for example).
// 'EndCommand' is invoked at the end of the user interaction with the
// widget (when the mouse button is released for example).
// 'EntryCommand' is invoked when the widget value is changed using
// the text entry.
// The need for a 'Command', 'StartCommand' and 'EndCommand' can be
// explained as follows: 'EndCommand' can be used to be notified about any
// changes made to this widget *after* the corresponding user interaction has
// been performed (say, after releasing the mouse button that was dragging
// a slider, or after clicking on a checkbutton). 'Command' can be set
// *additionally* to be notified about the intermediate changes that
// occur *during* the corresponding user interaction (say, *while* dragging
// a slider). While setting 'EndCommand' is enough to be notified about
// any changes, setting 'Command' is an application-specific choice that
// is likely to depend on how fast you want (or can) answer to rapid changes
// occuring during a user interaction, if any. 'StartCommand' is rarely
// used but provides an opportunity for the application to modify its
// state and prepare itself for user-interaction; in that case, the
// 'EndCommand' is usually set in a symmetric fashion to set the application
// back to its previous state.
// The 'object' argument is the object that will have the method called on
// it. The 'method' argument is the name of the method to be called and any
// arguments in string form. If the object is NULL, the method is still
// evaluated as a simple command.
// Note that the same events as vtkKWScale are generated, as a convenience.
// The following parameters are also passed to the command:
// - the current value: double
virtual void SetCommand(vtkObject *object, const char *method);
virtual void SetStartCommand(vtkObject *object, const char *method);
virtual void SetEndCommand(vtkObject *object, const char *method);
virtual void SetEntryCommand(vtkObject *object, const char *method);
// Description:
// Events. IMPORTANT: this widget is a composite widget that assembles
// both a vtkKWScale (which can be retrieved using GetScale()) and a
// (which can be retrieved using GetEntry()). Events are generated by
// both classes separately (see the corresponding class documentation).
// HOWEVER, for convenience purposes, an instance of vtkKWScaleWithEntry
// will emit (i.e. forward) the events that were sent by its internal
// vtkKWScale automatically, just as if they were sent by the instance
// itself. Therefore, you do not need to listen to the internal GetScale()
// or GetEntry() objects, but to the instance directly.
// Check the vtkKWScale documentation for the list of events.
// (for example, vtkKWScale::ScaleValueChangingEvent,
// vtkKWScale::ScaleValueChangedEvent,
// vtkKWScale::ScaleValueStartChangingEvent, etc).
// Description:
// Set/Get whether the above commands should be called or not.
// This make it easier to disable the commands while setting the scale
// value for example.
virtual void SetDisableCommands(int);
virtual int GetDisableCommands();
vtkBooleanMacro(DisableCommands, int);
// Description:
// Setting this string enables balloon help for this widget.
// Override to pass down to children for cleaner behavior
virtual void SetBalloonHelpString(const char *str);
// 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:
// Callbacks. Internal, do not use.
virtual void DisplayPopupModeCallback();
virtual void WithdrawPopupModeCallback();
virtual void EntryValueCallback(const char *value);
virtual void ScaleValueCallback(double num);
// Description:
// Add all the default observers needed by that object, or remove
// all the observers that were added through AddCallbackCommandObserver.
// Subclasses can override these methods to add/remove their own default
// observers, but should call the superclass too.
virtual void AddCallbackCommandObservers();
virtual void RemoveCallbackCommandObservers();
protected:
vtkKWScaleWithEntry();
~vtkKWScaleWithEntry();
// Description:
// Create the widget.
virtual void CreateWidget();
// Description:
// Bind/Unbind all components so that values can be changed, but
// no command will be called.
void Bind();
void UnBind();
int PopupMode;
int RangeVisibility;
virtual void InvokeEntryCommand(double value);
char *EntryCommand;
int EntryVisibility;
int EntryPosition;
int ExpandEntry;
vtkKWTopLevel *TopLevel;
vtkKWPushButton *PopupPushButton;
vtkKWLabel *RangeMinLabel;
vtkKWLabel *RangeMaxLabel;
// Description:
// Pack or repack the widget. To be implemented by subclasses.
virtual void Pack();
// Description:
// Create the entry
virtual void CreateEntry();
// Description:
// Update internal widgets value
virtual void UpdateValue();
virtual void SetEntryValue(double num);
virtual void UpdateRange();
// Description:
// Processes the events that are passed through CallbackCommand (or others).
// Subclasses can oberride this method to process their own events, but
// should call the superclass too.
virtual void ProcessCallbackCommandEvents(
vtkObject *caller, unsigned long event, void *calldata);
private:
// Description:
// Internal entry
// In 'private:' to allow lazy evaluation. GetEntry() will create the
// entry if it does not exist. This allow the object to remain lightweight.
vtkKWEntry *Entry;
vtkKWScaleWithEntry(const vtkKWScaleWithEntry&); // Not implemented
void operator=(const vtkKWScaleWithEntry&); // Not implemented
};
#endif
|