OpenASIP  2.0
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.

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 }

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.

97  {
99 }

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:
HDBEditorConstants::COMMAND_NAME_CREATE_HDB
static const std::string COMMAND_NAME_CREATE_HDB
Name of the create HDB command.
Definition: HDBEditorConstants.hh:72
CreateHDBCmd::CreateHDBCmd
CreateHDBCmd()
Definition: CreateHDBCmd.cc:46
HDBEditorConstants::COMMAND_CREATE_HDB
@ COMMAND_CREATE_HDB
Definition: HDBEditorConstants.hh:46
assert
#define assert(condition)
Definition: Application.hh:86
GUICommand::GUICommand
GUICommand(std::string name, wxWindow *parent)
Definition: GUICommand.cc:42
WxConversion::toString
static std::string toString(const wxString &source)
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition: GUICommand.cc:75