diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-04 23:26:22 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-04 23:41:45 +0200 |
commit | 6cacaa3d7f55d91d8b7ca178f8595cc6c6b4383d (patch) | |
tree | a4ae355fe26eda518a5fd82c15347b6cfcf6b7f6 /src/gui/menuwindow.cpp | |
parent | 1b06ec9f12e3fbfe6fbf6579fb64bb895464badb (diff) | |
download | mana-6cacaa3d7f55d91d8b7ca178f8595cc6c6b4383d.tar.gz mana-6cacaa3d7f55d91d8b7ca178f8595cc6c6b4383d.tar.bz2 mana-6cacaa3d7f55d91d8b7ca178f8595cc6c6b4383d.tar.xz mana-6cacaa3d7f55d91d8b7ca178f8595cc6c6b4383d.zip |
Replaced emote window with a new emote popup
The popup is meant to be temporary, showing the emote instantly when you
click on it. It adapts nicely to show any number of emotes.
I still need to add a better way of assigning emote shortcuts, since
currently you can only change which emote is assigned to which shortcut
by actually using it.
Diffstat (limited to 'src/gui/menuwindow.cpp')
-rw-r--r-- | src/gui/menuwindow.cpp | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp deleted file mode 100644 index 06ebb39c..00000000 --- a/src/gui/menuwindow.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* - * The Mana World - * Copyright (C) 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "gui/menuwindow.h" - -#include "gui/widgets/button.h" -#include "gui/widgets/window.h" - -#include "graphics.h" - -#include "utils/gettext.h" - -#include <guichan/actionlistener.hpp> - -#include <string> - -extern Window *equipmentWindow; -extern Window *inventoryWindow; -extern Window *itemShortcutWindow; -extern Window *emoteWindow; -extern Window *setupWindow; -extern Window *skillDialog; -extern Window *statusWindow; -#ifdef TMWSERV_SUPPORT -extern Window *buddyWindow; -extern Window *guildWindow; -extern Window *magicDialog; -#endif - -namespace { - struct MenuWindowListener : public gcn::ActionListener - { - /** - * Called when receiving actions from widget. - */ - void action(const gcn::ActionEvent &event); - } listener; -} - -MenuWindow::MenuWindow(): - Popup("Menu") -{ - // Buttons - static const char *buttonNames[] = - { - N_("Status"), - N_("Equipment"), - N_("Inventory"), - N_("Skills"), -#ifdef TMWSERV_SUPPORT - N_("Magic"), - N_("Guilds"), - N_("Buddys"), -#endif - N_("Shortcut"), - N_("Emote"), - N_("Setup"), - 0 - }; - int x = 0, h = 0; - - for (const char **curBtn = buttonNames; *curBtn; curBtn++) - { - gcn::Button *btn = new Button(gettext(*curBtn), *curBtn, &listener); - btn->setPosition(x, 0); - add(btn); - x += btn->getWidth() + 3; - h = btn->getHeight(); - } - - setPosition(graphics->getWidth() - x - 3, 3); - setContentSize(x - 3, h); - - setVisible((bool) config.getValue(getPopupName() + "Visible", true)); -} - -void MenuWindow::draw(gcn::Graphics *graphics) -{ - drawChildren(graphics); -} - -void MenuWindowListener::action(const gcn::ActionEvent &event) -{ - Window *window = NULL; - - if (event.getId() == "Status") - { - window = statusWindow; - } - else if (event.getId() == "Equipment") - { - window = equipmentWindow; - } - else if (event.getId() == "Inventory") - { - window = inventoryWindow; - } - else if (event.getId() == "Skills") - { - window = skillDialog; - } -#ifdef TMWSERV_SUPPORT - else if (event.getId() == "Magic") - { - window = magicDialog; - } - else if (event.getId() == "Guilds") - { - window = guildWindow; - } - else if (event.getId() == "Buddys") - { - window = buddyWindow; - } -#endif - else if (event.getId() == "Shortcut") - { - window = itemShortcutWindow; - } - else if (event.getId() == "Emote") - { - window = emoteWindow; - } - else if (event.getId() == "Setup") - { - window = setupWindow; - } - - if (window) - { - window->setVisible(!window->isVisible()); - if (window->isVisible()) - { - window->requestMoveToTop(); - } - } -} |