StarTrekV3_Linux  Version3
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Pages
SaveSlots.h
Go to the documentation of this file.
1 //
2 // ___.--------._____________,------' -----.`----._
3 // \ ` - . _ /\
4 // `.__________ ` - | | __,---"-._
5 // `-----------.______ ,'_/ ________,------'___________`----.___________
6 // `-----.____,' \===========================================/
7 // | :| >--------------.----------.---------------'
8 // / :| _,--' ,--' `--.__.--'
9 // / : |--'______________/_
10 // ,---,' : \__________________`--.
11 // `__________ |/|
12 // `------._ |\|
13 // `--._________,-'
14 //
15 //
16 //
17 // Credits go to Paramount pictures for the star - trek concept and universe.
18 
19 
20 // Copyright (C) 2015 - 2016 E.J.M. Martens
21 //
22 // This program is free software; you can redistribute it and/or
23 // modify it under the terms of the GNU General Public License
24 // as published by the Free Software Foundation; either version 2
25 // of the License, or (at your option) any later version.
26 //
27 // This program is distributed in the hope that it will be useful,
28 // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 // GNU General Public License for more details.
31 //
32 // You should have received a copy of the GNU General Public License
33 // along with this program; if not, write to the Free Software
34 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
35 
36 
37 #ifndef _SAVE_SLOTS
38 #define _SAVE_SLOTS
39 
40 #include <allegro5/allegro.h>
41 #include <allegro5/allegro_font.h>
42 #include <allegro5/allegro_ttf.h>
43 
44 #include <string>
45 #include <vector>
46 
47 
48 using namespace std;
49 
50 
51 class SlotManager;
52 
53 
54 class Slot
55 {
56 friend class SlotManager;
57 private:
58 string m_strCaption;
59 bool m_blActive;
60 bool m_blHighLight;
61 int m_nIndex;
62 int m_nX;
63 int m_nY;
64 int m_nWidth;
65 int m_nHeight;
66 SlotManager * m_pParent;
67 
68 public:
69 
70  Slot(SlotManager * a_pParent);
71  Slot(int a_nX, int a_nY,const string a_strCaption, SlotManager * a_pParent);
72  ~Slot();
73  string GetCaption();
74  void Draw(ALLEGRO_FONT * a_pFont);
75  void ProcessMouseEvent(ALLEGRO_MOUSE_EVENT * mouse_event);
76  void ProcessKeyEvent(int a_nUniChar);
77 };
78 
79 
81 {
82  friend class Slot;
83  private:
84  // Callback function
85  void (* m_pCallBack)(string);
86 
87  Slot * m_pActiveSlot;
88  ALLEGRO_COLOR m_ColorInner;
89  ALLEGRO_COLOR m_ColorOuter;
90  ALLEGRO_COLOR m_ColorHighlight;
91  int m_nIndex;
92  bool m_blLoading;
93  vector <Slot> m_vSlots;
94  protected:
95 
96  public:
97  SlotManager(bool a_blLoading, ALLEGRO_PATH * a_pSearchpath,void (* a_pCallBack)(string));
98  ~SlotManager();
99  void DeactivateSlots();
100  void AddSlot(string a_strCaption);
101  void DeleteSlot(int a_nIndex);
102  void ProcessMouseEvent(ALLEGRO_MOUSE_EVENT * mouse_event);
103  void ProcessKeyEvent(int a_nUniChar);
104  void Draw(ALLEGRO_FONT * a_pFont);
105  int Count();
106 
107 };
108 
109 
110 #endif // _SAVE_SLOTS
111 
friend class SlotManager
Definition: SaveSlots.h:56
Definition: SaveSlots.h:80
void ProcessMouseEvent(ALLEGRO_MOUSE_EVENT *mouse_event)
Definition: SaveSlots.cpp:204
void ProcessMouseEvent(ALLEGRO_MOUSE_EVENT *mouse_event)
Definition: SaveSlots.cpp:77
friend class Slot
Definition: SaveSlots.h:82
void Draw(ALLEGRO_FONT *a_pFont)
Definition: SaveSlots.cpp:220
void Draw(ALLEGRO_FONT *a_pFont)
Definition: SaveSlots.cpp:34
void ProcessKeyEvent(int a_nUniChar)
Definition: SaveSlots.cpp:102
void ProcessKeyEvent(int a_nUniChar)
Definition: SaveSlots.cpp:192
Definition: SaveSlots.h:54