Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vuMainWindow Class Reference

The main class of the GUI Tool. It implements the main window and the general functionality. More...

#include <vuMainWindow.h>

Inheritance diagram for vuMainWindow:

Inheritance graph
[legend]
Collaboration diagram for vuMainWindow:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 vuMainWindow ()
 The vuMainWindow constructor. Does default initialization.
 ~vuMainWindow ()
 The vuMainWindow destructor. Responsible for cleaning up memory use.
bool init (int argc=0, char *argv[]=0)
 Initializes and starts the vuMainWindow, with the option of command line parameters.
void notifyDataChanged ()
 Notifies the vuMainWindow that a change has been made to the volume data.
void notifyClosed (vuUtilityWindow *Window)
 Notifies the vuMainWindow that a utility window has been closed by the user.

Private Member Functions

bool open (const char *file)
 Opens a volume data file.
void close ()
 Closes the volume data file.
bool isOpened ()
 Tells whether the window is in the opened or closed state.
bool save (const char *file)
 Saves the volume data to a file.
bool isSaved ()
 Indicates whether the current volume data is saved to disk.
bool parseCommandLine (int argc, char *argv[])
 Parses the command line and returns whether it was successful or not.
bool addUtility (const char *Name)
 Creates and initializes a utility window of the given Name.
void saveData ()
 Pops up a file dialog and saves to the chosen file.
bool initWindow ()
 Creates and sets up the main window.
void setOpened ()
 Puts the window into the opened state.
void setClosed ()
 Puts the window into the closed state.
wxMenu * createUtilityMenu ()
 Creates a utility menu for the opened file type.
void OnOpenData (wxCommandEvent &event)
 Opens a file dialog and opens the chosen file.
void OnSaveData (wxCommandEvent &event)
 Opens a file dialog and saves to the chosen file.
void OnCloseData (wxCommandEvent &event)
 Puts the window in a closed state.
void OnAddUtility (wxCommandEvent &event)
 Adds the utility that the user chose.
void OnSize (wxSizeEvent &event)
 Handles the window resize event.
void OnExit (wxCommandEvent &event)
 Handles the window exit event.
void OnClose (wxCloseEvent &event)
 Handles the window close event.

Private Attributes

vuVolumem_Data
 A pointer to the opened volume data, if any -- currently unused.
wxString m_FileName
 The name of the file storing the opened volume data.
wxString m_FileType
 The known file type of the chosen data file.
bool m_Opened
 Indicates whether the program is in the open state.
bool m_Saved
 Indicates whether the opened volume data is saved to the disk.
wxList m_Windows
 A list of the utility windows.

Detailed Description

The main class of the GUI Tool. It implements the main window and the general functionality.

This class primarily represents to the main window of the GUI Tool; it is created and used as a windowing class. As such, it creates the main window and implements its functions. The implementation of the main window depends on the windowing system. In most systems, the main window is implemented as an MDI parent window, and so is derived from the wxWindows wxMDIParentFrame class. In gtk, the wxWindow's implementation of the mdi architecture is not suitable to the gui tool, and so the main window is implemented as a regular window, deriving from the wxFrame class.

The main window's other task is to manage all the utility windows. It is responsible for creating them, supplying them with the volume data file, and notifying them of any changes in the data. All the utility windows implement the vuUtilityWindow interface, and this is what the main window sees.

Finally, the class also manages the volume data for the application. This is because the main window corresponds to a viewing session of volume data. Therefore the vuMainWindow class keeps track of this data and supplies functions for operating on it. For many utilities, this simply constitutes passing around the data file name. These are the utilites which need to open their own data set for efficiency reasons. The main window can also keep track of a shared data set which a number of utilities operate on.

The vuMainWindow, and so the main program, can be started with command line parameters. When the vuMainWindow initializes itself, it will automatically open up the volume data and create the desired utility windows. The syntax is as follows

programname VolumeData Utility1 Utility2 ...

programName - name of the executable

VolumeData - the file name of the volume data

Utility# - a list of the utilities to be opened up, by name

Definition at line 64 of file vuMainWindow.h.


Constructor & Destructor Documentation

vuMainWindow::vuMainWindow  ) 
 

The vuMainWindow constructor. Does default initialization.

Definition at line 38 of file vuMainWindow.cpp.

vuMainWindow::~vuMainWindow  ) 
 

The vuMainWindow destructor. Responsible for cleaning up memory use.

Definition at line 49 of file vuMainWindow.cpp.

References close(), and isOpened().

Here is the call graph for this function:


Member Function Documentation

