diff gtk/tool_bar.d @ 27:f3d91579bb28

Checkpoint
author David Bryant <daveb@acres.com.au>
date Wed, 29 Jul 2009 14:11:35 +0930
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gtk/tool_bar.d	Wed Jul 29 14:11:35 2009 +0930
@@ -0,0 +1,63 @@
+module gtk.toolbar;
+
+public {
+    import gtk.Toolbar;
+}
+
+private {
+    import gtk.ToolButton;
+    import gtk.SeparatorToolItem;
+    import gtk.RadioToolButton;
+    import gtk.Image;
+
+    import glib.ListSG;
+
+    import std.stdio;
+}
+
+class ToolBar : Toolbar {
+    this() {
+        // INVALID, MENU, SMALL_TOOLBAR, LARGE_TOOLBAR,
+        // BUTTON, DND, DIALOG
+        setIconSize(GtkIconSize.LARGE_TOOLBAR);
+	// ICONS, TEXT, BOTH, BOTH_HORIZ
+        setStyle(GtkToolbarStyle.ICONS);
+	// HORIZONTAL, VERTICAL
+        setOrientation(GtkOrientation.HORIZONTAL);
+        setTooltips(true);
+
+        Image image;
+        ListSG group;
+
+        image = new Image("icons/select.svg");
+        button1 = new RadioToolButton(group);
+        button1.setLabelWidget(image);
+        insert(button1);
+
+        image = new Image("icons/select.png");
+        button2 = new RadioToolButton(group);
+        button2.setGroup(button1.getGroup);
+        button2.setLabelWidget(image);
+        button2.addOnClicked(&on_clicked);
+        insert(button2);
+
+        insert(new SeparatorToolItem);
+
+        image = new Image("icons/select.png");
+        button3 = new RadioToolButton(group);
+        button3.setGroup(button1.getGroup);
+        button3.setLabelWidget(image);
+        insert(button3);
+    }
+
+    private {
+
+        void on_clicked(ToolButton tool_button) {
+            writefln("Clicked!");
+        }
+
+        RadioToolButton button1;
+        RadioToolButton button2;
+        RadioToolButton button3;
+    }
+}