KWWidgets
vtkKWRadioButton.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWRadioButton.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 vtkKWRadioButton - a radio button widget
15 // .SECTION Description
16 // A simple widget representing a radio button. The state can be set or
17 // queried.
18 
19 #ifndef __vtkKWRadioButton_h
20 #define __vtkKWRadioButton_h
21 
22 #include "vtkKWCheckButton.h"
23 
25 {
26 public:
27  static vtkKWRadioButton* New();
28  vtkTypeRevisionMacro(vtkKWRadioButton,vtkKWCheckButton);
29  void PrintSelf(ostream& os, vtkIndent indent);
30 
31  // Description:
32  // Set/Get the state of the Radio button 0 = off 1 = on
33  vtkBooleanMacro(SelectedState,int);
34  virtual int GetSelectedState();
35 
36  // Description:
37  // Set/Get the value to store in the button's associated variable
38  // whenever this button is selected.
39  virtual void SetValue(const char *v);
40  virtual void SetValueAsInt(int v);
41  virtual const char* GetValue();
42  virtual int GetValueAsInt();
43 
44  // Description:
45  // Specifies a command to associate with the widget. This command is
46  // typically invoked when the button is selected or deselected.
47  // The 'object' argument is the object that will have the method called on
48  // it. The 'method' argument is the name of the method to be called and any
49  // arguments in string form. If the object is NULL, the method is still
50  // evaluated as a simple command.
51  // Note that the selected state is *not* passed as parameter, which is
52  // the case for vtkKWCheckButton for example. In most cases, since the
53  // selected state is shared among many radiobuttons, this command will
54  // likely to perform a task related to the meaning of the button itself.
55  virtual void SetCommand(vtkObject *object, const char *method);
56 
57  // Description:
58  // Events. The SelectedStateChangedEvent is triggered when the button
59  // is selected or deselected.
60  // The following parameters are also passed as client data:
61  // - the current selected state: int
62  // Yes, this is duplicated from vtkKWCheckButton, so that code does not
63  // break when vtkKWRadioButton is not a subclass of vtkKWCheckButton anymore.
64  //BTX
65  enum
66  {
67  SelectedStateChangedEvent = 10000
68  };
69  //ETX
70 
71  // Description:
72  // Set/Get the button's associated variable directly to a specific value.
73  virtual void SetVariableValue(const char *v);
74  virtual void SetVariableValueAsInt(int v);
75  virtual const char* GetVariableValue();
76  virtual int GetVariableValueAsInt();
77 
78  // Description:
79  // Callbacks. Internal, do not use.
80  virtual void CommandCallback();
81 
82 protected:
85 
86  // Description:
87  // Create the widget.
88  virtual void CreateWidget();
89 
90  // Override the superclass (state is ignored)
91  virtual void InvokeCommand(int state);
92 
93 private:
94  vtkKWRadioButton(const vtkKWRadioButton&); // Not implemented
95  void operator=(const vtkKWRadioButton&); // Not implemented
96 };
97 
98 
99 #endif
100 
101 
102