bool vuMainWindow::addUtility const char *  Name  )  [private]
 

Creates and initializes a utility window of the given Name.

Definition at line 177 of file vuMainWindow.cpp.

References vuUtilityFactory::create(), vuUtilityWindow::init(), isOpened(), m_FileName, and m_Windows.

Referenced by OnAddUtility(), and parseCommandLine().

Here is the call graph for this function:

void vuMainWindow::close  )  [private]
 

Closes the volume data file.

This puts the main window into the closed state. The main window is open but it's empty and has no data. This implies that no utility windows can be added anymore. The user can only quit or open up another set of data.

Definition at line 290 of file vuMainWindow.cpp.

References vuUtilityWindow::close(), isOpened(), m_Data, m_FileName, m_FileType, m_Opened, m_Saved, m_Windows, and setClosed().

Referenced by open(), and ~vuMainWindow().

Here is the call graph for this function:

wxMenu * vuMainWindow::createUtilityMenu  )  [private]
 

Creates a utility menu for the opened file type.

The method checks with the vuUtilityFactory to see what utilities are available for the opened file type, and creates a menu that lets the user choose from among them.

Definition at line 150 of file vuMainWindow.cpp.

References vuUtilityFactory::listAvailable(), m_FileType, and MENU_ADD.

Referenced by initWindow(), and setOpened().

Here is the call graph for this function:

bool vuMainWindow::init int  argc = 0,
char *  argv[] = 0
 

Initializes and starts the vuMainWindow, with the option of command line parameters.

This method intializes the windowing environment for the vuMainWindow, creates the main window, and starts it. Once this method has been called, the window will be visible and accepting events from the user. The user can then choose to open data and so on.

The main window can be optionally initialized with command line parameters. These tell it the name of a file containing volume data, and the utility windows to start with. If the volume file or utility name is invalid, the main window asks the user if it should quit.

Returns:
True if initialization was successful, false otherwise.

Definition at line 58 of file vuMainWindow.cpp.

References initWindow(), parseCommandLine(), and setClosed().

Referenced by vuGUI::OnInit().

Here is the call graph for this function:

bool vuMainWindow::initWindow  )  [private]
 

Creates and sets up the main window.

This method sets up the user interface for the main window. It does not put the window into neither the open nor the closed state, that has to be done afterwards.

Returns:
True if initialization was successful.

Definition at line 76 of file vuMainWindow.cpp.

References createUtilityMenu(), MENU_CLOSE, MENU_EXIT, MENU_OPEN, and NULL.

Referenced by init().

Here is the call graph for this function:

bool vuMainWindow::isOpened  )  [private]
 

Tells whether the window is in the opened or closed state.

Returns:
True if the window is in the opened state.

Definition at line 324 of file vuMainWindow.cpp.

Referenced by addUtility(), close(), open(), and ~vuMainWindow().

bool vuMainWindow::isSaved  )  [private]
 

Indicates whether the current volume data is saved to disk.

This would be false if one of the utilities changed the volume data in memory, and thereby created new data. By checking this function, the caller can find out whether to provide the option of saving the data to disk. Once the data has been saved, this method again returns true.

Returns:
True if the data has been saved to disk, false if it has been changed since opening or saving.
Note:
This method is not used right now, but may be in future expansions.

Definition at line 347 of file vuMainWindow.cpp.

Referenced by OnClose().

void vuMainWindow::notifyClosed vuUtilityWindow Window  ) 
 

Notifies the vuMainWindow that a utility window has been closed by the user.

This is called by utility windows when they have been closed by the user, as opposed to being closed by the vuMainWindow itself. In GUI environments, this is often done without the main window being aware that the child has been closed.

Definition at line 251 of file vuMainWindow.cpp.

References m_Windows.

Referenced by vuBasicUtility::~vuBasicUtility().

void vuMainWindow::notifyDataChanged  ) 
 

Notifies the vuMainWindow that a change has been made to the volume data.

This is called by utility windows when they change the data and is necessary for program synchronization. First of all, the vuMainWindow window will then notify the user of the change. Also, it will let other utility windows know of the change so that they can update their data views.

Note:
This method is not used right now, but may be in future expansions.

Definition at line 237 of file vuMainWindow.cpp.

References m_Saved, and m_Windows.

void vuMainWindow::OnAddUtility wxCommandEvent &  event  )  [private]
 

Adds the utility that the user chose.

This method handles the Add Utility menu commands.

Definition at line 439 of file vuMainWindow.cpp.

References addUtility(), dword, vuUtilityFactory::listAvailable(), m_FileType, and MENU_ADD.

