2 Copyright 2009 by Hans Baier
11 public class TransportButtons
: TransportButton
{
13 public TransportButtons () {
14 // Set favored widget size
15 set_size_request (280, 40);
16 draw
.connect(on_draw
);
19 /* Widget is asked to draw itself */
20 public new
bool on_draw (Cairo
.Context cr
) {
21 Gtk
.Allocation allocation
;
22 get_allocation(out allocation
);
24 cr
.translate (10.0, 10.0);
27 cr
.translate (20.0, 0.0);
30 cr
.translate (20.0, 0.0);
33 cr
.translate (20.0, 0.0);
34 paint_fast_forward_icon (cr
);
36 cr
.translate (20.0, 0.0);
37 paint_fast_to_end_icon (cr
);
39 cr
.translate (20.0, 0.0);
40 paint_fast_backward_icon (cr
);
42 cr
.translate (20.0, 0.0);
43 paint_fast_to_start_icon (cr
);
49 static int main (string[] args
) {
51 var window
= new Gtk
.Window (Gtk
.WindowType
.TOPLEVEL
);
52 var vbox
= new Gtk
.Box (Gtk
.Orientation
.VERTICAL
, 0);
53 var hbox
= new Gtk
.Box (Gtk
.Orientation
.HORIZONTAL
, 0);
54 var widget
= new
TransportButtons ();
57 var button
= new
TransportButton();
58 button
.icon_type
= IconType
.STOP
;
60 button
= new
TransportButton();
61 button
.icon_type
= IconType
.PLAY
;
63 button
= new
TransportButton();
64 button
.icon_type
= IconType
.REC
;
66 button
= new
TransportButton();
67 button
.icon_type
= IconType
.FAST_BACKWARD
;
69 button
= new
TransportButton();
70 button
.icon_type
= IconType
.FAST_FORWARD
;
72 button
= new
TransportButton();
73 button
.icon_type
= IconType
.TO_START
;
75 button
= new
TransportButton();
76 button
.icon_type
= IconType
.TO_END
;
81 int[] sizes
= {16, 22, 24, 28, 32, 48};
82 foreach (var size
in sizes
) {
83 hbox
= new Gtk
.HBox (true, 100);
85 button
= new
TransportButton();
86 button
.icon_type
= IconType
.STOP
;
87 button
.set_size_request (size
, size
);
89 hbox
.set_child_packing (button
, false, false, 0, PackType
.END
);
91 button
= new
TransportButton();
92 button
.icon_type
= IconType
.PLAY
;
93 button
.set_size_request (size
, size
);
95 hbox
.set_child_packing (button
, false, false, 0, PackType
.END
);
97 button
= new
TransportButton();
98 button
.icon_type
= IconType
.REC
;
99 button
.set_size_request (size
, size
);
101 hbox
.set_child_packing (button
, false, false, 0, PackType
.END
);
103 button
= new
TransportButton();
104 button
.icon_type
= IconType
.FAST_BACKWARD
;
105 button
.set_size_request (size
, size
);
107 hbox
.set_child_packing (button
, false, false, 0, PackType
.END
);
109 button
= new
TransportButton();
110 button
.icon_type
= IconType
.FAST_FORWARD
;
111 button
.set_size_request (size
, size
);
113 hbox
.set_child_packing (button
, false, false, 0, PackType
.END
);
115 button
= new
TransportButton();
116 button
.icon_type
= IconType
.TO_START
;
117 button
.set_size_request (size
, size
);
119 hbox
.set_child_packing (button
, false, false, 0, PackType
.END
);
121 button
= new
TransportButton();
122 button
.icon_type
= IconType
.TO_END
;
123 button
.set_size_request (size
, size
);
125 hbox
.set_child_packing (button
, false, false, 0, PackType
.END
);
132 window
.destroy
.connect(Gtk
.main_quit
);
139 } // namespace Prolooks