DocumentView* UIContext::activeView() const { Workspace* workspace = App::instance()->getMainWindow()->getWorkspace(); WorkspaceView* view = workspace->activeView(); if (DocumentView* docView = dynamic_cast<DocumentView*>(view)) return docView; else return NULL; }
DocumentView* UIContext::activeView() const { if (!isUIAvailable()) return nullptr; Workspace* workspace = App::instance()->workspace(); if (!workspace) return nullptr; WorkspaceView* view = workspace->activeView(); if (DocumentView* docView = dynamic_cast<DocumentView*>(view)) return docView; else return nullptr; }
bool DuplicateViewCommand::onEnabled(Context* context) { Workspace* workspace = App::instance()->workspace(); WorkspaceView* view = workspace->activeView(); return (view != nullptr); }
void onExecute(Context* context) override { Workspace* workspace = App::instance()->getMainWindow()->getWorkspace(); WorkspaceView* view = workspace->activeView(); if (view) workspace->closeView(view); }
bool onEnabled(Context* context) override { Workspace* workspace = App::instance()->getMainWindow()->getWorkspace(); WorkspaceView* view = workspace->activeView(); return (view != nullptr); }