Here is the call graph for this function:

void vuMainWindow::OnClose wxCloseEvent &  event  )  [private]
 

Handles the window close event.

Definition at line 502 of file vuMainWindow.cpp.

References isSaved(), and saveData().

Here is the call graph for this function:

void vuMainWindow::OnCloseData wxCommandEvent &  event  )  [private]
 

Puts the window in a closed state.

This method handles the Close Data menu command.

void vuMainWindow::OnExit wxCommandEvent &  event  )  [private]
 

Handles the window exit event.

void vuMainWindow::OnOpenData wxCommandEvent &  event  )  [private]
 

Opens a file dialog and opens the chosen file.

This method handles the Open Data menu command.

void vuMainWindow::OnSaveData wxCommandEvent &  event  )  [private]
 

Opens a file dialog and saves to the chosen file.

This method handles the Save Data menu command.

void vuMainWindow::OnSize wxSizeEvent &  event  )  [private]
 

Handles the window resize event.

bool vuMainWindow::open const char *  file  )  [private]
 

Opens a volume data file.

This puts the main window into the opened state. Menus and functions which depend on volume data are now enabled. This includes adding utilities, managing windows and so on.

Parameters:
file The name of the volume data file.
Returns:
True if successful, false if the file does not exist or was invalid.

Definition at line 262 of file vuMainWindow.cpp.

References close(), vuFileHelper::getFileType(), isOpened(), m_FileName, m_FileType, m_Opened, m_Saved, and setOpened().

Referenced by parseCommandLine().

Here is the call graph for this function:

bool vuMainWindow::parseCommandLine int  argc,
char *  argv[]
[private]
 

Parses the command line and returns whether it was successful or not.

Definition at line 207 of file vuMainWindow.cpp.

References addUtility(), and open().

Referenced by init().

Here is the call graph for this function:

bool vuMainWindow::save const char *  file  )  [private]
 

Saves the volume data to a file.

Parameters:
file The name of the file to save the volume data to.
Returns:
True if successfule, false otherwise.
Note:
This method is not used right now, but may be in future expansions.

Definition at line 333 of file vuMainWindow.cpp.

References m_Saved.

Referenced by saveData().

void vuMainWindow::saveData  )  [private]
 

Pops up a file dialog and saves to the chosen file.

Note:
This method is not used right now, but may be in future expansions.

Definition at line 356 of file vuMainWindow.cpp.

References save().

Referenced by OnClose().

Here is the call graph for this function:

void vuMainWindow::setClosed  )  [private]
 

Puts the window into the closed state.

This is the state of the window when there is no opened volume data file. Under this state, the user can only open a volume data file.

Definition at line 132 of file vuMainWindow.cpp.

References MENU_ADD, MENU_CLOSE, and MENU_OPEN.

Referenced by close(), and init().

void vuMainWindow::setOpened  )  [private]
 

Puts the window into the opened state.

This is the state of the window when there is an opened volume data file. Under this state, the utitily menu is enabled and the user can add utilities

Definition at line 105 of file vuMainWindow.cpp.

References createUtilityMenu(), m_FileName, MENU_CLOSE, and MENU_OPEN.

Referenced by open().

Here is the call graph for this function:


Member Data Documentation

vuVolume* vuMainWindow::m_Data [private]
 

A pointer to the opened volume data, if any -- currently unused.

Definition at line 227 of file vuMainWindow.h.

Referenced by close().

wxString vuMainWindow::m_FileName [private]
 

The name of the file storing the opened volume data.

Definition at line 229 of file vuMainWindow.h.

Referenced by addUtility(), close(), open(), and setOpened().

wxString vuMainWindow::m_FileType [private]
 

The known file type of the chosen data file.

Definition at line 231 of file vuMainWindow.h.

Referenced by close(), createUtilityMenu(), OnAddUtility(), and open().

bool vuMainWindow::m_Opened [private]
 

Indicates whether the program is in the open state.

Definition at line 234 of file vuMainWindow.h.

Referenced by close(), and open().

bool vuMainWindow::m_Saved [private]
 

Indicates whether the opened volume data is saved to the disk.

Definition at line 236 of file vuMainWindow.h.

Referenced by close(), notifyDataChanged(), open(), and save().

wxList vuMainWindow::m_Windows [private]
 

A list of the utility windows.

Definition at line 239 of file vuMainWindow.h.

Referenced by addUtility(), close(), notifyClosed(), and notifyDataChanged().


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 21:21:18 2004 for vuVolume by  doxygen 1.3.9.1