-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGUIComponentBase.cpp
More file actions
103 lines (70 loc) · 1.98 KB
/
Copy pathGUIComponentBase.cpp
File metadata and controls
103 lines (70 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
#include "GUIComponentBase.h"
GUIManager* GUIComponentBase::Gmanager;
GUIComponentBase::GUIComponentBase(int x, int y) {
refPoint.x = x;
refPoint.y = y;
}
GUIComponentBase::~GUIComponentBase() {
}
void GUIComponentBase::registerGUImanager(GUIManager* arg) {
Gmanager = arg;
}
int GUIComponentBase::getComponentID() {
return componentID;
}
void GUIComponentBase::setComponentID(int ID) {
componentID = ID;
}
void GUIComponentBase::onMotion(int x, int y) {
std::cout << "Motion x = " << x << "; Y = " << y << std::endl;
}
Point2i GUIComponentBase::getRefPoint(){
return refPoint;
}
//Deleate later
void GUIComponentBase::onRemap(uint_fast8_t* map) {
for (int i = 0; i < 1000 * 400; i++)
map[i] = componentID;
std::cout << "Remap" << std::endl;
}
void GUIComponentBase::onUnmap(uint8_t *map) {
for (unsigned i = 0; i < winWidth * winHeight; i++)
if (map[i] == componentID)
map[i] = 0;
}
void GUIComponentBase::onCreate() {
std::cout << "I'm created!!" << std::endl;
}
void GUIComponentBase::onKeyPress(int keyAscii) {
std::cout << keyAscii << std::endl;
}
void GUIComponentBase::onFocus() {
std::cout << "Entered " << componentID << std::endl;
}
void GUIComponentBase::onUnFocus() {
std::cout << "Left " << componentID << std::endl;
}
void GUIComponentBase::onClick(int x, int y) {
std::cout << "Click x = " << x << "; Y = " << y << std::endl;
}
void GUIComponentBase::onDrag(int x, int y) {
}
void GUIComponentBase::onDraw(cairo_t*) {
}
void GUIComponentBase::onDrop(int x, int y) {
}
void GUIComponentBase::onKeyRelease(int keyAscii) {
}
void GUIComponentBase::onButtonPress(int x, int y, int buttonCode) {
}
void GUIComponentBase::onDestory() {
}
//Functions exposed to GUIcomponents
uint8_t GUIComponentBase::idAtGUImapLocation(int x, int y) {
return Gmanager->checkIDatGUImap(x, y);
}