From 2da02fa8bb7c1e6d57cf1a26038951336018814a Mon Sep 17 00:00:00 2001 From: John Luke Date: Tue, 10 Aug 2004 19:50:10 +0000 Subject: [PATCH] fix implement some StockBrowser stuff svn path=/trunk/gtk-sharp/; revision=32177 --- sample/GtkDemo/DemoStockBrowser.cs | 32 ++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/sample/GtkDemo/DemoStockBrowser.cs b/sample/GtkDemo/DemoStockBrowser.cs index f896aab2a..0a3719e96 100644 --- a/sample/GtkDemo/DemoStockBrowser.cs +++ b/sample/GtkDemo/DemoStockBrowser.cs @@ -36,8 +36,9 @@ namespace GtkDemo list.Selection.Changed += new EventHandler (OnSelectionChanged); scrolledWindow.Add (list); - Frame frame = new Frame (); - hbox.PackStart (frame, true, true, 0); + Frame frame = new Frame ("Selected Item"); + frame.Add (new Label ("TODO")); + hbox.PackStart (frame, false, false, 0); this.ShowAll (); } @@ -45,20 +46,20 @@ namespace GtkDemo private ListStore CreateStore () { // image, name, label, accel, id - ListStore store = new Gtk.ListStore (typeof (Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof (string)); + ListStore store = new Gtk.ListStore (typeof (Gtk.Image), typeof(string), typeof(string), typeof(string), typeof (string)); string[] stock_ids = Gtk.Stock.ListIds (); foreach (string s in stock_ids) { - Gtk.StockItem si; - /* Gtk.Stock.Lookup is not being generated - if (Gtk.Stock.Lookup (out si)) { + /* until 61893 + Gtk.StockItem si = new StockItem (); + if (Gtk.StockManager.Lookup (s, ref si)) { Image icon = new Image (s, IconSize.Menu); - store.AppendValues (si.Pixbuf, si.Label, "Ok", "_Ok", si.StockId); + store.AppendValues (icon, GetCLSName (si.StockId), si.Label, GetKeyName (si), si.StockId); } else { - Console.WriteLine ("StockItem {0} could not be found.", s); + Console.WriteLine ("StockItem '{0}' could not be found.", s); } */ } @@ -66,6 +67,21 @@ namespace GtkDemo return store; } + string GetCLSName (string stockID) + { + // TODO: change gtk-stock-close + // int Gtk.Stock.Close + return stockID; + } + + string GetKeyName (StockItem si) + { + // TODO: use si.Keyval and si.Modifier + // to produce a reasonable representation + // of the key binding + return " + key"; + } + void OnSelectionChanged (object o, EventArgs args) { TreeIter iter;