comparison doodle/gtk/palette.d @ 55:4922e746dd76

Checkpoint
author "David Bryant <bagnose@gmail.com>"
date Sun, 08 Aug 2010 21:37:38 +0930
parents 30ecedfe2ce2
children
comparison
equal deleted inserted replaced
54:30ecedfe2ce2 55:4922e746dd76
8 private { 8 private {
9 import doodle.core.logging; 9 import doodle.core.logging;
10 import gtk.ToolButton; 10 import gtk.ToolButton;
11 import gtk.RadioToolButton; 11 import gtk.RadioToolButton;
12 import gtk.Image; 12 import gtk.Image;
13 import gtk.Label;
13 import glib.ListSG; 14 import glib.ListSG;
14 import std.stdio; 15 import std.stdio;
15 } 16 }
16 17
17 class Palette : Toolbar, IPalette { 18 class Palette : Toolbar, IPalette {
18 this() { 19 this() {
20 // INVALID, MENU, SMALL_TOOLBAR, LARGE_TOOLBAR,
21 // BUTTON, DND, DIALOG
19 setIconSize(GtkIconSize.LARGE_TOOLBAR); 22 setIconSize(GtkIconSize.LARGE_TOOLBAR);
23 // ICONS, TEXT, BOTH, BOTH_HORIZ
20 setStyle(GtkToolbarStyle.ICONS); 24 setStyle(GtkToolbarStyle.ICONS);
25 // HORIZONTAL, VERTICAL
21 setOrientation(GtkOrientation.HORIZONTAL); 26 setOrientation(GtkOrientation.HORIZONTAL);
22 setTooltips(true); 27 setTooltips(true);
23 } 28 }
24 29
25 override void configure(in Item[] items) { 30 override void configure(in Item[] items) {
26 _items = items.dup; 31 _items = items.dup;
27 ListSG group; 32
33 RadioToolButton group;
28 34
29 foreach(index, item; _items) { 35 foreach(index, item; _items) {
30 auto button = new RadioToolButton(group); 36 RadioToolButton button;
31 if (index == 0) group = button.getGroup; 37
38 if (index == 0) {
39 ListSG list;
40 button = new RadioToolButton(list);
41 group = button;
42 }
43 else {
44 button = new RadioToolButton(group);
45 }
46
32 auto image = new Image(_iconBase ~ "/" ~ item.iconPath); 47 auto image = new Image(_iconBase ~ "/" ~ item.iconPath);
33 button.setLabelWidget(image); 48 auto label = new Label(item.tooltipText);
49 button.setIconWidget(image);
50 button.setLabelWidget(label);
34 button.setTooltipText(item.tooltipText); 51 button.setTooltipText(item.tooltipText);
35 52
36 int * i = new int; 53 int * i = new int;
37 *i = index; 54 *i = index;
38 button.objectGSetDataFull(_indexStr, cast(gpointer)i); 55 button.objectGSetDataFull(_indexStr, cast(gpointer)i);