-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathC_GTK_Button.cpp
More file actions
116 lines (85 loc) · 3.96 KB
/
C_GTK_Button.cpp
File metadata and controls
116 lines (85 loc) · 3.96 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//////////////////////////////////////////////////////////////////////////////////
// [ GTK_Button_Class_Source ]
//////////////////////////////////////////////////////////////////////////////////
#include "C_GTK_Button.hpp"
//////////////////////////////////////////////////////////////////////////////////
// [Konstructor]
//////////////////////////////////////////////////////////////////////////////////
C_GTK_Button::C_GTK_Button(){
this->pbutton = 0;
this->status = C_GTK_BUTTON_ERROR;
}
//////////////////////////////////////////////////////////////////////////////////
// [Destructor]
//////////////////////////////////////////////////////////////////////////////////
C_GTK_Button::~C_GTK_Button(){
}
//////////////////////////////////////////////////////////////////////////////////
// [create]
//////////////////////////////////////////////////////////////////////////////////
GtkWidget* C_GTK_Button::create(const gchar *title){
if(this->status == C_GTK_BUTTON_READY) return(this->pbutton);
if(!title) return(C_GTK_BUTTON_ERROR);
this->pbutton = gtk_button_new_with_label(title);
if(!this->pbutton) return(C_GTK_BUTTON_ERROR);
this->status = C_GTK_BUTTON_READY;
return(this->pbutton);
}
//////////////////////////////////////////////////////////////////////////////////
// [setCaption]
//////////////////////////////////////////////////////////////////////////////////
int C_GTK_Button::setCaption(const gchar *title){
if(this->status != C_GTK_BUTTON_READY) return(C_GTK_BUTTON_ERROR);
if(!title) return(C_GTK_BUTTON_ERROR);
gtk_window_set_title(GTK_WINDOW(this->pbutton), title);
return(C_GTK_BUTTON_READY);
}
//////////////////////////////////////////////////////////////////////////////////
// [setBackground]
//////////////////////////////////////////////////////////////////////////////////
int C_GTK_Button::setBackground(const GdkRGBA* color){
if(this->status != C_GTK_BUTTON_READY) return(C_GTK_BUTTON_ERROR);
if(!color) return(C_GTK_BUTTON_ERROR);
gtk_widget_override_background_color(this->pbutton, GTK_STATE_FLAG_NORMAL, color);
return(C_GTK_BUTTON_READY);
}
//////////////////////////////////////////////////////////////////////////////////
// [setColor]
//////////////////////////////////////////////////////////////////////////////////
int C_GTK_Button::setColor(const GdkRGBA* color){
if(this->status != C_GTK_BUTTON_READY) return(C_GTK_BUTTON_ERROR);
if(!color) return(C_GTK_BUTTON_ERROR);
gtk_widget_override_color(this->pbutton, GTK_STATE_FLAG_NORMAL, color);
return(C_GTK_BUTTON_READY);
}
//////////////////////////////////////////////////////////////////////////////////
// [setSize]
//////////////////////////////////////////////////////////////////////////////////
int C_GTK_Button::setSize(int x, int y){
if(this->status != C_GTK_BUTTON_READY) return(C_GTK_BUTTON_ERROR);
gtk_widget_set_size_request(this->pbutton, x, y);
return(C_GTK_BUTTON_READY);
}
//////////////////////////////////////////////////////////////////////////////////
// [set_size]
//////////////////////////////////////////////////////////////////////////////////
GtkWidget* C_GTK_Button::getButton(){
if(this->status != C_GTK_BUTTON_READY) return(C_GTK_BUTTON_ERROR);
return(this->pbutton);
}
//////////////////////////////////////////////////////////////////////////////////
// [hide]
//////////////////////////////////////////////////////////////////////////////////
int C_GTK_Button::hide(){
if(this->status != C_GTK_BUTTON_READY) return(C_GTK_BUTTON_ERROR);
gtk_widget_hide(this->pbutton);
return(C_GTK_BUTTON_READY);
}
//////////////////////////////////////////////////////////////////////////////////
// [show]
//////////////////////////////////////////////////////////////////////////////////
int C_GTK_Button::show(){
if(this->status != C_GTK_BUTTON_READY) return(C_GTK_BUTTON_ERROR);
gtk_widget_show(this->pbutton);
return(C_GTK_BUTTON_READY);
}