00001 /*========================================================================= 00002 00003 Module: $RCSfile: vtkKWRadioButton.h,v $ 00004 00005 Copyright (c) Kitware, Inc. 00006 All rights reserved. 00007 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 // .NAME vtkKWRadioButton - a radio button widget 00015 // .SECTION Description 00016 // A simple widget representing a radio button. The state can be set or 00017 // queried. 00018 00019 #ifndef __vtkKWRadioButton_h 00020 #define __vtkKWRadioButton_h 00021 00022 #include "vtkKWCheckButton.h" 00023 00024 class KWWidgets_EXPORT vtkKWRadioButton : public vtkKWCheckButton 00025 { 00026 public: 00027 static vtkKWRadioButton* New(); 00028 vtkTypeRevisionMacro(vtkKWRadioButton,vtkKWCheckButton); 00029 void PrintSelf(ostream& os, vtkIndent indent); 00030 00031 // Description: 00032 // Set/Get the state of the Radio button 0 = off 1 = on 00033 vtkBooleanMacro(SelectedState,int); 00034 virtual int GetSelectedState(); 00035 00036 // Description: 00037 // Set/Get the value to store in the button's associated variable 00038 // whenever this button is selected. 00039 virtual void SetValue(const char *v); 00040 virtual void SetValueAsInt(int v); 00041 virtual const char* GetValue(); 00042 virtual int GetValueAsInt(); 00043 00044 // Description: 00045 // Specifies a command to associate with the widget. This command is 00046 // typically invoked when the button is selected or deselected. 00047 // The 'object' argument is the object that will have the method called on 00048 // it. The 'method' argument is the name of the method to be called and any 00049 // arguments in string form. If the object is NULL, the method is still 00050 // evaluated as a simple command. 00051 // Note that the selected state is *not* passed as parameter, which is 00052 // the case for vtkKWCheckButton for example. In most cases, since the 00053 // selected state is shared among many radiobuttons, this command will 00054 // likely to perform a task related to the meaning of the button itself. 00055 virtual void SetCommand(vtkObject *object, const char *method); 00056 00057 // Description: 00058 // Events. The SelectedStateChangedEvent is triggered when the button 00059 // is selected or deselected. 00060 // The following parameters are also passed as client data: 00061 // - the current selected state: int 00062 // Yes, this is duplicated from vtkKWCheckButton, so that code does not 00063 // break when vtkKWRadioButton is not a subclass of vtkKWCheckButton anymore. 00064 //BTX 00065 enum 00066 { 00067 SelectedStateChangedEvent = 10000 00068 }; 00069 //ETX 00070 00071 // Description: 00072 // Set/Get the button's associated variable directly to a specific value. 00073 virtual void SetVariableValue(const char *v); 00074 virtual void SetVariableValueAsInt(int v); 00075 virtual const char* GetVariableValue(); 00076 virtual int GetVariableValueAsInt(); 00077 00078 // Description: 00079 // Callbacks. Internal, do not use. 00080 virtual void CommandCallback(); 00081 00082 protected: 00083 vtkKWRadioButton() {}; 00084 ~vtkKWRadioButton() {}; 00085 00086 // Description: 00087 // Create the widget. 00088 virtual void CreateWidget(); 00089 00090 // Override the superclass (state is ignored) 00091 virtual void InvokeCommand(int state); 00092 00093 private: 00094 vtkKWRadioButton(const vtkKWRadioButton&); // Not implemented 00095 void operator=(const vtkKWRadioButton&); // Not implemented 00096 }; 00097 00098 00099 #endif 00100 00101 00102