55 addButton(
":-)", x, h,
"button-icon-smilies.png");
56 addButton(
N_(
"Status"), x, h,
"button-icon-status.png",
58 addButton(
N_(
"Inventory"), x, h,
"button-icon-inventory.png",
60 addButton(
N_(
"Equipment"), x, h,
"button-icon-equipment.png",
64 addButton(
N_(
"Skills"), x, h,
"button-icon-skills.png",
68 addButton(
N_(
"Abilities"), x, h,
"button-icon-abilities.png");
71 addButton(
N_(
"Quests"), x, h,
"button-icon-quests.png");
73 addButton(
N_(
"Social"), x, h,
"button-icon-social.png",
75 addButton(
N_(
"Shortcuts"), x, h,
"button-icon-shortcut.png",
77 addButton(
N_(
"Setup"), x, h,
"button-icon-setup.png",
94 if (event.getId() ==
":-)")
98 const gcn::Widget *s =
event.getSource();
99 const gcn::Rectangle &r = s->getDimension();
100 const int parentX = s->getParent()->getX();
103 const int offset = (r.width -
mEmotePopup->getWidth()) / 2;
115 else if (event.getId() ==
"Status")
119 else if (event.getId() ==
"Equipment")
123 else if (event.getId() ==
"Inventory")
127 else if (event.getId() ==
"Skills")
131 else if (event.getId() ==
"Quests")
135 else if (event.getId() ==
"Abilities")
139 else if (event.getId() ==
"Social")
143 else if (event.getId() ==
"Shortcuts")
147 else if (event.getId() ==
"Setup")
155 if (window->isVisible())
157 window->requestMoveToTop();
175static std::string createShortcutCaption(
const std::string &text,
178 std::string caption =
gettext(text.c_str());
186 caption += SDL_GetKeyName(keyValue);
195 const std::string &iconPath,
198 auto *btn =
new Button(std::string(), text,
this);
199 if (!iconPath.empty() && btn->setButtonIcon(iconPath))
201 btn->setButtonPopupText(createShortcutCaption(text, key));
205 btn->setCaption(
gettext(text.c_str()));
206 btn->setButtonPopupText(createShortcutCaption(std::string(), key));
209 btn->setPosition(x, 0);
211 x += btn->getWidth() + 3;
212 h = std::max(h, btn->getHeight());
217 for (
auto &widget : mWidgets)
219 auto *button =
dynamic_cast<Button*
>(widget);
223 const std::string &eventId = button->getActionEventId();
224 if (eventId ==
"Status")
229 else if (eventId ==
"Equipment")
231 button->setButtonPopupText(createShortcutCaption(eventId,
234 else if (eventId ==
"Inventory")
236 button->setButtonPopupText(createShortcutCaption(eventId,
239 else if (eventId ==
"Skills")
241 button->setButtonPopupText(createShortcutCaption(eventId,
244 else if (eventId ==
"Quests")
246 button->setButtonPopupText(
249 else if (eventId ==
"Social")
251 button->setButtonPopupText(createShortcutCaption(eventId,
254 else if (eventId ==
"Shortcuts")
256 button->setButtonPopupText(createShortcutCaption(eventId,
259 else if (eventId ==
"Setup")
261 button->setButtonPopupText(createShortcutCaption(eventId,
bool hasAbilities() const
int getWidth() const
Returns the logical width of the screen.
int getKeyValue(int index) const
Obtain the value stored in memory.
KeyAction
All the key functions.
virtual void emote(int emoteId)=0
void scheduleDelete(gcn::Widget *widget)
Schedule a widget for deletion.
virtual void setVisible(bool visible)
Overloads window setVisible by Guichan to allow sticky window handling.
AbilitiesWindow * abilitiesWindow
InventoryWindow * inventoryWindow
SocialWindow * socialWindow
QuestsWindow * questsWindow
ShortcutWindow * itemShortcutWindow
EquipmentWindow * equipmentWindow
StatusWindow * statusWindow
SkillDialog * skillDialog
PlayerHandler * getPlayerHandler()
WindowContainer * windowContainer