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

#include <DropDownMenu.hh>

Inheritance diagram for DropDownMenu:
Inheritance graph
Collaboration diagram for DropDownMenu:
Collaboration graph

Public Types

enum  MenuType { MENU_PATH , MENU_MODULE , MENU_OPERATION }
 

Public Member Functions

 DropDownMenu (MenuType type)
 
virtual ~DropDownMenu ()
 

Private Member Functions

 DropDownMenu (const DropDownMenu &)
 Copying not allowed.
 
DropDownMenuoperator= (const DropDownMenu &)
 Assignment not allowed.
 
void onMenuEvent (wxCommandEvent &event)
 
void updateMenu ()
 

Detailed Description

Class that models drop down menu.

Drop down menu is shown, when user clicks right mouse button over tree item or list item in main window.

Definition at line 44 of file DropDownMenu.hh.

Member Enumeration Documentation

◆ MenuType

Type of the drop down menu.

Enumerator
MENU_PATH 

Path menu.

MENU_MODULE 

Module menu.

MENU_OPERATION 

Operation menu.

Definition at line 50 of file DropDownMenu.hh.

50 {
51 MENU_PATH, ///< Path menu.
52 MENU_MODULE, ///< Module menu.
53 MENU_OPERATION ///< Operation menu.
54 };
@ MENU_MODULE
Module menu.
@ MENU_OPERATION
Operation menu.
@ MENU_PATH
Path menu.

Constructor & Destructor Documentation

◆ DropDownMenu() [1/2]

DropDownMenu::DropDownMenu ( MenuType  type)
explicit

Constructor.

param type The type of the drop down menu.

Definition at line 54 of file DropDownMenu.cc.

54 : wxMenu() {
55
57
58 switch (type) {
59 case MENU_PATH: {
61 Append(
63 WxConversion::toWxString(fmt.str()));
64 }
65 break;
66 case MENU_MODULE: {
68 Append(
70 WxConversion::toWxString(fmt.str()));
71
73 Append(
75 WxConversion::toWxString(fmt.str()));
76
78 Append(
80 }
81 break;
82 case MENU_OPERATION: {
84 Append(
86 WxConversion::toWxString(fmt.str()));
87
89 Append(
91 WxConversion::toWxString(fmt.str()));
92
94 Append(
96 WxConversion::toWxString(fmt.str()));
97
99 Append(
101 WxConversion::toWxString(fmt.str()));
102 }
103 break;
104 default:
105 break;
106 }
107
108 updateMenu();
109}
@ CMD_MODIFY_BEHAVIOR
Modify operation behavior command id.
@ CMD_REMOVE_MODULE
Remove module command id.
@ CMD_PROPERTIES
Operation properties command id.
@ CMD_ADD_OPERATION
Add operation command id.
@ CMD_BUILD
Build command id.
@ CMD_SIMULATE
Simulate command id.
@ CMD_ADD_MODULE
Add module command id.
@ CMD_REMOVE_OPERATION
Remove operation command id.
static OSEdTextGenerator & instance()
@ TXT_MENU_SIMULATE
Simulate menu label.
@ TXT_MENU_REMOVE_OPERATION
Remove operation menu label.
@ TXT_MENU_BUILD
Build menu label.
@ TXT_MENU_ADD_OPERATION
Add operation menu label.
@ TXT_MENU_ADD_MODULE
Add module menu label.
@ TXT_MENU_MODIFY_PROPERTIES
Modify properties menu label.
@ TXT_MENU_REMOVE_MODULE
Remove module menu label.
@ TXT_MENU_MODIFY_BEHAVIOR
Modify behavior menu label.
virtual boost::format text(int textId)
static wxString toWxString(const std::string &source)

References OSEdConstants::CMD_ADD_MODULE, OSEdConstants::CMD_ADD_OPERATION, OSEdConstants::CMD_BUILD, OSEdConstants::CMD_MODIFY_BEHAVIOR, OSEdConstants::CMD_PROPERTIES, OSEdConstants::CMD_REMOVE_MODULE, OSEdConstants::CMD_REMOVE_OPERATION, OSEdConstants::CMD_SIMULATE, OSEdTextGenerator::instance(), Texts::TextGenerator::text(), WxConversion::toWxString(), OSEdTextGenerator::TXT_MENU_ADD_MODULE, OSEdTextGenerator::TXT_MENU_ADD_OPERATION, OSEdTextGenerator::TXT_MENU_BUILD, OSEdTextGenerator::TXT_MENU_MODIFY_BEHAVIOR, OSEdTextGenerator::TXT_MENU_MODIFY_PROPERTIES, OSEdTextGenerator::TXT_MENU_REMOVE_MODULE, OSEdTextGenerator::TXT_MENU_REMOVE_OPERATION, and OSEdTextGenerator::TXT_MENU_SIMULATE.

Here is the call graph for this function:

◆ ~DropDownMenu()

DropDownMenu::~DropDownMenu ( )
virtual

Destructor.

Definition at line 114 of file DropDownMenu.cc.

114 {
115}

◆ DropDownMenu() [2/2]

DropDownMenu::DropDownMenu ( const DropDownMenu )
private

Copying not allowed.

Member Function Documentation

◆ onMenuEvent()

void DropDownMenu::onMenuEvent ( wxCommandEvent &  event)
private

Handles the menu commands.

Parameters
eventThe event to be handled.

Definition at line 123 of file DropDownMenu.cc.

123 {
124 wxGetApp().mainFrame()->onCommandEvent(event);
125}

◆ operator=()

DropDownMenu & DropDownMenu::operator= ( const DropDownMenu )
private

Assignment not allowed.

◆ updateMenu()

void DropDownMenu::updateMenu ( )
private

Updates the menus enabled/disabled status.

Definition at line 131 of file DropDownMenu.cc.

131 {
132 CommandRegistry* registry = wxGetApp().mainFrame()->registry();
133 GUICommand* command = registry->firstCommand();
134 while (command != NULL) {
135 if (FindItem(command->id()) != NULL) {
136 if (command->isEnabled()) {
137 Enable(command->id(), true);
138 } else {
139 Enable(command->id(), false);
140 }
141 }
142 command = registry->nextCommand();
143 }
144}
GUICommand * firstCommand()
GUICommand * nextCommand()
virtual int id() const =0
virtual bool isEnabled()=0

References CommandRegistry::firstCommand(), GUICommand::id(), GUICommand::isEnabled(), and CommandRegistry::nextCommand().

Here is the call graph for this function:

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