OpenASIP  2.0
Public Member Functions | List of all members
CloseDocumentCmd Class Reference

#include <CloseDocumentCmd.hh>

Inheritance diagram for CloseDocumentCmd:
Inheritance graph
Collaboration diagram for CloseDocumentCmd:
Collaboration graph

Public Member Functions

 CloseDocumentCmd ()
 
virtual ~CloseDocumentCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual CloseDocumentCmdcreate () const
 
virtual std::string shortName () const
 
virtual std::string icon () const
 
virtual bool isEnabled ()
 
- Public Member Functions inherited from EditorCommand
 EditorCommand (std::string name, wxWindow *parent=NULL)
 
virtual ~EditorCommand ()
 
void setView (wxView *view)
 
wxView * view () const
 
- Public Member Functions inherited from GUICommand
 GUICommand (std::string name, wxWindow *parent)
 
virtual ~GUICommand ()
 
virtual bool isChecked () const
 
void setParentWindow (wxWindow *view)
 
wxWindow * parentWindow () const
 
std::string name () const
 

Detailed Description

EditorCommand for closing documents.

Definition at line 41 of file CloseDocumentCmd.hh.

Constructor & Destructor Documentation

◆ CloseDocumentCmd()

CloseDocumentCmd::CloseDocumentCmd ( )

The Constructor.

Definition at line 44 of file CloseDocumentCmd.cc.

Referenced by create().

◆ ~CloseDocumentCmd()

CloseDocumentCmd::~CloseDocumentCmd ( )
virtual

The Destructor.

Definition at line 53 of file CloseDocumentCmd.cc.

53 {}

Member Function Documentation

◆ create()

CloseDocumentCmd * CloseDocumentCmd::create ( ) const
virtual

Creates and returns a new instance of this command.

Returns
Newly created instance of this command.

Implements GUICommand.

Definition at line 94 of file CloseDocumentCmd.cc.

94  {
95  return new CloseDocumentCmd();
96 }

References CloseDocumentCmd().

Here is the call graph for this function:

◆ Do()

bool CloseDocumentCmd::Do ( )
virtual

Executes the command.

Returns
Always false. Returning true here would cause problems with the wxCommandProcessor, and the command is never undoable so it's safe to return false even if the command was succesfully executed.

Implements GUICommand.

Definition at line 64 of file CloseDocumentCmd.cc.

64  {
65  // close the active document
66  wxDocManager* docManager = wxGetApp().docManager();
67  wxDocument *doc = docManager->GetCurrentDocument();
68  if (!doc)
69  return false;
70  if (doc->Close()) {
71  doc->DeleteAllViews();
72  }
73  return false;
74 }

◆ icon()

string CloseDocumentCmd::icon ( ) const
virtual

Returns path to the command's icon file.

Returns
Full path to the command's icon file.

Reimplemented from EditorCommand.

Definition at line 115 of file CloseDocumentCmd.cc.

115  {
117 }

References ProDeConstants::CMD_ICON_CLOSE_DOC.

◆ id()

int CloseDocumentCmd::id ( ) const
virtual

Returns id of this command.

Returns
ID for this command to be used in menus and toolbars.

Implements GUICommand.

Definition at line 83 of file CloseDocumentCmd.cc.

83  {
85 }

References ProDeConstants::COMMAND_CLOSE_DOC.

◆ isEnabled()

bool CloseDocumentCmd::isEnabled ( )
virtual

Returns true when the command is executable, false when not.

This command is executable when a document is open.

Returns
True, if a document is open.

Reimplemented from EditorCommand.

Definition at line 128 of file CloseDocumentCmd.cc.

128  {
129  wxDocManager* manager = wxGetApp().docManager();
130  if (manager->GetCurrentView() != NULL) {
131  return true;
132  }
133  return false;
134 }

◆ shortName()

string CloseDocumentCmd::shortName ( ) const
virtual

Returns short version of the command name.

Returns
Short name of the command to be used in the toolbar.

Reimplemented from GUICommand.

Definition at line 105 of file CloseDocumentCmd.cc.

105  {
107 }

References ProDeConstants::CMD_SNAME_CLOSE_DOC.


The documentation for this class was generated from the following files:
ProDeConstants::CMD_ICON_CLOSE_DOC
static const std::string CMD_ICON_CLOSE_DOC
Icon location for the "Close Document" command.
Definition: ProDeConstants.hh:290
EditorCommand::EditorCommand
EditorCommand(std::string name, wxWindow *parent=NULL)
Definition: EditorCommand.cc:42
ProDeConstants::COMMAND_CLOSE_DOC
@ COMMAND_CLOSE_DOC
Definition: ProDeConstants.hh:409
ProDeConstants::CMD_SNAME_CLOSE_DOC
static const std::string CMD_SNAME_CLOSE_DOC
Command name for the "Close Document" command.
Definition: ProDeConstants.hh:200
CloseDocumentCmd::CloseDocumentCmd
CloseDocumentCmd()
Definition: CloseDocumentCmd.cc:44
ProDeConstants::CMD_NAME_CLOSE_DOC
static const std::string CMD_NAME_CLOSE_DOC
Command name for the "Close Document" command.
Definition: ProDeConstants.hh:78