本文整理汇总了C#中Gtk.TreeView.ExpandAll方法的典型用法代码示例。如果您正苦于以下问题:C# TreeView.ExpandAll方法的具体用法?C# TreeView.ExpandAll怎么用?C# TreeView.ExpandAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TreeView
的用法示例。
在下文中一共展示了TreeView.ExpandAll方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillListView
/// <summary>
/// Add new tab to Notebook object and fill it with
/// scan result of multimedia file
/// </summary>
private void FillListView(List<string[]> video, List<string[]> audio, string filePath)
{
TreeStore store = null;
ScrolledWindow sw = new ScrolledWindow();
Label lblIndex =
new Label(Path.GetFileName(filePath).PadRight(25).Substring(0,25).Trim());
lblIndex.TooltipText = Path.GetFileName(filePath);
tabContainer.AppendPage(sw, lblIndex);
TreeView tv = new TreeView();
tv.HeadersVisible = true;
tv.AppendColumn ("", new CellRendererPixbuf(), "pixbuf", 0);
tv.AppendColumn ("Description", new CellRendererText(), "text", 1);
tv.AppendColumn ("Value", new CellRendererText(), "text", 2);
sw.Add(tv);
store = new TreeStore (typeof (Gdk.Pixbuf), typeof (string), typeof (string));
TreeIter iter = store.AppendValues (Gdk.Pixbuf.LoadFromResource("video.png"),
"Video", "");
for (int k=0; k<video.Count; k++)
{
store.AppendValues(iter, null, video[k][0], video[k][1]);
}
iter = store.AppendValues (Gdk.Pixbuf.LoadFromResource("sound.png"),
"Audio", "");
for (int k=0; k<audio.Count; k++)
{
store.AppendValues(iter, null, audio[k][0], audio[k][1]);
}
tv.Model = store;
tv.ExpandAll();
}
示例2: DirtyFilesDialog
public DirtyFilesDialog () : base (GettextCatalog.GetString ("Save Files"), IdeApp.Workbench.RootWindow, DialogFlags.Modal)
{
tsFiles = new TreeStore (typeof(string), typeof(bool), typeof(SdiWorkspaceWindow), typeof(bool));
tvFiles = new TreeView (tsFiles);
TreeIter topCombineIter = TreeIter.Zero;
Hashtable projectIters = new Hashtable ();
foreach (Document doc in IdeApp.Workbench.Documents) {
if (!doc.IsDirty)
continue;
IViewContent viewcontent = doc.Window.ViewContent;
if (viewcontent.Project != null) {
TreeIter projIter = TreeIter.Zero;
if (projectIters.ContainsKey (viewcontent.Project))
projIter = (TreeIter)projectIters [viewcontent.Project];
else {
if (topCombineIter.Equals (TreeIter.Zero))
projIter = tsFiles.AppendValues (GettextCatalog.GetString ("Project: {0}", viewcontent.Project.Name), true, null, false);
else
projIter = tsFiles.AppendValues (topCombineIter, GettextCatalog.GetString ("Project: {0}", viewcontent.Project.Name), true, null, false);
projectIters [viewcontent.Project] = projIter;
}
tsFiles.AppendValues (projIter, viewcontent.PathRelativeToProject, true, viewcontent.WorkbenchWindow);
} else {
if (viewcontent.ContentName == null) {
viewcontent.ContentName = System.IO.Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), viewcontent.UntitledName);
}
tsFiles.AppendValues (viewcontent.ContentName, true, viewcontent.WorkbenchWindow);
}
}
if (!topCombineIter.Equals (TreeIter.Zero)) {
if (!tsFiles.IterHasChild (topCombineIter))
tsFiles.Remove (ref topCombineIter);
}
TreeViewColumn mainColumn = new TreeViewColumn ();
mainColumn.Title = "header";
togRender = new CellRendererToggle ();
togRender.Toggled += toggled;
mainColumn.PackStart (togRender, false);
mainColumn.AddAttribute (togRender, "active", 1);
mainColumn.AddAttribute (togRender, "inconsistent", 3);
textRender = new CellRendererText ();
mainColumn.PackStart (textRender, true);
mainColumn.AddAttribute (textRender, "text", 0);
tvFiles.AppendColumn (mainColumn);
tvFiles.HeadersVisible = false;
tvFiles.ExpandAll ();
ScrolledWindow sc = new ScrolledWindow ();
sc.Add (tvFiles);
sc.ShadowType = ShadowType.In;
sc.BorderWidth = 6;
this.VBox.PackStart (sc, true, true, 6);
btnSaveAndQuit = new Button (GettextCatalog.GetString ("_Save and Close"));
btnQuit = new Button (Gtk.Stock.Quit);
btnQuit.Label = GettextCatalog.GetString ("_Close");
btnCancel = new Button (Gtk.Stock.Cancel);
btnSaveAndQuit.Clicked += SaveAndQuit;
btnQuit.Clicked += Quit;
btnCancel.Clicked += Cancel;
this.ActionArea.PackStart (btnCancel);
this.ActionArea.PackStart (btnQuit);
this.ActionArea.PackStart (btnSaveAndQuit);
this.SetDefaultSize (300, 200);
this.Child.ShowAll ();
}
示例3: CreateTree
private TreeView CreateTree ()
{
TreeView view = new TreeView ();
view.Model = FillTree ();
CellRendererText cr = new CellRendererText ();
TreeViewColumn column = new TreeViewColumn ("Widget (double click for demo)", cr, "text", 0);
column.AddAttribute (cr, "style" , 2);
view.AppendColumn (column);
view.Selection.Changed += new EventHandler (TreeChanged);
view.RowActivated += new RowActivatedHandler (RowActivated);
view.ExpandAll ();
view.SetSizeRequest (200, -1);
view.Selection.Mode = Gtk.SelectionMode.Browse;
return view;
}
示例4: DirtyFilesDialog
public DirtyFilesDialog()
: base(GettextCatalog.GetString ("Save Files"), (Gtk.Window)WorkbenchSingleton.Workbench, DialogFlags.Modal)
{
tsFiles = new TreeStore (typeof (string), typeof (bool), typeof (SdiWorkspaceWindow), typeof (bool));
tvFiles = new TreeView (tsFiles);
TreeIter topCombineIter = TreeIter.Zero;
Hashtable projectIters = new Hashtable ();
if (Runtime.ProjectService.CurrentOpenCombine != null) {
topCombineIter = tsFiles.AppendValues (String.Format (GettextCatalog.GetString ("Solution: {0}"), Runtime.ProjectService.CurrentOpenCombine.Name), true, null, false);
}
foreach (IViewContent viewcontent in WorkbenchSingleton.Workbench.ViewContentCollection) {
if (!viewcontent.IsDirty)
continue;
if (viewcontent.HasProject) {
TreeIter projIter = TreeIter.Zero;
if (projectIters.ContainsKey (viewcontent.Project))
projIter = (TreeIter) projectIters[viewcontent.Project];
else {
if (topCombineIter.Equals (TreeIter.Zero))
projIter = tsFiles.AppendValues (String.Format (GettextCatalog.GetString ("Project: {0}"), viewcontent.Project.Name), true, null, false);
else
projIter = tsFiles.AppendValues (topCombineIter, String.Format (GettextCatalog.GetString ("Project: {0}"), viewcontent.Project.Name), true, null, false);
projectIters[viewcontent.Project] = projIter;
}
tsFiles.AppendValues (projIter, viewcontent.PathRelativeToProject, true, viewcontent.WorkbenchWindow);
} else {
if (viewcontent.ContentName == null) {
viewcontent.ContentName = System.IO.Path.Combine (Environment.GetEnvironmentVariable ("HOME"), viewcontent.UntitledName);
}
tsFiles.AppendValues (viewcontent.ContentName, true, viewcontent.WorkbenchWindow);
}
}
if (!topCombineIter.Equals (TreeIter.Zero)) {
if (!tsFiles.IterHasChild (topCombineIter))
tsFiles.Remove (ref topCombineIter);
}
TreeViewColumn mainColumn = new TreeViewColumn ();
mainColumn.Title = "header";
CellRendererToggle togRender = new CellRendererToggle ();
togRender.Toggled += new ToggledHandler (toggled);
mainColumn.PackStart (togRender, false);
mainColumn.AddAttribute (togRender, "active", 1);
mainColumn.AddAttribute (togRender, "inconsistent", 3);
CellRendererText textRender = new CellRendererText ();
mainColumn.PackStart (textRender, true);
mainColumn.AddAttribute (textRender, "text", 0);
tvFiles.AppendColumn (mainColumn);
tvFiles.HeadersVisible = false;
tvFiles.ExpandAll ();
ScrolledWindow sc = new ScrolledWindow ();
sc.Add (tvFiles);
sc.ShadowType = ShadowType.In;
sc.BorderWidth = 6;
this.VBox.PackStart (sc, true, true, 6);
btnSaveAndQuit = new Button (GettextCatalog.GetString ("_Save and Quit"));
btnQuit = new Button (Gtk.Stock.Quit);
btnCancel = new Button (Gtk.Stock.Cancel);
btnSaveAndQuit.Clicked += new EventHandler (SaveAndQuit);
btnQuit.Clicked += new EventHandler (Quit);
btnCancel.Clicked += new EventHandler (Cancel);
this.ActionArea.PackStart (btnCancel);
this.ActionArea.PackStart (btnQuit);
this.ActionArea.PackStart (btnSaveAndQuit);
this.SetDefaultSize (300, 200);
this.ShowAll ();
}
示例5: AddinView
public AddinView()
{
var hbox = new HBox () { Spacing = 6 };
var filter_label = new Label (Catalog.GetString ("Show:"));
var filter_combo = new ComboBoxText ();
filter_combo.AppendText (Catalog.GetString ("All"));
filter_combo.AppendText (Catalog.GetString ("Enabled"));
filter_combo.AppendText (Catalog.GetString ("Not Enabled"));
filter_combo.Active = 0;
var search_label = new Label (Catalog.GetString ("Search:"));
var search_entry = new Banshee.Widgets.SearchEntry () {
WidthRequest = 160,
Visible = true,
Ready = true
};
hbox.PackStart (filter_label, false, false, 0);
hbox.PackStart (filter_combo, false, false, 0);
hbox.PackEnd (search_entry, false, false, 0);
hbox.PackEnd (search_label, false, false, 0);
var model = new TreeStore (typeof(bool), typeof(bool), typeof (string), typeof (Addin));
var addins = AddinManager.Registry.GetAddins ().Where (a => { return
a.Name != a.Id && a.Description != null &&
!String.IsNullOrEmpty (a.Description.Category) && !a.Description.Category.StartsWith ("required:") &&
(!a.Description.Category.Contains ("Debug") || ApplicationContext.Debugging);
});
var categorized_addins = addins.GroupBy<Addin, string> (a => a.Description.Category)
.Select (c => new {
Addins = c.OrderBy (a => Catalog.GetString (a.Name)).ToList (),
Name = c.Key,
NameLocalized = Catalog.GetString (c.Key) })
.OrderBy (c => c.NameLocalized)
.ToList ();
tree_view = new TreeView () {
FixedHeightMode = false,
HeadersVisible = false,
SearchColumn = 1,
RulesHint = true,
Model = model
};
var update_model = new System.Action (() => {
string search = search_entry.Query;
bool? enabled = filter_combo.Active > 0 ? (bool?) (filter_combo.Active == 1 ? true : false) : null;
model.Clear ();
foreach (var cat in categorized_addins) {
var cat_iter = model.AppendValues (false, false, String.Format ("<b>{0}</b>", GLib.Markup.EscapeText (cat.NameLocalized)), null);
bool any = false;
foreach (var a in cat.Addins.Matching (search)) {
if (enabled == null || (a.Enabled == enabled.Value)) {
model.AppendValues (cat_iter, true,
a.Enabled,
String.Format (
"<b>{0}</b>\n<small>{1}</small>",
GLib.Markup.EscapeText (Catalog.GetString (a.Name)),
GLib.Markup.EscapeText (Catalog.GetString (a.Description.Description))),
a
);
any = true;
}
}
if (!any) {
model.Remove (ref cat_iter);
}
}
tree_view.ExpandAll ();
});
var txt_cell = new CellRendererText () { WrapMode = Pango.WrapMode.Word };
tree_view.AppendColumn ("Name", txt_cell , "markup", Columns.Name);
var check_cell = new CellRendererToggle () { Activatable = true };
tree_view.AppendColumn ("Enable", check_cell, "visible", Columns.IsAddin, "active", Columns.IsEnabled);
check_cell.Toggled += (o, a) => {
TreeIter iter;
if (model.GetIter (out iter, new TreePath (a.Path))) {
var addin = model.GetValue (iter, 3) as Addin;
bool enabled = (bool) model.GetValue (iter, 1);
addin.Enabled = !enabled;
model.SetValue (iter, 1, addin.Enabled);
model.Foreach (delegate (ITreeModel current_model, TreePath path, TreeIter current_iter) {
var an = current_model.GetValue (current_iter, 3) as Addin;
if (an != null) {
current_model.SetValue (current_iter, 1, an.Enabled);
}
return false;
});
}
};
update_model ();
search_entry.Changed += (o, a) => update_model ();
filter_combo.Changed += (o, a) => update_model ();
//.........这里部分代码省略.........
示例6: DemoMain
//.........这里部分代码省略.........
iters [1] = store.AppendNode (iters [0]);
store.SetValues (iters [1], "item 2b", "item 2b (2)");
treeView1 = new Gtk.TreeView (store);
AddTreeViewColumn (treeView1, 0, "column 1");
treeView1.CollapseAll ();
treeView2 = new Gtk.TreeView (store);
AddTreeViewColumn (treeView2, 0, "column 1");
AddTreeViewColumn (treeView2, 1, "column 2");
treeView2.CollapseAll ();
treeView2.Accessible.Name = "treeView2";
tableStore = new Gtk.TreeStore (typeof (string), typeof (string), typeof (string), typeof (string));
iters [0] = tableStore.AppendNode ();
tableStore.SetValues (iters [0], "False", "Alice", "24", "");
iters [0] = tableStore.AppendNode ();
tableStore.SetValues (iters [0], "True", "Bob", "28", "");
dataGridView1 = new Gtk.TreeView (tableStore);
dataGridView1 = new Gtk.TreeView (tableStore);
dataGridView1 = new Gtk.TreeView (tableStore);
AddTreeViewColumn (dataGridView1, 0, "Gender");
AddTreeViewColumn (dataGridView1, 1, "Name");
AddTreeViewColumn (dataGridView1, 2, "Age");
dataGridView1.Accessible.Name = "dataGridView1";
hboxPanel = new Gtk.HBox ();
Gtk.Button btnRemoveTextBox = new Gtk.Button ("Remove");
btnRemoveTextBox.Clicked += RemoveTextBoxClicked;
Gtk.Button btnAddTextBox = new Gtk.Button ("Add");
btnAddTextBox.Clicked += AddTextBoxClicked;
txtCommand = new Gtk.Entry ();
txtCommand.Accessible.Name = "txtCommand";
Gtk.Button btnRun = new Gtk.Button ("Run");
btnRun.Clicked += btnRunClicked;
hboxPanel.Add (btnRemoveTextBox);
hboxPanel.Add (btnAddTextBox);
Gtk.TreeStore treeStore = new Gtk.TreeStore (typeof (string));
Gtk.TreeIter iter = treeStore.AppendNode ();
treeStore.SetValue (iter, 0, "Item 0");
iter = treeStore.AppendNode ();
treeStore.SetValue (iter, 0, "Item 1");
listView1 = new Gtk.TreeView (treeStore);
AddTreeViewColumn (listView1, 0, "items");
listView1.Accessible.Name = "listView1";
listView1.ExpandAll ();
hbox2.Add (button5);
hbox2.Add (checkbox1);
hbox2.Add (checkbox2);
hbox2.Add (button4);
hbox2.Accessible.Name = "groupBox2";
hbox3.Add (button7);
hbox3.Add (button6);
hbox3.Sensitive = false;
hbox3.Accessible.Name = "groupBox3";
hbox.Add (textBox3);
hbox.Add (textBox2);
hbox.Add (textBox1);
hbox.Add (label1);
hbox.Add (button1);
hbox.Add (treeView1);
hbox.Add (treeView2);
hbox.Add (listView1);
hbox.Add (dataGridView1);
hbox.Add (txtCommand);
hbox.Add (btnRun);
hbox.Add (hboxPanel);
hbox.Add (scaleButton1);
Gtk.Menu file = new Gtk.Menu ();
file.Append (new Gtk.MenuItem ("_New"));
file.Append (new Gtk.MenuItem ("_Open"));
file.Append (new Gtk.CheckMenuItem ("Check"));
Gtk.MenuItem fileItem = new Gtk.MenuItem ("File");
fileItem.Submenu = file;
Gtk.Menu edit = new Gtk.Menu ();
edit.Append (new Gtk.MenuItem ("_Undo"));
edit.Append (new Gtk.SeparatorMenuItem ());
edit.Append (new Gtk.MenuItem ("_Cut"));
edit.Append (new Gtk.MenuItem ("Copy"));
edit.Append (new Gtk.MenuItem ("_Paste"));
Gtk.MenuItem editItem = new Gtk.MenuItem ("Edit");
editItem.Submenu = edit;
Gtk.MenuBar menuBar = new Gtk.MenuBar ();
menuBar.Append (fileItem);
menuBar.Append (editItem);
hbox.Add (menuBar);
hbox.Add (new Gtk.SpinButton (0, 100, 1));
hbox.Add (new Gtk.ToggleButton ("ToggleButton"));
Gtk.Adjustment adj = new Gtk.Adjustment (50, 0, 100,
1, 10, 10);
hbox.Add (new Gtk.VScrollbar (adj));
window.Add (hbox);
window.ShowAll ();
}