OpenASIP  2.0
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. More...
 
DropDownMenuoperator= (const DropDownMenu &)
 Assignment not allowed. More...
 
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  };

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: {
60  format fmt = texts.text(OSEdTextGenerator::TXT_MENU_ADD_MODULE);
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 }

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 }

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:
DropDownMenu::MENU_OPERATION
@ MENU_OPERATION
Operation menu.
Definition: DropDownMenu.hh:53
DropDownMenu::MENU_MODULE
@ MENU_MODULE
Module menu.
Definition: DropDownMenu.hh:52
WxConversion::toWxString
static wxString toWxString(const std::string &source)
GUICommand::isEnabled
virtual bool isEnabled()=0
OSEdConstants::CMD_ADD_OPERATION
@ CMD_ADD_OPERATION
Add operation command id.
Definition: OSEdConstants.hh:93
DropDownMenu::MENU_PATH
@ MENU_PATH
Path menu.
Definition: DropDownMenu.hh:51
OSEdConstants::CMD_BUILD
@ CMD_BUILD
Build command id.
Definition: OSEdConstants.hh:98
OSEdConstants::CMD_REMOVE_OPERATION
@ CMD_REMOVE_OPERATION
Remove operation command id.
Definition: OSEdConstants.hh:96
OSEdConstants::CMD_PROPERTIES
@ CMD_PROPERTIES
Operation properties command id.
Definition: OSEdConstants.hh:94
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
OSEdConstants::CMD_SIMULATE
@ CMD_SIMULATE
Simulate command id.
Definition: OSEdConstants.hh:100
GUICommand
Definition: GUICommand.hh:43
OSEdConstants::CMD_REMOVE_MODULE
@ CMD_REMOVE_MODULE
Remove module command id.
Definition: OSEdConstants.hh:95
OSEdTextGenerator::TXT_MENU_MODIFY_PROPERTIES
@ TXT_MENU_MODIFY_PROPERTIES
Modify properties menu label.
Definition: OSEdTextGenerator.hh:170
DropDownMenu::updateMenu
void updateMenu()
Definition: DropDownMenu.cc:131
CommandRegistry
Definition: CommandRegistry.hh:47
OSEdTextGenerator::TXT_MENU_ADD_OPERATION
@ TXT_MENU_ADD_OPERATION
Add operation menu label.
Definition: OSEdTextGenerator.hh:167
OSEdTextGenerator::TXT_MENU_ADD_MODULE
@ TXT_MENU_ADD_MODULE
Add module menu label.
Definition: OSEdTextGenerator.hh:169
CommandRegistry::nextCommand
GUICommand * nextCommand()
Definition: CommandRegistry.cc:120
OSEdConstants::CMD_ADD_MODULE
@ CMD_ADD_MODULE
Add module command id.
Definition: OSEdConstants.hh:92
OSEdTextGenerator::TXT_MENU_REMOVE_MODULE
@ TXT_MENU_REMOVE_MODULE
Remove module menu label.
Definition: OSEdTextGenerator.hh:178
OSEdTextGenerator::instance
static OSEdTextGenerator & instance()
Definition: OSEdTextGenerator.cc:214
OSEdTextGenerator::TXT_MENU_MODIFY_BEHAVIOR
@ TXT_MENU_MODIFY_BEHAVIOR
Modify behavior menu label.
Definition: OSEdTextGenerator.hh:179
OSEdTextGenerator
Definition: OSEdTextGenerator.hh:42
OSEdTextGenerator::TXT_MENU_REMOVE_OPERATION
@ TXT_MENU_REMOVE_OPERATION
Remove operation menu label.
Definition: OSEdTextGenerator.hh:168
GUICommand::id
virtual int id() const =0
CommandRegistry::firstCommand
GUICommand * firstCommand()
Definition: CommandRegistry.cc:104
OSEdTextGenerator::TXT_MENU_SIMULATE
@ TXT_MENU_SIMULATE
Simulate menu label.
Definition: OSEdTextGenerator.hh:173
OSEdTextGenerator::TXT_MENU_BUILD
@ TXT_MENU_BUILD
Build menu label.
Definition: OSEdTextGenerator.hh:171
OSEdConstants::CMD_MODIFY_BEHAVIOR
@ CMD_MODIFY_BEHAVIOR
Modify operation behavior command id.
Definition: OSEdConstants.hh:97