KWWidgets
|
00001 /*========================================================================= 00002 00003 Module: $RCSfile: vtkKWMultiColumnList.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 vtkKWMultiColumnList - a multi-column list 00015 // .SECTION Description 00016 // A composite widget used for displaying multi-column lists. It is a 00017 // front-end to a tablelist::tablelist. 00018 // A tablelist is a multi-column listbox, implemented as a mega-widget, 00019 // consisting of a body and a header. The body displays a list of items, one 00020 // per line. Each item is a list of elements, which are aligned in columns. 00021 // In other words, an item is the contents of a row, and an element is the 00022 // text contained in a cell. The header consists of label widgets displaying 00023 // the column titles. The labels can be used, among others, for interactive 00024 // column resizing and column-based sorting of the items. 00025 // Use vtkKWMultiColumnListWithScrollbars if you need scrollbars. 00026 // .SECTION Thanks 00027 // This work is part of the National Alliance for Medical Image 00028 // Computing (NAMIC), funded by the National Institutes of Health 00029 // through the NIH Roadmap for Medical Research, Grant U54 EB005149. 00030 // Information on the National Centers for Biomedical Computing 00031 // can be obtained from http://nihroadmap.nih.gov/bioinformatics. 00032 // .SECTION See Also 00033 // vtkKWMultiColumnListWithScrollbars 00034 00035 #ifndef __vtkKWMultiColumnList_h 00036 #define __vtkKWMultiColumnList_h 00037 00038 #include "vtkKWCoreWidget.h" 00039 00040 class vtkKWIcon; 00041 class vtkKWMultiColumnListInternals; 00042 class vtkKWCheckButton; 00043 class vtkKWComboBox; 00044 class vtkKWFrame; 00045 class vtkKWLoadSaveButton; 00046 class vtkStringArray; 00047 00048 class KWWidgets_EXPORT vtkKWMultiColumnList : public vtkKWCoreWidget 00049 { 00050 public: 00051 static vtkKWMultiColumnList* New(); 00052 vtkTypeRevisionMacro(vtkKWMultiColumnList,vtkKWCoreWidget); 00053 void PrintSelf(ostream& os, vtkIndent indent); 00054 00055 // Description: 00056 // Set/add/remove a binding to a widget, i.e. the command that is invoked 00057 // whenever the 'event' is triggered on the widget. 00058 // SetBinding will replace any old bindings, whereas AddBinding will 00059 // add the binding to the list of bindings already defined for that event. 00060 // RemoveBinding can remove a specific binding or all bindings for an event. 00061 // The 'object' argument is the object that will have the method called on 00062 // it. The 'method' argument is the name of the method to be called and any 00063 // arguments in string form. If the object is NULL, the method is still 00064 // evaluated as a simple command. 00065 virtual void SetBinding( 00066 const char *event, vtkObject *object, const char *method); 00067 virtual void SetBinding( 00068 const char *event, const char *command); 00069 virtual void AddBinding( 00070 const char *event, vtkObject *object, const char *method); 00071 virtual void AddBinding( 00072 const char *event, const char *command); 00073 virtual void RemoveBinding(const char *event); 00074 virtual void RemoveBinding( 00075 const char *event, vtkObject *object, const char *method); 00076 00077 // Description: 00078 // Set focus to this widget. 00079 virtual void Focus(); 00080 virtual int HasFocus(); 00081 00082 // Description: 00083 // Set the width (in chars) and height (in lines). 00084 // If width is set to 0, the widget will be large enough to show 00085 // all columns. If set to a different value, columns will stretch 00086 // depending on their width (see SetColumnWidth) and on the strech 00087 // parameter (see SetColumnStretchable and StretchableColumns) 00088 virtual void SetWidth(int width); 00089 virtual int GetWidth(); 00090 virtual void SetHeight(int height); 00091 virtual int GetHeight(); 00092 00093 // Description: 00094 // Set/Get the background color of the widget. 00095 virtual void GetBackgroundColor(double *r, double *g, double *b); 00096 virtual double* GetBackgroundColor(); 00097 virtual void SetBackgroundColor(double r, double g, double b); 00098 virtual void SetBackgroundColor(double rgb[3]) 00099 { this->SetBackgroundColor(rgb[0], rgb[1], rgb[2]); }; 00100 00101 // Description: 00102 // Set/Get the foreground color of the widget. 00103 virtual void GetForegroundColor(double *r, double *g, double *b); 00104 virtual double* GetForegroundColor(); 00105 virtual void SetForegroundColor(double r, double g, double b); 00106 virtual void SetForegroundColor(double rgb[3]) 00107 { this->SetForegroundColor(rgb[0], rgb[1], rgb[2]); }; 00108 00109 // Description: 00110 // Set/Get the highlight thickness, a non-negative value indicating the 00111 // width of the highlight rectangle to draw around the outside of the 00112 // widget when it has the input focus. 00113 virtual void SetHighlightThickness(int); 00114 virtual int GetHighlightThickness(); 00115 00116 // Description: 00117 // Set/Get the border width, a non-negative value indicating the width of 00118 // the 3-D border to draw around the outside of the widget (if such a border 00119 // is being drawn; the Relief option typically determines this). 00120 virtual void SetBorderWidth(int); 00121 virtual int GetBorderWidth(); 00122 00123 // Description: 00124 // Set/Get the 3-D effect desired for the widget. 00125 // The value indicates how the interior of the widget should appear 00126 // relative to its exterior. 00127 // Valid constants can be found in vtkKWOptions::ReliefType. 00128 virtual void SetRelief(int); 00129 virtual int GetRelief(); 00130 virtual void SetReliefToRaised(); 00131 virtual void SetReliefToSunken(); 00132 virtual void SetReliefToFlat(); 00133 virtual void SetReliefToRidge(); 00134 virtual void SetReliefToSolid(); 00135 virtual void SetReliefToGroove(); 00136 00137 // Description: 00138 // Insert a column just before the column given by col_index. If col_index 00139 // is equal to (or greater than) the number of columns the new column is 00140 // added to the end of the column list. The AddColumn method can be 00141 // used to add a column directly to the end of the list. 00142 // Returns the index of the column 00143 virtual int InsertColumn(int col_index, const char *title); 00144 virtual int AddColumn(const char *title); 00145 00146 // Description: 00147 // Set a column name. Most of the API in this class uses numerical indices 00148 // to refer to columns. Yet, the index of a column can change if columns 00149 // are added or removed. Assigning a unique name to a column provides a 00150 // way to refer to a column without worrying about its location. Use the 00151 // GetColumnIndexWithName() to query the index of a column given its name. 00152 // indexing is done using numerical index. 00153 // Note that the name of a column has nothing to do with its title, which 00154 // is used to label the column in the table. 00155 virtual void SetColumnName(int col_index, const char *col_name); 00156 virtual const char* GetColumnName(int col_index); 00157 virtual int GetColumnIndexWithName(const char *col_name); 00158 00159 // Description: 00160 // Get number columns. 00161 // Returns -1 on error. 00162 virtual int GetNumberOfColumns(); 00163 00164 // Description: 00165 // Adjusts the view in the tablelist so that the column is visible. 00166 virtual void SeeColumn(int col_index); 00167 00168 // Description: 00169 // Delete one or all columns in the list. 00170 virtual void DeleteColumn(int col_index); 00171 virtual void DeleteAllColumns(); 00172 00173 // Description: 00174 // Specifies a boolean value that determines whether the columns can be 00175 // moved interactively. 00176 vtkBooleanMacro(MovableColumns, int); 00177 virtual void SetMovableColumns(int); 00178 virtual int GetMovableColumns(); 00179 00180 // Description: 00181 // Specifies additional space to provide above and below each row of the 00182 // widget. 00183 virtual void SetRowSpacing(int); 00184 virtual int GetRowSpacing(); 00185 00186 // Description: 00187 // Specifies a boolean value that determines whether the columns can be 00188 // resized interactively. 00189 vtkBooleanMacro(ResizableColumns, int); 00190 virtual void SetResizableColumns(int); 00191 virtual int GetResizableColumns(); 00192 00193 // Description: 00194 // Specifies a boolean value that determines whether the columns are to be 00195 // separated with borders. 00196 vtkBooleanMacro(ColumnSeparatorsVisibility, int); 00197 virtual void SetColumnSeparatorsVisibility(int); 00198 virtual int GetColumnSeparatorsVisibility(); 00199 00200 // Description: 00201 // Specifies a boolean value that determines whether the columns labels 00202 // are to be shown. 00203 vtkBooleanMacro(ColumnLabelsVisibility, int); 00204 virtual void SetColumnLabelsVisibility(int); 00205 virtual int GetColumnLabelsVisibility(); 00206 00207 // Description: 00208 // Set/Get the column label background and foreground colors. 00209 virtual void GetColumnLabelBackgroundColor(double *r, double *g, double *b); 00210 virtual double* GetColumnLabelBackgroundColor(); 00211 virtual void SetColumnLabelBackgroundColor(double r, double g, double b); 00212 virtual void SetColumnLabelBackgroundColor(double rgb[3]) 00213 { this->SetColumnLabelBackgroundColor(rgb[0], rgb[1], rgb[2]); }; 00214 virtual void GetColumnLabelForegroundColor(double *r, double *g, double *b); 00215 virtual double* GetColumnLabelForegroundColor(); 00216 virtual void SetColumnLabelForegroundColor(double r, double g, double b); 00217 virtual void SetColumnLabelForegroundColor(double rgb[3]) 00218 { this->SetColumnLabelForegroundColor(rgb[0], rgb[1], rgb[2]); }; 00219 00220 // Description: 00221 // Set/Get the column title. 00222 virtual void SetColumnTitle(int col_index, const char*); 00223 virtual const char* GetColumnTitle(int col_index); 00224 00225 // Description: 00226 // Set/Get the width and maxwidth of a column. 00227 // Both must be a number. A positive value specifies the column's 00228 // width in average-size characters of the widget's font. If width is 00229 // negative, its absolute value is interpreted as a column width in pixels. 00230 // Finally, a value of zero (default) specifies that the column's width is 00231 // to be made just large enough to hold all the elements in the column, 00232 // including its header 00233 virtual void SetColumnWidth(int col_index, int width); 00234 virtual int GetColumnWidth(int col_index); 00235 virtual void SetColumnMaximumWidth(int col_index, int width); 00236 virtual int GetColumnMaximumWidth(int col_index); 00237 00238 // Description: 00239 // Specifies a boolean value that determines whether a specific column 00240 // can be stretched or not to fill the empty space on the right of 00241 // the table that might appear when it is resized or the width is 00242 // set to a larger value (see SetWidth). 00243 // Use StretchableColumns to set all columns to be stretchable. 00244 virtual void SetColumnStretchable(int col_index, int flag); 00245 virtual void ColumnStretchableOn(int col_index) 00246 { this->SetColumnStretchable(col_index, 1); }; 00247 virtual void ColumnStretchableOff(int col_index) 00248 { this->SetColumnStretchable(col_index, 0); }; 00249 virtual int GetColumnStretchable(int col_index); 00250 vtkBooleanMacro(StretchableColumns, int); 00251 virtual void SetStretchableColumns(int); 00252 00253 // Description: 00254 // Set/Get the alignment of a column, or the aligment of the column 00255 // label specifically. 00256 // The alignment must be one of left (default), right, or center. 00257 //BTX 00258 enum 00259 { 00260 ColumnAlignmentLeft = 0, 00261 ColumnAlignmentRight, 00262 ColumnAlignmentCenter, 00263 ColumnAlignmentUnknown 00264 }; 00265 //ETX 00266 virtual int GetColumnAlignment(int col_index); 00267 virtual void SetColumnAlignment(int col_index, int align); 00268 virtual void SetColumnAlignmentToLeft(int col_index) 00269 { this->SetColumnAlignment( 00270 col_index, vtkKWMultiColumnList::ColumnAlignmentLeft); }; 00271 virtual void SetColumnAlignmentToRight(int col_index) 00272 { this->SetColumnAlignment( 00273 col_index, vtkKWMultiColumnList::ColumnAlignmentRight); }; 00274 virtual void SetColumnAlignmentToCenter(int col_index) 00275 { this->SetColumnAlignment( 00276 col_index, vtkKWMultiColumnList::ColumnAlignmentCenter); }; 00277 virtual int GetColumnLabelAlignment(int col_index); 00278 virtual void SetColumnLabelAlignment(int col_index, int align); 00279 virtual void SetColumnLabelAlignmentToLeft(int col_index) 00280 { this->SetColumnLabelAlignment( 00281 col_index, vtkKWMultiColumnList::ColumnAlignmentLeft); }; 00282 virtual void SetColumnLabelAlignmentToRight(int col_index) 00283 { this->SetColumnLabelAlignment( 00284 col_index, vtkKWMultiColumnList::ColumnAlignmentRight); }; 00285 virtual void SetColumnLabelAlignmentToCenter(int col_index) 00286 { this->SetColumnLabelAlignment( 00287 col_index, vtkKWMultiColumnList::ColumnAlignmentCenter); }; 00288 00289 // Description: 00290 // Sort by a given column. 00291 // The GetLastSortedColumn returns the numerical index of the column by 00292 // which the items were last sorted with the aid of the SortByColumn or -1 if 00293 // they haven't been sorted at all. 00294 //BTX 00295 enum 00296 { 00297 SortByIncreasingOrder = 0, 00298 SortByDecreasingOrder, 00299 SortByUnknownOrder 00300 }; 00301 //ETX 00302 virtual void SortByColumn(int col_index, int order); 00303 virtual void SortByColumnIncreasingOrder(int col_index) 00304 { this->SortByColumn( 00305 col_index, vtkKWMultiColumnList::SortByIncreasingOrder); }; 00306 virtual void SortByColumnDecreasingOrder(int col_index) 00307 { this->SortByColumn( 00308 col_index, vtkKWMultiColumnList::SortByDecreasingOrder); }; 00309 virtual int GetLastSortedColumn(); 00310 virtual int GetLastSortedOrder(); 00311 00312 // Description: 00313 // Set/Get each column sort mode 00314 //BTX 00315 enum 00316 { 00317 SortModeAscii = 0, 00318 SortModeDictionary, 00319 SortModeInteger, 00320 SortModeReal, 00321 SortModeCommand, 00322 SortModeUnknown 00323 }; 00324 //ETX 00325 virtual int GetColumnSortMode(int col_index); 00326 virtual void SetColumnSortMode(int col_index, int mode); 00327 virtual void SetColumnSortModeToAscii(int col_index) 00328 { this->SetColumnSortMode( 00329 col_index, vtkKWMultiColumnList::SortModeAscii); }; 00330 virtual void SetColumnSortModeToDictionary(int col_index) 00331 { this->SetColumnSortMode( 00332 col_index, vtkKWMultiColumnList::SortModeDictionary); }; 00333 virtual void SetColumnSortModeToInteger(int col_index) 00334 { this->SetColumnSortMode( 00335 col_index, vtkKWMultiColumnList::SortModeInteger); }; 00336 virtual void SetColumnSortModeToReal(int col_index) 00337 { this->SetColumnSortMode( 00338 col_index, vtkKWMultiColumnList::SortModeReal); }; 00339 00340 // Description: 00341 // Specifies a boolean value that determines whether the widget should place 00342 // an arrow indicating the sort order into the header label of the column 00343 // being sorted 00344 vtkBooleanMacro(SortArrowVisibility, int); 00345 virtual void SetSortArrowVisibility(int); 00346 virtual int GetSortArrowVisibility(); 00347 00348 // Description: 00349 // Set/Get if the background color of the sorted column should be set 00350 // automatically to SortedColumnBackgroundColor. 00351 // Warning: when a different column is sorted, the background color of the 00352 // previously sorted column is cleared (i.e., this column has no background 00353 // color anymore). 00354 vtkBooleanMacro(ColorSortedColumn, int); 00355 vtkGetMacro(ColorSortedColumn, int); 00356 virtual void SetColorSortedColumn(int); 00357 00358 // Description: 00359 // Set/Get the background color of the sorted column, when ColorSortedColumn 00360 // is set to On. 00361 vtkGetVector3Macro(SortedColumnBackgroundColor,double); 00362 virtual void SetSortedColumnBackgroundColor( 00363 double r, double g, double b); 00364 virtual void SetSortedColumnBackgroundColor(double rgb[3]) 00365 { this->SetSortedColumnBackgroundColor(rgb[0], rgb[1], rgb[2]); }; 00366 00367 // Description: 00368 // Set/Get the type of the temporary embedded widget to be used for 00369 // interactive editing of the contents of the given column's cells. 00370 // It can be one of entry (which is the default), spinbox or checkbutton 00371 // at the moment. 00372 // This can be set at the cell level too (see SetCellEditWindow). 00373 // Note that this setting controls the widget used for *editing*, not for 00374 // display. The cell contents is still displayed using whatever text (see 00375 // SetCellText), image (see SetCellImage) or custom window (see 00376 // SetCellWindowCommand) is defined at the cell level. Check the 00377 // SetCellWindowCommandToCheckButton or SetCellWindowCommandToColorButton 00378 // methods for more advanced display *and* editing features. 00379 //BTX 00380 enum 00381 { 00382 ColumnEditWindowEntry = 0, 00383 ColumnEditWindowCheckButton, 00384 ColumnEditWindowSpinBox, 00385 ColumnEditWindowUnknown 00386 }; 00387 //ETX 00388 virtual int GetColumnEditWindow(int col_index); 00389 virtual void SetColumnEditWindow(int col_index, int arg); 00390 virtual void SetColumnEditWindowToEntry(int col_index) 00391 { this->SetColumnEditWindow( 00392 col_index, vtkKWMultiColumnList::ColumnEditWindowEntry); }; 00393 virtual void SetColumnEditWindowToCheckButton(int col_index) 00394 { this->SetColumnEditWindow( 00395 col_index, vtkKWMultiColumnList::ColumnEditWindowCheckButton); }; 00396 virtual void SetColumnEditWindowToSpinBox(int col_index) 00397 { this->SetColumnEditWindow( 00398 col_index, vtkKWMultiColumnList::ColumnEditWindowSpinBox); }; 00399 00400 // Description: 00401 // Specifies a boolean value that determines whether a specific column 00402 // can be resized interactively. 00403 virtual void SetColumnResizable(int col_index, int flag); 00404 virtual void ColumnResizableOn(int col_index) 00405 { this->SetColumnResizable(col_index, 1); }; 00406 virtual void ColumnResizableOff(int col_index) 00407 { this->SetColumnResizable(col_index, 0); }; 00408 virtual int GetColumnResizable(int col_index); 00409 00410 // Description: 00411 // Specifies a boolean value that determines whether a specific column 00412 // can be edited interactively. 00413 virtual void SetColumnEditable(int col_index, int flag); 00414 virtual void ColumnEditableOn(int col_index) 00415 { this->SetColumnEditable(col_index, 1); }; 00416 virtual void ColumnEditableOff(int col_index) 00417 { this->SetColumnEditable(col_index, 0); }; 00418 virtual int GetColumnEditable(int col_index); 00419 00420 // Description: 00421 // Specifies a boolean value that determines whether a specific column 00422 // is visible or not. 00423 virtual void SetColumnVisibility(int col_index, int flag); 00424 virtual void ColumnVisibilityOn(int col_index) 00425 { this->SetColumnVisibility(col_index, 1); }; 00426 virtual void ColumnVisibilityOff(int col_index) 00427 { this->SetColumnVisibility(col_index, 0); }; 00428 virtual int GetColumnVisibility(int col_index); 00429 00430 // Description: 00431 // Set/Get an arbitrary column attribute 00432 // (warning, Get returns a pointer to the Tcl buffer). 00433 virtual int HasColumnAttribute( 00434 int col_index, const char *name); 00435 virtual void SetColumnAttribute( 00436 int col_index, const char *name, const char *value); 00437 virtual const char* GetColumnAttribute( 00438 int col_index, const char *name); 00439 virtual void SetColumnAttributeAsInt( 00440 int col_index, const char *name, int value); 00441 virtual int GetColumnAttributeAsInt( 00442 int col_index, const char *name); 00443 00444 // Description: 00445 // Set/Get a column background and foreground colors 00446 virtual void GetColumnBackgroundColor( 00447 int col_index, double *r, double *g, double *b); 00448 virtual double* GetColumnBackgroundColor(int col_index); 00449 virtual void SetColumnBackgroundColor( 00450 int col_index, double r, double g, double b); 00451 virtual void SetColumnBackgroundColor(int col_index, double rgb[3]) 00452 { this->SetColumnBackgroundColor(col_index, rgb[0], rgb[1], rgb[2]); }; 00453 virtual void ClearColumnBackgroundColor(int col_index); 00454 virtual void GetColumnForegroundColor( 00455 int col_index, double *r, double *g, double *b); 00456 virtual double* GetColumnForegroundColor(int col_index); 00457 virtual void SetColumnForegroundColor( 00458 int col_index, double r, double g, double b); 00459 virtual void SetColumnForegroundColor(int col_index, double rgb[3]) 00460 { this->SetColumnForegroundColor(col_index, rgb[0], rgb[1], rgb[2]); }; 00461 00462 // Description: 00463 // Specifies an image to display in the label of a column 00464 virtual void SetColumnLabelImage(int col_index, const char *); 00465 virtual void SetColumnLabelImageToIcon(int col_index, vtkKWIcon *icon); 00466 virtual void SetColumnLabelImageToPredefinedIcon( 00467 int col_index, int icon_index); 00468 virtual void SetColumnLabelImageToPixels( 00469 int col_index, 00470 const unsigned char *pixels, int width, int height, int pixel_size, 00471 unsigned long buffer_length = 0); 00472 00473 // Description: 00474 // Specifies the command to be invoked when displaying the contents of a 00475 // cell within a column col_index or adding them to the selection when the 00476 // latter is being exported. If command is a nonempty string, then it is 00477 // automatically concatenated with the cell's text, the resulting script is 00478 // evaluated in the global scope, and the return value is displayed in the 00479 // cell or added to the selection instead of the original data. For example, 00480 // a cell may hold a data value in seconds, but the format command could 00481 // be set to display the cell value as a formatted data (say "%Y-%m-%d"). 00482 // Notice that this option is only used for preparing the text to be 00483 // displayed or returned when exporting the selection, and does not affect 00484 // the internal cell contents. In the case of the above example, this will 00485 // make it possible to sort the items very easily by time, with a second's 00486 // precision, even if their visual representation only contains the year, 00487 // month, and day. 00488 // Also check SetColumnFormatCommandToEmptyOutput or 00489 // SetColumnFormatCommandToEmptyOutputIfWindowCommand, which can be used 00490 // to set the ColumnFormatCommand to return an empty output. 00491 // The 'object' argument is the object that will have the method called on 00492 // it. The 'method' argument is the name of the method to be called and any 00493 // arguments in string form. If the object is NULL, the method is still 00494 // evaluated as a simple command. 00495 // The following parameters are also passed to the command: 00496 // - the current cell's text for that col_index column: const char* 00497 // The following output is expected from the command: 00498 // - the text to be displayed in the cell instead: const char* 00499 virtual void SetColumnFormatCommand(int col_index, 00500 vtkObject *object, const char *method); 00501 00502 // Description: 00503 // Specifies a command to be used for the comparison of the items when 00504 // invoking the sort subcommand of the Tcl command associated with the 00505 // specified column of the tablelist widget. 00506 // To compare two items (viewed as lists of cell contents 00507 // within one row each) during the sort operation, the command is 00508 // automatically concatenated with the two items and the resulting script 00509 // is evaluated. The script should return an integer less than, equal to, or 00510 // greater than zero if the first item is to be considered less than, equal 00511 // to, or greater than the second, respectively. 00512 // The 'object' argument is the object that will have the method called on 00513 // it. The 'method' argument is the name of the method to be called and any 00514 // arguments in string form. If the object is NULL, the method is still 00515 // evaluated as a simple command. 00516 // The following parameters are also passed to the command: 00517 // - the contents of the first item/cell to compare: const char* 00518 // - the contents of the second item/cell to compare: const char* 00519 // The following output is expected from the command: 00520 // - the result of the comparison: int 00521 virtual void SetColumnSortCommand(int col_index, 00522 vtkObject *object, const char *method); 00523 00524 // Description: 00525 // Specifies the command to be invoked when displaying the contents of a 00526 // cell within a column col_index. 00527 // This is a convenience method to set the ColumnFormatCommand to return an 00528 // empty output. This comes in handy if only images or embedded windows are 00529 // to be displayed in a column but the texts associated with the cells may 00530 // not simply be empty strings because they are needed for other purposes 00531 // (like sorting or editing). In such cases, a command returning an empty 00532 // string can be used, thus making sure that the textual information 00533 // contained in that column remains hidden. This method can be used just 00534 // for that instead of SetColumnFormatCommand. 00535 // SetColumnFormatCommandToEmptyOutputIfWindowCommand is another variant 00536 // of that will only return an empty ouput if the cell's window command 00537 // is set (see SetCellWindowCommand methods). 00538 virtual void SetColumnFormatCommandToEmptyOutput(int col_index); 00539 virtual void SetColumnFormatCommandToEmptyOutputIfWindowCommand(int col_index); 00540 00541 // Description: 00542 // Specifies a command to associate with the widget. This command is 00543 // typically invoked when the "Delete" Key is pressed, but this will only 00544 // invoke the 'method' passed in. This 'method' of the 'object' needs to 00545 // decide what to do with this <KeyPress-Delete> event. For examples, if 00546 // user wants to go ahead and delete, the 'object' needs to find out the 00547 // selected rows/cells and delete them using API of this class. 00548 // The 'object' argument is the object that will have the method called on 00549 // it. The 'method' argument is the name of the method to be called and any 00550 // arguments in string form. If the object is NULL, the method is still 00551 // evaluated as a simple command. 00552 virtual void SetKeyPressDeleteCommand(vtkObject *object, 00553 const char *method); 00554 00555 // Description: 00556 // Specifies a boolean value that determines whether the rows can be 00557 // moved interactively. 00558 vtkBooleanMacro(MovableRows, int); 00559 virtual void SetMovableRows(int); 00560 virtual int GetMovableRows(); 00561 00562 // Description: 00563 // Add a row(rows) at the end, or insert it(them) at a given location. 00564 virtual void AddRow(); 00565 virtual void AddRows(int num_rows); 00566 virtual void InsertRow(int row_index); 00567 virtual void InsertRows(int row_index, int num_rows); 00568 00569 // Description: 00570 // Get number of rows. 00571 // Returns -1 on error. 00572 virtual int GetNumberOfRows(); 00573 00574 // Description: 00575 // Adjusts the view in the tablelist so that the row is visible. 00576 virtual void SeeRow(int row_index); 00577 00578 // Description: 00579 // Delete one or all rows in the list. 00580 virtual void DeleteRow(int row_index); 00581 virtual void DeleteAllRows(); 00582 00583 // Description: 00584 // Find a specific text in a specific column and delete the corresponding 00585 // row if found. 00586 virtual void FindAndDeleteRow( 00587 int look_for_col_index, const char *look_for_text); 00588 00589 // Description: 00590 // Set/Get an arbitrary row attribute 00591 // (warning, Get returns a pointer to the Tcl buffer). 00592 virtual int HasRowAttribute( 00593 int row_index, const char *name); 00594 virtual void SetRowAttribute( 00595 int row_index, const char *name, const char *value); 00596 virtual const char* GetRowAttribute( 00597 int row_index, const char *name); 00598 virtual void SetRowAttributeAsInt( 00599 int row_index, const char *name, int value); 00600 virtual int GetRowAttributeAsInt( 00601 int row_index, const char *name); 00602 00603 // Description: 00604 // Set/Get a row background and foreground colors 00605 virtual void GetRowBackgroundColor( 00606 int row_index, double *r, double *g, double *b); 00607 virtual double* GetRowBackgroundColor(int row_index); 00608 virtual void SetRowBackgroundColor( 00609 int row_index, double r, double g, double b); 00610 virtual void SetRowBackgroundColor(int row_index, double rgb[3]) 00611 { this->SetRowBackgroundColor(row_index, rgb[0], rgb[1], rgb[2]); }; 00612 virtual void ClearRowBackgroundColor(int col_index); 00613 virtual void GetRowForegroundColor( 00614 int row_index, double *r, double *g, double *b); 00615 virtual double* GetRowForegroundColor(int row_index); 00616 virtual void SetRowForegroundColor( 00617 int row_index, double r, double g, double b); 00618 virtual void SetRowForegroundColor(int row_index, double rgb[3]) 00619 { this->SetRowForegroundColor(row_index, rgb[0], rgb[1], rgb[2]); }; 00620 00621 // Description: 00622 // Set/Get the stripe background and foreground colors, and strip height 00623 // Specifies the colors to use when displaying the items belonging to a 00624 // stripe. Each stripe is composed of the same number StripeHeight of 00625 // consecutive items. The first stripeHeight items are "normal" ones; they 00626 // are followed by a stripe composed of the next StripeHeight items, which 00627 // in turn is followed by the same number of "normal" items, and so on. 00628 // The default value is an empty string, indicating that the stripes will 00629 // inherit the colors of the widget. The Stripe colors have a higher 00630 // priority than the column colors, but a lower priority than the 00631 // row or cell color. 00632 virtual void GetStripeBackgroundColor(double *r, double *g, double *b); 00633 virtual double* GetStripeBackgroundColor(); 00634 virtual void SetStripeBackgroundColor(double r, double g, double b); 00635 virtual void SetStripeBackgroundColor(double rgb[3]) 00636 { this->SetStripeBackgroundColor(rgb[0], rgb[1], rgb[2]); }; 00637 virtual void ClearStripeBackgroundColor(); 00638 virtual void GetStripeForegroundColor(double *r, double *g, double *b); 00639 virtual double* GetStripeForegroundColor(); 00640 virtual void SetStripeForegroundColor(double r, double g, double b); 00641 virtual void SetStripeForegroundColor(double rgb[3]) 00642 { this->SetStripeForegroundColor(rgb[0], rgb[1], rgb[2]); }; 00643 virtual void SetStripeHeight(int height); 00644 virtual int GetStripeHeight(); 00645 00646 // Description: 00647 // Specifies a boolean value that determines whether a specific row 00648 // can be selected interactively. 00649 virtual void SetRowSelectable(int row_index, int flag); 00650 virtual void RowSelectableOn(int row_index) 00651 { this->SetRowSelectable(row_index, 1); }; 00652 virtual void RowSelectableOff(int row_index) 00653 { this->SetRowSelectable(row_index, 0); }; 00654 virtual int GetRowSelectable(int row_index); 00655 00656 // Description: 00657 // Activate a row. 00658 virtual void ActivateRow(int row_index); 00659 00660 // Description: 00661 // Set/Get contents of cell (warning, Get returns a pointer to the Tcl 00662 // buffer, copy the resulting string ASAP). 00663 // SetCellText is the fast version and assumes the cell already exists! 00664 // InsertCellText will insert one (or more) full row(s) if there is no 00665 // row/cell at that location (using InsertRow). 00666 // Note that InsertCellTextAsDouble will insert a number using the 00667 // printf-style %f format type. Use InsertCellTextAsFormattedDouble to 00668 // restrict the number of digits (i.e. if size = 5, format will be %.5g) 00669 virtual void InsertCellText( 00670 int row_index, int col_index, const char *text); 00671 virtual void InsertCellTextAsInt( 00672 int row_index, int col_index, int value); 00673 virtual void InsertCellTextAsDouble( 00674 int row_index, int col_index, double value); 00675 virtual void InsertCellTextAsFormattedDouble( 00676 int row_index, int col_index, double value, int size); 00677 virtual void SetCellText( 00678 int row_index, int col_index, const char *text); 00679 virtual const char* GetCellText(int row_index, int col_index); 00680 virtual void SetCellTextAsInt( 00681 int row_index, int col_index, int value); 00682 virtual int GetCellTextAsInt(int row_index, int col_index); 00683 virtual void SetCellTextAsDouble( 00684 int row_index, int col_index, double value); 00685 virtual void SetCellTextAsFormattedDouble( 00686 int row_index, int col_index, double value, int size); 00687 virtual double GetCellTextAsDouble(int row_index, int col_index); 00688 00689 // Description: 00690 // Set/Get an arbitrary cell attribute 00691 // (warning, Get returns a pointer to the Tcl buffer). 00692 virtual int HasCellAttribute( 00693 int row_index, int col_index, const char *name); 00694 virtual void SetCellAttribute( 00695 int row_index, int col_index, const char *name, const char *value); 00696 virtual const char* GetCellAttribute( 00697 int row_index, int col_index, const char *name); 00698 virtual void SetCellAttributeAsInt( 00699 int row_index, int col_index, const char *name, int value); 00700 virtual int GetCellAttributeAsInt( 00701 int row_index, int col_index, const char *name); 00702 00703 // Description: 00704 // Convenience function to Set/Get the "enabled" attribute 00705 // on a cell. Note that this doesn't automatically enabled or disabled 00706 // the contents of a cell but embedded window should check if this 00707 // attribute was set to create themselves enabled or disabled automatically. 00708 // SetCellEnabledAttribute will call RefreshCellWithWindowCommand on the 00709 // cell to give a chance to an embedded window to enable/disable itself. 00710 virtual void SetCellEnabledAttribute( 00711 int row_index, int col_index, int value); 00712 virtual int GetCellEnabledAttribute( 00713 int row_index, int col_index); 00714 virtual int HasCellEnabledAttribute( 00715 int row_index, int col_index); 00716 00717 // Description: 00718 // Set the contents of a full row or full column. 00719 virtual void InsertRowText(int row_index, const char *text); 00720 virtual void InsertColumnText(int col_index, const char *text); 00721 00722 // Description: 00723 // Set the contents of the cell given a column index only and a text to look 00724 // for in a specific column. If that text is found, its row index is used to 00725 // set the contents of the cell, if it is not found, a new row is inserted. 00726 virtual void FindAndInsertCellText( 00727 int look_for_col_index, const char *look_for_text , 00728 int col_index, const char *text); 00729 00730 // Description: 00731 // Activate a cell. 00732 virtual void ActivateCell(int row_index, int col_index); 00733 00734 // Description: 00735 // Adjusts the view in the tablelist so that the cell is visible. 00736 virtual void SeeCell(int row_index, int col_index); 00737 00738 // Description: 00739 // Set/Get a cell background and foreground colors 00740 virtual void GetCellBackgroundColor( 00741 int row_index, int col_index, double *r, double *g, double *b); 00742 virtual double* GetCellBackgroundColor(int row_index, int col_index); 00743 virtual void SetCellBackgroundColor( 00744 int row_index, int col_index, double r, double g, double b); 00745 virtual void SetCellBackgroundColor( 00746 int row_index, int col_index, double rgb[3]) 00747 { this->SetCellBackgroundColor( 00748 row_index, col_index, rgb[0], rgb[1], rgb[2]); }; 00749 virtual void ClearCellBackgroundColor(int row_index, int col_index); 00750 virtual void GetCellForegroundColor( 00751 int row_index, int col_index, double *r, double *g, double *b); 00752 virtual double* GetCellForegroundColor(int row_index, int col_index); 00753 virtual void SetCellForegroundColor( 00754 int row_index, int col_index, double r, double g, double b); 00755 virtual void SetCellForegroundColor( 00756 int row_index, int col_index, double rgb[3]) 00757 { this->SetCellForegroundColor( 00758 row_index, col_index, rgb[0], rgb[1], rgb[2]); }; 00759 00760 // Description: 00761 // Get the cell background or foreground color 00762 // In order of priority: 00763 // - if not selected, color is: cell > row > stripe > column > widget. 00764 // - if selected, color is: cell > row > column > widget. 00765 virtual void GetCellCurrentBackgroundColor( 00766 int row_index, int col_index, double *r, double *g, double *b); 00767 virtual double* GetCellCurrentBackgroundColor(int row_index, int col_index); 00768 virtual void GetCellCurrentForegroundColor( 00769 int row_index, int col_index, double *r, double *g, double *b); 00770 virtual double* GetCellCurrentForegroundColor(int row_index, int col_index); 00771 00772 // Description: 00773 // Specifies a boolean value that determines whether a specific row 00774 // can be edited interactively. 00775 virtual void SetCellEditable(int row_index, int col_index, int flag); 00776 virtual void CellEditableOn(int row_index, int col_index) 00777 { this->SetCellEditable(row_index, col_index, 1); }; 00778 virtual void CellEditableOff(int row_index, int col_index) 00779 { this->SetCellEditable(row_index, col_index, 0); }; 00780 virtual int GetCellEditable(int row_index, int col_index); 00781 00782 // Description: 00783 // Specifies an image to display in the cell. Both text and image can 00784 // be displayed simultaneously. If a WindowCommand is specified for that 00785 // cell, it overrides the image. 00786 // An attempt is made to blend the image with the current cell background 00787 // color (as returned by GetCellBackgroundColor). But since sorting 00788 // a column, or inserting new rows, can change the position of the cell 00789 // in a stripe (see SetStripeBackgroundColor), it is best to: 00790 // - use images that do not have an alpha component, or 00791 // - refresh the image periodically (each time a row is added/removed) 00792 // also check SetPotentialCellColorsChangedCommand and 00793 // ScheduleRefreshAllCellsWithWindowCommand or 00794 // ScheduleRefreshAllRowsWithWindowCommand. 00795 virtual void SetCellImage(int row_index, int col_index, const char *); 00796 virtual void SetCellImageToIcon( 00797 int row_index, int col_index, vtkKWIcon *icon); 00798 virtual void SetCellImageToPredefinedIcon( 00799 int row_index, int col_index, int icon_index); 00800 virtual void SetCellImageToPixels( 00801 int row_index, int col_index, 00802 const unsigned char *pixels, int width, int height, int pixel_size, 00803 unsigned long buffer_length = 0); 00804 virtual const char* GetCellImage(int row_index, int col_index); 00805 00806 // Description: 00807 // Set/Get the type of the temporary embedded widget to be used for 00808 // interactive editing of the contents of the cell. 00809 // This option overrides the one with the same name for the column 00810 // containing the given cell, and may have the same values as its 00811 // column-related counterpart (see SetColumnEditWindow). 00812 // It can be one of entry (which is the default), spinbox or checkbutton 00813 // at the moment. 00814 // Note that this setting controls the widget used for *editing*, not for 00815 // display. The cell contents is still displayed using whatever text (see 00816 // SetCellText), image (see SetCellImage) or custom window (see 00817 // SetCellWindowCommand) is defined at the cell level. Check the 00818 // SetCellWindowCommandToCheckButton or SetCellWindowCommandToColorButton 00819 // methods for more advanced display *and* editing features. 00820 //BTX 00821 enum 00822 { 00823 CellEditWindowEntry = 0, 00824 CellEditWindowCheckButton, 00825 CellEditWindowSpinBox, 00826 CellEditWindowUnknown 00827 }; 00828 //ETX 00829 virtual int GetCellEditWindow(int row_index, int col_index); 00830 virtual void SetCellEditWindow(int row_index, int col_index, int arg); 00831 virtual void SetCellEditWindowToEntry(int row_index, int col_index) 00832 { this->SetCellEditWindow( 00833 row_index, col_index, vtkKWMultiColumnList::CellEditWindowEntry); }; 00834 virtual void SetCellEditWindowToCheckButton(int row_index, int col_index) 00835 { this->SetCellEditWindow( 00836 row_index,col_index, vtkKWMultiColumnList::CellEditWindowCheckButton);}; 00837 virtual void SetCellEditWindowToSpinBox(int row_index, int col_index) 00838 { this->SetCellEditWindow( 00839 row_index, col_index, vtkKWMultiColumnList::CellEditWindowSpinBox); }; 00840 00841 // Description: 00842 // Specifies a command to create the window (i.e. widget) to be embedded 00843 // into the cell located at (row_index, col_index). 00844 // The command is automatically concatenated with the name of the tablelist 00845 // widget, the cell's row and column indices, as well as the path name of 00846 // the embedded window to be created, and the resulting script is evaluated 00847 // in the global scope. This path name can be used to create your own 00848 // vtkKWWidget by assigning the widget's name manually using vtkKWWidget's 00849 // SetWidgetName method. 00850 // In most case, you should attempt to set the widget's background and 00851 // foreground colors to match the cell's background and foreground colors 00852 // (which can be retrieved using GetCellCurrentBackgroundColor and 00853 // GetCellCurrentForegroundColor). 00854 // Since the background and foreground colors of the cell change dynamically 00855 // depending on the sorting order and the selected rows, you should set 00856 // the SetPotentialCellColorsChangedCommand to this object's own 00857 // ScheduleRefreshColorsOfAllCellsWithWindowCommand method so that each time 00858 // the cell colors change, this user-defined widget is refreshed. 00859 // Also, if you have set a text contents in the same cell (using SetCellText) 00860 // you may want to hide it automatically using 00861 // SetColumnFormatCommandToEmptyOutput or 00862 // SetColumnFormatCommandToEmptyOutputIfWindowCommand. 00863 // The 'object' argument is the object that will have the method called on 00864 // it. The 'method' argument is the name of the method to be called and any 00865 // arguments in string form. If the object is NULL, the method is still 00866 // evaluated as a simple command. 00867 // The following parameters are also passed to the command: 00868 // - the name of the internal tablelist widget (to be ignored): const char* 00869 // - the cell location, i.e. its row and column indices: int, int 00870 // - the path name of the embedded window/widget to be created: const char* 00871 virtual void SetCellWindowCommand( 00872 int row_index, int col_index, vtkObject *object, const char *method); 00873 00874 // Description: 00875 // The SetCellWindowCommandToCheckButton method is a very convenient 00876 // way to automatically display a checkbutton in the cell. The selected 00877 // state of the button is interpreted directly from the text in the cell 00878 // (as set by SetCellText for example), and thus should be either 0 or 1. 00879 // The editable flag of the cell is automatically set to 0, do 00880 // not change it manually using SetCellEditable. 00881 // When the checkbutton selected state changes, the contents of 00882 // the cell is updated automatically (to 0 or 1). Note that the 00883 // EditEndCommand and CellUpdatedCommand are handled the same way. 00884 // Check the SetCellWindowCommand method for more information. 00885 // Important: note that you can not set the Command for this checkbutton 00886 // (doing so will prevent CellUpdatedCommand from being called for example 00887 // or the cell contents to be updated). Also note that a new checkbutton 00888 // instance will be created each time you sort its column (by design of 00889 // the third-party tablelist Tk widget used under the hood). 00890 // WARNING: do NOT use GetCellWindowAsCheckButton and set any value on it; 00891 // anytime the table is sorted, a new checkbutton is recreated automatically 00892 // by calling the corresponding CellWindowCommand; therefore, any value 00893 // you may have set will be lost. The widget itself is just a representation 00894 // of the value inside a cell (here, a boolean). 00895 virtual void SetCellWindowCommandToCheckButton(int row_index, int col_index); 00896 virtual vtkKWCheckButton *GetCellWindowAsCheckButton( 00897 int row_index, int col_index); 00898 00899 // Description: 00900 // The SetCellWindowCommandToComboBox is a convenience method to 00901 // add a list of items in a combo box within one of the cells. For instance, 00902 // similar items may be grouped and added in a pull down list. This also 00903 // prevents overcrowding the Multi-column list by having things hidden in a 00904 // combo box. 00905 // WARNING: do NOT use GetCellWindowAsComboBox and set any value on it; 00906 // anytime the table is sorted, a new combo box is recreated automatically 00907 // by calling the corresponding CellWindowCommand; therefore, any value 00908 // you may have set will be lost. The widget itself is just a representation 00909 // of the value inside a cell. 00910 virtual void SetCellWindowCommandToComboBox(int row_index, int col_index); 00911 virtual void SetCellWindowCommandToComboBoxWithValues( 00912 int row_index, int col_index, int nb_values, const char *values[]); 00913 virtual void SetCellWindowCommandToComboBoxWithValuesAsArray( 00914 int row_index, int col_index, vtkStringArray *values); 00915 virtual void SetCellWindowCommandToComboBoxWithValuesAsSemiColonSeparated( 00916 int row_index, int col_index, const char *values); 00917 virtual vtkKWComboBox *GetCellWindowAsComboBox(int row_index, int col_index); 00918 virtual void SetCellWindowComboBoxValues( 00919 int row_index, int col_index, int nb_values, const char *values[]); 00920 virtual void SetCellWindowComboBoxValuesAsArray( 00921 int row_index, int col_index, vtkStringArray *values); 00922 virtual void SetCellWindowComboBoxValuesAsSemiColonSeparated( 00923 int row_index, int col_index, const char *values); 00924 00925 // Description: 00926 // The SetCellWindowCommandToColorButton method is a convenient 00927 // way to automatically display a color button in the cell. The color of 00928 // the button is interpreted directly from the text in the cell 00929 // (as set by SetCellText for example), provided it is a space separated 00930 // list of 3 normalized floating point numbers representing the 00931 // red, green and blue components of the color (ex: "1.0 0.2 0.6"). 00932 // When the color button is edited (if the column or cell is 00933 // made editable), a color dialog pops up so that the user can pick 00934 // a new color. The contents of the cell is updated automatically 00935 // with the new color value, as a similar space separated list of 00936 // normalized R, G, B values. Note that the EditStartCommand, 00937 // EditEndCommand and CellUpdatedCommand are handled the same way. 00938 // Check the SetCellWindowCommand method for more information. 00939 // Set UseBalloonHelpStringInCellColorButton to On to set the color button 00940 // balloon help string automatically (it will be set to display the 00941 // color in different color space). Off by default for performance reasons. 00942 // WARNING: do NOT use GetCellWindowAsFrame and set any value on it; 00943 // anytime the table is sorted, a new frame is recreated automatically 00944 // by calling the corresponding CellWindowCommand; therefore, any value 00945 // you may have set will be lost. The widget itself is just a representation 00946 // of the value inside a cell (here, a color). 00947 virtual void SetCellWindowCommandToColorButton(int row_index, int col_index); 00948 virtual vtkKWFrame* GetCellWindowAsFrame(int row_index, int col_index); 00949 vtkBooleanMacro(UseBalloonHelpStringInCellColorButton, int); 00950 vtkGetMacro(UseBalloonHelpStringInCellColorButton, int); 00951 virtual void SetUseBalloonHelpStringInCellColorButton(int); 00952 00953 // Description: 00954 // The SetCellWindowCommandToPickDirectoryButton is a convenience method 00955 // to automatically display a LoadSaveButton with ChooseDirectoryOn 00956 // in the cell. The selected directory of the button is interpreted 00957 // directly from the text in the cell, as set by SetCellText for example. 00958 // WARNING: do NOT use GetCellWindowAsPickDirectoryButton and set any value 00959 // on it; anytime the table is sorted, a new directory button is recreated 00960 // automatically by calling the corresponding CellWindowCommand; therefore, 00961 // any value you may have set will be lost. The widget itself is just a 00962 // representation of the value inside a cell (here, a filename). 00963 virtual void SetCellWindowCommandToPickDirectoryButton( 00964 int row_index, int col_index); 00965 virtual vtkKWLoadSaveButton* GetCellWindowAsPickDirectoryButton( 00966 int row_index, int col_index); 00967 00968 // Description: 00969 // Specifies a command to be invoked when the window embedded into the cell 00970 // located at (row_index, col_index) is destroyed. It is automatically 00971 // concatenated the same parameter as the SetCellWindowCommand method that 00972 // was used to create the embedded window. 00973 // The 'object' argument is the object that will have the method called on 00974 // it. The 'method' argument is the name of the method to be called and any 00975 // arguments in string form. If the object is NULL, the method is still 00976 // evaluated as a simple command. 00977 // The following parameters are also passed to the command: 00978 // - the name of the internal tablelist widget (to be ignored): const char* 00979 // - the cell location, i.e. row and column indices: int, int 00980 // - the path name of the embedded window/widget to be created: const char* 00981 virtual void SetCellWindowDestroyCommand( 00982 int row_index, int col_index, vtkObject *object, const char *method); 00983 00984 // Description: 00985 // The SetCellWindowDestroyCommandToRemoveChild method is a convenient 00986 // way to automatically set the CellWindowDestroyCommand to a callback that 00987 // will remove the child widget that matches the name of the Tk widget about 00988 // to be destroyed. This is very useful if the SetCellWindowCommand 00989 // is set to a callback that actually allocates a new vtkKWWidget object. 00990 // That way, each time the cell is about to be destroyed, it is 00991 // cleanly de-allocated first (by setting its Parent to NULL). 00992 virtual void SetCellWindowDestroyCommandToRemoveChild( 00993 int row_index, int col_index); 00994 00995 // Description: 00996 // Force a cell (or all cells, or all rows in a column) for which a 00997 // WindowCommand has been defined to recreate its dynamic content. It does 00998 // so by setting the WindowCommand to NULL, than setting it to its previous 00999 // value (per author's suggestion). 01000 // The ScheduleRefreshAllCellsWithWindowCommand method will 01001 // schedule RefreshAllCellsWithWindowCommand when the application is idle. 01002 // The ScheduleRefreshAllRowsWithWindowCommand method will 01003 // schedule RefreshAllRowsWithWindowCommand when the application is idle. 01004 virtual void RefreshCellWithWindowCommand(int row_index, int col_index); 01005 virtual void RefreshAllCellsWithWindowCommand(); 01006 virtual void ScheduleRefreshAllCellsWithWindowCommand(); 01007 virtual void RefreshAllRowsWithWindowCommand(int col); 01008 virtual void ScheduleRefreshAllRowsWithWindowCommand(int col); 01009 virtual void RefreshEnabledStateOfAllCellsWithWindowCommand(); 01010 virtual void ScheduleRefreshEnabledStateOfAllCellsWithWindowCommand(); 01011 01012 // Description: 01013 // Force a cell (or all cells) for which a WindowCommand has been defined 01014 // to set the background and foreground colors to the cell current 01015 // background and foreground colors. 01016 // It does so by tyring to safe-down-cast the widget inside that cell into 01017 // a vtkKWCoreWidget and set its background color to the color returned 01018 // by GetCellCurrentBackgroundColor and its foreground color to the color 01019 // returned by GetCellCurrentForegroundColor. It then performs the same 01020 // for the first level children of the widget inside that cell. 01021 // This can be useful when the cell contents is an image with an alpha 01022 // channel (transparency), or a user-defined dynamic widget 01023 // (see SetCellWindowCommand and SetPotentialCellColorsChangedCommand). 01024 // The ScheduleRefreshColorsOfAllCellsWithWindowCommand method will 01025 // schedule RefreshColorsOfAllCellsWithWindowCommand when the application 01026 // is idle: this is especially useful in conjonction with the 01027 // SetPotentialCellColorsChangedCommand method. 01028 virtual void RefreshColorsOfCellWithWindowCommand( 01029 int row_index, int col_index); 01030 virtual void RefreshColorsOfAllCellsWithWindowCommand(); 01031 virtual void ScheduleRefreshColorsOfAllCellsWithWindowCommand(); 01032 01033 // Description: 01034 // Retrieve the path of the window contained in the cell as created by 01035 // the WindowCommand. 01036 virtual const char* GetCellWindowWidgetName(int row_index, int col_index); 01037 01038 // Description: 01039 // Once a user-defined dynamic widget is created by the WindowCommand, 01040 // clicking on it is likely *not* to trigger the same interactive behavior 01041 // as clicking on a regular cell (i.e., clicking on the widget will not 01042 // select the row or cell for example). This can be a good thing if 01043 // clicking on the widget is meant to be intercepted by the widget to 01044 // trigger a different behaviour, but in many other cases, one would want 01045 // the interaction bindings to remain the same and consistent for all rows. 01046 // In order to do so, the common widget row bindings have to be added to the 01047 // widget the was just created. To do so, call AddBindingsToWidget, either on 01048 // the Tk widget name, or on avtkKWWidget that may have been used to wrap 01049 // around that Tk widget name. 01050 // A complex widget can be made of several other sub-widgets that need 01051 // the bindings to be passed on too. Use AddBindingsToWidgetAndChildren 01052 // to pass the bindings to a widget and its chilren automatically (or 01053 // call AddBindingsToWidget manually on each sub-widgets). 01054 virtual void AddBindingsToWidgetName(const char *widget_name); 01055 virtual void AddBindingsToWidget(vtkKWWidget *widget); 01056 virtual void AddBindingsToWidgetAndChildren(vtkKWWidget *widget); 01057 01058 // Description: 01059 // Find contents of cell in all table or single column 01060 // One FindCellText signature returns 1 if found, 0 otherwise, and 01061 // assign the position to row_index, col_index. The other FindCellText 01062 // method returns a pointer to an array of 2 ints (row and col index) if 01063 // found, NULL otherwise. 01064 // FindCellTextInColumn return the row index of the cell in the col_index 01065 // column if found, or -1 otherwise. 01066 virtual int FindCellText(const char *text, int *row_index, int *col_index); 01067 virtual int* FindCellText(const char *text); 01068 virtual int FindCellTextInColumn(int col_index, const char *text); 01069 virtual int FindCellTextAsIntInColumn(int col_index, int value); 01070 01071 // Description: 01072 // Edit cell (or cancel edit). If supported, edit cell contents interactively 01073 // CancelEditing attempts to cancel the current interactive editing. 01074 // FinishEditing attempts to terminate the current interactive editing. 01075 virtual void EditCell(int row_index, int col_index); 01076 virtual void CancelEditing(); 01077 virtual void FinishEditing(); 01078 01079 // Description: 01080 // Set/Get the selection background and foreground colors. 01081 virtual void GetSelectionBackgroundColor(double *r, double *g, double *b); 01082 virtual double* GetSelectionBackgroundColor(); 01083 virtual void SetSelectionBackgroundColor(double r, double g, double b); 01084 virtual void SetSelectionBackgroundColor(double rgb[3]) 01085 { this->SetSelectionBackgroundColor(rgb[0], rgb[1], rgb[2]); }; 01086 virtual void GetSelectionForegroundColor(double *r, double *g, double *b); 01087 virtual double* GetSelectionForegroundColor(); 01088 virtual void SetSelectionForegroundColor(double r, double g, double b); 01089 virtual void SetSelectionForegroundColor(double rgb[3]) 01090 { this->SetSelectionForegroundColor(rgb[0], rgb[1], rgb[2]); }; 01091 01092 // Description: 01093 // Set/Get the selection background and foreground colors for a specific 01094 // column. 01095 virtual void GetColumnSelectionBackgroundColor( 01096 int col_index, double *r, double *g, double *b); 01097 virtual double* GetColumnSelectionBackgroundColor(int col_index); 01098 virtual void SetColumnSelectionBackgroundColor( 01099 int col_index, double r, double g, double b); 01100 virtual void SetColumnSelectionBackgroundColor(int col_index, double rgb[3]) 01101 { this->SetColumnSelectionBackgroundColor( 01102 col_index, rgb[0], rgb[1], rgb[2]); }; 01103 virtual void GetColumnSelectionForegroundColor( 01104 int col_index, double *r, double *g, double *b); 01105 virtual double* GetColumnSelectionForegroundColor(int col_index); 01106 virtual void SetColumnSelectionForegroundColor( 01107 int col_index, double r, double g, double b); 01108 virtual void SetColumnSelectionForegroundColor(int col_index, double rgb[3]) 01109 { this->SetColumnSelectionForegroundColor( 01110 col_index, rgb[0], rgb[1], rgb[2]); }; 01111 01112 // Description: 01113 // Set/Get the selection background and foreground colors for a specific 01114 // row. 01115 virtual void GetRowSelectionBackgroundColor( 01116 int row_index, double *r, double *g, double *b); 01117 virtual double* GetRowSelectionBackgroundColor(int row_index); 01118 virtual void SetRowSelectionBackgroundColor( 01119 int row_index, double r, double g, double b); 01120 virtual void SetRowSelectionBackgroundColor(int row_index, double rgb[3]) 01121 { this->SetRowSelectionBackgroundColor( 01122 row_index, rgb[0], rgb[1], rgb[2]); }; 01123 virtual void GetRowSelectionForegroundColor( 01124 int row_index, double *r, double *g, double *b); 01125 virtual double* GetRowSelectionForegroundColor(int row_index); 01126 virtual void SetRowSelectionForegroundColor( 01127 int row_index, double r, double g, double b); 01128 virtual void SetRowSelectionForegroundColor(int row_index, double rgb[3]) 01129 { this->SetRowSelectionForegroundColor( 01130 row_index, rgb[0], rgb[1], rgb[2]); }; 01131 01132 // Description: 01133 // Set/Get the selection background and foreground colors for a specific 01134 // cell. 01135 virtual void GetCellSelectionBackgroundColor( 01136 int row_index, int col_index, double *r, double *g, double *b); 01137 virtual double* GetCellSelectionBackgroundColor( 01138 int row_index, int col_index); 01139 virtual void SetCellSelectionBackgroundColor( 01140 int row_index, int col_index, double r, double g, double b); 01141 virtual void SetCellSelectionBackgroundColor( 01142 int row_index, int col_index, double rgb[3]) 01143 { this->SetCellSelectionBackgroundColor( 01144 row_index, col_index, rgb[0], rgb[1], rgb[2]); }; 01145 virtual void GetCellSelectionForegroundColor( 01146 int row_index, int col_index, double *r, double *g, double *b); 01147 virtual double* GetCellSelectionForegroundColor( 01148 int row_index, int col_index); 01149 virtual void SetCellSelectionForegroundColor( 01150 int row_index, int col_index, double r, double g, double b); 01151 virtual void SetCellSelectionForegroundColor( 01152 int row_index, int col_index, double rgb[3]) 01153 { this->SetCellSelectionForegroundColor( 01154 row_index, col_index, rgb[0], rgb[1], rgb[2]); }; 01155 01156 // Description: 01157 // Set/Get the one of several styles for manipulating the selection. 01158 // Valid constants can be found in vtkKWOptions::SelectionModeType. 01159 // Default is browse. 01160 virtual void SetSelectionMode(int); 01161 virtual int GetSelectionMode(); 01162 virtual void SetSelectionModeToSingle(); 01163 virtual void SetSelectionModeToBrowse(); 01164 virtual void SetSelectionModeToMultiple(); 01165 virtual void SetSelectionModeToExtended(); 01166 01167 // Description: 01168 // Set/Get the selection type. 01169 // Specifies one of two selection types for the tablelist widget: row or 01170 // cell. If the selection type is row then the default bindings will select 01171 // and deselect entire items, and the whole row having the location cursor 01172 // will be displayed as active when the tablelist has the keyboard focus. 01173 // If the selection type is cell then the default bindings will select and 01174 // deselect individual elements, and the single cell having the location 01175 // cursor will be displayed as active when the tablelist has the keyboard 01176 // focus. 01177 //BTX 01178 enum 01179 { 01180 SelectionTypeRow, 01181 SelectionTypeCell, 01182 SelectionTypeUnknown 01183 }; 01184 //ETX 01185 virtual int GetSelectionType(); 01186 virtual void SetSelectionType(int align); 01187 virtual void SetSelectionTypeToRow() 01188 { this->SetSelectionType(vtkKWMultiColumnList::SelectionTypeRow); }; 01189 virtual void SetSelectionTypeToCell() 01190 { this->SetSelectionType(vtkKWMultiColumnList::SelectionTypeCell); }; 01191 01192 // Description: 01193 // Select/deselect a row, or single row (any other selection is cleared). 01194 virtual void SelectRow(int row_index); 01195 virtual void DeselectRow(int row_index); 01196 virtual void SelectSingleRow(int row_index); 01197 01198 // Description: 01199 // Check if row is selected (i.e. any element in the row is selected) 01200 virtual int IsRowSelected(int row_index); 01201 01202 // Description: 01203 // Get the number of selected rows, and retrieve their indices (it is up 01204 // to the caller to provide a large enough buffer). Both returns the 01205 // number of selected rows. 01206 virtual int GetNumberOfSelectedRows(); 01207 virtual int GetSelectedRows(int *indices); 01208 01209 // Description: 01210 // Get index of first selected row. 01211 // Returns -1 on error. 01212 virtual int GetIndexOfFirstSelectedRow(); 01213 01214 // Description: 01215 // Select/deselect a cell, or single cell (any other selection is cleared). 01216 virtual void SelectCell(int row_index, int col_index); 01217 virtual void DeselectCell(int row_index, int col_index); 01218 virtual void SelectSingleCell(int row_index, int col_index); 01219 01220 // Description: 01221 // Check if cell is selected 01222 virtual int IsCellSelected(int row_index, int col_index); 01223 01224 // Description: 01225 // Get the number of selected cells, and retrieve their indices (it is up 01226 // to the caller to provide large enough buffers). Both returns the 01227 // number of selected cells. 01228 virtual int GetNumberOfSelectedCells(); 01229 virtual int GetSelectedCells(int *row_indices, int *col_indices); 01230 01231 // Description: 01232 // Clear selection 01233 virtual void ClearSelection(); 01234 01235 // Description: 01236 // Specifies whether or not a selection in the widget should also be the X 01237 // selection. If the selection is exported, then selecting in the widget 01238 // deselects the current X selection, selecting outside the widget deselects 01239 // any widget selection, and the widget will respond to selection retrieval 01240 // requests when it has a selection. 01241 virtual void SetExportSelection(int); 01242 virtual int GetExportSelection(); 01243 vtkBooleanMacro(ExportSelection, int); 01244 01245 // Description: 01246 // Specifies a command to be invoked when an element is selected/deselected 01247 // in the widget. Re-selecting an element will trigger this command too. 01248 // If one want to be notified only when the selection has *changed* (the 01249 // number of selected/deselected items has changed), use the 01250 // SelectionChangedCommand command instead. 01251 // The 'object' argument is the object that will have the method called on 01252 // it. The 'method' argument is the name of the method to be called and any 01253 // arguments in string form. If the object is NULL, the method is still 01254 // evaluated as a simple command. 01255 virtual void SetSelectionCommand(vtkObject *object, const char *method); 01256 01257 // Description: 01258 // Specifies a command to be invoked when the selection has *changed*. This 01259 // command will *not* be invoked when an item is re-selected (i.e. it 01260 // was already selected when the user clicked on it again). To be notified 01261 // when any selection event occurs, use SelectionCommand instead. 01262 // The 'object' argument is the object that will have the method called on 01263 // it. The 'method' argument is the name of the method to be called and any 01264 // arguments in string form. If the object is NULL, the method is still 01265 // evaluated as a simple command. 01266 virtual void SetSelectionChangedCommand( 01267 vtkObject *object, const char *method); 01268 01269 // Description: 01270 // Specifies a command to be invoked when any change is made that 01271 // can potentially affect the background color of a cell (selecting 01272 // a cell, sorting a column, adding/removing rows, etc). 01273 // This is useful if a user-defined dynamic widget created in a cell 01274 // (using the SetCellWindowCommand methods) 01275 // is setting its own background color to match the background color 01276 // of a cell (using GetCellCurrentBackgroundColor). In that case, 01277 // just set this command to RefreshColorsOfAllCellsWithWindowCommand. 01278 // The 'object' argument is the object that will have the method called on 01279 // it. The 'method' argument is the name of the method to be called and any 01280 // arguments in string form. If the object is NULL, the method is still 01281 // evaluated as a simple command. 01282 virtual void SetPotentialCellColorsChangedCommand( 01283 vtkObject *object, const char *method); 01284 01285 // Description: 01286 // Specifies a command to be invoked when a column has been sorted. 01287 // The 'object' argument is the object that will have the method called on 01288 // it. The 'method' argument is the name of the method to be called and any 01289 // arguments in string form. If the object is NULL, the method is still 01290 // evaluated as a simple command. 01291 virtual void SetColumnSortedCommand( 01292 vtkObject *object, const char *method); 01293 01294 // Description: 01295 // Specifies a command to be invoked when a row has been moved. 01296 // The 'object' argument is the object that will have the method called on 01297 // it. The 'method' argument is the name of the method to be called and any 01298 // arguments in string form. If the object is NULL, the method is still 01299 // evaluated as a simple command. 01300 virtual void SetRowMovedCommand( 01301 vtkObject *object, const char *method); 01302 01303 // Description: 01304 // Specifies a command to be invoked when the number of rows changed. 01305 // The 'object' argument is the object that will have the method called on 01306 // it. The 'method' argument is the name of the method to be called and any 01307 // arguments in string form. If the object is NULL, the method is still 01308 // evaluated as a simple command. 01309 virtual void SetNumberOfRowsChangedCommand( 01310 vtkObject *object, const char *method); 01311 01312 // Description: 01313 // Specifies a command to be invoked when the interactive editing of a cell's 01314 // contents is started. The command is automatically concatenated with 01315 // the cell's row and column indices, as well as the text displayed in 01316 // the cell, the resulting script is evaluated in the global scope, and 01317 // the return value becomes the initial contents of the temporary 01318 // embedded widget used for the editing. 01319 // The next step (validation) is handled by SetEditEndCommand (if any) 01320 // The 'object' argument is the object that will have the method called on 01321 // it. The 'method' argument is the name of the method to be called and any 01322 // arguments in string form. If the object is NULL, the method is still 01323 // evaluated as a simple command. 01324 // The following parameters are also passed to the command: 01325 // - the cell location, i.e. its row and column indices: int, int 01326 // - the current cell's text: const char* 01327 // The following output is expected from the command: 01328 // - the initial contents of the widget used for editing: const char* 01329 virtual void SetEditStartCommand(vtkObject *object, const char *method); 01330 01331 // Description: 01332 // Specifies a command to be invoked on normal termination of the 01333 // interactive editing of a cell's contents if the final text of the 01334 // temporary embedded widget used for the editing is different from its 01335 // initial one. The command is automatically concatenated with the 01336 // cell's row and column indices, as well as the final contents of the edit 01337 // window, the resulting script is evaluated in the global scope, and the 01338 // return value becomes the cell's new contents after destroying the 01339 // temporary embedded widget. The main purpose of this script is to perform 01340 // a final validation of the edit window's contents and eventually reject 01341 // the input by calling the RejectInput() method. Another purpose of this 01342 // command is to convert the edit window's text to the cell's new internal 01343 // contents, which is necessary if, due to the SetColumnFormatCommand option 01344 // the cell's internal value is different from its external representation. 01345 // The next step (updating) is handled by SetCellUpdatedCommand (if any) 01346 // The 'object' argument is the object that will have the method called on 01347 // it. The 'method' argument is the name of the method to be called and any 01348 // arguments in string form. If the object is NULL, the method is still 01349 // evaluated as a simple command. 01350 // The following parameters are also passed to the command: 01351 // - the cell location, i.e. its row and column indices: int, int 01352 // - the final contents of the edit window: const char* 01353 // The following output is expected from the command: 01354 // - the cell's new contents: const char* 01355 virtual void SetEditEndCommand(vtkObject *object, const char *method); 01356 01357 // Description: 01358 // If invoked from within EditEndCommand, this method prevents the 01359 // termination of the interactive editing of the contents of a cell. It 01360 // enables you to reject the widget's text during the final validation of the 01361 // string intended to become the new cell contents. 01362 virtual void RejectInput(); 01363 01364 // Description: 01365 // Specifies a command to be invoked when a cell contents has been 01366 // successfully updated after editing it. The command is automatically 01367 // concatenated with the cell's row and column indices, as well as the 01368 // new contents of the cell. The main purpose of this script is to let 01369 // external/third-party applications/objects retrieve the new cell contents 01370 // and update their own internal values. 01371 // The 'object' argument is the object that will have the method called on 01372 // it. The 'method' argument is the name of the method to be called and any 01373 // arguments in string form. If the object is NULL, the method is still 01374 // evaluated as a simple command. 01375 // The following parameters are also passed to the command: 01376 // - the cell location, i.e. its row and column indices: int, int 01377 // - the cell's new contents: const char* 01378 virtual void SetCellUpdatedCommand(vtkObject *object, const char *method); 01379 01380 // Description: 01381 // Specifies a command to be invoked when mouse button 1 is pressed over one 01382 // of the header labels and later released over the same label. When the 01383 // <ButtonRelease-1> event occurs, the command is automatically 01384 // concatenated with the name of the tablelist widget and the column index 01385 // of the respective label, and the resulting script is evaluated in the 01386 // global scope. 01387 // The 'object' argument is the object that will have the method called on 01388 // it. The 'method' argument is the name of the method to be called and any 01389 // arguments in string form. If the object is NULL, the method is still 01390 // evaluated as a simple command. 01391 // The following parameters are also passed to the command: 01392 // - the name of the internal tablelist widget (to be ignored): const char* 01393 // - the column index of the label: int 01394 virtual void SetLabelCommand(vtkObject *object, const char *method); 01395 01396 // Description: 01397 // Specifies a command to be used for the comparison of the items when 01398 // invoking the sort subcommand of the Tcl command associated with the 01399 // tablelist widget. To compare two items (viewed as lists of cell contents 01400 // within one row each) during the sort operation, the command is 01401 // automatically concatenated with the two items and the resulting script 01402 // is evaluated. The script should return an integer less than, equal to, or 01403 // greater than zero if the first item is to be considered less than, equal 01404 // to, or greater than the second, respectively. 01405 // The 'object' argument is the object that will have the method called on 01406 // it. The 'method' argument is the name of the method to be called and any 01407 // arguments in string form. If the object is NULL, the method is still 01408 // evaluated as a simple command. 01409 // The following parameters are also passed to the command: 01410 // - the contents of the first item/cell to compare: const char* 01411 // - the contents of the second item/cell to compare: const char* 01412 // The following output is expected from the command: 01413 // - the result of the comparison: int 01414 virtual void SetSortCommand(vtkObject *object, const char *method); 01415 01416 // Description: 01417 // Specifies a command to be invoked when the user right-click on a cell. 01418 // The 'object' argument is the object that will have the method called on 01419 // it. The 'method' argument is the name of the method to be called and any 01420 // arguments in string form. If the object is NULL, the method is still 01421 // evaluated as a simple command. 01422 // The following parameters are also passed to the command: 01423 // - the cell location, i.e. its row and column indices: int, int 01424 // - the pointer (x, y) absolute location the click occured at: int, int 01425 virtual void SetRightClickCommand(vtkObject *object, const char *method); 01426 01427 // Description: 01428 // The command is invoked when the user double-clicks on any uneditable 01429 // cell of the listbox. The command is not invoked on a double click on 01430 // an editable cell. 01431 // The 'object' argument is the object that will have the method called on 01432 // it. The 'method' argument is the name of the method to be called and any 01433 // arguments in string form. If the object is NULL, the method is still 01434 // evaluated as a simple command. 01435 virtual void SetUneditableCellDoubleClickCommand( 01436 vtkObject *object, const char *method); 01437 01438 // Description: 01439 // Update the "enable" state of the object and its internal parts. 01440 // Depending on different Ivars (this->Enabled, the application's 01441 // Limited Edition Mode, etc.), the "enable" state of the object is updated 01442 // and propagated to its internal parts/subwidgets. This will, for example, 01443 // enable/disable parts of the widget UI, enable/disable the visibility 01444 // of 3D widgets, etc. 01445 virtual void UpdateEnableState(); 01446 01447 // Description: 01448 // Events. The SelectionChangedEvent is triggered when the selection is 01449 // changed (see SetSelectionCommand for more details). 01450 // The CellUpdatedEvent is triggered whenever a cell is updated, i.e. 01451 // when InvokeCellUpdatedCommand is called. The following parameters are 01452 // also passed as client data for CellUpdatedEvent: 01453 // - the cell location, i.e. its row and column indices: int, int 01454 // - the cell's new contents: const char* 01455 // Note that given the heterogeneous nature of types passed as client data, 01456 // you should treat it as an array of void*[3], each one a pointer to 01457 // the parameter (i.e., &int, &int, &const char*). 01458 //BTX 01459 enum 01460 { 01461 SelectionChangedEvent = 10000, 01462 NumberOfRowsChangedEvent, 01463 CellUpdatedEvent 01464 }; 01465 //ETX 01466 01467 // Description: 01468 // Callbacks. Internal, do not use. 01469 virtual void SelectionCallback(); 01470 virtual void CellWindowDestroyRemoveChildCallback( 01471 const char*, int, int, const char*); 01472 virtual void CellUpdatedCallback(); 01473 virtual void UneditableCellDoubleClickCallback(); 01474 virtual const char* EditStartCallback( 01475 const char *widget, int row, int col, const char *text); 01476 virtual const char* EditEndCallback( 01477 const char *widget, int row, int col, const char *text); 01478 virtual void CellWindowCommandToCheckButtonCreateCallback( 01479 const char*, int, int, const char*); 01480 virtual void CellWindowCommandToCheckButtonSelectCallback( 01481 vtkKWWidget*, int, int, int); 01482 virtual void CellWindowCommandToComboBoxCreateCallback( 01483 const char *values, const char*, int, int, const char*); 01484 virtual void CellWindowCommandToComboBoxValueCallback( 01485 vtkKWWidget*, int, int, const char *); 01486 virtual void CellWindowCommandToColorButtonCallback( 01487 const char*, int, int, const char*); 01488 virtual void CellWindowCommandToPickDirectoryButtonCallback( 01489 const char*, int, int, const char*); 01490 virtual void CellWindowCommandToPickDirectoryButtonChangeCallback( 01491 vtkKWWidget*, int, int); 01492 virtual const char* ColumnFormatCommandToEmptyOutputIfWindowCommandCallback( 01493 vtkKWWidget*, const char *); 01494 virtual void ColumnSortedCallback(); 01495 virtual void ColumnMovedCallback(); 01496 virtual void RowMovedCallback(); 01497 virtual void RightClickCallback( 01498 const char *w, int x, int y, int root_x, int root_y); 01499 virtual void RefreshColorsOfAllCellsWithWindowCommandCallback(); 01500 virtual void RefreshAllCellsWithWindowCommandCallback(); 01501 virtual void RefreshEnabledStateOfAllCellsWithWindowCommandCallback(); 01502 virtual void RefreshAllRowsWithWindowCommandCallback(int col); 01503 virtual void KeyPressDeleteCallback(); 01504 01505 protected: 01506 vtkKWMultiColumnList(); 01507 ~vtkKWMultiColumnList(); 01508 01509 // Description: 01510 // Create the widget. 01511 virtual void CreateWidget(); 01512 01513 char *KeyPressDeleteCommand; 01514 void InvokeKeyPressDeleteCommand(); 01515 01516 char *EditStartCommand; 01517 const char* InvokeEditStartCommand(int row, int col, const char *text); 01518 01519 char *EditEndCommand; 01520 const char* InvokeEditEndCommand(int row, int col, const char *text); 01521 01522 char *CellUpdatedCommand; 01523 void InvokeCellUpdatedCommand(int row, int col, const char *text); 01524 01525 char *SelectionCommand; 01526 virtual void InvokeSelectionCommand(); 01527 01528 char *SelectionChangedCommand; 01529 virtual void InvokeSelectionChangedCommand(); 01530 01531 char *PotentialCellColorsChangedCommand; 01532 virtual void InvokePotentialCellColorsChangedCommand(); 01533 01534 char *ColumnSortedCommand; 01535 void InvokeColumnSortedCommand(); 01536 01537 char *RowMovedCommand; 01538 void InvokeRowMovedCommand(); 01539 01540 char *NumberOfRowsChangedCommand; 01541 void InvokeNumberOfRowsChangedCommand(); 01542 01543 char *RightClickCommand; 01544 void InvokeRightClickCommand(int row, int col, int x, int y); 01545 01546 char *UneditableCellDoubleClickCommand; 01547 virtual void InvokeUneditableCellDoubleClickCommand(); 01548 01549 // Description: 01550 // Called when the number of rows/columns changed 01551 virtual void NumberOfRowsChanged(); 01552 virtual void NumberOfColumnsChanged(); 01553 01554 // Description: 01555 // Set/Get a column configuration option (ex: "-bg") 01556 virtual int SetColumnConfigurationOption( 01557 int col_index, const char* option, const char *value); 01558 virtual int HasColumnConfigurationOption( 01559 int col_index, const char* option); 01560 virtual const char* GetColumnConfigurationOption( 01561 int col_index, const char* option); 01562 virtual int GetColumnConfigurationOptionAsInt( 01563 int col_index, const char* option); 01564 virtual int SetColumnConfigurationOptionAsInt( 01565 int col_index, const char* option, int value); 01566 virtual void SetColumnConfigurationOptionAsText( 01567 int col_index, const char *option, const char *value); 01568 virtual const char* GetColumnConfigurationOptionAsText( 01569 int col_index, const char *option); 01570 01571 // Description: 01572 // Set/Get a row configuration option (ex: "-bg") 01573 virtual int SetRowConfigurationOption( 01574 int row_index, const char* option, const char *value); 01575 virtual int HasRowConfigurationOption( 01576 int row_index, const char* option); 01577 virtual const char* GetRowConfigurationOption( 01578 int row_index, const char* option); 01579 virtual int GetRowConfigurationOptionAsInt( 01580 int row_index, const char* option); 01581 virtual int SetRowConfigurationOptionAsInt( 01582 int row_index, const char* option, int value); 01583 01584 // Description: 01585 // Set/Get a cell configuration option (ex: "-bg") 01586 virtual int SetCellConfigurationOption( 01587 int row_index, int col_index, const char* option, const char *value); 01588 virtual int HasCellConfigurationOption( 01589 int row_index, int col_index, const char* option); 01590 virtual const char* GetCellConfigurationOption( 01591 int row_index, int col_index, const char* option); 01592 virtual int GetCellConfigurationOptionAsInt( 01593 int row_index, int col_index, const char* option); 01594 virtual int SetCellConfigurationOptionAsInt( 01595 int row_index, int col_index, const char* option, int value); 01596 virtual double GetCellConfigurationOptionAsDouble( 01597 int row_index, int col_index, const char* option); 01598 virtual int SetCellConfigurationOptionAsDouble( 01599 int row_index, int col_index, const char* option, double value); 01600 virtual int SetCellConfigurationOptionAsFormattedDouble( 01601 int row_index, int col_index, const char* option, double value, int size); 01602 virtual int SetCellConfigurationOptionAsText( 01603 int row_index, int col_index, const char *option, const char *value); 01604 virtual const char* GetCellConfigurationOptionAsText( 01605 int row_index, int col_index, const char *option); 01606 virtual void ReportErrorOnSetCellConfigurationOption( 01607 int row_index, int col_index, const char* option, const char *res); 01608 01609 // PIMPL Encapsulation for STL containers 01610 //BTX 01611 vtkKWMultiColumnListInternals *Internals; 01612 //ETX 01613 01614 // Description: 01615 // Check if the selection has changed and invoke the corresponding command 01616 virtual void HasSelectionChanged(); 01617 01618 // Description: 01619 // Find cell at relative coordinate x, y 01620 virtual int FindCellAtRelativeCoordinates( 01621 int x, int y, int *row_index, int *col_index); 01622 01623 // Description: 01624 // Color of the sorted column. 01625 int ColorSortedColumn; 01626 double SortedColumnBackgroundColor[3]; 01627 virtual void UpdateSortedColumnBackgroundColor(); 01628 01629 // Description: 01630 // Remove all the window destroy commands. 01631 virtual void RemoveAllWindowDestroyCommandFromCells(); 01632 01633 // Description: 01634 // Add/Remove some interaction bindings 01635 virtual void AddInteractionBindings(); 01636 virtual void RemoveInteractionBindings(); 01637 01638 // Description: 01639 // Manage the column name to index cache 01640 virtual void SetColumnNameToIndexCacheEntry( 01641 const char *col_name, int col_index); 01642 virtual int GetColumnNameToIndexCacheEntry(const char *col_name); 01643 virtual void DeleteColumnNameToIndexCacheEntry(const char *col_name); 01644 virtual void InvalidateColumnNameToIndexCache(); 01645 01646 // Description: 01647 // Manage the column name to visibility cache 01648 virtual void SetColumnIndexToVisibilityCacheEntry( 01649 int col_index, int vis); 01650 virtual int GetColumnIndexToVisibilityCacheEntry(int col_index); 01651 virtual void InvalidateColumnIndexToVisibilityCache(); 01652 01653 int UseBalloonHelpStringInCellColorButton; 01654 01655 private: 01656 vtkKWMultiColumnList(const vtkKWMultiColumnList&); // Not implemented 01657 void operator=(const vtkKWMultiColumnList&); // Not implemented 01658 }; 01659 01660 #endif