1
/*
2
 *  Extended support for activating emotes
3
 *  Copyright (C) 2009  Aethyra Development Team
4
 *
5
 *  This file is part of The Mana World.
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program; if not, write to the Free Software
19
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
 */
21
22
#ifndef EMOTESHORTCUT_H
23
#define EMOTESHORTCUT_H
24
25
#define SHORTCUT_EMOTES 12
26
27
/**
28
 * The class which keeps track of the emote shortcuts.
29
 */
30
class EmoteShortcut
31
{
32
    public:
33
        /**
34
         * Constructor.
35
         */
36
        EmoteShortcut();
37
38
        /**
39
         * Destructor.
40
         */
41
        ~EmoteShortcut();
42
43
        /**
44
         * Load the configuration information.
45
         */
46
        void load();
47
48
        /**
49
         * Returns the shortcut Emote ID specified by the index.
50
         *
51
         * @param index Index of the shortcut Emote.
52
         */
53
        int getEmote(int index) const
54
        { return mEmotes[index]; }
55
56
        /**
57
         * Returns the amount of shortcut Emotes.
58
         */
59
        int getEmoteCount() const
60
        { return SHORTCUT_EMOTES; }
61
62
        /**
63
         * Returns the emote ID that is currently selected.
64
         */
65
        int getEmoteSelected() const
66
        { return mEmoteSelected; }
67
68
        /**
69
         * Adds the selected emote ID to the emotes specified by the index.
70
         *
71
         * @param index Index of the emotes.
72
         */
73
        void setEmote(int index)
74
        { mEmotes[index] = mEmoteSelected; }
75
76
        /**
77
         * Adds a emoticon to the emotes store specified by the index.
78
         *
79
         * @param index Index of the emote.
80
         * @param emoteId ID of the emote.
81
         */
82
        void setEmotes(int index, int emoteId)
83
        { mEmotes[index] = emoteId; }
84
85
        /**
86
         * Set the Emote that is selected.
87
         *
88
         * @param emoteId The ID of the emote that is to be assigned.
89
         */
90
        void setEmoteSelected(int emoteId)
91
        { mEmoteSelected = emoteId; }
92
93
        /**
94
         * A flag to check if the Emote is selected.
95
         */
96
        bool isEmoteSelected()
97
        { return mEmoteSelected; }
98
99
        /**
100
         * Remove a Emote from the shortcut.
101
         */
102
        void removeEmote(int index)
103
        { mEmotes[index] = 0; }
104
105
        /**
106
         * Try to use the Emote specified by the index.
107
         *
108
         * @param index Index of the emote shortcut.
109
         */
110
        void useEmote(int index);
111
112
    private:
113
        /**
114
         * Save the configuration information.
115
         */
116
        void save();
117
118
        int mEmotes[SHORTCUT_EMOTES];  /**< The emote stored. */
119
        int mEmoteSelected;            /**< The emote held by cursor. */
120
121
};
122
123
extern EmoteShortcut *emoteShortcut;
124
125
#endif