-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbotoes.cpp
128 lines (101 loc) · 4.45 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
#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);
//Botoes -> vox
this->m_box1_2.pack_start(this->m_btn1);
this->m_box1_2.pack_start(this->m_btn2);
this->m_box1_2.pack_start(this->m_btn3);
this->m_box1_2.pack_start(this->m_btn4);
//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));
//BOtão com Imagem;
this->m_box1_1.pack_start(this->m_btn_img);
this->ref5 = Gdk::Pixbuf::create_from_file("img/img.svg",24,24,false);
this->img5.set(this->ref5);
this->m_btn_img.set_image(img5);
this->m_btn_img.set_label("Label");
this->m_btn_img.set_always_show_image(true);
//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->m_btn_img.set_image_position(Gtk::POS_LEFT);
}
}
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);
this->m_btn_img.set_image_position(Gtk::POS_RIGHT);
}
}
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);
this->m_btn_img.set_image_position(Gtk::POS_TOP);
}
}
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);
this->m_btn_img.set_image_position(Gtk::POS_BOTTOM);
}
}