FifeGUI 0.2.0
A C++ GUI library designed for games.
tab.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2004 - 2008 Olof Naessén and Per Larsson
3// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
4
5#ifndef INCLUDE_FIFECHAN_WIDGETS_TAB_HPP_
6#define INCLUDE_FIFECHAN_WIDGETS_TAB_HPP_
7
8#include <map>
9#include <string>
10
11#include "fifechan/mouselistener.hpp"
12#include "fifechan/platform.hpp"
13#include "fifechan/widgets/container.hpp"
14
15namespace fcn
16{
17 class TabbedArea;
18
26 class FIFEGUI_API Tab : public MouseListener, public Container
27 {
28 public:
29 Tab();
30
31 ~Tab() override;
32
33 Tab(Tab const &) = delete;
34 Tab& operator=(Tab const &) = delete;
35 Tab(Tab&&) = delete;
36 Tab& operator=(Tab&&) = delete;
37
44 void setTabbedArea(TabbedArea* tabbedArea);
45
53
54 // Inherited from Widget
55
60 void adjustSize() override;
61
62 Rectangle getChildrenArea() override;
63
64 void draw(Graphics* graphics) override;
65
66 // Inherited from MouseListener
67
68 void mouseEntered(MouseEvent& mouseEvent) override;
69
70 void mouseExited(MouseEvent& mouseEvent) override;
71
72 protected:
76 bool mHasMouse{false};
77
82 };
83} // namespace fcn
84
85#endif // INCLUDE_FIFECHAN_WIDGETS_TAB_HPP_
Container()
Constructor.
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Definition graphics.hpp:57
Represents a mouse event.
Represents a rectangular area (X, Y, Width, Height).
Definition rectangle.hpp:20
Rectangle getChildrenArea() override
Gets the area of the widget occupied by the widget's children.
Definition tab.cpp:40
bool mHasMouse
True if the tab has the mouse, false otherwise.
Definition tab.hpp:76
void mouseExited(MouseEvent &mouseEvent) override
Called when the mouse has exited the widget area.
Definition tab.cpp:102
void setTabbedArea(TabbedArea *tabbedArea)
Sets the tabbed area the tab should be a part of.
Definition tab.cpp:30
void adjustSize() override
Adjusts the size of the tab to fit the caption.
Definition tab.cpp:22
void mouseEntered(MouseEvent &mouseEvent) override
Called when the mouse has entered into the widget area.
Definition tab.cpp:97
TabbedArea * mTabbedArea
Holds the tabbed area the tab is a part of.
Definition tab.hpp:81
TabbedArea * getTabbedArea()
Gets the tabbed are the tab is a part of.
Definition tab.cpp:35
void draw(Graphics *graphics) override
Draws the widget.
Definition tab.cpp:50
A container organizing content into selectable tabs.