1 #include <gtkmm/label.h>
2 #include <gtkmm/separator.h>
8 NewEventBox::NewEventBox() :
12 vBox
.pack_start (hBoxUp
);
13 vBox
.pack_start (hBoxDown
);
14 Gtk::Label
* lB0
= new Gtk::Label ("rrr");
15 hBoxUp
.pack_start (*lB0
);
16 for (int i
=0; i
<5; i
++)
18 Gtk::Widget
* w
= new Gtk::HSeparator
;
19 hBoxUp
.pack_start (*w
);
21 Gtk::Label
* lB1
= new Gtk::Label ("ttt");
22 hBoxUp
.pack_start (*lB1
);
28 bool NewEventBox::on_expose_event (GdkEventExpose
* event
)
30 bool rv
= Gtk::EventBox::on_expose_event (event
);
32 int width
= get_allocation().get_width();
33 int height
= get_allocation().get_height();
34 double scale_x
= (double)width
/ scale
;
35 double scale_y
= (double)height
/ scale
;
37 Cairo::RefPtr
<Cairo::Context
> cr
= this->get_window()->create_cairo_context();
39 //cr->move_to(get_allocation().get_width()/2,get_allocation().get_height()/2);
41 cr
->translate (width
/2.0, height
/2.0);
42 double radius
= 400;//width < height ? width-40 : height-40;
44 cr
->scale (radius
, radius
);
45 cr
->arc (0.0, 0.0, 1.0, 0.0, 2 * 3.14);
46 cr
->arc_negative (0.0, 0.0, 1.0, 0.0, 2 * 3.14);
54 void NewEventBox::on_realize (void)
59 Gtk::EventBox::on_realize ();
63 std::cout
<< __FUNCTION__
<< std::endl
;
69 GdkWindowAttr attributes
;
70 memset (&attributes
, 0, sizeof(attributes
));
72 Gtk::Allocation allocation
= get_allocation ();
75 // Set initial position and size of the Gdk::Window:
77 attributes
.x
= allocation
.get_x();
78 attributes
.y
= allocation
.get_y();
79 attributes
.width
= allocation
.get_width();
80 attributes
.height
= allocation
.get_height();
82 attributes
.event_mask
= get_events () | Gdk::EXPOSURE_MASK
;
83 attributes
.window_type
= GDK_WINDOW_CHILD
;
84 attributes
.wclass
= GDK_INPUT_OUTPUT
;
90 bgCol
.set_rgb_p (0.7, 0.4, 0.4);
92 fgCol
.set_rgb_p (0.0, 0.0, 0.0);
93 modify_bg (Gtk::STATE_NORMAL
, bgCol
);
94 modify_fg (Gtk::STATE_NORMAL
, fgCol
);