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
51
class
gGUIMenuItem
:
public
gGUIControl
{
52
public
:
53
static
const
int
TYPE_ITEM
= 0,
TYPE_SEPERATOR
= 1;
54
55
gGUIMenuItem
(std::string text);
56
~gGUIMenuItem
();
57
61
int
getItemId
();
62
66
int
getParentItemId
();
67
73
void
setParentItemId
(
int
itemId);
74
83
int
addChild
(std::string text,
bool
addSeperator =
false
);
84
90
int
addChild
(
gGUIMenuItem
childItem);
91
95
int
getChildNum
();
96
102
void
removeChild
(
int
childNo);
103
111
gGUIMenuItem
*
getChild
(
int
childNo);
112
113
gGUIMenuItem
*
findChild
(
int
itemId);
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
141
void
resInitialize
();
142
int
menuboxx
,
menuboxy
,
menuboxw
,
menuboxh
;
143
int
texty
;
144
145
protected
:
146
static
int
totaltextw
;
147
148
private
:
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
174
class
gGUIMenubar
:
public
gGUIMenuItem
{
175
public
:
176
177
gGUIMenubar
();
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
*/
189
private
:
190
std::vector<gGUIMenuItem> childs;
191
};
192
193
#endif
/* UI_GGUIMENUBAR_H_ */
gGUIControl
Definition
gGUIControl.h:29
gGUIMenuItem
Definition
gGUIMenubar.h:51
gGUIMenuItem::addChild
int addChild(std::string text, bool addSeperator=false)
gGUIMenuItem::addChild
int addChild(gGUIMenuItem childItem)
gGUIMenuItem::menuboxy
int menuboxy
Definition
gGUIMenubar.h:142
gGUIMenuItem::texty
int texty
Definition
gGUIMenubar.h:143
gGUIMenuItem::mouseReleased
void mouseReleased(int x, int y, int button)
gGUIMenuItem::gGUIMenuItem
gGUIMenuItem(std::string text)
gGUIMenuItem::mousePressed
void mousePressed(int x, int y, int button)
gGUIMenuItem::resInitialize
void resInitialize()
gGUIMenuItem::getItemId
int getItemId()
gGUIMenuItem::getChild
gGUIMenuItem * getChild(int childNo)
gGUIMenuItem::~gGUIMenuItem
~gGUIMenuItem()
gGUIMenuItem::removeChild
void removeChild(int childNo)
gGUIMenuItem::TYPE_SEPERATOR
static const int TYPE_SEPERATOR
Definition
gGUIMenubar.h:53
gGUIMenuItem::totaltextw
static int totaltextw
Definition
gGUIMenubar.h:146
gGUIMenuItem::menuboxw
int menuboxw
Definition
gGUIMenubar.h:142
gGUIMenuItem::setParentItemId
void setParentItemId(int itemId)
gGUIMenuItem::getParentItemId
int getParentItemId()
gGUIMenuItem::update
void update()
gGUIMenuItem::menuboxx
int menuboxx
Definition
gGUIMenubar.h:142
gGUIMenuItem::findChild
gGUIMenuItem * findChild(int itemId)
gGUIMenuItem::mouseMoved
void mouseMoved(int x, int y)
gGUIMenuItem::menuboxh
int menuboxh
Definition
gGUIMenubar.h:142
gGUIMenuItem::getChildNum
int getChildNum()
gGUIMenuItem::setMenuicon
void setMenuicon(int menuItemid, std::string icon)
gGUIMenuItem::draw
virtual void draw()
gGUIMenuItem::setMenuicon
void setMenuicon(int menuItemId, int icon)
gGUIMenuItem::TYPE_ITEM
static const int TYPE_ITEM
Definition
gGUIMenubar.h:53
gGUIMenubar
Definition
gGUIMenubar.h:174
gGUIMenubar::gGUIMenubar
gGUIMenubar()
gGUIMenubar::draw
void draw()
gGUIMenubar::~gGUIMenubar
virtual ~gGUIMenubar()
gTexture
Definition
gTexture.h:17
gGUIControl.h
gImage.h
engine
ui
gGUIMenubar.h
Generated by
1.9.8