KiCad PCB EDA Suite
|
#include <zoom_menu.h>
Public Member Functions | |
ZOOM_MENU (EDA_DRAW_FRAME *aParent) | |
void | SetTitle (const wxString &aTitle) override |
Function SetTitle() Sets title for the context menu. More... | |
void | DisplayTitle (bool aDisplay=true) |
Function DisplayTitle() Decides whether a title for a pop up menu should be displayed. More... | |
void | SetIcon (const BITMAP_OPAQUE *aIcon) |
Function SetIcon() Assigns an icon for the entry. More... | |
wxMenuItem * | Add (const wxString &aLabel, int aId, const BITMAP_OPAQUE *aIcon=NULL) |
Function Add() Adds an entry to the menu. More... | |
wxMenuItem * | Add (const TOOL_ACTION &aAction) |
Function Add() Adds an entry to the menu, basing on the TOOL_ACTION object. More... | |
std::list< wxMenuItem * > | Add (CONTEXT_MENU *aMenu, bool aExpand=false) |
Function Add() Adds a context menu as a submenu. More... | |
void | Clear () |
Function Clear() Removes all the entries from the menu (as well as its title). More... | |
bool | HasEnabledItems () const |
Function HasEnabledItems();. More... | |
int | GetSelected () const |
Function GetSelected() Returns the position of selected item. More... | |
void | UpdateAll () |
Function UpdateAll() Runs update handlers for the menu and its submenus. More... | |
void | SetTool (TOOL_INTERACTIVE *aTool) |
Function SetTool() Sets a tool that is the creator of the menu. More... | |
CONTEXT_MENU * | Clone () const |
Creates a deep, recursive copy of this CONTEXT_MENU. More... | |
Protected Member Functions | |
TOOL_MANAGER * | getToolManager () |
More... | |
void | copyFrom (const CONTEXT_MENU &aMenu) |
Copies another menus data to this instance. More... | |
Static Protected Member Functions | |
static int | getMenuId (const TOOL_ACTION &aAction) |
More... | |
Private Member Functions | |
CONTEXT_MENU * | create () const override |
More... | |
OPT_TOOL_EVENT | eventHandler (const wxMenuEvent &aEvent) override |
Event handler stub. More... | |
void | update () override |
Update menu state stub. More... | |
Private Attributes | |
EDA_DRAW_FRAME * | m_parent |
Definition at line 32 of file zoom_menu.h.
ZOOM_MENU::ZOOM_MENU | ( | EDA_DRAW_FRAME * | aParent | ) |
Definition at line 35 of file zoom_menu.cpp.
References Format(), EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_FRAME::GetZoomLevelCoeff(), i, ID_POPUP_ZOOM_LEVEL_END, ID_POPUP_ZOOM_LEVEL_START, BASE_SCREEN::m_ZoomList, min, CONTEXT_MENU::SetIcon(), and CONTEXT_MENU::SetTitle().
Referenced by create().
|
inherited |
Function Add() Adds an entry to the menu.
After highlighting/selecting the entry, a TOOL_EVENT command is sent that contains ID of the entry.
aLabel | is the text label show in the menu. |
aId | is the ID that is sent in the TOOL_EVENT. It should be unique for every entry. |
aIcon | is an optional icon. |
Definition at line 134 of file context_menu.cpp.
References set_wxMenuIcon().
Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), CONDITIONAL_MENU::Generate(), ALIGN_DISTRIBUTE_TOOL::Init(), and PAD_CONTEXT_MENU::PAD_CONTEXT_MENU().
|
inherited |
Function Add() Adds an entry to the menu, basing on the TOOL_ACTION object.
After selecting the entry, a TOOL_EVENT command containing name of the action is sent.
aAction | is the action to be added to menu entry. |
ID numbers for tool actions need to have a value higher than ACTION_ID
Definition at line 149 of file context_menu.cpp.
References TOOL_ACTION::GetDescription(), TOOL_ACTION::GetIcon(), CONTEXT_MENU::getMenuId(), TOOL_ACTION::GetMenuItem(), i, CONTEXT_MENU::m_toolActions, and set_wxMenuIcon().
|
inherited |
Function Add() Adds a context menu as a submenu.
The difference between this function and wxMenu::AppendSubMenu() is the capability to handle icons.
aMenu | is the submenu to be added. |
aExpand | allows to add all entries from the menu as individual entries rather than add everything as a submenu. |
Definition at line 166 of file context_menu.cpp.
References CONTEXT_MENU::appendCopy(), CONTEXT_MENU::Clone(), i, CONTEXT_MENU::m_icon, CONTEXT_MENU::m_submenus, CONTEXT_MENU::m_title, and set_wxMenuIcon().
|
inherited |
Function Clear() Removes all the entries from the menu (as well as its title).
It leaves the menu in the initial state.
Definition at line 201 of file context_menu.cpp.
References i, CONTEXT_MENU::m_submenus, CONTEXT_MENU::m_titleDisplayed, and CONTEXT_MENU::m_toolActions.
Referenced by CONTEXT_MENU::Clone().
|
inherited |
Creates a deep, recursive copy of this CONTEXT_MENU.
Definition at line 259 of file context_menu.cpp.
References CONTEXT_MENU::Clear(), CONTEXT_MENU::copyFrom(), and CONTEXT_MENU::create().
Referenced by CONTEXT_MENU::Add(), CONTEXT_MENU::appendCopy(), TOOL_MANAGER::dispatchContextMenu(), and CONTEXT_MENU::GetSelected().
|
protectedinherited |
Copies another menus data to this instance.
Old entries are preserved, and ones form aMenu are copied.
Definition at line 435 of file context_menu.cpp.
References CONTEXT_MENU::appendCopy(), i, CONTEXT_MENU::m_icon, CONTEXT_MENU::m_selected, CONTEXT_MENU::m_title, CONTEXT_MENU::m_titleDisplayed, CONTEXT_MENU::m_tool, and CONTEXT_MENU::m_toolActions.
Referenced by CONTEXT_MENU::Clone(), and CONTEXT_MENU::eventHandler().
|
inlineoverrideprivatevirtual |
Returns an instance of this class. It has to be overridden in inheriting classes.
Reimplemented from CONTEXT_MENU.
Definition at line 38 of file zoom_menu.h.
References eventHandler(), m_parent, update(), and ZOOM_MENU().
|
inherited |
Function DisplayTitle() Decides whether a title for a pop up menu should be displayed.
Definition at line 97 of file context_menu.cpp.
References CONTEXT_MENU::m_icon, CONTEXT_MENU::m_title, CONTEXT_MENU::m_titleDisplayed, and set_wxMenuIcon().
Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), and CONTEXT_MENU::SetTitle().
|
overrideprivatevirtual |
Event handler stub.
It should be used if you want to generate a TOOL_EVENT from a wxMenuEvent. It will be called when a menu entry is clicked.
Reimplemented from CONTEXT_MENU.
Definition at line 55 of file zoom_menu.cpp.
References ID_POPUP_ZOOM_LEVEL_START, and ACTIONS::zoomPreset.
Referenced by create().
|
inlinestaticprotectedinherited |
Returns the corresponding wxMenuItem identifier for a TOOL_ACTION object.
Definition at line 155 of file context_menu.h.
References CONTEXT_MENU::ACTION_ID, and TOOL_ACTION::GetId().
Referenced by CONTEXT_MENU::Add(), and PAD_CONTEXT_MENU::update().
|
inlineinherited |
Function GetSelected() Returns the position of selected item.
If the returned value is negative, that means that menu was dismissed.
Definition at line 124 of file context_menu.h.
References CONTEXT_MENU::Clone(), CONTEXT_MENU::create(), CONTEXT_MENU::getToolManager(), CONTEXT_MENU::m_selected, CONTEXT_MENU::SetTool(), and CONTEXT_MENU::UpdateAll().
|
protectedinherited |
Returns an instance of TOOL_MANAGER class.
Definition at line 279 of file context_menu.cpp.
References TOOL_BASE::GetManager(), and CONTEXT_MENU::m_tool.
Referenced by CONTEXT_MENU::GetSelected(), PAD_CONTEXT_MENU::update(), and CONTEXT_MENU::updateHotKeys().
|
inherited |
Function HasEnabledItems();.
Returns true if the menu has any enabled items
Definition at line 215 of file context_menu.cpp.
|
inherited |
Function SetIcon() Assigns an icon for the entry.
aIcon | is the icon to be assigned. NULL is used to remove icon. |
Definition at line 73 of file context_menu.cpp.
References CONTEXT_MENU::m_icon.
Referenced by SELECTION_TOOL::disambiguationMenu(), GRID_MENU::GRID_MENU(), ALIGN_DISTRIBUTE_TOOL::Init(), PAD_CONTEXT_MENU::PAD_CONTEXT_MENU(), TRACK_VIA_SIZE_MENU::TRACK_VIA_SIZE_MENU(), and ZOOM_MENU().
|
overrideinherited |
Function SetTitle() Sets title for the context menu.
The title is shown as a text label shown on the top of the menu.
aTitle | is the new title. |
Definition at line 86 of file context_menu.cpp.
References CONTEXT_MENU::DisplayTitle(), CONTEXT_MENU::m_title, and CONTEXT_MENU::m_titleDisplayed.
Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), GRID_MENU::GRID_MENU(), ALIGN_DISTRIBUTE_TOOL::Init(), PAD_CONTEXT_MENU::PAD_CONTEXT_MENU(), and ZOOM_MENU().
|
inherited |
Function SetTool() Sets a tool that is the creator of the menu.
aTool | is the tool that created the menu. |
Definition at line 252 of file context_menu.cpp.
References CONTEXT_MENU::m_tool, and CONTEXT_MENU::runOnSubmenus().
Referenced by CONDITIONAL_MENU::Generate(), CONTEXT_MENU::GetSelected(), and TOOL_INTERACTIVE::SetContextMenu().
|
overrideprivatevirtual |
Update menu state stub.
It is called before a menu is shown, in order to update its state. Here you can tick current settings, enable/disable entries, etc.
Reimplemented from CONTEXT_MENU.
Definition at line 65 of file zoom_menu.cpp.
References EDA_DRAW_FRAME::GetScreen(), BASE_SCREEN::GetZoom(), i, ID_POPUP_ZOOM_LEVEL_START, m_parent, and BASE_SCREEN::m_ZoomList.
Referenced by create().
|
inherited |
Function UpdateAll() Runs update handlers for the menu and its submenus.
Definition at line 234 of file context_menu.cpp.
References Format(), CONTEXT_MENU::m_tool, CONTEXT_MENU::runOnSubmenus(), CONTEXT_MENU::update(), and CONTEXT_MENU::updateHotKeys().
Referenced by CONTEXT_MENU::GetSelected().
|
private |
Definition at line 46 of file zoom_menu.h.