1 #include "onewindow.h"
 2 #include <iostream>
 3 #include <gtkmm/stock.h>
 4
 5 Onewindow::Onewindow()
 6         //:m_button(Gtk::Stock::OK) //Create a new button on initialization line
 7 {
 8         //m_button.add_pixlabel("/usr/local/share/gtk-gnutella/pixmaps/download.xpm","cool button");
 9         m_button.add_pixlabel("/usr/local/share/gtk-gnutella/pixmaps/download.xpm","cool button"); //Create a new button on initialization line
10
11         set_title("Pixeled Button");
12         set_border_width(18);
13         
14         //connect signal when button clicked
15         m_button.signal_clicked().connect(sigc::mem_fun(*this,
16                                 &Onewindow::l_clicked));
17         m_button.signal_pressed().connect(sigc::mem_fun(*this,
18                                 &Onewindow::l_pressed));
19         m_button.signal_enter().connect(sigc::mem_fun(*this,
20                                 &Onewindow::l_enter));
21         m_button.signal_leave().connect(sigc::mem_fun(*this,
22                                 &Onewindow::l_leave));
23         m_button.signal_released().connect(sigc::mem_fun(*this,
24                                 &Onewindow::l_released));
25         //m_button.signal_toggled().connect(sigc::mem_fun(*this,
26         //                     &Onewindow::l_toggled));
27
28         //pack the button into the window
29         add(m_button);
30
31         //show the widget
32         show_all_children();
33 }
34
35 Onewindow::~Onewindow()
36 {
37         std::cout << "BYE!!" <<std::endl;
38 }
39
40 void Onewindow::l_clicked()
41 {
42         std::cout << "Click Click!" <<std::endl;
43 }
44
45 void Onewindow::l_pressed()
46 {
47         std::cout << "press press!" <<std::endl;
48 }
49 void Onewindow::l_released()
50 {
51         std::cout << "released released!" <<std::endl;
52         m_button.set_active(true);
53 }
54 void Onewindow::l_enter()
55 {
56         m_button.toggled();
57         std::cout << "enter enter!" <<std::endl;
58
59 }
60 void Onewindow::l_leave()
61 {
62         bool result = m_button.get_active();
63         std::cout << "leave leave!" << result << std::endl;
64         m_button.toggled();
65         result = m_button.get_active();
66         std::cout << "and leave leave!" << result << std::endl;
67         m_button.set_active(false);
68         result = m_button.get_active();
69         std::cout << "leave leave!" << result << std::endl;
70
71 }
72
73 void Onewindow::l_get_active()
74 {
75         std::cout << "get active!" <<std::endl;
76 }
77 void Onewindow::l_set_active()
78 {
79         m_button.set_active(true);
80         bool result = m_button.get_active();
81         std::cout << "set_active " << result <<std::endl;
82 }
83 void Onewindow::l_toggled()
84 {
85         bool result = m_button.get_active();
86         std::cout << "toggled! "<< result <<std::endl;
87 }
88
89
90
91
92
93
94