27
|
1 module gtk.toolbar;
|
|
2
|
|
3 public {
|
|
4 import gtk.Toolbar;
|
|
5 }
|
|
6
|
|
7 private {
|
|
8 import gtk.ToolButton;
|
|
9 import gtk.SeparatorToolItem;
|
|
10 import gtk.RadioToolButton;
|
|
11 import gtk.Image;
|
|
12
|
|
13 import glib.ListSG;
|
|
14
|
|
15 import std.stdio;
|
|
16 }
|
|
17
|
|
18 class ToolBar : Toolbar {
|
|
19 this() {
|
|
20 // INVALID, MENU, SMALL_TOOLBAR, LARGE_TOOLBAR,
|
|
21 // BUTTON, DND, DIALOG
|
|
22 setIconSize(GtkIconSize.LARGE_TOOLBAR);
|
|
23 // ICONS, TEXT, BOTH, BOTH_HORIZ
|
|
24 setStyle(GtkToolbarStyle.ICONS);
|
|
25 // HORIZONTAL, VERTICAL
|
|
26 setOrientation(GtkOrientation.HORIZONTAL);
|
|
27 setTooltips(true);
|
|
28
|
|
29 Image image;
|
|
30 ListSG group;
|
|
31
|
|
32 image = new Image("icons/select.svg");
|
|
33 button1 = new RadioToolButton(group);
|
|
34 button1.setLabelWidget(image);
|
|
35 insert(button1);
|
|
36
|
|
37 image = new Image("icons/select.png");
|
|
38 button2 = new RadioToolButton(group);
|
|
39 button2.setGroup(button1.getGroup);
|
|
40 button2.setLabelWidget(image);
|
|
41 button2.addOnClicked(&on_clicked);
|
|
42 insert(button2);
|
|
43
|
|
44 insert(new SeparatorToolItem);
|
|
45
|
|
46 image = new Image("icons/select.png");
|
|
47 button3 = new RadioToolButton(group);
|
|
48 button3.setGroup(button1.getGroup);
|
|
49 button3.setLabelWidget(image);
|
|
50 insert(button3);
|
|
51 }
|
|
52
|
|
53 private {
|
|
54
|
|
55 void on_clicked(ToolButton tool_button) {
|
|
56 writefln("Clicked!");
|
|
57 }
|
|
58
|
|
59 RadioToolButton button1;
|
|
60 RadioToolButton button2;
|
|
61 RadioToolButton button3;
|
|
62 }
|
|
63 }
|