OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CreateHDBCmd Class Reference

#include <CreateHDBCmd.hh>

Inheritance diagram for CreateHDBCmd:
Inheritance graph
Collaboration diagram for CreateHDBCmd:
Collaboration graph

Public Member Functions

 CreateHDBCmd ()
 
virtual ~CreateHDBCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual CreateHDBCmdcreate () const
 
virtual std::string icon () const
 
virtual bool isEnabled ()
 
- Public Member Functions inherited from GUICommand
 GUICommand (std::string name, wxWindow *parent)
 
virtual ~GUICommand ()
 
virtual bool isChecked () const
 
virtual std::string shortName () const
 
void setParentWindow (wxWindow *view)
 
wxWindow * parentWindow () const
 
std::string name () const
 

Detailed Description

Command for creating a new HDB in HDBEditor.

Displays a file dialog for choosing filename for the new HDB.

Definition at line 43 of file CreateHDBCmd.hh.

Constructor & Destructor Documentation

◆ CreateHDBCmd()

CreateHDBCmd::CreateHDBCmd ( )

The Constructor.

Definition at line 46 of file CreateHDBCmd.cc.

46 :
48}
static const std::string COMMAND_NAME_CREATE_HDB
Name of the create HDB command.

Referenced by create().

◆ ~CreateHDBCmd()

CreateHDBCmd::~CreateHDBCmd ( )
virtual

The Destructor.

Definition at line 54 of file CreateHDBCmd.cc.

54 {
55}

Member Function Documentation

◆ create()

CreateHDBCmd * CreateHDBCmd::create ( ) const
virtual

Creates and returns a new isntance of this command.

Returns
Newly created instance of this command.

Implements GUICommand.

Definition at line 108 of file CreateHDBCmd.cc.

108 {
109 return new CreateHDBCmd();
110}

References CreateHDBCmd().

Here is the call graph for this function:

◆ Do()

bool CreateHDBCmd::Do ( )
virtual

Executes the command.

Implements GUICommand.

Definition at line 62 of file CreateHDBCmd.cc.

62 {
63 assert(parentWindow() != NULL);
64
65 wxString wildcard = _T("Hardware Database files (*.hdb)|*.hdb");
66 wildcard.Append(_T("|All files|*"));
67 wxFileDialog dialog(
68 parentWindow(), _T("Enter path for the new HDB"), _T(""), _T(""),
69 wildcard, wxSAVE);
70
71 if (dialog.ShowModal() == wxID_CANCEL) {
72 return false;
73 }
74
75 std::string command;
76 std::string file = WxConversion::toString(dialog.GetPath());
77
78 return wxGetApp().mainFrame().createHDB(file);
79}
#define assert(condition)
wxWindow * parentWindow() const
Definition GUICommand.cc:75
static std::string toString(const wxString &source)

References assert, GUICommand::parentWindow(), and WxConversion::toString().

Here is the call graph for this function:

◆ icon()

std::string CreateHDBCmd::icon ( ) const
virtual

Returns full path to the command icon file.

Returns
Full path to the command icon file.

Implements GUICommand.

Definition at line 88 of file CreateHDBCmd.cc.

88 {
89 return "filenew.png";
90}

◆ id()

int CreateHDBCmd::id ( ) const
virtual

Returns ID of this command.

Implements GUICommand.

Definition at line 97 of file CreateHDBCmd.cc.

References HDBEditorConstants::COMMAND_CREATE_HDB.

◆ isEnabled()

bool CreateHDBCmd::isEnabled ( )
virtual

Returns true if the command is enabled, false otherwise.

Returns
Always true.

Implements GUICommand.

Definition at line 119 of file CreateHDBCmd.cc.

119 {
120 return true;
121}

The documentation for this class was generated from the following files: