hx3d  1
2D/3D Simple Game Framework
widget.hpp
1 /*
2  Base widget.
3  Copyright (C) 2015 Denis BOURGE
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
21 #ifndef HX3D_GUI_WIDGET
22 #define HX3D_GUI_WIDGET
23 
24 #include "hx3d/graphics/mesh.hpp"
25 #include "hx3d/window/event_manager.hpp"
26 
27 namespace hx3d {
28 
32 namespace gui {
33 
34 using namespace ::hx3d::graphics;
35 
39 class Widget: public graphics::Mesh {
40 public:
46  Widget(Widget* parent);
47 
53  void add(Ptr<Widget> widget);
54 
55  virtual void draw(Ptr<Shader> shader) override;
56 
57 private:
59  Widget* _parent;
61  std::vector<Ptr<Widget>> _children;
62 };
63 
64 } /* gui */
65 } /* hx3d */
66 
67 #endif
void add(Ptr< Widget > widget)
Add a widget to the list.
Definition: widget.cpp:62
Base GUI element.
Definition: widget.hpp:39
2D and 3D graphics components.
Definition: animation.hpp:28
hx3d framework namespace
Definition: audio.hpp:26
Widget(Widget *parent)
Construct a widget from a parent widget.
Definition: widget.cpp:28
Displayable 2D/3D element.
Definition: mesh.hpp:41
std::shared_ptr< T > Ptr
Quick-typing shared ptr.
Definition: ptr.hpp:34