KWWidgets
|
00001 /*========================================================================= 00002 00003 Module: $RCSfile: vtkKWComboBox.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 vtkKWComboBox - a text entry widget with a pull-down menu of values 00015 // .SECTION Description 00016 // A simple subclass of entry that adds a pull-down menu where a predefined 00017 // set of values can be chosed to set the entry field. 00018 // .SECTION Thanks 00019 // This work is part of the National Alliance for Medical Image 00020 // Computing (NAMIC), funded by the National Institutes of Health 00021 // through the NIH Roadmap for Medical Research, Grant U54 EB005149. 00022 // Information on the National Centers for Biomedical Computing 00023 // can be obtained from http://nihroadmap.nih.gov/bioinformatics. 00024 // .SECTION See Also 00025 // vtkKWEntry 00026 00027 #ifndef __vtkKWComboBox_h 00028 #define __vtkKWComboBox_h 00029 00030 #include "vtkKWEntry.h" 00031 00032 class KWWidgets_EXPORT vtkKWComboBox : public vtkKWEntry 00033 { 00034 public: 00035 static vtkKWComboBox* New(); 00036 vtkTypeRevisionMacro(vtkKWComboBox,vtkKWEntry); 00037 void PrintSelf(ostream& os, vtkIndent indent); 00038 00039 // Description: 00040 // Add and delete values to put in the list. 00041 virtual void AddValue(const char* value); 00042 virtual void AddValueAsInt(int value); 00043 virtual void DeleteValue(int idx); 00044 virtual int HasValue(const char* value); 00045 virtual int GetValueIndex(const char* value); 00046 virtual int GetNumberOfValues(); 00047 virtual void DeleteAllValues(); 00048 00049 // Description: 00050 // Get the corresponding value given an index 00051 // Note that the output of GetValueFromIndex is a pointer to a 00052 // temporary buffer that should be copied *immediately* to your own storage. 00053 virtual const char* GetValueFromIndex(int idx); 00054 00055 // Description: 00056 // Replace the nth value in the combo box with another string value. 00057 virtual void ReplaceNthValue( int n, const char* value ); 00058 00059 // Description: 00060 // Set/Get the value of the entry in a few different formats. 00061 // Overriden to comply with the Tk type 00062 virtual void SetValue(const char *); 00063 00064 // Description: 00065 // Specifies a command to associate with the widget. This command is 00066 // typically invoked when the return key is pressed, or the focus is lost, 00067 // or a value is picked from the dropdown list. 00068 // The 'object' argument is the object that will have the method called on 00069 // it. The 'method' argument is the name of the method to be called and any 00070 // arguments in string form. If the object is NULL, the method is still 00071 // evaluated as a simple command. 00072 // The following parameters are also passed to the command: 00073 // - current value: const char* 00074 virtual void SetCommand(vtkObject *object, const char *method); 00075 00076 // Description: 00077 // Update the "enable" state of the object and its internal parts. 00078 // Depending on different Ivars (this->Enabled, the application's 00079 // Limited Edition Mode, etc.), the "enable" state of the object is updated 00080 // and propagated to its internal parts/subwidgets. This will, for example, 00081 // enable/disable parts of the widget UI, enable/disable the visibility 00082 // of 3D widgets, etc. 00083 virtual void UpdateEnableState(); 00084 00085 // Description: 00086 // Set/Get the width of the listbox in the dropdown, in pixels. 00087 virtual void SetListboxWidth(int n); 00088 virtual int GetListboxWidth(); 00089 00090 // Description: 00091 // Set/Get the background color of the widget. 00092 // Override the super to make sure all elements are set correctly. 00093 virtual void SetBackgroundColor(double r, double g, double b); 00094 virtual void SetBackgroundColor(double rgb[3]) 00095 { this->SetBackgroundColor(rgb[0], rgb[1], rgb[2]); }; 00096 00097 protected: 00098 vtkKWComboBox(); 00099 ~vtkKWComboBox(); 00100 00101 // Description: 00102 // Create the widget. 00103 virtual void CreateWidget(); 00104 00105 private: 00106 vtkKWComboBox(const vtkKWComboBox&); // Not implemented 00107 void operator=(const vtkKWComboBox&); // Not Implemented 00108 }; 00109 00110 00111 #endif 00112 00113 00114