KWWidgets
debian/tmp/usr/include/KWWidgets/vtkKWComboBox.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWComboBox.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 vtkKWComboBox - a text entry widget with a pull-down menu of values
15 // .SECTION Description
16 // A simple subclass of entry that adds a pull-down menu where a predefined
17 // set of values can be chosed to set the entry field.
18 // .SECTION Thanks
19 // This work is part of the National Alliance for Medical Image
20 // Computing (NAMIC), funded by the National Institutes of Health
21 // through the NIH Roadmap for Medical Research, Grant U54 EB005149.
22 // Information on the National Centers for Biomedical Computing
23 // can be obtained from http://nihroadmap.nih.gov/bioinformatics.
24 // .SECTION See Also
25 // vtkKWEntry
26 
27 #ifndef __vtkKWComboBox_h
28 #define __vtkKWComboBox_h
29 
30 #include "vtkKWEntry.h"
31 
33 {
34 public:
35  static vtkKWComboBox* New();
36  vtkTypeRevisionMacro(vtkKWComboBox,vtkKWEntry);
37  void PrintSelf(ostream& os, vtkIndent indent);
38 
39  // Description:
40  // Add and delete values to put in the list.
41  virtual void AddValue(const char* value);
42  virtual void AddValueAsInt(int value);
43  virtual void DeleteValue(int idx);
44  virtual int HasValue(const char* value);
45  virtual int GetValueIndex(const char* value);
46  virtual int GetNumberOfValues();
47  virtual void DeleteAllValues();
48 
49  // Description:
50  // Get the corresponding value given an index
51  // Note that the output of GetValueFromIndex is a pointer to a
52  // temporary buffer that should be copied *immediately* to your own storage.
53  virtual const char* GetValueFromIndex(int idx);
54 
55  // Description:
56  // Replace the nth value in the combo box with another string value.
57  virtual void ReplaceNthValue( int n, const char* value );
58 
59  // Description:
60  // Set/Get the value of the entry in a few different formats.
61  // Overriden to comply with the Tk type
62  virtual void SetValue(const char *);
63 
64  // Description:
65  // Specifies a command to associate with the widget. This command is
66  // typically invoked when the return key is pressed, or the focus is lost,
67  // or a value is picked from the dropdown list.
68  // The 'object' argument is the object that will have the method called on
69  // it. The 'method' argument is the name of the method to be called and any
70  // arguments in string form. If the object is NULL, the method is still
71  // evaluated as a simple command.
72  // The following parameters are also passed to the command:
73  // - current value: const char*
74  virtual void SetCommand(vtkObject *object, const char *method);
75 
76  // Description:
77  // Update the "enable" state of the object and its internal parts.
78  // Depending on different Ivars (this->Enabled, the application's
79  // Limited Edition Mode, etc.), the "enable" state of the object is updated
80  // and propagated to its internal parts/subwidgets. This will, for example,
81  // enable/disable parts of the widget UI, enable/disable the visibility
82  // of 3D widgets, etc.
83  virtual void UpdateEnableState();
84 
85  // Description:
86  // Set/Get the width of the listbox in the dropdown, in pixels.
87  virtual void SetListboxWidth(int n);
88  virtual int GetListboxWidth();
89 
90  // Description:
91  // Set/Get the background color of the widget.
92  // Override the super to make sure all elements are set correctly.
93  virtual void SetBackgroundColor(double r, double g, double b);
94  virtual void SetBackgroundColor(double rgb[3])
95  { this->SetBackgroundColor(rgb[0], rgb[1], rgb[2]); };
96 
97 protected:
98  vtkKWComboBox();
99  ~vtkKWComboBox();
100 
101  // Description:
102  // Create the widget.
103  virtual void CreateWidget();
104 
105 private:
106  vtkKWComboBox(const vtkKWComboBox&); // Not implemented
107  void operator=(const vtkKWComboBox&); // Not Implemented
108 };
109 
110 
111 #endif
112 
113 
114