Mana
Loading...
Searching...
No Matches
shortcutcontainer.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2007-2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include <guichan/mouselistener.hpp>
25#include <guichan/widget.hpp>
26#include <guichan/widgetlistener.hpp>
27
33class ShortcutContainer : public gcn::Widget,
34 public gcn::WidgetListener,
35 public gcn::MouseListener
36{
37 public:
39
43 void draw(gcn::Graphics *graphics) override = 0;
44
45 // Overridden to disable drawing of the frame
46 void drawFrame(gcn::Graphics *graphics) override {}
47
52 void widgetResized(const gcn::Event &event) override;
53
54 int getMaxItems() const { return mMaxItems; }
55 int getBoxWidth() const { return mBoxWidth; }
56 int getBoxHeight() const { return mBoxHeight; }
57
58 protected:
66 int getIndexFromGrid(int pointX, int pointY) const;
67
68 int mMaxItems = 0;
69 int mBoxWidth = 0;
70 int mBoxHeight = 0;
71 int mCursorPosX = 0;
72 int mCursorPosY = 0;
73 int mGridWidth = 1;
74 int mGridHeight = 1;
75};
A generic shortcut container.
void drawFrame(gcn::Graphics *graphics) override
int getIndexFromGrid(int pointX, int pointY) const
Gets the index from the grid provided the point is in an item box.
void widgetResized(const gcn::Event &event) override
Invoked when a widget changes its size.
void draw(gcn::Graphics *graphics) override=0
Draws the shortcuts.
Graphics * graphics
Definition client.cpp:104