-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbotoes.cpp
223 lines (177 loc) · 8 KB
/
botoes.cpp
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#include <iostream>
#include <iostream>
#include "botoes.h"
Botoes::Botoes(){
//Window
this->add(this->m_box_main);
this->set_border_width(5);
//Box
this->m_box_main.set_orientation(Gtk::ORIENTATION_VERTICAL);
this->m_box1.set_orientation(Gtk::ORIENTATION_HORIZONTAL);
this->m_box1.set_spacing(5);
this->m_box1_1.set_orientation(Gtk::ORIENTATION_HORIZONTAL);
this->m_box1_1.set_valign(Gtk::ALIGN_CENTER);
this->m_box1_2.set_orientation(Gtk::ORIENTATION_HORIZONTAL);
this->m_box1_2.set_valign(Gtk::ALIGN_CENTER);
//Config Frame
this->m_f1.set_label(" Horizontal ");
this->m_f1.set_label_align(0.2);
this->m_f2.set_label(" Vertical ");
this->m_f2.set_label_align(0.2);
//Botoes -> vox
this->m_vbox1.set_border_width(5);
this->m_hbox1.set_border_width(5);
this->m_box1_2.pack_start(this->m_f1);
this->m_box1_2.pack_start(this->m_f2);
this->m_f1.add(this->m_vbox1);
this->m_f2.add(this->m_hbox1);
this->m_vbox1.pack_start(this->m_btn1);
this->m_vbox1.pack_start(this->m_btn2);
this->m_vbox1.pack_start(this->m_btn3);
this->m_vbox1.pack_start(this->m_btn4);
this->m_hbox1.pack_start(this->m_btn5);
this->m_hbox1.pack_start(this->m_btn6);
this->m_hbox1.pack_start(this->m_btn7);
this->m_hbox1.pack_start(this->m_btn8);
//Botoes
this->ref1= Gdk::Pixbuf::create_from_file("img/d.svg",24,24,false);
this->m_btn1.set_tooltip_text("Gtk::POS_RIGHT");
this->img1.set(this->ref1);
this->m_btn1.set_image(this->img1);
this->m_btn1.set_relief(Gtk::RELIEF_NONE);
this->m_btn1.set_state_flags(Gtk::STATE_FLAG_CHECKED);
this->m_btn1.signal_clicked().connect(sigc::mem_fun(*this,&Botoes::on_btn1_action));
this->ref2= Gdk::Pixbuf::create_from_file("img/e.svg",24,24,false);
this->m_btn2.set_tooltip_text("Gtk::POS_LEFT");
this->img2.set(this->ref2);
this->m_btn2.set_image(img2);
this->m_btn2.set_relief(Gtk::RELIEF_NONE);
this->m_btn2.signal_clicked().connect(sigc::mem_fun(*this,&Botoes::on_btn2_action));
this->ref3= Gdk::Pixbuf::create_from_file("img/t.svg",24,24,false);
this->m_btn3.set_tooltip_text("Gtk::POS_TOP");
this->img3.set(this->ref3);
this->m_btn3.set_image(img3);
this->m_btn3.set_relief(Gtk::RELIEF_NONE);
this->m_btn3.signal_clicked().connect(sigc::mem_fun(*this,&Botoes::on_btn3_action));
this->ref4= Gdk::Pixbuf::create_from_file("img/u.svg",24,24,false);
this->m_btn4.set_tooltip_text("Gtk::POS_BOTTOM");
this->img4.set(this->ref4);
this->m_btn4.set_image(img4);
this->m_btn4.set_relief(Gtk::RELIEF_NONE);
this->m_btn4.signal_clicked().connect(sigc::mem_fun(*this,&Botoes::on_btn4_action));
this->ref5= Gdk::Pixbuf::create_from_file("img/d.svg",24,24,false);
this->m_btn5.set_state_flags(Gtk::STATE_FLAG_CHECKED);
this->m_btn5.set_tooltip_text("Gtk::POS_RIGHT");
this->img5.set(this->ref5);
this->m_btn5.set_image(this->img5);
this->m_btn5.set_relief(Gtk::RELIEF_NONE);
this->m_btn5.signal_clicked().connect(sigc::mem_fun(*this,&Botoes::on_btn5_action));
this->ref6= Gdk::Pixbuf::create_from_file("img/e.svg",24,24,false);
this->m_btn6.set_tooltip_text("Gtk::POS_LEFT");
this->img6.set(this->ref6);
this->m_btn6.set_image(img6);
this->m_btn6.set_relief(Gtk::RELIEF_NONE);
this->m_btn6.signal_clicked().connect(sigc::mem_fun(*this,&Botoes::on_btn6_action));
this->ref7= Gdk::Pixbuf::create_from_file("img/t.svg",24,24,false);
this->m_btn7.set_tooltip_text("Gtk::POS_TOP");
this->img7.set(this->ref7);
this->m_btn7.set_image(img7);
this->m_btn7.set_relief(Gtk::RELIEF_NONE);
this->m_btn7.signal_clicked().connect(sigc::mem_fun(*this,&Botoes::on_btn7_action));
this->ref8= Gdk::Pixbuf::create_from_file("img/u.svg",24,24,false);
this->m_btn8.set_tooltip_text("Gtk::POS_BOTTOM");
this->img8.set(this->ref8);
this->m_btn8.set_image(img8);
this->m_btn8.set_relief(Gtk::RELIEF_NONE);
this->m_btn8.signal_clicked().connect(sigc::mem_fun(*this,&Botoes::on_btn8_action));
//BOtão com Imagem;
this->m_btn_img.add_pixlabel("img/img.svg","Label",Gtk::ALIGN_START,Gtk::ALIGN_START);
this->v_al = Gtk::ALIGN_START;
this->h_al = Gtk::ALIGN_START;
this->m_btn_img.set_image_position(Gtk::POS_LEFT);
this->m_btn_img.set_size_request(150,0);
this->m_btn_img.set_image_position(Gtk::POS_TOP);
this->m_box1_1.pack_start(this->m_btn_img);
//boxs -> box_main
this->m_box_main.pack_start(this->m_box1);
this->m_box1.pack_start(this->m_box1_1);
this->m_box1.pack_start(this->m_box1_2);
this->show_all_children();
}
Botoes::~Botoes(){
}
void Botoes::on_btn1_action(){
if((int)this->m_btn1.get_state_flags() == 163){
std::cout << "Active" << std::endl;
this->m_btn1.set_state_flags(Gtk::STATE_FLAG_CHECKED,true);
this->m_btn2.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn3.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn4.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->h_al = Gtk::ALIGN_START;
//Método obsoleto.....
this->m_btn_img.add_pixlabel("img/img.svg","Label",this->h_al,this->v_al);
}
}
void Botoes::on_btn2_action(){
if((int)this->m_btn2.get_state_flags() == 163){
std::cout << "Active" << std::endl;
this->m_btn1.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn2.set_state_flags(Gtk::STATE_FLAG_CHECKED,true);
this->m_btn3.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn4.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
}
}
void Botoes::on_btn3_action(){
if((int)this->m_btn3.get_state_flags() == 163){
std::cout << "Active" << std::endl;
this->m_btn1.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn2.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn3.set_state_flags(Gtk::STATE_FLAG_CHECKED,true);
this->m_btn4.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
}
}
void Botoes::on_btn4_action(){
if((int)this->m_btn4.get_state_flags() == 163){
std::cout << "Active" << std::endl;
this->m_btn1.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn2.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn3.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn4.set_state_flags(Gtk::STATE_FLAG_CHECKED,true);
}
}
void Botoes::on_btn5_action(){
if((int)this->m_btn5.get_state_flags() == 163){
std::cout << "Active" << std::endl;
this->m_btn5.set_state_flags(Gtk::STATE_FLAG_CHECKED,true);
this->m_btn6.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn7.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn8.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
}
}
void Botoes::on_btn6_action(){
if((int)this->m_btn6.get_state_flags() == 163){
std::cout << "Active" << std::endl;
this->m_btn5.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn6.set_state_flags(Gtk::STATE_FLAG_CHECKED,true);
this->m_btn7.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn8.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
}
}
void Botoes::on_btn7_action(){
if((int)this->m_btn7.get_state_flags() == 163){
std::cout << "Active" << std::endl;
this->m_btn5.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn6.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn7.set_state_flags(Gtk::STATE_FLAG_CHECKED,true);
this->m_btn8.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
}
}
void Botoes::on_btn8_action(){
if((int)this->m_btn8.get_state_flags() == 163){
std::cout << "Active" << std::endl;
this->m_btn5.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn6.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn7.set_state_flags(Gtk::STATE_FLAG_NORMAL,true);
this->m_btn8.set_state_flags(Gtk::STATE_FLAG_CHECKED,true);
}
}