/usr/include/KWWidgets/vtkKWRange.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 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | /*=========================================================================
Module: $RCSfile: vtkKWRange.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 vtkKWRange - a range widget
// .SECTION Description
// A widget that represents a range within a bigger range.
// Note: As a subclass of vtkKWWidgetWithLabel, it inherits a label and methods
// to set its position and visibility. Note that the default label position
// implemented in this class is on the top of the range if the range
// direction is horizontal, on the left if is is vertical. Specific positions
// listed in vtkKWWidgetWithLabel are supported as well.
// .SECTION See Also
// vtkKWWidgetWithLabel
#ifndef __vtkKWRange_h
#define __vtkKWRange_h
#include "vtkKWWidgetWithLabel.h"
class vtkKWCanvas;
class vtkKWEntry;
class vtkKWFrame;
class vtkKWPushButtonSet;
class KWWidgets_EXPORT vtkKWRange : public vtkKWWidgetWithLabel
{
public:
static vtkKWRange* New();
vtkTypeRevisionMacro(vtkKWRange,vtkKWWidgetWithLabel);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Set/Get the whole range.
vtkGetVector2Macro(WholeRange, double);
virtual void SetWholeRange(double r0, double r1);
virtual void SetWholeRange(const double range[2])
{ this->SetWholeRange(range[0], range[1]); };
// Description:
// Set/Get the current (sub-)range.
vtkGetVector2Macro(Range, double);
virtual void SetRange(double r0, double r1);
virtual void SetRange(const double range[2])
{ this->SetRange(range[0], range[1]); };
// Description:
// Set/Get the current (sub-)range as relative positions in the whole range.
virtual void GetRelativeRange(double &r0, double &r1);
virtual void GetRelativeRange(double range[2])
{ this->GetRelativeRange(range[0], range[1]); };
virtual void SetRelativeRange(double r0, double r1);
virtual void SetRelativeRange(const double range[2])
{ this->SetRelativeRange(range[0], range[1]); };
// Description:
// Set/Get the resolution of the slider.
// The whole range and sub range are not snapped to this resolution.
// Both ranges can be set to any floating point number.
// Think of the sliders and the resolution as a way to set the bounds of
// the sub range interactively using nice clean steps (power of 10 for
// example).
// The entries associated to the sub range can be used to set the bounds to
// anything within the whole range, despite the resolution, allowing the user
// to enter precise values that could not be reached given the resolution.
// Of course, given a whole range of 1 to 64, if the resolution is set to 3
// the slider will only snap to values ranging from 3 to 63 (within the
// whole range constraint), but the entries can be used to set accurate
// values out of the resolution (i.e., 1, 2... 64).
virtual void SetResolution(double r);
vtkGetMacro(Resolution, double);
// Description:
// Adjust the resolution automatically (to a power of 10 in this implem)
virtual void SetAdjustResolution(int);
vtkBooleanMacro(AdjustResolution, int);
vtkGetMacro(AdjustResolution, int);
// Description:
// Set/Get the orientation.
//BTX
enum
{
OrientationHorizontal = 0,
OrientationVertical = 1
};
//ETX
virtual void SetOrientation(int);
vtkGetMacro(Orientation, int);
virtual void SetOrientationToHorizontal()
{ this->SetOrientation(vtkKWRange::OrientationHorizontal); };
virtual void SetOrientationToVertical()
{ this->SetOrientation(vtkKWRange::OrientationVertical); };
// Description:
// Set/Get the order of the sliders (inverted means that the first slider
// will be associated to Range[1], the last to Range[0])
virtual void SetInverted(int);
vtkBooleanMacro(Inverted, int);
vtkGetMacro(Inverted, int);
// Description:
// Set/Get the desired narrow dimension of the widget. For horizontal widget
// this is the widget height, for vertical this is the width.
// In the current implementation, this controls the sliders narrow dim.
virtual void SetThickness(int);
vtkGetMacro(Thickness, int);
// Description:
// Set/Get the desired narrow dimension of the internal widget as a fraction
// of the thickness of the widget (see Thickness).
// In the current implementation, this controls the range bar narrow dim.
virtual void SetInternalThickness(double);
vtkGetMacro(InternalThickness, double);
// Description:
// Set/Get the long dimension of the widget. For horizontal widget
// this is the widget width, for vertical this is the height.
// Set it to zero (default) to ignore it and let the widget
// resize.
virtual void SetRequestedLength(int);
vtkGetMacro(RequestedLength, int);
// Description:
// Set/Get the slider size.
virtual void SetSliderSize(int);
vtkGetMacro(SliderSize, int);
// Description:
// Set/Get if a slider can push another slider when bumping into it
vtkSetMacro(SliderCanPush, int);
vtkBooleanMacro(SliderCanPush, int);
vtkGetMacro(SliderCanPush, int);
// Description:
// Set/Get the (sub) range scale color.
// Defaults to -1, -1, -1: a shade of the widget background color will
// be used at runtime.
vtkGetVector3Macro(RangeColor, double);
virtual void SetRangeColor(double r, double g, double b);
virtual void SetRangeColor(double rgb[3])
{ this->SetRangeColor(rgb[0], rgb[1], rgb[2]); };
// Description:
// Set/Get the (sub) range scale interaction color. Used when interaction
// is performed using the sliders.
// IF set to -1, -1, -1: a shade of the widget background color will
// be used at runtime.
vtkGetVector3Macro(RangeInteractionColor, double);
virtual void SetRangeInteractionColor(double r, double g, double b);
virtual void SetRangeInteractionColor(double rgb[3])
{ this->SetRangeInteractionColor(rgb[0], rgb[1], rgb[2]); };
// Description:
// Set/Get the color of the first slider.
// Defaults to -1, -1, -1: a shade of the widget background color will
// be used at runtime.
vtkGetVector3Macro(Slider1Color, double);
virtual void SetSlider1Color(double r, double g, double b);
virtual void SetSlider1Color(double rgb[3])
{ this->SetSlider1Color(rgb[0], rgb[1], rgb[2]); };
// Description:
// Set/Get the (sub) slider scale interaction color. Used when interaction
// is performed using the sliders.
// IF set to -1, -1, -1: a shade of the widget background color will
// be used at runtime.
vtkGetVector3Macro(SliderInteractionColor, double);
virtual void SetSliderInteractionColor(double r, double g, double b);
virtual void SetSliderInteractionColor(double rgb[3])
{ this->SetSliderInteractionColor(rgb[0], rgb[1], rgb[2]); };
// Description:
// Set/Get the color of the second slider.
// Defaults to -1, -1, -1: a shade of the widget background color will
// be used at runtime.
vtkGetVector3Macro(Slider2Color, double);
virtual void SetSlider2Color(double r, double g, double b);
virtual void SetSlider2Color(double rgb[3])
{ this->SetSlider2Color(rgb[0], rgb[1], rgb[2]); };
// Description:
// Set/Get the entries visibility.
virtual void SetEntriesVisibility(int);
vtkBooleanMacro(EntriesVisibility, int);
vtkGetMacro(EntriesVisibility, int);
// Description:
// Get the entries object.
virtual vtkKWEntry* GetEntry1()
{ return this->Entries[0]; };
virtual vtkKWEntry* GetEntry2()
{ return this->Entries[1]; };
// Description:
// Set/Get the entries width (in chars).
virtual void SetEntriesWidth(int width);
vtkGetMacro(EntriesWidth, int);
// Description:
// Set/Get the position of the entries (Default is top if the range
// direction is horizontal, left if it is vertical).
// Note that you can also set the label position using the superclass
// methods (vtkKWWidgetWithLabel).
//BTX
enum
{
EntryPositionDefault = 0,
EntryPositionTop,
EntryPositionBottom,
EntryPositionLeft,
EntryPositionRight
};
//ETX
virtual void SetEntry1Position(int);
vtkGetMacro(Entry1Position, int);
virtual void SetEntry1PositionToDefault()
{ this->SetEntry1Position(vtkKWRange::EntryPositionDefault); };
virtual void SetEntry1PositionToTop()
{ this->SetEntry1Position(vtkKWRange::EntryPositionTop); };
virtual void SetEntry1PositionToBottom()
{ this->SetEntry1Position(vtkKWRange::EntryPositionBottom); };
virtual void SetEntry1PositionToLeft()
{ this->SetEntry1Position(vtkKWRange::EntryPositionLeft); };
virtual void SetEntry1PositionToRight()
{ this->SetEntry1Position(vtkKWRange::EntryPositionRight); };
virtual void SetEntry2Position(int);
vtkGetMacro(Entry2Position, int);
virtual void SetEntry2PositionToDefault()
{ this->SetEntry2Position(vtkKWRange::EntryPositionDefault); };
virtual void SetEntry2PositionToTop()
{ this->SetEntry2Position(vtkKWRange::EntryPositionTop); };
virtual void SetEntry2PositionToBottom()
{ this->SetEntry2Position(vtkKWRange::EntryPositionBottom); };
virtual void SetEntry2PositionToLeft()
{ this->SetEntry2Position(vtkKWRange::EntryPositionLeft); };
virtual void SetEntry2PositionToRight()
{ this->SetEntry2Position(vtkKWRange::EntryPositionRight); };
// 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).
// 'EntriesCommand' is invoked when the widget value is changed using
// the text entries.
// 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.
// The following parameters are also passed to the command:
// - the current range: int, int (if Resolution is integer); double, double
// otherwise.
// Note: the 'int' signature is for convenience, so that the command can
// be set to a callback accepting 'int'. In doubt, implement the callback
// using a 'double' signature that will accept both 'int' and '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 SetEntriesCommand(vtkObject *object, const char *method);
// Description:
// Set/Get whether the above commands should be called or not.
// This allow you to disable the commands while you are setting the range
// value for example.
vtkSetMacro(DisableCommands, int);
vtkGetMacro(DisableCommands, int);
vtkBooleanMacro(DisableCommands, int);
// Description:
// Events. The RangeValueChangingEvent is triggered when the widget value
// is changed (i.e., during user interaction on the widget's slider),
// the RangeValueStartChangingEvent is invoked at the beginning of an
// interaction with the widget, the RangeValueChangedEvent is invoked at the
// end of an interaction with the widget (or when the value is changed
// using the entries widget). They are similar in concept as
// the 'Command', 'StartCommand', 'EndCommand' and 'EntriesCommand' callbacks
// but can be used by multiple listeners/observers at a time.
// The following parameters are also passed as client data:
// - the current range: double, double.
//BTX
enum
{
RangeValueChangingEvent = 10000,
RangeValueChangedEvent,
RangeValueStartChangingEvent
};
//ETX
// Description:
// If set to on, set the interaction to a symmetrical mode, where
// adjusting one slider adjust the other one symmetrically.
vtkBooleanMacro(SymmetricalInteraction, int);
vtkGetMacro(SymmetricalInteraction, int);
vtkSetMacro(SymmetricalInteraction, int);
// Description:
// Set the string that enables balloon help for this widget.
// Override to pass down to children.
virtual void SetBalloonHelpString(const char *str);
// Description:
// Access to the canvas
vtkGetObjectMacro(Canvas, vtkKWCanvas);
// 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:
// Turn on/off the automatic clamping of the end values when the
// user types a value beyond the range. Default is on.
vtkSetMacro(ClampRange, int);
vtkGetMacro(ClampRange, int);
vtkBooleanMacro(ClampRange, int);
// Description:
// Callbacks. Internal, do not use.
//BTX
enum
{
SliderIndex0 = 0,
SliderIndex1 = 1
};
//ETX
virtual void ConfigureCallback();
virtual void MaximizeRangeCallback();
virtual void EnlargeRangeCallback();
virtual void ShrinkRangeCallback();
virtual void EntriesUpdateCallback(int i);
virtual void StartRangeInteractionCallback(int x, int y);
virtual void StartSliderInteractionCallback(int slider_idx, int x, int y);
virtual void EndInteractionCallback();
virtual void SliderMotionCallback(
int slider_idx, int x, int y, int shift, int ctrl);
virtual void RangeMotionCallback(int x, int y, int shift, int ctrl);
protected:
vtkKWRange();
~vtkKWRange();
// Description:
// Create the widget.
virtual void CreateWidget();
double WholeRange[2];
double Range[2];
double WholeRangeAdjusted[2];
double RangeAdjusted[2];
double Resolution;
int AdjustResolution;
int SymmetricalInteraction;
int Inverted;
int Thickness;
double InternalThickness;
int RequestedLength;
int Orientation;
int DisableCommands;
int SliderSize;
double RangeColor[3];
double RangeInteractionColor[3];
double Slider1Color[3];
double Slider2Color[3];
double SliderInteractionColor[3];
int EntriesVisibility;
int Entry1Position;
int Entry2Position;
int EntriesWidth;
int SliderCanPush;
int ClampRange;
char *Command;
char *StartCommand;
char *EndCommand;
char *EntriesCommand;
virtual void InvokeRangeCommand(const char *command, double r0, double r1);
virtual void InvokeCommand(double r0, double r1);
virtual void InvokeStartCommand(double r0, double r1);
virtual void InvokeEndCommand(double r0, double r1);
virtual void InvokeEntriesCommand(double r0, double r1);
vtkKWFrame *CanvasFrame;
vtkKWCanvas *Canvas;
vtkKWEntry *Entries[2];
virtual void CreateEntries();
virtual void UpdateEntriesValue(double range[2]);
virtual void ConstrainResolution();
// Description:
// Bind/Unbind all components.
virtual void Bind();
virtual void UnBind();
// Description:
// Make sure all elements are constrained correctly
virtual void ConstrainRangeToResolution(
double range[2], double res, int adjust = 1);
virtual void ConstrainRangeToWholeRange(
double range[2], double whole_range[2], double *old_range_hint = 0);
virtual void ConstrainWholeRange();
virtual void ConstrainRange(double *old_range_hint = 0);
virtual void ConstrainRanges();
// Description:
// Pack the widget
virtual void Pack();
// Description:
// Get type of interaction
//BTX
enum
{
RangeInteraction,
Slider1Interaction,
Slider2Interaction
};
// Description:
// Start Interactions with the input interaction type
// (RangeInteraction, Slider1Interaction, Slider2Interaction)
virtual void StartInteraction(int inter_type, int x, int y);
// Description:
// Get element colors (and shades)
//BTX
enum
{
DarkShadowColor,
LightShadowColor,
BackgroundColor,
HighlightColor
};
//ETX
virtual void GetColorShade(
int type, double rgb[3], double &r, double &g, double &b);
virtual void GetWholeRangeColor(int type, double &r, double &g, double &b);
virtual void GetRangeColor(int type, double &r, double &g, double &b);
virtual void GetSliderColor(int slider_idx, int type, double &r, double &g, double &b);
// Description:
// Redraw elements
virtual void RedrawCanvas();
virtual void RedrawWholeRange();
virtual void RedrawRange();
virtual void RedrawSliders();
virtual void RedrawSlider(int x, int slider_idx);
virtual void UpdateRangeColors();
virtual void UpdateSliderColors(int slider_idx);
virtual void UpdateColors();
// Description:
// Look for a tag
virtual int HasTag(const char *tag, const char *suffix = 0);
// Description:
// Get the current sliders center positions
virtual void GetSlidersPositions(int pos[2]);
private:
int InInteraction;
int StartInteractionPos;
double StartInteractionRange[2];
vtkKWRange(const vtkKWRange&); // Not implemented
void operator=(const vtkKWRange&); // Not implemented
};
#endif
|