fix implement some StockBrowser stuff

svn path=/trunk/gtk-sharp/; revision=32177
This commit is contained in:
John Luke 2004-08-10 19:50:10 +00:00
parent 189b8b47c6
commit 2da02fa8bb

View file

@ -36,8 +36,9 @@ namespace GtkDemo
list.Selection.Changed += new EventHandler (OnSelectionChanged); list.Selection.Changed += new EventHandler (OnSelectionChanged);
scrolledWindow.Add (list); scrolledWindow.Add (list);
Frame frame = new Frame (); Frame frame = new Frame ("Selected Item");
hbox.PackStart (frame, true, true, 0); frame.Add (new Label ("TODO"));
hbox.PackStart (frame, false, false, 0);
this.ShowAll (); this.ShowAll ();
} }
@ -45,20 +46,20 @@ namespace GtkDemo
private ListStore CreateStore () private ListStore CreateStore ()
{ {
// image, name, label, accel, id // 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 (); string[] stock_ids = Gtk.Stock.ListIds ();
foreach (string s in stock_ids) foreach (string s in stock_ids)
{ {
Gtk.StockItem si; /* until 61893
/* Gtk.Stock.Lookup is not being generated Gtk.StockItem si = new StockItem ();
if (Gtk.Stock.Lookup (out si)) { if (Gtk.StockManager.Lookup (s, ref si)) {
Image icon = new Image (s, IconSize.Menu); 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 { 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; 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 "<ctl> + key";
}
void OnSelectionChanged (object o, EventArgs args) void OnSelectionChanged (object o, EventArgs args)
{ {
TreeIter iter; TreeIter iter;