/usr/include/KWWidgets/vtkKWWindowBase.h is in libkwwidgets1-dev 1.0.0~cvs20100930-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | /*=========================================================================
Module: $RCSfile: vtkKWWindowBase.h,v $
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkKWWindowBase - a window superclass
// .SECTION Description
// This class represents a top level window with a menu bar, a status
// line and a main central frame.
#ifndef __vtkKWWindowBase_h
#define __vtkKWWindowBase_h
#include "vtkKWTopLevel.h"
class vtkKWFrame;
class vtkKWLabel;
class vtkKWMenu;
class vtkKWMostRecentFilesManager;
class vtkKWKeyBindingsManager;
class vtkKWProgressGauge;
class vtkKWSeparator;
class vtkKWToolbar;
class vtkKWToolbarSet;
class KWWidgets_EXPORT vtkKWWindowBase : public vtkKWTopLevel
{
public:
static vtkKWWindowBase* New();
vtkTypeRevisionMacro(vtkKWWindowBase,vtkKWTopLevel);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Close this window, possibly prompting the user.
// Note that the current vtkKWApplication implementation will
// exit the application if no more windows are open.
// Return 1 if the window closed successfully, 0 otherwise (for example,
// if some dialogs are still up, or the user did not confirm, etc).
virtual int Close();
// Description:
// Set/Get if a confirmation dialog should be displayed before a
// window is closed. Default to false.
vtkSetMacro(PromptBeforeClose, int);
vtkGetMacro(PromptBeforeClose, int);
vtkBooleanMacro(PromptBeforeClose, int);
// Description:
// Load and evaluate a Tcl based script.
// If called without an argument it will open a file dialog.
// This implementation basically forwards the call to
// vtkKWApplication::LoadScript.
virtual void LoadScript();
virtual void LoadScript(const char *filename);
// Description:
// The extension used in LoadScript. Default is .tcl.
vtkSetStringMacro(ScriptExtension);
vtkGetStringMacro(ScriptExtension);
// Description:
// The type name used in LoadScript. Default is Tcl.
vtkSetStringMacro(ScriptType);
vtkGetStringMacro(ScriptType);
// Description:
// Set the text for the status bar of this window.
virtual void SetStatusText(const char *);
virtual const char *GetStatusText();
// Description:
// Set the error/warning icon in the tray.
// Note that if StatusFrameVisibility is Off, you may want to move the
// tray frame to a different position (say, in a toolbar), using
// the SetTrayFramePosition() method.
//BTX
enum
{
ErrorIconNone = 0,
ErrorIconBlack,
ErrorIconRed
};
//ETX
virtual void SetErrorIcon(int);
virtual void SetErrorIconToNone()
{ this->SetErrorIcon(vtkKWWindowBase::ErrorIconNone); };
virtual void SetErrorIconToBlack()
{ this->SetErrorIcon(vtkKWWindowBase::ErrorIconBlack); };
virtual void SetErrorIconToRed()
{ this->SetErrorIcon(vtkKWWindowBase::ErrorIconRed); };
// Description:
// The window is made of a menu bar (methods are available to access each
// menus), a separator, a toolbar placeholder, a large main frame called
// the "view frame", and a status frame (inside which the a progress
// gauge and some other UI elements can be found).
// Note that this large frame is likely to be re-allocated by subclasses
// into a different UI structure involving panels, notebooks, interface
// managers, etc. therefore GetViewFrame() will be overriden in order to
// return the most convenient viewing frame.
// The rational here is that GetViewFrame() always return the frame that
// can be used by users or developpers to add more "viewing" element (say,
// renderwidgets, 3D scenes), without knowing about the current layout.
virtual vtkKWFrame* GetViewFrame();
// Description:
// Get the main toolbar set.
vtkGetObjectMacro(MainToolbarSet, vtkKWToolbarSet);
// Description:
// Get the status frame object.
vtkGetObjectMacro(StatusFrame, vtkKWFrame);
// Description:
// Set/Get the visibility of the status frame. If set to Off, the status
// text, as set by SetStatusText(), will not be displayed anymore. Neither
// will the progress gauge, the application icon, the tray frame and status
// icons. Both the progress gauge and tray frame position can be changed
// independently though (see SetProgressGaugePosition and
// SetTrayFramePosition).
virtual void SetStatusFrameVisibility(int flag);
vtkGetMacro(StatusFrameVisibility, int);
vtkBooleanMacro(StatusFrameVisibility, int);
// Description:
// Get the progress gauge widget. The progress gauge is displayed
// in the Status frame on the bottom right corner of the window.
vtkGetObjectMacro(ProgressGauge, vtkKWProgressGauge);
// Description:
// Set the progress gauge position. The default position is in the
// status frame, but this object can also be displayed in a toolbar, on
// top of the window. This is useful when StatusFrameVisibility is set
// to Off.
//BTX
enum
{
ProgressGaugePositionStatusFrame = 0,
ProgressGaugePositionToolbar
};
//ETX
virtual void SetProgressGaugePosition(int);
virtual void SetProgressGaugePositionToStatusFrame()
{ this->SetProgressGaugePosition(
vtkKWWindowBase::ProgressGaugePositionStatusFrame); };
virtual void SetProgressGaugePositionToToolbar()
{ this->SetProgressGaugePosition(
vtkKWWindowBase::ProgressGaugePositionToolbar); };
// Description:
// Get the tray frame object. A default status icon is already packed
// in this frame and modified by SetErrorIcon, but other icons can
// probably fit there.
vtkGetObjectMacro(TrayFrame, vtkKWFrame);
// Description:
// Set the tray frame position. The default position is in the
// status frame, but this object can also be displayed in a toolbar, on
// top of the window. This is useful when StatusFrameVisibility is set
// to Off.
//BTX
enum
{
TrayFramePositionStatusFrame = 0,
TrayFramePositionToolbar
};
//ETX
vtkGetMacro(TrayFramePosition, int);
virtual void SetTrayFramePosition(int);
virtual void SetTrayFramePositionToStatusFrame()
{ this->SetTrayFramePosition(
vtkKWWindowBase::TrayFramePositionStatusFrame); };
virtual void SetTrayFramePositionToToolbar()
{ this->SetTrayFramePosition(
vtkKWWindowBase::TrayFramePositionToolbar); };
// Description:
// Get the menu objects. This will allocate and create them on the fly.
// Several convenience functions are also available to get the position
// where to safely insert entries in those menus without interferring with
// entries that should stay at the end of the menus.
// Note: if you need to enable/disable a menu item conditionally in a
// subclass, do it so by reimplementing UpdateMenuState(); do not forget to
// call the parent class's UpdateMenuState() from the subclass as well.
vtkKWMenu *GetFileMenu();
vtkKWMenu *GetEditMenu();
vtkKWMenu *GetViewMenu();
vtkKWMenu *GetWindowMenu();
vtkKWMenu *GetHelpMenu();
vtkKWMenu *GetToolbarsVisibilityMenu();
vtkGetObjectMacro(MenuBarSeparator, vtkKWSeparator);
// Description:
// Convenience method that return the position where to safely insert
// entries in the corresponding menu without interferring with entries
// that should stay at the end of the menu.
// At the moment, GetFileMenuInsertPosition() checks for the 'close',
// 'exit' or 'print setup' commands, GetHelpMenuInsertPosition() checks for
// the 'about' commands, GetViewMenuInsertPosition() is available for
// subclasses to be redefined.
virtual int GetFileMenuInsertPosition();
virtual int GetHelpMenuInsertPosition();
virtual int GetViewMenuInsertPosition();
// Description:
// Set/Get a hint about help support. Disabled by default.
// If set to true (programmatically or by a superclass), it will hint the
// instance about populating the help menu with common entries.
// For example, an entry invoking the application's DisplayHelpDialog or
// DisplayTutorial.
vtkSetClampMacro(SupportHelp, int, 0, 1);
vtkGetMacro(SupportHelp, int);
vtkBooleanMacro(SupportHelp, int);
// Description:
// Add a file to the Recent File list, and save the whole list to
// the registry.
// If the "Recent files" sub-menu has been inserted at that point (see
// the InsertRecentFilesMenu method), it will be updated as well.
virtual void AddRecentFile(
const char *filename, vtkObject *target, const char *command);
// Description:
// Insert a "Recent Files" sub-menu to the File menu at position 'pos'
// and fill it with the most recent files stored in the registry.
// The 'target' parameter is the object against which the command
// associated to a most recent file will be executed (usually the instance).
virtual void InsertRecentFilesMenu(int pos, vtkObject *target);
// Description:
// Set/Get a hint about print support. Disabled by default.
// If set to true (programmatically or by a superclass), it will hint the
// instance about populating some menus with common print-related entries.
// For example, an entry in the file menu to set up print options like
// the application's PrintTargetDPI.
vtkSetClampMacro(SupportPrint, int, 0, 1);
vtkGetMacro(SupportPrint, int);
vtkBooleanMacro(SupportPrint, int);
// Description:
// Get the key bindings manager.
vtkGetObjectMacro(KeyBindingsManager, vtkKWKeyBindingsManager);
// Description:
// Get title of window.
// Override the superclass to use app name if the title was not set
virtual char* GetTitle();
// Description:
// Update the UI. This will call:
// UpdateToolbarState
// UpdateEnableState
// UpdateMenuState
// Update on all panels belonging to the UserInterfaceManager, if any
virtual void Update();
// Description:
// Update the toolbar state
virtual void UpdateToolbarState();
// Description:
// Update the "enable" state of the object and its internal parts.
// Depending on different Ivars (this->Enabled, the application's
// Limited Edition Mode, etc.), the "enable" state of the object is updated
// and propagated to its internal parts/subwidgets. This will, for example,
// enable/disable parts of the widget UI, enable/disable the visibility
// of 3D widgets, etc.
// Note: if you need to enable/disable a menu item conditionally in a
// subclass, do it so by reimplementing UpdateMenuState(); do not forget to
// call the parent class's UpdateMenuState() from the subclass as well.
virtual void UpdateEnableState();
virtual void UpdateMenuState();
// Description:
// Deallocate/delete/reparent some internal objects in order to solve
// reference loops that would prevent this instance from being deleted.
virtual void PrepareForDelete();
// Description:
// Some constants
vtkGetStringMacro(PrintOptionsMenuLabel);
vtkGetStringMacro(FileMenuLabel);
vtkGetStringMacro(FileCloseMenuLabel);
vtkGetStringMacro(FileExitMenuLabel);
vtkGetStringMacro(OpenRecentFileMenuLabel);
vtkGetStringMacro(EditMenuLabel);
vtkGetStringMacro(ViewMenuLabel);
vtkGetStringMacro(WindowMenuLabel);
vtkGetStringMacro(HelpMenuLabel);
vtkGetStringMacro(HelpAboutMenuLabel);
vtkGetStringMacro(HelpTopicsMenuLabel);
vtkGetStringMacro(HelpTutorialMenuLabel);
vtkGetStringMacro(HelpKeyBindingsMenuLabel);
vtkGetStringMacro(HelpCheckForUpdatesMenuLabel);
vtkGetStringMacro(ToolbarsVisibilityMenuLabel);
vtkGetStringMacro(WindowGeometryRegKey);
vtkGetStringMacro(DefaultGeometry);
// Description:
// Events.
// WindowClosedEvent is called when the window is closing. It is triggered
// right before requesting the application to remove the window instance
// from its window pool (vtkKWApplication::RemoveWindow).
//BTX
enum
{
WindowClosingEvent = 10000
};
//ETX
// Description:
// Add all the default observers needed by that object, or remove
// all the observers that were added through AddCallbackCommandObserver.
// Subclasses can override these methods to add/remove their own default
// observers, but should call the superclass too.
virtual void AddCallbackCommandObservers();
virtual void RemoveCallbackCommandObservers();
// Description:
// Add observers required to propagate error messages. Note that they
// were not put in AddCallbackCommandObservers on purpose, so that they
// do not get accidentally removed by RemoveCallbackCommandObservers:
// propagation of error messages, after all, should never be disabled.
virtual void AddErrorCallbackCommandObservers();
virtual void RemoveErrorCallbackCommandObservers();
// Description:
// Callbacks. Internal, do not use.
virtual void ErrorIconCallback();
virtual void PrintSettingsCallback() {};
virtual void ToolbarVisibilityChangedCallback(vtkKWToolbar*);
virtual void NumberOfToolbarsChangedCallback();
virtual void DisplayKeyBindingsCallback();
protected:
vtkKWWindowBase();
~vtkKWWindowBase();
// Description:
// Create the widget.
virtual void CreateWidget();
// Description:
// Display the close dialog.
// Return 1 if the user wants to close the window, 0 otherwise
virtual int DisplayCloseDialog();
// Description:
// Update the image in the status frame. Usually a logo of some sort.
// Override this function to include your own application logo
virtual void UpdateStatusImage();
virtual vtkKWLabel *GetStatusImage();
// Description:
// Recent files manager
vtkKWMostRecentFilesManager *MostRecentFilesManager;
// Description:
// Key bindings manager
vtkKWKeyBindingsManager *KeyBindingsManager;
// Description:
// Save/Restore window geometry
virtual void SaveWindowGeometryToRegistry();
virtual void RestoreWindowGeometryFromRegistry();
// Description:
// Pack/repack the UI
virtual void Pack();
vtkKWSeparator *MenuBarSeparator;
vtkKWFrame *MainFrame;
vtkKWSeparator *StatusFrameSeparator;
vtkKWFrame *StatusFrame;
vtkKWLabel *StatusImage;
vtkKWLabel *StatusLabel;
vtkKWProgressGauge *ProgressGauge;
int ProgressGaugePosition;
vtkKWFrame *TrayFrame;
vtkKWLabel *TrayImageError;
int TrayFramePosition;
vtkKWToolbarSet *MainToolbarSet;
vtkKWToolbar *StatusToolbar;
char *ScriptExtension;
char *ScriptType;
int SupportHelp;
int SupportPrint;
int PromptBeforeClose;
int StatusFrameVisibility;
// Allocated and created when queried
vtkKWMenu *FileMenu;
vtkKWMenu *EditMenu;
vtkKWMenu *ViewMenu;
vtkKWMenu *WindowMenu;
vtkKWMenu *HelpMenu;
vtkKWMenu *ToolbarsVisibilityMenu;
// Description:
// Populate the menus.
// Note: if you need to enable/disable a menu item conditionally in a
// subclass, do it so by reimplementing UpdateMenuState(); do not forget to
// call the parent class's UpdateMenuState() from the subclass as well.
virtual void PopulateFileMenu();
virtual void PopulateEditMenu();
virtual void PopulateViewMenu();
virtual void PopulateWindowMenu();
virtual void PopulateHelpMenu();
vtkKWTclInteractor *TclInteractor;
// Description:
// Some constants
vtkSetStringMacro(PrintOptionsMenuLabel);
vtkSetStringMacro(FileMenuLabel);
vtkSetStringMacro(FileCloseMenuLabel);
vtkSetStringMacro(FileExitMenuLabel);
vtkSetStringMacro(OpenRecentFileMenuLabel);
vtkSetStringMacro(EditMenuLabel);
vtkSetStringMacro(ViewMenuLabel);
vtkSetStringMacro(WindowMenuLabel);
vtkSetStringMacro(HelpMenuLabel);
vtkSetStringMacro(HelpTopicsMenuLabel);
vtkSetStringMacro(HelpTutorialMenuLabel);
vtkSetStringMacro(HelpKeyBindingsMenuLabel);
vtkSetStringMacro(HelpAboutMenuLabel);
vtkSetStringMacro(HelpCheckForUpdatesMenuLabel);
vtkSetStringMacro(ToolbarsVisibilityMenuLabel);
vtkSetStringMacro(WindowGeometryRegKey);
vtkSetStringMacro(DefaultGeometry);
// Description:
// Processes the events that are passed through CallbackCommand (or others).
// Subclasses can oberride this method to process their own events, but
// should call the superclass too.
virtual void ProcessCallbackCommandEvents(
vtkObject *caller, unsigned long event, void *calldata);
private:
// Description:
// Some constants
char *PrintOptionsMenuLabel;
char *FileMenuLabel;
char *FileCloseMenuLabel;
char *FileExitMenuLabel;
char *OpenRecentFileMenuLabel;
char *EditMenuLabel;
char *ViewMenuLabel;
char *WindowMenuLabel;
char *HelpMenuLabel;
char *HelpTopicsMenuLabel;
char *HelpTutorialMenuLabel;
char *HelpKeyBindingsMenuLabel;
char *HelpAboutMenuLabel;
char *HelpCheckForUpdatesMenuLabel;
char *ToolbarsVisibilityMenuLabel;
char *WindowGeometryRegKey;
char *DefaultGeometry;
vtkKWWindowBase(const vtkKWWindowBase&); // Not implemented
void operator=(const vtkKWWindowBase&); // Not implemented
};
#endif
|