KWWidgets
debian/tmp/usr/include/KWWidgets/vtkKWFileBrowserWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWFileBrowserWidget.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 vtkKWFileBrowserWidget - a file browser widget
15 // .SECTION Description
16 // The class assembles vtkKWFavoriteDirectoriesFrame, vtkKWDirectoryExploer,
17 // and vtkKWFileListTable widgets together and give user options to turn
18 // on/off (visible/invisible) each individual widget.
19 // .SECTION Thanks
20 // This work is part of the National Alliance for Medical Image
21 // Computing (NAMIC), funded by the National Institutes of Health
22 // through the NIH Roadmap for Medical Research, Grant U54 EB005149.
23 // Information on the National Centers for Biomedical Computing
24 // can be obtained from http://nihroadmap.nih.gov/bioinformatics.
25 // .SECTION See Also
26 // vtkKWFileBrowserDialog vtkKWDirectoryExplorer vtkKWFileListTable
27 // vtkKWFavoriteDirectoriesFrame
28 
29 #ifndef __vtkKWFileBrowserWidget_h
30 #define __vtkKWFileBrowserWidget_h
31 
32 #include "vtkKWCompositeWidget.h"
33 
36 class vtkKWFileListTable;
37 class vtkKWFrame;
38 class vtkKWSplitFrame;
39 class vtkKWFileBrowserWidgetInternals;
40 
42 {
43 public:
44  static vtkKWFileBrowserWidget* New();
46  void PrintSelf(ostream& os, vtkIndent indent);
47 
48  // Description:
49  // Open a directory.
50  // Return 1 on success, 0 otherwise
51  virtual int OpenDirectory(const char* path);
52 
53  // Description:
54  // Filter the files of the file list table by file extensions
55  // The argument is NOT a Tk format, just a simple string of extensions
56  // with space between them.
57  // Example: ".txt .text .jpg .jpeg"
58  virtual void FilterFilesByExtensions(const char* fileextensions);
59 
60  // Description:
61  // Accessor for DirectoryExplorer and FileListTable
62  vtkGetObjectMacro(DirectoryExplorer, vtkKWDirectoryExplorer);
63  vtkGetObjectMacro(FileListTable, vtkKWFileListTable);
64  vtkGetObjectMacro(FavoriteDirectoriesFrame, vtkKWFavoriteDirectoriesFrame);
65  vtkGetObjectMacro(MainFrame, vtkKWSplitFrame);
66  vtkGetObjectMacro(DirFileFrame, vtkKWSplitFrame);
67 
68  // Description:
69  // Set/Get the visibility of the directory explorer
70  virtual void SetDirectoryExplorerVisibility(int);
71  vtkBooleanMacro(DirectoryExplorerVisibility, int);
72  vtkGetMacro(DirectoryExplorerVisibility, int);
73 
74  // Description:
75  // Set/Get the visibility of the favorite directories frame
76  virtual void SetFavoriteDirectoriesFrameVisibility(int);
77  vtkBooleanMacro(FavoriteDirectoriesFrameVisibility, int);
78  vtkGetMacro(FavoriteDirectoriesFrameVisibility, int);
79 
80  // Description:
81  // Set/Get the visibility of the file list table
82  virtual void SetFileListTableVisibility(int);
83  vtkBooleanMacro(FileListTableVisibility, int);
84  vtkGetMacro(FileListTableVisibility, int);
85 
86  // Description:
87  // Set/Get if multiple selection are allowed.
88  virtual void SetMultipleSelection(int);
89  vtkBooleanMacro(MultipleSelection, int);
90  vtkGetMacro(MultipleSelection, int);
91 
92  // Description:
93  // Set/Get the foreground/background color of selected items, when
94  // in focus or out of focus.
95  vtkGetVector3Macro(SelectionForegroundColor, double);
96  virtual void SetSelectionForegroundColor(double r, double g, double b);
97  virtual void SetSelectionForegroundColor(double rgb[3])
98  { this->SetSelectionForegroundColor(rgb[0], rgb[1], rgb[2]); };
99  vtkGetVector3Macro(SelectionBackgroundColor, double);
100  virtual void SetSelectionBackgroundColor(double r, double g, double b);
101  virtual void SetSelectionBackgroundColor(double rgb[3])
102  { this->SetSelectionBackgroundColor(rgb[0], rgb[1], rgb[2]); };
103  vtkGetVector3Macro(OutOfFocusSelectionForegroundColor, double);
104  virtual void SetOutOfFocusSelectionForegroundColor(
105  double r, double g, double b);
106  virtual void SetOutOfFocusSelectionForegroundColor(double rgb[3])
107  { this->SetOutOfFocusSelectionForegroundColor(rgb[0], rgb[1], rgb[2]); };
108  vtkGetVector3Macro(OutOfFocusSelectionBackgroundColor, double);
109  virtual void SetOutOfFocusSelectionBackgroundColor(
110  double r, double g, double b);
111  virtual void SetOutOfFocusSelectionBackgroundColor(double rgb[3])
112  { this->SetOutOfFocusSelectionBackgroundColor(rgb[0], rgb[1], rgb[2]); };
113 
114  // Description:
115  // Set focus to directory explorer or file list table.
116  virtual void SetFocusToDirectoryExplorer();
117  virtual void SetFocusToFileListTable();
118 
119  // Description:
120  // Callback, do NOT use
121  // When the "Add Favorites" button is clicked in the favorite directories
122  // frame, this function will be called and a dialog will popup prompting
123  // for a name of the directory that is going to be added to the favorite
124  // directory frame.
125  virtual void AddFavoriteDirectoryCallback();
126 
127  // Description:
128  // Callback, do NOT use
129  // When a favorite button in the favorite directory frame is clicked on,
130  // navigate to the corresponding favorite directory (path is a pointer to
131  // the absolute directory path, text a pointer to the favorite button label)
132  virtual void FavoriteDirectorySelectedCallback(
133  const char* path,
134  const char* text);
135 
136  // Description:
137  // Callbacks, do NOT use
138  // Callback for the vtkKWDirectoryExplorer widget.
139  virtual void DirectoryCreatedCallback(const char* fullname);
140  virtual void DirectorySelectedCallback(const char* fullname);
141  virtual void DirectoryOpenedCallback(const char* fullname);
142  virtual void DirectoryClosedCallback(const char* fullname);
143  virtual void DirectoryDeletedCallback(const char* fullname);
144  virtual void DirectoryRenamedCallback(
145  const char* oldname,
146  const char* newname);
147 
148  // Description:
149  // Callbacks, do NOT use
150  // Callback for the vtkKWFileListTable widget.
151  virtual void FileSelectionChangedCallback(const char* fullname);
152  virtual void FileDoubleClickedCallback(const char* fullname);
153  virtual void FileRenamedCallback(
154  const char* oldname,
155  const char* newname);
156  virtual void FolderCreatedCallback(const char* filename);
157  virtual void FileDeletedCallback(const char* fullname, int isDir);
158 
159  // Description:
160  // Callback, do NOT use.
161  virtual void DirectoryTreeFocusInCallback();
162  virtual void FileTableFocusInCallback();
163  virtual void DirectoryTreeFocusOutCallback();
164  virtual void FileTableFocusOutCallback();
165 
166  // Description:
167  // Update the "enable" state of the object and its internal parts.
168  // Depending on different Ivars (this->Enabled, the application's
169  // Limited Edition Mode, etc.), the "enable" state of the object is updated
170  // and propagated to its internal parts/subwidgets. This will, for example,
171  // enable/disable parts of the widget UI, enable/disable the visibility
172  // of 3D widgets, etc.
173  virtual void UpdateEnableState();
174 
175  // Description:
176  // Request the width/height of the widget.
177  virtual void SetWidth(int);
178  virtual int GetWidth();
179  virtual void SetHeight(int);
180  virtual int GetHeight();
181 
182 protected:
185 
186  // Description:
187  // Create the widget.
188  virtual void CreateWidget();
189 
190  // Description:
191  // Pack all the widgets according to their visibility
192  virtual void Pack();
193 
194  // Description:
195  // Setup all the frames with widgets.
196  virtual void CreateFavoriteDirectoriesFrame();
197  virtual void CreateDirectoryExplorerAndFileListTableFrame();
198  virtual void CreateDirectoryExplorer();
199  virtual void CreateFileListTable();
200 
201  // Description:
202  // Function to update the selected Background/Foreground.
203  virtual void UpdateDirectorySelectionColor(int infocus = 0);
204  virtual void UpdateFileSelectionColor(int infocus = 0);
205 
206  virtual void UpdateForCurrentDirectory();
207  virtual void PropagateMultipleSelection();
208 
209  // Description:
210  // Member variable
211  // PIMPL for STL stuff.
212  vtkKWFileBrowserWidgetInternals *Internals;
213 
214  // Description:
215  // Member variable
216  // A split frame holding the favorite frame, directory frame, and
217  // file list table.
218  // Both directory frame and file list table will be in DirFileFrame, which
219  // is parented to MainFrame->Frame2.
222 
223  // Description:
224  // GUI members.
228 
229  // Description:
230  // Member variables
235 
236  // Description:
237  // Colors
238  double SelectionForegroundColor[3];
239  double SelectionBackgroundColor[3];
240  double OutOfFocusSelectionForegroundColor[3];
241  double OutOfFocusSelectionBackgroundColor[3];
242 
243 private:
244  vtkKWFileBrowserWidget(const vtkKWFileBrowserWidget&); // Not implemented
245  void operator=(const vtkKWFileBrowserWidget&); // Not implemented
246 };
247 
248 #endif