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 {
43 };
44 enum {
50 };
51 enum {
56 };
57
59 virtual ~gGUIDialogue();
60
61 void setup();
62
63 void setSizer(gGUISizer* guiSizer);
64
65 void update();
66 void draw();
67
68 bool show();
69 bool hide();
70 bool isShown();
71
78
79 void setTitle(std::string title);
81
82 void setButtonEvent(int buttonEvent);
84
85 void enableDrag(bool isDragEnabled);
86 void enableResize(bool isResizeEnabled);
87
88 void setIsMaximized(bool isMaximized);
89 void transformDialogue(int left, int top, int width, int height);
90
91 void setMessageText(std::string messageText);
92 std::string getMessageText();
93 void setIconType(int iconId);
95 void setDialogueType(int typeId);
97 void setTitleType(int typeId);
99
100 int getCursor(int x, int y);
101 void keyPressed(int key);
102 void keyReleased(int key);
103 void charPressed(unsigned int codepoint);
104 void mouseMoved(int x, int y);
105 void mousePressed(int x, int y, int button);
106 void mouseDragged(int x, int y, int button);
107 void mouseReleased(int x, int y, int button);
108
113
118
119private:
120 bool isdialogueshown;
121
122 gGUIContainer titlebar;
123 gGUISizer titlebarsizer;
124 gGUIContainer buttonsbar;
125 gGUISizer buttonsbarsizer;
126 gGUIContainer messagebar;
127
128 gGUIImageButton minimizebutton;
129 gGUIImageButton maximizebutton;
130 gGUIImageButton exitbutton;
131
132 static const int titlebarh = 35, titlebarbitmapw = 24, titlebarbuttonw = 48;
133 static const int buttonsbarh = 45, buttonsbarbuttonw = 100, buttonsbarbuttonh = 27;
134
135 void initTitleBar();
136 void initButtonsBar();
137 void initDefMessageBar();
138
139 gGUIBitmap titlebarbitmap;
140 gGUIText titlebartext;
141
142 gGUIButton buttonsbarokbutton;
143 gGUIButton buttonsbaryesbutton;
144 gGUIButton buttonsbarnobutton;
145 gGUIButton buttonsbarcancelbutton;
146
147 gGUISizer defmessagebarsizer;
148 gGUIText defmessagetext;
149 gGUIImageButton defdialogueicon;
150
151 int buttontrigger, buttonevent;
152
153 int defmessagebartopspace, defmessagebarrightspace;
154
155 int dialoguetype;
156 int titletype;
157
158 bool isdragenabled, isresizeenabled;
159 bool ismaximized, isdragged;
160 bool isiconenabled;
161
162 int dragposx, dragposy, sizeposx, sizeposy;
163
164 int resizeposition;
165 int icontypeid;
166};
167
168#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_NONE
Definition gGUIDialogue.h:42
@ 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:46
@ TITLETYPE_EXITMIN
Definition gGUIDialogue.h:47
@ TITLETYPE_EXIT
Definition gGUIDialogue.h:48
@ TITLETYPE_EXITMINMAX
Definition gGUIDialogue.h:45
@ TITLETYPE_NONE
Definition gGUIDialogue.h:49
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:52
@ ICONTYPE_INFO
Definition gGUIDialogue.h:54
@ ICONTYPE_WARNING
Definition gGUIDialogue.h:55
@ ICONTYPE_ERROR
Definition gGUIDialogue.h:53
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