forked from FNNDSC/KWWidgets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkKWCoreWidget.h
139 lines (118 loc) · 5.34 KB
/
vtkKWCoreWidget.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
/*=========================================================================
Module: $RCSfile: vtkKWCoreWidget.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 vtkKWCoreWidget - a core widget.
// .SECTION Description
// A superclass for all core widgets, i.e. C++ wrappers around simple
// Tk widgets.
// .SECTION Thanks
// This work is part of the National Alliance for Medical Image
// Computing (NAMIC), funded by the National Institutes of Health
// through the NIH Roadmap for Medical Research, Grant U54 EB005149.
// Information on the National Centers for Biomedical Computing
// can be obtained from http://nihroadmap.nih.gov/bioinformatics.
#ifndef __vtkKWCoreWidget_h
#define __vtkKWCoreWidget_h
#include "vtkKWWidget.h"
class vtkKWCoreWidgetInternals;
class KWWidgets_EXPORT vtkKWCoreWidget : public vtkKWWidget
{
public:
static vtkKWCoreWidget* New();
vtkTypeMacro(vtkKWCoreWidget, vtkKWWidget);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Set/Get the -state option to "normal" (1) or "disabled" (0) or "readonly"
// (2, if supported).
// Valid constants can be found in vtkKWOptions::StateType.
// This should not be used directly, this is done by
// SetEnabled()/UpdateEnableState().
// TODO: should be in protected:
virtual void SetState(int);
virtual int GetState();
virtual void SetStateToDisabled();
virtual void SetStateToNormal();
virtual void SetStateToReadOnly();
// Description:
// Arranges for window to be displayed above all of its siblings in the
// stacking order.
virtual void Raise();
// Description:
// Set/Get a Tk configuration option (ex: "-bg").
// Make *sure* you check the class (and subclasses) API for a
// C++ method that would already act as a front-end to the Tk option.
// For example, the SetBackgroundColor() method should be used instead of
// accessing the -bg Tk option.
// Note that SetConfigurationOption will enclose the value inside
// curly braces {} as a convenience.
// SetConfigurationOption returns 1 on success, 0 otherwise.
virtual int SetConfigurationOption(const char* option, const char *value);
virtual int HasConfigurationOption(const char* option);
virtual const char* GetConfigurationOption(const char* option);
virtual int GetConfigurationOptionAsInt(const char* option);
virtual int SetConfigurationOptionAsInt(const char* option, int value);
virtual double GetConfigurationOptionAsDouble(const char* option);
virtual int SetConfigurationOptionAsDouble(const char* option, double value);
virtual void GetConfigurationOptionAsColor(
const char* option, double *r, double *g, double *b);
virtual double* GetConfigurationOptionAsColor(const char* option);
virtual void SetConfigurationOptionAsColor(
const char* option, double r, double g, double b);
virtual void SetConfigurationOptionAsColor(const char* option, double rgb[3])
{ this->SetConfigurationOptionAsColor(option, rgb[0], rgb[1], rgb[2]); };
virtual void GetDefaultConfigurationOptionAsColor(
const char* option, double *r, double *g, double *b);
virtual double* GetDefaultConfigurationOptionAsColor(const char* option);
protected:
vtkKWCoreWidget();
~vtkKWCoreWidget();
// Description:
// Create the widget.
virtual void CreateWidget();
// Description:
// Get the Tk string type of the widget.
virtual const char* GetType();
// Description:
// Convert a Tcl string (stored internally as UTF-8/Unicode) to another
// internal format (given the widget's application CharacterEncoding),
// and vice-versa.
// The 'source' string is the source to convert.
// It returns a pointer to where the converted string can be found
// (copy the result to safe storage immediately).
// The 'options' can be set to perform some replacements/escaping.
// ConvertStringEscapeInterpretable will attempt to escape all characters
// that can be interpreted (when found between a pair of quotes for
// example): $ [ ] "
//BTX
enum
{
ConvertStringEscapeCurlyBraces = 1,
ConvertStringEscapeInterpretable = 2
};
const char* ConvertTclStringToInternalString(
const char *source, int options = 0);
const char* ConvertInternalStringToTclString(
const char *source, int options = 0);
//ETX
// Description:
// Set/Get a textual Tk configuration option (ex: "-bg").
// This should be used instead of SetConfigurationOption as it performs
// various characted encoding and escaping tricks.
// The characted encoding used in the string will be retrieved by querying
// the widget's application CharacterEncoding ivar. Conversion from that
// encoding to Tk internal encoding will be performed automatically.
virtual void SetTextOption(const char *option, const char *value);
virtual const char* GetTextOption(const char *option);
// PIMPL Encapsulation for STL containers
vtkKWCoreWidgetInternals *Internals;
private:
vtkKWCoreWidget(const vtkKWCoreWidget&); // Not implemented
void operator=(const vtkKWCoreWidget&); // Not implemented
};
#endif