![]() |
appkit
1.5.1
RoadNarrows Robotics Application Kit
|
Window button menu base class. More...
#include <WinMenu.h>
Public Types | |
| typedef std::map< int, WinButton * > | MapBttns_T |
| map of added menu buttons | |
Public Member Functions | |
| WinButtonMenu (const std::string &strIconPath=WinIconDirDft) | |
| WinButtonMenu initialization constructor. More... | |
| virtual | ~WinButtonMenu () |
| WinButtonMenu destructor. | |
| void | appendIconDir (const std::string &strIconDir) |
| Append directory to icon search path. More... | |
| void | prependIconDir (const std::string &strIconDir) |
| Prepend directory to icon search path. More... | |
| void | setIconPath (const std::string &strIconPath) |
| Set icon search path. More... | |
| std::string | getIconPath () |
| Get icon search path. More... | |
| virtual bool | addImageButton (int nEvent, WidgetState eInitState, AlignOp eAlign, const std::string &strAltText, const std::string &strIconNormal, const std::string &strToolTipNormal="", const std::string &strIconActive="", const std::string &strToolTipActive="") |
| Add button with image to menu. More... | |
| virtual bool | addLabelButton (int nEvent, WidgetState eInitState, AlignOp eAlign, const std::string &strLabelNormal, const std::string &strToolTipNormal="", const std::string &strLabelActive="", const std::string &strToolTipActive="") |
| Add button with text label to menu. More... | |
| virtual void | bind (Win *pWin) |
| Bind the button menu to the given window. More... | |
| virtual void | unbind () |
| Unbind the menu from the currently bound window. | |
| int | getCurrentEvent () |
| Get the current button menu event. More... | |
| int | setCurrentEvent (int nNewEvent) |
| Set the current button menu event. More... | |
| int | getPreviousEvent () |
| Get the previous menu event. More... | |
| size_t | getNumMenuButtons () |
| Get the current number of menu items;. More... | |
| WidgetState | getButtonState (int nEvent) |
| Get the given button state. More... | |
| void | setButtonState (int nEvent, WidgetState eNewState) |
| Set the given button state. More... | |
| void | setButtonStateList (const std::string &strEvent,...) |
| Set the states of the given buttons. More... | |
| void | resetAllButtonStates () |
| Reset all menu buttons states to their initial states. | |
Protected Member Functions | |
| std::string | makeIconPath (const std::string &strIconFile) |
| Make icon image file path. More... | |
| void | changeButtonState (WinButton *pButton, WidgetState eNewState) |
| Change the state and gui look of the given button. More... | |
Static Protected Member Functions | |
| static void | onMenuButtonClick (int nEvent, void *user_data) |
| Menu button press callback. More... | |
Protected Attributes | |
| Win * | m_pWin |
| menus are bound to this window | |
| std::string | m_strIconPath |
| icon directories search path | |
| int | m_nCurrentEvent |
| current (user) menu event | |
| int | m_nPreviousEvent |
| previous (user) menu event | |
| MapBttns_T | m_mapButtons |
| menu button map | |
Window button menu base class.
Buttons with icons or text are placed on the left or right side of the application window. Each icon is associated with an application defined event.
|
inline |
WinButtonMenu initialization constructor.
| strIconPath | Icon path of search directories. |
Definition at line 243 of file WinMenu.h.
References rnr::UIEventNone.
|
inlinevirtual |
Add button with image to menu.
| nEvent | Unique event (and id) associated with button press. |
| eInitState | Button widget initial state. See GUI Widget State. |
| eAlign | Button alignment. See rnmpwin_align. |
| strAltText | Button alternative text string. |
| strIconNormal | Button icon image file name for normal state. |
| strToolTipNormal | Button tooltip for normal state. |
| strIconActive | Button icon image file name for active state. Empty for no icon. |
| strToolTipActive | Button tooltip for active state. |
Reimplemented in rnr::WinGtkButtonMenu.
|
inlinevirtual |
Add button with text label to menu.
| nEvent | Unique event (and id) associated with button press. |
| eInitState | Button widget initial state. See GUI Widget State. |
| eAlign | Button alignment. See rnmpwin_align. |
| strLabelNormal | Button text label for normal state. |
| strToolTipNormal | Button tooltip for normal state. |
| strLabelActive | Button text label for active state. Empty for no label. |
| strToolTipActive | Button tooltip for active state. |
Reimplemented in rnr::WinGtkButtonMenu.
|
inline |
Append directory to icon search path.
| strIconDir | Directory holding icons. |
Definition at line 261 of file WinMenu.h.
|
virtual |
Bind the button menu to the given window.
Any previously bound menu is unbound. This menu is reset to its initial state. The menu buttons are added to the window and displayed.
| pWin | Pointer to binding window. |
Definition at line 167 of file WinMenu.cxx.
References rnr::WinButton::getCurrentImageWidget(), rnr::WinButton::getCurrentLabel(), rnr::WinButton::getCurrentToolTip(), rnr::WinButton::m_eAlign, rnr::WinButton::m_eType, rnr::WinButton::m_nEvent, rnr::WinButton::m_strAltText, rnr::WinButtonTypeImage, and rnr::WinButtonTypeLabel.
|
protected |
Change the state and gui look of the given button.
| pButton | Pointer to menu button instance. |
| eNewState | New button state. See rnmpwin_widgetstate |
Definition at line 338 of file WinMenu.cxx.
References rnr::WinButton::getActiveImageWidget(), rnr::WinButton::getNormalImageWidget(), rnr::WinButton::m_eState, rnr::WinButton::m_eType, rnr::WinButton::m_nEvent, rnr::WinButton::m_strTagActive, rnr::WinButton::m_strTagNormal, rnr::WinButton::m_strToolTipActive, rnr::WinButton::m_strToolTipNormal, rnr::WidgetStateActive, rnr::WinButtonTypeImage, and rnr::WinButtonTypeLabel.
Referenced by onMenuButtonClick().
|
inline |
Get the given button state.
| nEvent | Menu-wide unique event button identifier. |
Definition at line 439 of file WinMenu.h.
References rnr::WidgetStateNormal.
|
inline |
Get the current button menu event.
Definition at line 390 of file WinMenu.h.
|
inline |
Get icon search path.
Definition at line 305 of file WinMenu.h.
|
inline |
|
inline |
Get the previous menu event.
Definition at line 417 of file WinMenu.h.
|
protected |
Make icon image file path.
The built file path is check of existence.
| strIconFile | Icon file absolute or relative file name. |
Definition at line 275 of file WinMenu.cxx.
|
staticprotected |
Menu button press callback.
| nEvent | Button event (and button id). |
| user_data | User-supplied data (this). |
Definition at line 398 of file WinMenu.cxx.
References changeButtonState(), m_mapButtons, setCurrentEvent(), rnr::WidgetStateActive, and rnr::WidgetStateNormal.
|
inline |
Prepend directory to icon search path.
| strIconDir | Directory holding icons. |
Definition at line 278 of file WinMenu.h.
|
inline |
Set the given button state.
| nEvent | Menu-wide unique event button identifier. |
| eNewState | New button state. See rnmpwin_widgetstate |
Definition at line 456 of file WinMenu.h.
| void WinButtonMenu::setButtonStateList | ( | const std::string & | strEvent, |
| ... | |||
| ) |
Set the states of the given buttons.
| strEvent | Event reason string (used for logging only). |
| ... | Sequence of event,state pairs. The sequence is terminated by the UIEventNone special 'no' action event. |
Definition at line 229 of file WinMenu.cxx.
References rnr::UIEventNone.
|
inline |
Set the current button menu event.
| nNewEvent | New event unique identifier. |
Definition at line 402 of file WinMenu.h.
Referenced by onMenuButtonClick().
|
inline |
Set icon search path.
| strIconPath | Icon path of search directories. |
Definition at line 295 of file WinMenu.h.