void InitializeView() { PixbufList smalllist = new PixbufList(); PixbufList imglist = new PixbufList(); smalllist.Add(Runtime.Gui.Resources.GetBitmap("md-empty-file-icon")); imglist.Add(Runtime.Gui.Resources.GetBitmap("md-empty-file-icon")); int i = 0; Hashtable tmp = new Hashtable(icons); foreach (DictionaryEntry entry in icons) { Gdk.Pixbuf bitmap = Runtime.Gui.Resources.GetBitmap(entry.Key.ToString(), Gtk.IconSize.LargeToolbar); if (bitmap != null) { smalllist.Add(bitmap); imglist.Add(bitmap); tmp[entry.Key] = ++i; } else { Runtime.LoggingService.InfoFormat(GettextCatalog.GetString ("Can't load bitmap {0} using default"), entry.Key.ToString ()); } } icons = tmp; InsertCategories(TreeIter.Zero, categories); //PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService)); /*for (int j = 0; j < categories.Count; ++j) { if (((Category)categories[j]).Name == propertyService.GetProperty("Dialogs.NewFileDialog.LastSelectedCategory", "C#")) { ((TreeView)ControlDictionary["categoryTreeView"]).SelectedNode = (TreeNode)((TreeView)ControlDictionary["categoryTreeView"]).Nodes[j]; break; } }*/ ShowAll (); }
void InitializeComponents() { catStore = new Gtk.TreeStore (typeof(string), typeof(ArrayList), typeof(ArrayList), typeof(Gdk.Pixbuf)); catStore.SetSortColumnId (0, SortType.Ascending); templateStore = new Gtk.TreeStore (typeof(string), typeof(FileTemplate)); ScrolledWindow swindow1 = new ScrolledWindow(); swindow1.VscrollbarPolicy = PolicyType.Automatic; swindow1.HscrollbarPolicy = PolicyType.Automatic; swindow1.ShadowType = ShadowType.In; catView = new Gtk.TreeView (catStore); catView.WidthRequest = 160; catView.HeadersVisible = false; templateView = new Gtk.TreeView (templateStore); TemplateView = new IconView(); TreeViewColumn catColumn = new TreeViewColumn (); catColumn.Title = "categories"; CellRendererText cat_text_render = new CellRendererText (); catColumn.PackStart (cat_text_render, true); catColumn.AddAttribute (cat_text_render, "text", 0); catView.AppendColumn (catColumn); TreeViewColumn templateColumn = new TreeViewColumn (); templateColumn.Title = "template"; CellRendererText tmpl_text_render = new CellRendererText (); templateColumn.PackStart (tmpl_text_render, true); templateColumn.AddAttribute (tmpl_text_render, "text", 0); templateView.AppendColumn (templateColumn); okButton = new Button (Gtk.Stock.New); okButton.Clicked += new EventHandler (OpenEvent); cancelButton = new Button (Gtk.Stock.Close); cancelButton.Clicked += new EventHandler (cancelClicked); infoLabel = new Label (""); Frame infoLabelFrame = new Frame(); infoLabelFrame.Add(infoLabel); HBox viewbox = new HBox (false, 6); swindow1.Add(catView); viewbox.PackStart (swindow1,false,true,0); viewbox.PackStart(TemplateView, true, true,0); this.AddActionWidget (cancelButton, (int)Gtk.ResponseType.Cancel); this.AddActionWidget (okButton, (int)Gtk.ResponseType.Ok); this.VBox.PackStart (viewbox); this.VBox.PackStart (infoLabelFrame, false, false, 6); cat_imglist = new PixbufList(); cat_imglist.Add(Runtime.Gui.Resources.GetBitmap("md-open-folder")); cat_imglist.Add(Runtime.Gui.Resources.GetBitmap("md-closed-folder")); catView.Selection.Changed += new EventHandler (CategoryChange); TemplateView.IconSelected += new EventHandler(SelectedIndexChange); TemplateView.IconDoubleClicked += new EventHandler(OpenEvent); InitializeView (); }