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

#include <OpenHDBCmd.hh>

Inheritance diagram for OpenHDBCmd:
Inheritance graph
Collaboration diagram for OpenHDBCmd:
Collaboration graph

Public Member Functions

 OpenHDBCmd ()
 
virtual ~OpenHDBCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual OpenHDBCmdcreate () 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 opening HDB in HDBEditor.

Displays a file dialog for choosing the HDB file to open.

Definition at line 43 of file OpenHDBCmd.hh.

Constructor & Destructor Documentation

◆ OpenHDBCmd()

OpenHDBCmd::OpenHDBCmd ( )

The Constructor.

Definition at line 46 of file OpenHDBCmd.cc.

46 :
48}
static const std::string COMMAND_NAME_OPEN_HDB
Name of the open HDB command.

Referenced by create().

◆ ~OpenHDBCmd()

OpenHDBCmd::~OpenHDBCmd ( )
virtual

The Destructor.

Definition at line 54 of file OpenHDBCmd.cc.

54 {
55}

Member Function Documentation

◆ create()

OpenHDBCmd * OpenHDBCmd::create ( ) const
virtual

Creates and returns a new isntance of this command.

Returns
Newly created instance of this command.

Implements GUICommand.

Definition at line 110 of file OpenHDBCmd.cc.

110 {
111 return new OpenHDBCmd();
112}

References OpenHDBCmd().

Here is the call graph for this function:

◆ Do()

bool OpenHDBCmd::Do ( )
virtual

Executes the command.

Implements GUICommand.

Definition at line 62 of file OpenHDBCmd.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("Choose a file."), _T(""), _T(""),
69 wildcard, wxOPEN);
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 wxGetApp().mainFrame().setHDB(file);
79
80 return true;
81}
#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 OpenHDBCmd::icon ( ) const
virtual

Returns full path to the command icon file.

Returns
Full path to the command icon file.

Implements GUICommand.

Definition at line 90 of file OpenHDBCmd.cc.

90 {
91 return "fileopen.png";
92}

◆ id()

int OpenHDBCmd::id ( ) const
virtual

Returns ID of this command.

Implements GUICommand.

Definition at line 99 of file OpenHDBCmd.cc.

References HDBEditorConstants::COMMAND_OPEN_HDB.

◆ isEnabled()

bool OpenHDBCmd::isEnabled ( )
virtual

Returns true if the command is enabled, false otherwise.

Returns
Always true.

Implements GUICommand.

Definition at line 121 of file OpenHDBCmd.cc.

121 {
122 return true;
123}

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