Envision
A visual programming IDE for object-oriented languages
|
The ViewItemManager manages all the different ViewItems which are part of a given scene. More...
Public Member Functions | |
ViewItemManager (Scene *scene) | |
Creates a new ViewItemManager connected to the given scene. More... | |
~ViewItemManager () | |
ViewItem * | currentViewItem () |
Returns the currently visible ViewItem. More... | |
ViewItem * | loadView (QString name, QPoint position={-1, -1}) |
Loads the given view from persistent disk storage. More... | |
ViewItem * | newViewItem (const QString name={}, QPoint position={-1, -1}) |
Creates a new ViewItem and adds it to the manager. More... | |
void | removeAllViewItems () |
Removes all existing ViewItems from the manager. More... | |
void | removeViewItem (ViewItem *view) |
Removes view from the manager. More... | |
void | saveView (ViewItem *view, Model::TreeManager *manager) const |
Saves the given view persistently on disk, using the given manager. More... | |
bool | switchToView (const QString viewName) |
Overload using the view's name. More... | |
void | switchToView (ViewItem *view) |
Switches to the given view to be the new current view. More... | |
ViewItem * | viewItem (const QString name) |
Finds the ViewItem with the given name, or nullptr if it doesn't exist. More... | |
QVector< QVector< ViewItem * > > | viewItems () const |
Private Member Functions | |
void | addViewItem (ViewItem *view, QPoint position={-1, -1}) |
void | cleanupRemovedItem (Visualization::Item *removedItem) |
void | cleanupRemovedNode (Model::Node *removedNode) |
QString | fileName (QString viewName, QString managerName) const |
ViewItem * | loadView (QString name, Model::TreeManager *manager) |
QPoint | nextEmptyPosition () const |
Private Attributes | |
ViewItem * | currentViewItem_ {} |
const QString | DIRECTORY_NAME = "views" |
Scene * | scene_ {} |
const int | VIEW_ITEM_COLUMNS = 3 |
QVector< QVector< ViewItem * > > | viewItems_ |
Friends | |
class | Item |
class | Scene |
The ViewItemManager manages all the different ViewItems which are part of a given scene.
It is responsible for adding and removing views to and from the scene, as well as switching between the different views.
Visualization::ViewItemManager::ViewItemManager | ( | Scene * | scene | ) |
Creates a new ViewItemManager connected to the given scene.
Visualization::ViewItemManager::~ViewItemManager | ( | ) |
|
private |
|
private |
|
private |
ViewItem * Visualization::ViewItemManager::currentViewItem | ( | ) |
|
private |
|
private |
ViewItem * Visualization::ViewItemManager::loadView | ( | QString | name, |
QPoint | position = {-1, -1} |
||
) |
Loads the given view from persistent disk storage.
If it exists, it is added to the manager at the given position.
ViewItem * Visualization::ViewItemManager::newViewItem | ( | const QString | name = {} , |
QPoint | position = {-1, -1} |
||
) |
|
private |
void Visualization::ViewItemManager::removeAllViewItems | ( | ) |
Removes all existing ViewItems from the manager.
void Visualization::ViewItemManager::removeViewItem | ( | ViewItem * | view | ) |
Removes view from the manager.
void Visualization::ViewItemManager::saveView | ( | ViewItem * | view, |
Model::TreeManager * | manager | ||
) | const |
Saves the given view persistently on disk, using the given manager.
Note: The view can still contain nodes handled by other managers.
bool Visualization::ViewItemManager::switchToView | ( | const QString | viewName | ) |
Overload using the view's name.
Returns whether switching was successful, i.e. whether a view with the name was found.
void Visualization::ViewItemManager::switchToView | ( | ViewItem * | view | ) |
Switches to the given view to be the new current view.
The view must already be known to the manager.
ViewItem * Visualization::ViewItemManager::viewItem | ( | const QString | name | ) |
Finds the ViewItem with the given name, or nullptr if it doesn't exist.
|
inline |
|
friend |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |