Mana
Loading...
Searching...
No Matches
emotepopup.h
Go to the documentation of this file.
1/*
2 * Extended support for activating emotes
3 * Copyright (C) 2009 Aethyra Development Team
4 * Copyright (C) 2009 The Mana World Development Team
5 * Copyright (C) 2009-2012 The Mana Developers
6 *
7 * This file is part of The Mana Client.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#pragma once
24
25#include "gui/widgets/popup.h"
26
27#include <guichan/mouselistener.hpp>
28
29#include <list>
30
31class Image;
32
33namespace gcn {
34 class SelectionListener;
35}
36
42class EmotePopup : public Popup
43{
44 public:
48 EmotePopup();
49
50 ~EmotePopup() override;
51
55 void draw(gcn::Graphics *graphics) override;
56
57 void mouseExited(gcn::MouseEvent &event) override;
58 void mousePressed(gcn::MouseEvent &event) override;
59 void mouseMoved(gcn::MouseEvent &event) override;
60
64 int getSelectedEmoteId() const;
65
70 void addSelectionListener(gcn::SelectionListener *listener)
71 {
72 mListeners.push_back(listener);
73 }
74
79 void removeSelectionListener(gcn::SelectionListener *listener)
80 {
81 mListeners.remove(listener);
82 }
83
84 private:
88 void setSelectedEmoteId(int emoteId);
89
94 int getIndexAt(int x, int y) const;
95
99 void recalculateSize();
100
105
108
109 int mRowCount = 1;
111
112 std::list<gcn::SelectionListener *> mListeners;
113};
An emote popup.
Definition emotepopup.h:43
int mSelectedEmoteId
Definition emotepopup.h:106
void removeSelectionListener(gcn::SelectionListener *listener)
Removes a listener from the list that's notified each time a change to the selection occurs.
Definition emotepopup.h:79
void recalculateSize()
Determine and set the size of the container.
EmotePopup()
Constructor.
void mouseExited(gcn::MouseEvent &event) override
int getIndexAt(int x, int y) const
Returns the index at the specified coordinates.
void mouseMoved(gcn::MouseEvent &event) override
void setSelectedEmoteId(int emoteId)
Sets the index of the currently selected emote.
void addSelectionListener(gcn::SelectionListener *listener)
Adds a listener to the list that's notified each time a change to the selection occurs.
Definition emotepopup.h:70
~EmotePopup() override
void distributeValueChangedEvent()
Sends out selection events to the list of selection listeners.
void draw(gcn::Graphics *graphics) override
Draws the emotes.
int mColumnCount
Definition emotepopup.h:110
void mousePressed(gcn::MouseEvent &event) override
int mHoveredEmoteIndex
Definition emotepopup.h:107
int getSelectedEmoteId() const
Returns the selected emote.
std::list< gcn::SelectionListener * > mListeners
Definition emotepopup.h:112
Defines a class for loading and storing images.
Definition image.h:45
A light version of the Window class.
Definition popup.h:48
Graphics * graphics
Definition client.cpp:104