Mana
Loading...
Searching...
No Matches
scrollarea.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2004-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/widgets/scrollarea.hpp>
25
37class ScrollArea : public gcn::ScrollArea
38{
39 public:
44 ScrollArea();
45
51 ScrollArea(gcn::Widget *content);
52
56 ~ScrollArea() override;
57
61 void setShowButtons(bool showButtons);
62
67 void logic() override;
68
72 void draw(gcn::Graphics *graphics) override;
73
77 void drawFrame(gcn::Graphics *graphics) override;
78
82 void drawChildren(gcn::Graphics *graphics) override;
83
87 void setOpaque(bool opaque);
88
92 bool isOpaque() const { return mOpaque; }
93
97 void mouseMoved(gcn::MouseEvent &event) override;
98
102 void mouseEntered(gcn::MouseEvent &event) override;
103
107 void mouseExited(gcn::MouseEvent &event) override;
108
109 void mousePressed(gcn::MouseEvent &mouseEvent) override;
110 void mouseDragged(gcn::MouseEvent &mouseEvent) override;
111
112 protected:
116 void init();
117
118 void drawBackground(gcn::Graphics *graphics) override;
119 void drawUpButton(gcn::Graphics *graphics) override;
120 void drawDownButton(gcn::Graphics *graphics) override;
121 void drawLeftButton(gcn::Graphics *graphics) override;
122 void drawRightButton(gcn::Graphics *graphics) override;
123 void drawVBar(gcn::Graphics *graphics) override;
124 void drawHBar(gcn::Graphics *graphics) override;
125 void drawVMarker(gcn::Graphics *graphics) override;
126 void drawHMarker(gcn::Graphics *graphics) override;
127
128 void checkPolicies() override;
129
135 gcn::Rectangle getUpButtonDimension();
136 gcn::Rectangle getDownButtonDimension();
137 gcn::Rectangle getLeftButtonDimension();
138 gcn::Rectangle getRightButtonDimension();
139 gcn::Rectangle getVerticalBarDimension();
140 gcn::Rectangle getHorizontalBarDimension();
141
147 gcn::Rectangle getVerticalMarkerDimension();
148 gcn::Rectangle getHorizontalMarkerDimension();
149
150 int mX = 0;
151 int mY = 0;
152 bool mHasMouse = false;
153 bool mShowButtons = true;
154};
A scroll area.
Definition scrollarea.h:38
void drawChildren(gcn::Graphics *graphics) override
Applies clipping to the contents.
void drawBackground(gcn::Graphics *graphics) override
void mouseEntered(gcn::MouseEvent &event) override
Called when the mouse enteres the widget area.
void draw(gcn::Graphics *graphics) override
Overridden to draw the frame if its size is 0.
void mouseDragged(gcn::MouseEvent &mouseEvent) override
Code copied from gcn::ScrollArea::mouseDragged to make it call our custom getVerticalMarkerDimension ...
void setShowButtons(bool showButtons)
Sets whether the scroll bar buttons are shown.
void drawHBar(gcn::Graphics *graphics) override
ScrollArea()
Constructor that takes no content.
void drawFrame(gcn::Graphics *graphics) override
Draws the background and border of the scroll area.
void drawVMarker(gcn::Graphics *graphics) override
void mouseExited(gcn::MouseEvent &event) override
Called when the mouse leaves the widget area.
gcn::Rectangle getDownButtonDimension()
gcn::Rectangle getHorizontalBarDimension()
gcn::Rectangle getVerticalMarkerDimension()
Shadowing these functions from gcn::ScrollArea with versions that supports fixed-size scroll bar mark...
gcn::Rectangle getUpButtonDimension()
Shadowing these functions from gcn::ScrollArea with versions that support hiding the buttons.
void drawUpButton(gcn::Graphics *graphics) override
gcn::Rectangle getHorizontalMarkerDimension()
void logic() override
Logic function optionally adapts width or height of contents.
void init()
Initializes the scroll area.
bool mHasMouse
Definition scrollarea.h:152
~ScrollArea() override
Destructor.
void mouseMoved(gcn::MouseEvent &event) override
Called when the mouse moves in the widget area.
void setOpaque(bool opaque)
Sets whether the widget should draw its background or not.
void drawVBar(gcn::Graphics *graphics) override
void checkPolicies() override
Code copied from gcn::ScrollArea::checkPolicies to make sure it takes the frame size of the content i...
bool isOpaque() const
Returns whether the widget draws its background or not.
Definition scrollarea.h:92
void drawDownButton(gcn::Graphics *graphics) override
void mousePressed(gcn::MouseEvent &mouseEvent) override
Code copied from gcn::ScrollArea::mousePressed to make it call our custom getVerticalMarkerDimension ...
void drawLeftButton(gcn::Graphics *graphics) override
gcn::Rectangle getLeftButtonDimension()
bool mShowButtons
Definition scrollarea.h:153
void drawHMarker(gcn::Graphics *graphics) override
gcn::Rectangle getRightButtonDimension()
gcn::Rectangle getVerticalBarDimension()
void drawRightButton(gcn::Graphics *graphics) override
Graphics * graphics
Definition client.cpp:104