#include <WindowController.h>
Collaboration diagram for WindowController:
It can be used as a helper function to an application.
Definition at line 54 of file WindowController.h.
Public Member Functions | |
void | aboutToClose (CanvasWindow *window) |
Removes the window from the window list. | |
void | closeAllWindows (bool alsoDelete) |
Closes all Windows. | |
void | createInspector () |
Creates the Inspector object and positions it on the desktop. | |
CanvasWindow * | currentCanvas () |
Returns a pointer to the current CanvasWindow. | |
Inspector * | getInspector () |
returns the Inspector. | |
void | hasBeenHidden () |
Responds to hide event from a document window. | |
void | newWindow (CanvasWindow *) |
Registers the new CanvasWindow and finishes its initialization. | |
bool | okToQuit () |
Queries application if it is OK to quit. | |
void | openAssistant () |
Opens the QAssistant object. | |
void | quitOnLastWindowClose (bool yes=true) |
Sets the flag that determines if the application will be terminated when the last window is closed. | |
void | setCurrentCanvas (CanvasWindow *canvas) |
Sets the current canvas. | |
void | setFirstWindow () |
Sets up the first CanvasWindow object. | |
void | unHide (CanvasWindow *window) |
Responds to document window being shown. | |
void | updateActions () |
Update the actions in all CanvasWindow objects. | |
WindowController () | |
Private Constructor. | |
~WindowController () | |
The destructor. | |
Static Public Member Functions | |
static WindowController * | instance () |
Returns the application instance. | |
static const std::string & | version () |
Returns the version number of HippoDraw. | |
Private Member Functions | |
const QRect & | getScreenRect () |
Returns a rectangle of the screen. | |
void | moveInspector (CanvasWindow *window) |
Move the Inspector next to the edge of the Window. | |
void | positionCanvas (CanvasWindow *window) |
Positions and sets the size of the window taking into account the size of the screen. | |
void | positionInspector () |
Positions the Inspector as far right as possible based on size of screen and width of Inspector. | |
void | resizeCanvas (CanvasWindow *window) |
Resizes the CanvasWindow so that it doesn't overlap with the Inspector window. | |
Private Attributes | |
CanvasWindow * | m_active_window |
The CanvasWindow object. | |
QAssistantClient * | m_assistant |
The QtAssistant client. | |
Inspector * | m_inspector |
The Inspector. | |
bool | m_quit |
A flag that when set true will terminate the application when the last canvas window closes. | |
std::list< CanvasWindow * > | m_window_list |
The list of CanvasWindow objects created by the application. | |
Static Private Attributes | |
static WindowController * | s_instance = 0 |
The instance of the application. | |
static std::string | s_version |
The version number of HippoDraw. |
WindowController | ( | ) |
Private Constructor.
Definition at line 60 of file WindowController.cxx.
References WindowController::s_instance.
Referenced by WindowController::instance().
~WindowController | ( | ) |
The destructor.
Definition at line 69 of file WindowController.cxx.
References WindowController::s_instance.
void aboutToClose | ( | CanvasWindow * | window | ) |
Removes the window from the window list.
Definition at line 141 of file WindowController.cxx.
References CanvasWindow::autosaveSettings(), WindowController::m_inspector, WindowController::m_quit, and WindowController::m_window_list.
void closeAllWindows | ( | bool | alsoDelete | ) |
Closes all Windows.
Closes all Document windows as well as the Inspector window. Effectively this will terminate the application.
Definition at line 216 of file WindowController.cxx.
References WindowController::m_inspector, and WindowController::m_window_list.
void createInspector | ( | ) |
Creates the Inspector object and positions it on the desktop.
Definition at line 83 of file WindowController.cxx.
References WindowController::m_inspector, and WindowController::positionInspector().
Referenced by CanvasWindow::fileNew(), CanvasWindow::fileOpen(), and WindowController::setFirstWindow().
CanvasWindow * currentCanvas | ( | ) |
Returns a pointer to the current CanvasWindow.
Definition at line 311 of file WindowController.cxx.
References WindowController::m_active_window.
Referenced by Inspector::cutNew(), Inspector::fillPlotterList(), WindowController::openAssistant(), Inspector::setAppKey(), and Inspector::summaryNew().
Inspector * getInspector | ( | ) |
returns the Inspector.
Definition at line 316 of file WindowController.cxx.
References WindowController::m_inspector.
const QRect & getScreenRect | ( | ) | [private] |
Returns a rectangle of the screen.
Definition at line 232 of file WindowController.cxx.
References QApplication::desktop(), QDesktopWidget::primaryScreen(), and QDesktopWidget::screenGeometry().
Referenced by WindowController::positionCanvas(), WindowController::positionInspector(), and WindowController::resizeCanvas().
void hasBeenHidden | ( | ) |
Responds to hide event from a document window.
If all document windows are hidden, then hides the Inspector window as well. Otherwise, does nothing.
Definition at line 165 of file WindowController.cxx.
References WindowController::m_inspector, and WindowController::m_window_list.
WindowController * instance | ( | ) | [static] |
Returns the application instance.
Definition at line 74 of file WindowController.cxx.
References WindowController::s_instance, and WindowController::WindowController().
Referenced by CanvasWindow::CanvasWindow(), CanvasWindow::closeEvent(), CreateNTuple::createButtonClicked(), Inspector::createResiduals(), QtApp::currentCanvas(), Inspector::cutNew(), Inspector::diffDataRep(), CanvasWindow::editClear(), CanvasWindow::editCopy(), CanvasWindow::editCut(), CanvasWindow::editDelete(), CanvasWindow::editPaste(), CanvasWindow::editSelectAll(), CanvasWindow::fileExit(), CanvasWindow::fileNew(), CanvasWindow::fileOpen(), Inspector::fillPlotterList(), CreateNTuple::getPlotterList(), CanvasWindow::helpHelp(), CanvasWindow::hideEvent(), Inspector::newPlotButton_clicked(), CanvasView::notifyObservers(), Inspector::pushButtonNewErrorPlotClicked(), PyApp::quitOnLastWindowClose(), QtFileDialog::saveFitsTuple(), QtFileDialog::saveTextTuple(), Inspector::setAppKey(), CanvasWindow::setChanged(), QtApp::setFirstWindow(), CanvasWindow::showEvent(), Inspector::summaryNew(), CanvasWindow::windowActivationChange(), and QtApp::~QtApp().
void moveInspector | ( | CanvasWindow * | window | ) | [private] |
Move the Inspector next to the edge of the Window.
Definition at line 118 of file WindowController.cxx.
References WindowController::m_inspector, QPoint::setX(), num_util::size(), QSize::width(), and QPoint::x().
Referenced by WindowController::newWindow().
void newWindow | ( | CanvasWindow * | ) |
Registers the new CanvasWindow and finishes its initialization.
Definition at line 91 of file WindowController.cxx.
References CanvasWindow::getCanvasView(), CanvasWindow::inhibitClose(), WindowController::m_inspector, WindowController::m_quit, WindowController::m_window_list, WindowController::moveInspector(), WindowController::positionCanvas(), WindowController::resizeCanvas(), WindowController::setCurrentCanvas(), CanvasView::setInspector(), and num_util::size().
Referenced by CanvasWindow::CanvasWindow().
bool okToQuit | ( | ) |
Queries application if it is OK to quit.
The application queries each document window for unsaved changes. If any window refuses to close, the application returns false
Otherwise, returns true
.
Definition at line 187 of file WindowController.cxx.
References WindowController::m_quit, and WindowController::m_window_list.
void openAssistant | ( | ) |
Opens the QAssistant object.
Definition at line 335 of file WindowController.cxx.
References QString::arg(), WindowController::currentCanvas(), QString::findRev(), QString::length(), WindowController::m_assistant, QString::remove(), num_util::size(), and QString::truncate().
void positionCanvas | ( | CanvasWindow * | window | ) | [private] |
Positions and sets the size of the window taking into account the size of the screen.
Definition at line 245 of file WindowController.cxx.
References WindowController::getScreenRect(), WindowController::m_active_window, QPoint::setY(), QRect::topLeft(), and QPoint::y().
Referenced by WindowController::newWindow().
void positionInspector | ( | ) | [private] |
Positions the Inspector as far right as possible based on size of screen and width of Inspector.
Definition at line 290 of file WindowController.cxx.
References WindowController::getScreenRect(), WindowController::m_inspector, QPoint::setX(), QPoint::setY(), num_util::size(), and QRect::width().
Referenced by WindowController::createInspector().
void quitOnLastWindowClose | ( | bool | yes = true |
) |
Sets the flag that determines if the application will be terminated when the last window is closed.
Definition at line 131 of file WindowController.cxx.
References WindowController::m_quit.
Referenced by WindowController::setFirstWindow().
void resizeCanvas | ( | CanvasWindow * | window | ) | [private] |
Resizes the CanvasWindow so that it doesn't overlap with the Inspector window.
Definition at line 263 of file WindowController.cxx.
References WindowController::getScreenRect(), QSize::height(), WindowController::m_inspector, QRect::size(), num_util::size(), QSize::width(), and QPoint::x().
Referenced by WindowController::newWindow().
void setCurrentCanvas | ( | CanvasWindow * | canvas | ) |
Sets the current canvas.
This method does not change the canvas' window active state which is control by the windowing system. The intent of this method is to allow CanvasWindow object to inform the application that it has become active.
Definition at line 306 of file WindowController.cxx.
References WindowController::m_active_window.
Referenced by WindowController::newWindow().
void setFirstWindow | ( | ) |
Sets up the first CanvasWindow object.
Definition at line 323 of file WindowController.cxx.
References WindowController::createInspector(), WindowController::quitOnLastWindowClose(), and CanvasWindow::setCaption().
Referenced by QtApp::setFirstWindow().
void unHide | ( | CanvasWindow * | window | ) |
Responds to document window being shown.
Shows the Inspector window if it had been hidden.
Definition at line 182 of file WindowController.cxx.
References WindowController::m_inspector, and QDialog::show().
void updateActions | ( | ) |
Update the actions in all CanvasWindow objects.
Update the enabled status of all actions, such as menu items and tool bar icons, of all windows. Sends CanvasWindow::updateActions to all windows.
Definition at line 208 of file WindowController.cxx.
References WindowController::m_window_list, and CanvasWindow::updateActions().
const std::string & version | ( | ) | [static] |
Returns the version number of HippoDraw.
Definition at line 55 of file WindowController.cxx.
References WindowController::s_version.
CanvasWindow* m_active_window [private] |
The CanvasWindow object.
Definition at line 66 of file WindowController.h.
Referenced by WindowController::currentCanvas(), WindowController::positionCanvas(), and WindowController::setCurrentCanvas().
QAssistantClient* m_assistant [private] |
The QtAssistant client.
Definition at line 73 of file WindowController.h.
Referenced by WindowController::openAssistant().
Inspector* m_inspector [private] |
The Inspector.
Definition at line 69 of file WindowController.h.
Referenced by WindowController::aboutToClose(), WindowController::closeAllWindows(), WindowController::createInspector(), WindowController::getInspector(), WindowController::hasBeenHidden(), WindowController::moveInspector(), WindowController::newWindow(), WindowController::positionInspector(), WindowController::resizeCanvas(), and WindowController::unHide().
bool m_quit [private] |
A flag that when set true
will terminate the application when the last canvas window closes.
Definition at line 85 of file WindowController.h.
Referenced by WindowController::aboutToClose(), WindowController::newWindow(), WindowController::okToQuit(), and WindowController::quitOnLastWindowClose().
std::list< CanvasWindow * > m_window_list [private] |
The list of CanvasWindow objects created by the application.
Definition at line 63 of file WindowController.h.
Referenced by WindowController::aboutToClose(), WindowController::closeAllWindows(), WindowController::hasBeenHidden(), WindowController::newWindow(), WindowController::okToQuit(), and WindowController::updateActions().
WindowController * s_instance = 0 [static, private] |
The instance of the application.
Definition at line 60 of file WindowController.h.
Referenced by WindowController::instance(), WindowController::WindowController(), and WindowController::~WindowController().
std::string s_version [static, private] |
The version number of HippoDraw.
Definition at line 80 of file WindowController.h.
Referenced by WindowController::version().