GlistEngine
Loading...
Searching...
No Matches
gGUIMenubar.h
Go to the documentation of this file.
1/****************************************************************************
2 * Copyright (c) 2014 Nitra Games Ltd., Istanbul, Turkey *
3 * *
4 * Permission is hereby granted, free of charge, to any person obtaining a *
5 * copy of this software and associated documentation files (the *
6 * "Software"), to deal in the Software without restriction, including *
7 * without limitation the rights to use, copy, modify, merge, publish, *
8 * distribute, distribute with modifications, sublicense, and/or sell *
9 * copies of the Software, and to permit persons to whom the Software is *
10 * furnished to do so, subject to the following conditions: *
11 * *
12 * The above copyright notice and this permission notice should not be *
13 * deleted from the source form of the Software. *
14 * *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
22 * *
23 * Except as contained in this notice, the name(s) of the above copyright *
24 * holders shall not be used in advertising or otherwise to promote the *
25 * sale, use or other dealings in this Software without prior written *
26 * authorization. *
27 ****************************************************************************/
28
29/****************************************************************************
30 * Author: Medine, Yasin 2022-on *
31 ****************************************************************************/
32/*
33 * gGUIMenubar.h
34 *
35 * Created on: 29 Aug 2022
36 * Author: Medine, Yasin
37 */
38#ifndef UI_GGUIMENUBAR_H_
39#define UI_GGUIMENUBAR_H_
40
41#include "gGUIControl.h"
42#include "gImage.h"
43
44
51class gGUIMenuItem : public gGUIControl {
52public:
53 static const int TYPE_ITEM = 0, TYPE_SEPERATOR = 1;
54
55 gGUIMenuItem(std::string text);
57
61 int getItemId();
62
67
73 void setParentItemId(int itemId);
74
83 int addChild(std::string text, bool addSeperator = false);
84
90 int addChild(gGUIMenuItem childItem);
91
96
102 void removeChild(int childNo);
103
111 gGUIMenuItem* getChild(int childNo);
112
114
115 virtual void draw();
116
125 void setMenuicon(int menuItemid, std::string icon);
126
134 void setMenuicon(int menuItemId, int icon);
135
136 void mouseMoved(int x, int y);
137 void mousePressed(int x, int y, int button);
138 void mouseReleased(int x, int y, int button);
139 void update();
140
143 int texty;
144
145protected:
146 static int totaltextw;
147
148private:
149 static int lastitemid;
150 static int lastparentitemid;
151 static std::vector<int> parentitems;
152 int itemid, parentitemid;
153 std::string text;
154 std::vector<gGUIMenuItem> childs;
155 bool selected;
156 bool hovered;
157 int menuboxlineh, menuboxtextextrah;
158 int menuboxdefaultw;
159 bool menuboxshown;
160 bool isparent;
161 int menuboxdefaulth;
162 int texth;
163 int counter;
164 gTexture* menuicon;
165 bool isicon;
166 int iconh, iconw;
167 bool seperator;
168 static bool isresinitialized;
169 bool isparentpressed;
170 bool pressed;
171};
172
173
174class gGUIMenubar : public gGUIMenuItem {
175public:
176
178 virtual ~gGUIMenubar();
179
180 void draw();
181
182/*
183 int addMenuItem(std::string text);
184 void removeMenuItem(int childNo);
185 int getChildNum();
186 gGUIMenuItem* getChild(int childNo);
187 gGUIMenuItem* findItem(int itemId);
188*/
189private:
190 std::vector<gGUIMenuItem> childs;
191};
192
193#endif /* UI_GGUIMENUBAR_H_ */
Definition gGUIControl.h:29
Definition gGUIMenubar.h:51
int addChild(std::string text, bool addSeperator=false)
int addChild(gGUIMenuItem childItem)
int menuboxy
Definition gGUIMenubar.h:142
int texty
Definition gGUIMenubar.h:143
void mouseReleased(int x, int y, int button)
gGUIMenuItem(std::string text)
void mousePressed(int x, int y, int button)
void resInitialize()
gGUIMenuItem * getChild(int childNo)
void removeChild(int childNo)
static const int TYPE_SEPERATOR
Definition gGUIMenubar.h:53
static int totaltextw
Definition gGUIMenubar.h:146
int menuboxw
Definition gGUIMenubar.h:142
void setParentItemId(int itemId)
int getParentItemId()
int menuboxx
Definition gGUIMenubar.h:142
gGUIMenuItem * findChild(int itemId)
void mouseMoved(int x, int y)
int menuboxh
Definition gGUIMenubar.h:142
int getChildNum()
void setMenuicon(int menuItemid, std::string icon)
virtual void draw()
void setMenuicon(int menuItemId, int icon)
static const int TYPE_ITEM
Definition gGUIMenubar.h:53
Definition gGUIMenubar.h:174
virtual ~gGUIMenubar()
Definition gTexture.h:17