GlistEngine
Loading...
Searching...
No Matches
gGUIDialogue.h
Go to the documentation of this file.
1/*
2 * gGUIDialogue.h
3 *
4 * Created on: 27 Jul 2022
5 * Author: Umut Can
6 */
7
8/* INSTRUCTIONS ON HOW TO USE
9 *
10 * - After declaring a gGUIDialogue object, pass the same object as an argument to gGUIManager's "setupDialogue(gGUIDialogue* dialogue)" function.
11 * This function will initialize the object's dimensions and sizer before pushing it to an array of gGUIDialogue objects. By default, title bar and
12 * buttons bar of the same object will also be initialized within the same function. It should be noted that the gGUIDialogue objects pushed later
13 * will be drawn on top of the ones pushed earlier (if the objects have the "isdialogueactive" boolean variable set as TRUE).
14 *
15 * EX. "appmanager->getGUIManager()->setupDialogue(&dialogue);"
16 *
17 * - In order to draw the gGUIDialogue object's elements on the canvas (or remove the elements from the canvas), we need to call gGUIDialogue's
18 * "setIsDialogueActive(bool isDialogueActive)" function.
19 *
20 * EX. "dialogue.setIsDialogueActive(true);"
21 *
22 */
23
24#ifndef UI_GGUIDIALOGUE_H_
25#define UI_GGUIDIALOGUE_H_
26
27#include "gGUIForm.h"
28#include "gGUIContainer.h"
29#include "gGUIImageButton.h"
30#include "gGUIBitmap.h"
31#include "gGUIText.h"
32
33class gGUIDialogue: public gGUIForm {
34public:
35 static const int EVENT_NONE = 0, EVENT_MINIMIZE = 1, EVENT_MAXIMIZE = 2, EVENT_RESTORE = 3, EVENT_EXIT = 4;
36 static const int RESIZE_NONE = 0, RESIZE_LEFT = 1, RESIZE_RIGHT = 2, RESIZE_TOP = 3, RESIZE_BOTTOM = 4;
37 enum {
42 };
43 enum {
49 };
50 enum {
55 };
56
58 virtual ~gGUIDialogue();
59
60 void setSizer(gGUISizer* guiSizer);
61
62 void update();
63 void draw();
64
65 bool show();
66 bool hide();
67 bool isShown();
68
75
76 void setTitle(std::string title);
78
79 void setButtonEvent(int buttonEvent);
81
82 void enableDrag(bool isDragEnabled);
83 void enableResize(bool isResizeEnabled);
84
85 void setIsMaximized(bool isMaximized);
86 void transformDialogue(int left, int top, int width, int height);
87
88 void setMessageText(std::string messageText);
89 std::string getMessageText();
90 void setIconType(int iconId);
92 void setDialogueType(int typeId);
94 void setTitleType(int typeId);
96
97 int getCursor(int x, int y);
98 void keyPressed(int key);
99 void keyReleased(int key);
100 void charPressed(unsigned int codepoint);
101 void mouseMoved(int x, int y);
102 void mousePressed(int x, int y, int button);
103 void mouseDragged(int x, int y, int button);
104 void mouseReleased(int x, int y, int button);
105
110
115
116private:
117 bool isdialogueshown;
118
119 gGUIContainer titlebar;
120 gGUISizer titlebarsizer;
121 gGUIContainer buttonsbar;
122 gGUISizer buttonsbarsizer;
123 gGUIContainer messagebar;
124
125 gGUIImageButton minimizebutton;
126 gGUIImageButton maximizebutton;
127 gGUIImageButton exitbutton;
128
129 static const int titlebarh = 35, titlebarbitmapw = 24, titlebarbuttonw = 48;
130 static const int buttonsbarh = 45, buttonsbarbuttonw = 100, buttonsbarbuttonh = 27;
131
132 void initTitleBar();
133 void initButtonsBar();
134 void initDefMessageBar();
135
136 gGUIBitmap titlebarbitmap;
137 gGUIText titlebartext;
138
139 gGUIButton buttonsbarokbutton;
140 gGUIButton buttonsbaryesbutton;
141 gGUIButton buttonsbarnobutton;
142 gGUIButton buttonsbarcancelbutton;
143
144 gGUISizer defmessagebarsizer;
145 gGUIText defmessagetext;
146 gGUIImageButton defdialogueicon;
147
148 int buttontrigger, buttonevent;
149
150 int defmessagebartopspace, defmessagebarrightspace;
151
152 int dialoguetype;
153 int titletype;
154
155 bool isdragenabled, isresizeenabled;
156 bool ismaximized, isdragged;
157 bool isiconenabled;
158
159 int dragposx, dragposy, sizeposx, sizeposy;
160
161 int resizeposition;
162 int icontypeid;
163};
164
165#endif /* UI_GGUIDIALOGUE_H_ */
int top
Definition gBaseGUIObject.h:120
std::string title
Definition gBaseGUIObject.h:145
int width
Definition gBaseGUIObject.h:120
int height
Definition gBaseGUIObject.h:120
int left
Definition gBaseGUIObject.h:120
Definition gGUIBitmap.h:45
Definition gGUIButton.h:14
Definition gGUIContainer.h:15
Definition gGUIDialogue.h:33
static const int RESIZE_LEFT
Definition gGUIDialogue.h:36
void resetTitleBar()
void setIsMaximized(bool isMaximized)
static const int EVENT_RESTORE
Definition gGUIDialogue.h:35
void setTitle(std::string title)
int getNoButtonId()
static const int EVENT_NONE
Definition gGUIDialogue.h:35
int getIconType()
gGUIContainer * getMessageBar()
static const int EVENT_MINIMIZE
Definition gGUIDialogue.h:35
void mouseReleased(int x, int y, int button)
int getCancelButtonId()
gGUIContainer * getButtonsBar()
void mousePressed(int x, int y, int button)
@ DIALOGUETYPE_OKCANCEL
Definition gGUIDialogue.h:40
@ DIALOGUETYPE_OK
Definition gGUIDialogue.h:38
@ DIALOGUETYPE_YESNO
Definition gGUIDialogue.h:41
@ DIALOGUETYPE_YESNOCANCEL
Definition gGUIDialogue.h:39
bool isShown()
int getCursor(int x, int y)
@ TITLETYPE_EXITMAX
Definition gGUIDialogue.h:45
@ TITLETYPE_EXITMIN
Definition gGUIDialogue.h:46
@ TITLETYPE_EXIT
Definition gGUIDialogue.h:47
@ TITLETYPE_EXITMINMAX
Definition gGUIDialogue.h:44
@ TITLETYPE_NONE
Definition gGUIDialogue.h:48
int getTitleType()
void enableDrag(bool isDragEnabled)
static const int RESIZE_TOP
Definition gGUIDialogue.h:36
void setButtonEvent(int buttonEvent)
void setMessageText(std::string messageText)
void resetButtonsBar()
static const int RESIZE_RIGHT
Definition gGUIDialogue.h:36
gGUIButton * getOKButton()
virtual ~gGUIDialogue()
int getOKButtonId()
static const int RESIZE_NONE
Definition gGUIDialogue.h:36
void keyPressed(int key)
gGUIButton * getYesButton()
void mouseMoved(int x, int y)
void setSizer(gGUISizer *guiSizer)
int getButtonEvent()
int getDialogueType()
void resetMessageBar()
void setDialogueType(int typeId)
@ ICONTYPE_NONE
Definition gGUIDialogue.h:51
@ ICONTYPE_INFO
Definition gGUIDialogue.h:53
@ ICONTYPE_WARNING
Definition gGUIDialogue.h:54
@ ICONTYPE_ERROR
Definition gGUIDialogue.h:52
gGUIButton * getCancelButton()
void charPressed(unsigned int codepoint)
std::string getMessageText()
void setIconType(int iconId)
void enableResize(bool isResizeEnabled)
static const int EVENT_EXIT
Definition gGUIDialogue.h:35
gGUIButton * getNoButton()
int getYesButtonId()
static const int RESIZE_BOTTOM
Definition gGUIDialogue.h:36
void mouseDragged(int x, int y, int button)
static const int EVENT_MAXIMIZE
Definition gGUIDialogue.h:35
gGUIContainer * getTitleBar()
void setTitleType(int typeId)
void keyReleased(int key)
void setMessageBarSizer(gGUISizer *sizer)
void transformDialogue(int left, int top, int width, int height)
Definition gGUIForm.h:21
Definition gGUIImageButton.h:53
Definition gGUISizer.h:14
Definition gGUIText.h:14