OpenPolygon  1.0.0
OpenPolygon is a Rendering Engine
userinterfacemanager.h
1 /*
2  Copyright (C) 2014 - 2016 Mutzii
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 */
18 #ifndef USERINTERFACEMANAGER_H
19 #define USERINTERFACEMANAGER_H
20 
21 #include "displaymanager.h"
22 #include "overlaymanager.h"
23 #include "panelelement.h"
24 
25 namespace Engine
26 {
27 
28 
30  {
31  public:
32  explicit PanelMouseEvent( PanelElement * element , int mx , int my )
33  : m_element( element ) , m_mouse_x(mx) , m_mouse_y( my ){}
34  ~PanelMouseEvent(){}
35 
36  PanelElement * getElement(void) const
37  {
38  return m_element;
39  }
40 
41  int getMouseX(void) const
42  {
43  return m_mouse_x;
44  }
45 
46  int getMouseY(void) const
47  {
48  return m_mouse_y;
49  }
50 
51 
52  private:
53 
54  PanelElement * m_element;
55 
56  int m_mouse_x;
57  int m_mouse_y;
58  };
59 
61  {
62  public:
63  virtual ~UserInterfaceListener() = default;
64 
65  virtual void onPanelMouseCollisionEvent( const PanelMouseEvent & event )=0;
66  };
67 
68  using UIListener = std::list< UserInterfaceListener * >;
69  using PanelElements = std::list< PanelElement * >;
70 
72  {
73  private:
74 
75  static UserInterfaceManager * ptrInstance;
76 
79  void operator=( const UserInterfaceManager& ){}
80 
81  public:
82 
83  static UserInterfaceManager * getSingletonPtr(void);
84  void finish(void);
85 
86  void addUserInterfaceListener( UserInterfaceListener * listener );
87  void remove( UserInterfaceListener * listener);
88 
89  void triggerPanelMouseCollisionEvent( PanelElements elements );
90 
91  private:
92 
93  UIListener m_ui_listener;
94  };
95 
96 }
97 
98 #endif // USERINTERFACEMANAGER_H
Definition: element.h:23
Definition: userinterfacemanager.h:29
The PanelElement - Panel Objective class.
Definition: panelelement.h:35
Definition: userinterfacemanager.h:71
Definition: userinterfacemanager.h:60