KWWidgets
debian/tmp/usr/include/KWWidgets/vtkKWListBoxToListBoxSelectionEditor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWListBoxToListBoxSelectionEditor.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 vtkKWListBoxToListBoxSelectionEditor - a composite dual-listbox selection editor
15 // .SECTION Description
16 // This composite widget is used to manage a selection of text entries between
17 // two listboxes. The source listbox lists the available elements that can
18 // be add/removed/sorted to form a selection inside a target/final listbox.
19 
20 #ifndef __vtkKWListBoxToListBoxSelectionEditor_h
21 #define __vtkKWListBoxToListBoxSelectionEditor_h
22 
23 #include "vtkKWCompositeWidget.h"
24 
26 class vtkKWPushButton;
27 class vtkKWListBox;
28 class vtkKWFrame;
29 
31 {
32 public:
35  void PrintSelf(ostream& os, vtkIndent indent);
36 
37  // Description:
38  // Add/Remove a string element to the source list if it is not already
39  // there or on the final list. The optional argument force will make sure
40  // the item is added to the source list and removed from final if it is
41  // already there.
42  virtual void AddSourceElement(const char*, int force = 0);
43  virtual void RemoveSourceElement(int indx);
44 
45  // Description:
46  // Add/remove a string element to the final list if it is not already there
47  // or on the final list. The optional argument force will make sure the item
48  // is added to the final list and removed from source if it is already there.
49  virtual void AddFinalElement(const char*, int force = 0);
50  virtual void RemoveFinalElement(int index);
51 
52  // Description:
53  // Get the number of elements on the final list.
54  virtual int GetNumberOfElementsOnSourceList();
55  virtual int GetNumberOfElementsOnFinalList();
56 
57  // Description:
58  // Get the element from the list.
59  virtual const char* GetElementFromSourceList(int idx);
60  virtual const char* GetElementFromFinalList(int idx);
61 
62  // Description:
63  // Get the index of the item.
64  virtual int GetElementIndexFromSourceList(const char* element);
65  virtual int GetElementIndexFromFinalList(const char* element);
66 
67  // Description:
68  // Remove items from the list.
69  virtual void RemoveItemsFromSourceList();
70  virtual void RemoveItemsFromFinalList();
71 
72  // Description:
73  // Get the listbox objects.
74  vtkGetObjectMacro(SourceList, vtkKWListBoxWithScrollbarsWithLabel);
75  vtkGetObjectMacro(FinalList, vtkKWListBoxWithScrollbarsWithLabel);
76 
77  // Description:
78  // Specifies a command to associate with the widget. This command is
79  // typically invoked when the ellipsis button is pressed.
80  // The 'object' argument is the object that will have the method called on
81  // it. The 'method' argument is the name of the method to be called and any
82  // arguments in string form. If the object is NULL, the method is still
83  // evaluated as a simple command.
84  virtual void SetEllipsisCommand(vtkObject *obj, const char *method);
85 
86  // Description:
87  // Specifies a command to associate with the widget. This command is
88  // typically invoked when the values in the FinalList are changed.
89  // The 'object' argument is the object that will have the method called on
90  // it. The 'method' argument is the name of the method to be called and any
91  // arguments in string form. If the object is NULL, the method is still
92  // evaluated as a simple command.
93  virtual void SetFinalListChangedCommand(vtkObject *obj, const char *method);
94 
95  // Description:
96  // Events. The FinalListChangedEvent is triggered when the values in the
97  // FinalList are changed.
98  //BTX
99  enum
100  {
101  FinalListChangedEvent = 10000
102  };
103  //ETX
104 
105  // Description:
106  // Update the "enable" state of the object and its internal parts.
107  // Depending on different Ivars (this->Enabled, the application's
108  // Limited Edition Mode, etc.), the "enable" state of the object is updated
109  // and propagated to its internal parts/subwidgets. This will, for example,
110  // enable/disable parts of the widget UI, enable/disable the visibility
111  // of 3D widgets, etc.
112  virtual void UpdateEnableState();
113  virtual void Update();
114 
115  // Descrition:
116  // Set/Get whether the widget should allow reordering
117  // or the final list with the Up/Down buttons.
118  //BTX
119  virtual void SetAllowReordering(int);
120  vtkBooleanMacro(AllowReordering, int);
121  vtkGetMacro(AllowReordering, int);
122  //ETX
123 
124  // Description:
125  // Callbacks. Internal, do not use.
126  virtual void AddCallback();
127  virtual void AddAllCallback();
128  virtual void RemoveCallback();
129  virtual void RemoveAllCallback();
130  virtual void UpCallback();
131  virtual void DownCallback();
132  virtual void EllipsisCallback();
133  virtual void SourceSelectionChangedCallback();
134  virtual void FinalSelectionChangedCallback();
135 
136 protected:
139 
140  // Description:
141  // Create the widget.
142  virtual void CreateWidget();
143 
144  // Description:
145  // Pack the widget
146  virtual void Pack();
147 
150 
158 
159  virtual void MoveWholeList(vtkKWListBox* l1, vtkKWListBox* l2);
160  virtual void MoveSelectedList(vtkKWListBox* l1, vtkKWListBox* l2);
161  virtual void MoveList(vtkKWListBox* l1, vtkKWListBox* l2, const char* list);
162  virtual void ShiftItems(vtkKWListBox* l1, int down);
163  virtual void AddElement(
164  vtkKWListBox* l1, vtkKWListBox* l2, const char* element, int force);
165 
168  virtual void InvokeEllipsisCommand();
169  virtual void InvokeFinalListChangedCommand();
170 
173 
174  virtual void DisplayEllipsis();
175  virtual void RemoveEllipsis();
176 
177 private:
179  void operator=(const vtkKWListBoxToListBoxSelectionEditor&); // Not Implemented
180 };
181 
182 
183 #endif
184 
185 
186