ManaPlus
|
#include <windowmenu.h>
Public Member Functions | |
WindowMenu (const Widget2 *const widget) | |
~WindowMenu () | |
void | action (const ActionEvent &event) |
void | mousePressed (MouseEvent &event) |
void | mouseMoved (MouseEvent &event) |
void | mouseExited (MouseEvent &event) |
std::map< std::string, ButtonInfo * > & | getButtonNames () |
std::vector< Button * > & | getButtons () |
std::vector< ButtonText * > & | getButtonTexts () |
void | showButton (const std::string &name, const Visible visible) |
void | loadButtons () |
void | saveButtons () const |
void | optionChanged (const std::string &name) |
Public Member Functions inherited from Container | |
Container (const Widget2 *const widget) | |
~Container () | |
bool | safeRemove (Widget *const widget) |
void | removeControls () |
Public Member Functions inherited from BasicContainer2 | |
BasicContainer2 (const Widget2 *const widget) | |
~BasicContainer2 () | |
void | setOpaque (Opaque opaque) |
bool | isOpaque () const |
virtual void | add (Widget *const widget) |
void | addXY (Widget *const widget, const int x, const int y) |
void | draw (Graphics *const graphics) |
void | safeDraw (Graphics *const graphics) |
Public Member Functions inherited from BasicContainer | |
BasicContainer (const Widget2 *const widget) | |
~BasicContainer () | |
void | showWidgetPart (Widget *const widget, const Rect &area) |
void | moveToTop (Widget *const widget) |
void | moveToBottom (Widget *const widget) |
Rect | getChildrenArea () |
void | focusNext () |
void | focusPrevious () |
void | logic () |
void | setFocusHandler (FocusHandler *const focusHandler) |
void | setInternalFocusHandler (FocusHandler *const focusHandler) |
Widget * | getWidgetAt (int x, int y) |
void | death (const Event &event) |
Widget * | findFirstWidget (const std::set< Widget * > &list) |
void | add (Widget *const widget) |
virtual void | remove (Widget *const widget) |
virtual void | clear () |
Public Member Functions inherited from Widget | |
Widget (const Widget2 *const widget) | |
~Widget () | |
virtual void | drawFrame (Graphics *graphics) |
virtual void | safeDrawFrame (Graphics *graphics) |
void | setFrameSize (const unsigned int frameSize) |
unsigned int | getFrameSize () const |
Widget * | getParent () const |
void | setWidth (const int width) |
int | getWidth () const |
void | setHeight (const int height) |
int | getHeight () const |
void | setSize (const int width, const int height) |
void | setX (const int x) |
int | getX () const |
void | setY (const int y) |
int | getY () const |
void | setPosition (const int x, const int y) |
void | setDimension (const Rect &dimension) |
const Rect & | getDimension () const |
void | setFocusable (const bool focusable) |
bool | isFocusable () const |
virtual bool | isFocused () const |
void | setEnabled (const bool enabled) |
bool | isEnabled () const |
void | setVisible (Visible visible) |
bool | isVisible () const |
void | setBaseColor (const Color &color) |
const Color & | getBaseColor () const |
void | setForegroundColor (const Color &color) |
const Color & | getForegroundColor () const |
void | setBackgroundColor (const Color &color) |
const Color & | getBackgroundColor () const |
virtual void | requestFocus () |
virtual void | requestMoveToTop () |
virtual void | requestMoveToBottom () |
FocusHandler * | getFocusHandler () |
void | addActionListener (ActionListener *const actionListener) |
void | removeActionListener (ActionListener *const actionListener) |
void | addDeathListener (WidgetDeathListener *const deathListener) |
void | removeDeathListener (WidgetDeathListener *const deathListener) |
void | addMouseListener (MouseListener *const mouseListener) |
void | removeMouseListener (MouseListener *const mouseListener) |
void | addKeyListener (KeyListener *const keyListener) |
void | removeKeyListener (KeyListener *const keyListener) |
void | addFocusListener (FocusListener *const focusListener) |
void | removeFocusListener (FocusListener *const focusListener) |
void | addWidgetListener (WidgetListener *const widgetListener) |
void | removeWidgetListener (WidgetListener *const widgetListener) |
void | setActionEventId (const std::string &actionEventId) |
const std::string & | getActionEventId () const |
virtual void | getAbsolutePosition (int &x, int &y) const |
virtual void | setParent (Widget *parent) |
Font * | getFont () const |
void | setFont (Font *const font) |
virtual void | fontChanged () |
bool | isTabInEnabled () const |
void | setTabInEnabled (const bool enabled) |
bool | isTabOutEnabled () const |
void | setTabOutEnabled (const bool enabled) |
void | requestModalFocus () |
virtual void | requestModalMouseInputFocus () |
virtual void | releaseModalFocus () |
virtual void | releaseModalMouseInputFocus () |
virtual bool | isModalFocused () const |
virtual bool | isModalMouseInputFocused () const |
const std::list< MouseListener * > & | getMouseListeners () const A_CONST |
const std::list< KeyListener * > & | getKeyListeners () const A_CONST |
const std::list< FocusListener * > & | getFocusListeners () const A_CONST |
virtual FocusHandler * | getInternalFocusHandler () |
void | setInternalFocusHandler (FocusHandler *const internalFocusHandler) |
void | setId (const std::string &id) |
const std::string & | getId () const |
virtual void | showPart (const Rect &rectangle) |
bool | isAllowLogic () const |
void | setMouseConsume (const bool b) |
bool | isMouseConsume () const |
void | setRedraw (const bool b) |
virtual bool | isSelectable () const |
void | setSelectable (const bool selectable) |
void | windowResized () |
virtual void | postInit () |
Public Member Functions inherited from Widget2 | |
virtual | ~Widget2 () |
const Color & | getThemeColor (const ThemeColorIdT type, const unsigned int alpha) const A_INLINE |
const Color & | getThemeCharColor (const signed char c, bool &valid) const A_INLINE |
virtual void | setWidget2 (const Widget2 *const widget) |
void | setPalette (int palette) |
void | checkPalette () |
void | setForegroundColor2 (const Color &color) |
Widget * | getWindow () const |
virtual void | setWindow (Widget *const window) |
Public Member Functions inherited from WidgetDeathListener | |
virtual | ~WidgetDeathListener () |
Public Member Functions inherited from ConfigListener | |
ConfigListener () | |
virtual | ~ConfigListener () |
Public Member Functions inherited from ActionListener | |
virtual | ~ActionListener () |
Public Member Functions inherited from SelectionListener | |
virtual | ~SelectionListener () |
virtual void | valueChanged (const SelectionEvent &event) |
Public Member Functions inherited from MouseListener | |
virtual | ~MouseListener () |
virtual void | mouseEntered (MouseEvent &event) |
virtual void | mouseReleased (MouseEvent &event) |
virtual void | mouseClicked (MouseEvent &event) |
virtual void | mouseWheelMovedUp (MouseEvent &event) |
virtual void | mouseWheelMovedDown (MouseEvent &event) |
virtual void | mouseDragged (MouseEvent &event) |
Protected Member Functions | |
void | drawChildren (Graphics *const graphics) |
void | safeDrawChildren (Graphics *const graphics) |
Protected Member Functions inherited from BasicContainer | |
virtual void | logicChildren () |
Protected Member Functions inherited from Widget | |
void | distributeActionEvent () |
void | distributeResizedEvent () |
void | distributeMovedEvent () |
void | distributeHiddenEvent () |
void | distributeShownEvent () |
Protected Member Functions inherited from Widget2 | |
Widget2 (const Widget2 *const widget) | |
Protected Member Functions inherited from WidgetDeathListener | |
WidgetDeathListener () | |
Protected Member Functions inherited from ActionListener | |
ActionListener () | |
Protected Member Functions inherited from SelectionListener | |
SelectionListener () | |
Protected Member Functions inherited from MouseListener | |
MouseListener () | |
Private Member Functions | |
void | addButton (const char *const text, const int iconNumber, const std::string &description, int &x, int &h, const InputActionT key, const Visible visible) |
void | updateButtons () |
Private Attributes | |
Skin * | mSkin |
ImageSet * | mImageSet |
int | mPadding |
int | mSpacing |
std::vector< Button * > | mButtons |
std::vector< ButtonText * > | mButtonTexts |
std::map< std::string, ButtonInfo * > | mButtonNames |
bool | mHaveMouse |
int | mAutoHide |
bool | mSmallWindow |
The window menu. Allows showing and hiding many of the different windows used in the game.
Definition at line 49 of file windowmenu.h.
|
explicit |
Definition at line 53 of file windowmenu.cpp.
References _, addButton(), Configuration::addListener(), Widget::addMouseListener(), config, Theme::getImageSetFromTheme(), Configuration::getIntValue(), Skin::getOption(), SkillDialog::hasSkills(), loadButtons(), mainGraphics, mAutoHide, mImageSet, mPadding, mSkin, mSpacing, Graphics::mWidth, N_, Widget::setDimension(), Widget::setFocusable(), settings, Widget::setVisible(), InputAction::SHOW_WINDOWS, Settings::showButtonIcons, skillDialog, Visible_false, Visible_true, InputAction::WINDOW_BANK, InputAction::WINDOW_CART, InputAction::WINDOW_CHAT, InputAction::WINDOW_CLAN, InputAction::WINDOW_DEBUG, InputAction::WINDOW_DIDYOUKNOW, InputAction::WINDOW_DROP, InputAction::WINDOW_EMOTE_SHORTCUT, InputAction::WINDOW_EQUIPMENT, InputAction::WINDOW_HELP, InputAction::WINDOW_INVENTORY, InputAction::WINDOW_KILLS, InputAction::WINDOW_MAIL, InputAction::WINDOW_MINIMAP, InputAction::WINDOW_ONLINE, InputAction::WINDOW_OUTFIT, InputAction::WINDOW_QUESTS, InputAction::WINDOW_SERVER_INFO, InputAction::WINDOW_SETUP, InputAction::WINDOW_SHOP, InputAction::WINDOW_SHORTCUT, InputAction::WINDOW_SKILL, InputAction::WINDOW_SOCIAL, InputAction::WINDOW_SPELLS, InputAction::WINDOW_STATUS, InputAction::WINDOW_UPDATER, and x.
WindowMenu::~WindowMenu | ( | ) |
Definition at line 273 of file windowmenu.cpp.
References CHECKLISTENERS, config, Resource::decRef(), delete_all(), FOR_EACH, mButtonNames, mButtons, mButtonTexts, mImageSet, mSkin, Widget::mVisible, Configuration::removeListener(), theme, Theme::unload(), and Visible_false.
|
virtual |
Called when an action is recieved from a widget. It is used to be able to recieve a notification that an action has occured.
actionEvent | The event of the action. |
Implements ActionListener.
Definition at line 308 of file windowmenu.cpp.
References InputManager::executeAction(), Actions::info(), inputManager, and mButtonNames.
|
inlineprivate |
Definition at line 323 of file windowmenu.cpp.
References BasicContainer2::add(), Button::adjustSize(), BUTTON_SKIN, CAST_S32, ImageSet::get(), Widget::getHeight(), Widget::getWidth(), mButtonNames, mButtons, mButtonTexts, mImageSet, mPadding, mSpacing, Button::setDescription(), Widget::setFocusable(), Button::setImage(), Widget::setPosition(), Button::setTag(), settings, InputAction::SHOW_WINDOWS, Settings::showButtonIcons, and x.
Referenced by WindowMenu().
|
protectedvirtual |
Draws the children widgets of the basic container.
graphics | A graphics object to draw with. |
Reimplemented from BasicContainer.
Definition at line 554 of file windowmenu.cpp.
References BasicContainer::drawChildren(), mainGraphics, mAutoHide, mHaveMouse, mSmallWindow, and Graphics::mWidth.
|
inline |
|
inline |
Definition at line 73 of file windowmenu.h.
References mButtons.
Referenced by PopupMenu::showPopup().
|
inline |
Definition at line 76 of file windowmenu.h.
References mButtonTexts.
Referenced by PopupMenu::showWindowsPopup().
void WindowMenu::loadButtons | ( | ) |
Definition at line 484 of file windowmenu.cpp.
References config, fromBool, Widget::getActionEventId(), ConfigurationObject::getValue(), Actions::info(), mButtonNames, mSmallWindow, Widget::setVisible(), Catch::toString(), updateButtons(), Visible_false, and Visible_true.
Referenced by WindowMenu().
|
virtual |
Called when the mouse has exited the widget area.
event | Describes the event. |
Reimplemented from MouseListener.
Definition at line 438 of file windowmenu.cpp.
References Popup::hide(), mHaveMouse, and textPopup.
|
virtual |
Called when the mouse has moved in the widget area and no mouse button has been pressed (i.e no widget is being dragged).
event | Describes the event. |
Reimplemented from MouseListener.
Definition at line 399 of file windowmenu.cpp.
References _, Button::getDescription(), InputManager::getKeyValueString(), Event::getSource(), Button::getTag(), Popup::hide(), inputManager, Widget::mDimension, mHaveMouse, InputAction::NO_VALUE, TextPopup::show(), strprintf(), textPopup, Rect::x, x, Rect::y, and y.
|
virtual |
Called when a mouse button has been pressed on the widget area.
NOTE: A mouse press is NOT equal to a mouse click. Use mouseClickMessage to check for mouse clicks.
event | Describes the event. |
Reimplemented from MouseListener.
Definition at line 377 of file windowmenu.cpp.
References MouseEvent::getButton(), Widget::getX(), Widget::getY(), mSmallWindow, popupManager, popupMenu, MouseButton::RIGHT, and PopupMenu::showPopup().
|
virtual |
Called when an option changed. The config listener will have to be registered to the option name first.
Implements ConfigListener.
Definition at line 578 of file windowmenu.cpp.
References config, Configuration::getIntValue(), and mAutoHide.
|
protectedvirtual |
Reimplemented from BasicContainer.
Definition at line 566 of file windowmenu.cpp.
References mainGraphics, mAutoHide, mHaveMouse, mSmallWindow, Graphics::mWidth, and BasicContainer::safeDrawChildren().
void WindowMenu::saveButtons | ( | ) | const |
Definition at line 537 of file windowmenu.cpp.
References config, ConfigurationObject::deleteKey(), FOR_EACH, Widget::getActionEventId(), mButtons, Widget::mVisible, Configuration::setValue(), Catch::toString(), and Visible_false.
Referenced by showButton().
void WindowMenu::showButton | ( | const std::string & | name, |
const Visible | visible | ||
) |
Definition at line 447 of file windowmenu.cpp.
References Actions::info(), mButtonNames, saveButtons(), and updateButtons().
Referenced by PopupMenu::handleLink().
|
private |
Definition at line 459 of file windowmenu.cpp.
References BasicContainer2::add(), FOR_EACH, Widget::getHeight(), Widget::getWidth(), mainGraphics, mButtons, mPadding, mSpacing, Widget::mVisible, Graphics::mWidth, Container::safeRemove(), Widget::setDimension(), Widget::setPosition(), Visible_true, and x.
Referenced by loadButtons(), and showButton().
|
private |
Definition at line 116 of file windowmenu.h.
Referenced by drawChildren(), optionChanged(), safeDrawChildren(), and WindowMenu().
|
private |
Definition at line 114 of file windowmenu.h.
Referenced by action(), addButton(), getButtonNames(), loadButtons(), showButton(), and ~WindowMenu().
|
private |
Definition at line 112 of file windowmenu.h.
Referenced by addButton(), getButtons(), saveButtons(), updateButtons(), and ~WindowMenu().
|
private |
Definition at line 113 of file windowmenu.h.
Referenced by addButton(), getButtonTexts(), and ~WindowMenu().
|
private |
Definition at line 115 of file windowmenu.h.
Referenced by drawChildren(), mouseExited(), mouseMoved(), and safeDrawChildren().
|
private |
Definition at line 109 of file windowmenu.h.
Referenced by addButton(), WindowMenu(), and ~WindowMenu().
|
private |
Definition at line 110 of file windowmenu.h.
Referenced by addButton(), updateButtons(), and WindowMenu().
|
private |
Definition at line 108 of file windowmenu.h.
Referenced by WindowMenu(), and ~WindowMenu().
|
private |
Definition at line 117 of file windowmenu.h.
Referenced by drawChildren(), loadButtons(), mousePressed(), and safeDrawChildren().
|
private |
Definition at line 111 of file windowmenu.h.
Referenced by addButton(), updateButtons(), and WindowMenu().