sublime
Sublime::Controller Class Reference
#include <controller.h>

Detailed Description
Handles association of areas to main windows.Whereas the MainWindow class can be told to show arbitrary Area instance, this class establishes more high-level rules based on the following assumptions:
1. It's desirable to have a list of "area types" -- basically string, and be able to switch each main window between those "area types". For example, to switch main window between "Code" and "Debug"
2. It's also desirable to save the state of area -- like the set of toolviews, position of toolviews, etc. This need to be done per-main window, so that "code" area of one window is allowed to be different from "code" area of another window.
3. Is it desirable to be able to reset an area of given type in a given main window to a default state.
The current implementation achieves those goals as follows.
1. Controller keeps a list of default areas. Those areas are not shown by any main window, and never modified as result of user actions. They are directly constructed by kdevelop core. Those areas are returned by the defaultAreas method. Each Area instance in the list provides area type id, and human name of the area -- via Area::objectName and Area::title methods respectively. All methods in this class accept area id, and human name of the area is only used to present the area type to the user, for selection.
2. Controller also keeps a list of MainWindow instances that it manages. For each instance, it keeps a list of areas private to the MainWindow instance. There's one area for each area in defaultAreas. That is, for each area type, there's one area in defaultAreas, and one area per each main window
3. It's possible to switch a given main window to display an area of the given type -- which finds the area with the given id in the list of area private to that main window, and switches the main window to the found area.
When we create a new main window, we create fresh set of private areas by cloning the default areas. An alternative approach would be to create a clone only when we try to show a specific area type in a main window. However, I think that knowing that each main window has its Area instance for each area type simplifies the code. For example, most of the time, during restoring areas we'd need per-window area instances anyway. Of course, we can introduce a method demand_area_type(MainWindow*, QString) that clones the default area of the necessary type, but I don't see what that will buy us.
Controller has to exist before any area, document or mainwindow can be created. There's no point in having two controllers for one application unless they need to show completely different sets of areas.
Definition at line 89 of file controller.h.
Public Slots | |
| void | areaReleased (Sublime::Area *area) |
| void | areaReleased () |
Signals | |
| void | aboutToRemoveToolView (Sublime::View *) |
| void | aboutToRemoveView (Sublime::View *) |
| void | toolViewAdded (Sublime::View *) |
| void | toolViewMoved (Sublime::View *) |
| void | viewAdded (Sublime::View *) |
Public Member Functions | |
| void | addDefaultArea (Area *area) |
| void | addMainWindow (MainWindow *mainWindow) |
| const QList< Area * > & | allAreas () const |
| Area * | area (int mainWindow, const QString &id) |
| const QList< Area * > & | areas (int mainWindow) const |
| Controller (QObject *parent=0) | |
| Area * | defaultArea (const QString &id) |
| const QList< Area * > & | defaultAreas () const |
| const QList< Document * > & | documents () const |
| const QList< MainWindow * > & | mainWindows () const |
| void | resetCurrentArea (MainWindow *mainWindow) |
| void | setStatusIcon (Document *document, const QIcon &icon) |
| void | showArea (const QString &areaTypeId, MainWindow *mainWindow) |
| void | showArea (Area *area, MainWindow *mainWindow) |
Protected Member Functions | |
| bool | eventFilter (QObject *obj, QEvent *ev) |
| void | showAreaInternal (Area *area, MainWindow *mainWindow) |
Member Function Documentation
| void Sublime::Controller::addDefaultArea | ( | Area * | area | ) |
Add the area to the set of default areas in this controller.
Definition at line 225 of file controller.cpp.
| void Sublime::Controller::addMainWindow | ( | MainWindow * | mainWindow | ) |
Add a main window to the set of of windows managed by this controller.
The ownership of the window is passed to the controller. The window will be associated with a set of areas created by cloning the current defaultAreas.
Definition at line 232 of file controller.cpp.
Return the list of all areas, including default area and area private to each main window.
Definition at line 215 of file controller.cpp.
Return the area with the given in main window specified by its index, mainWindow.
Definition at line 277 of file controller.cpp.
| void Sublime::Controller::areaReleased | ( | Sublime::Area * | area | ) | [slot] |
| void Sublime::Controller::areaReleased | ( | ) | [slot] |
Area can connect to this slot to release itself from its mainwindow.
Definition at line 253 of file controller.cpp.
Return all areas associated with the main window with the specified index.
Definition at line 210 of file controller.cpp.
- Returns:
- the list of documents created in this controller.
Definition at line 220 of file controller.cpp.
| const QList< MainWindow * > & Sublime::Controller::mainWindows | ( | ) | const |
Return the set of MainWindow instances managed by this.
Definition at line 357 of file controller.cpp.
| void Sublime::Controller::resetCurrentArea | ( | MainWindow * | mainWindow | ) |
Make the tool configuration of the area currently shown in mainWindow match those of default area with the same area type.
Definition at line 180 of file controller.cpp.
| void Sublime::Controller::showArea | ( | const QString & | areaTypeId, | |
| MainWindow * | mainWindow | |||
| ) |
| void Sublime::Controller::showArea | ( | Area * | area, | |
| MainWindow * | mainWindow | |||
| ) |
The documentation for this class was generated from the following files:
KDE 4.2 API Reference