本文整理汇总了C#中Gtk.TreeView类的典型用法代码示例。如果您正苦于以下问题:C# TreeView类的具体用法?C# TreeView怎么用?C# TreeView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeView类属于Gtk命名空间,在下文中一共展示了TreeView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GacReferencePanel
public GacReferencePanel(SelectReferenceDialog selectDialog)
{
this.selectDialog = selectDialog;
store = new TreeStore (typeof (string), typeof (string), typeof(string), typeof(bool), typeof(string));
treeView = new TreeView (store);
TreeViewColumn firstColumn = new TreeViewColumn ();
firstColumn.Title = GettextCatalog.GetString ("Reference Name");
CellRendererToggle tog_render = new CellRendererToggle ();
tog_render.Toggled += new Gtk.ToggledHandler (AddReference);
firstColumn.PackStart (tog_render, false);
firstColumn.AddAttribute (tog_render, "active", 3);
CellRendererText text_render = new CellRendererText ();
firstColumn.PackStart (text_render, true);
firstColumn.AddAttribute (text_render, "text", 0);
treeView.AppendColumn (firstColumn);
treeView.AppendColumn (GettextCatalog.GetString ("Version"), new CellRendererText (), "text", 1);
// FIXME: this seems useless
//treeView.AppendColumn (GettextCatalog.GetString ("Path"), new CellRendererText (), "text", 2);
store.SetSortColumnId (0, SortType.Ascending);
store.SetSortFunc (0, new TreeIterCompareFunc (SortTree));
PrintCache();
ScrolledWindow sc = new ScrolledWindow ();
sc.ShadowType = Gtk.ShadowType.In;
sc.Add (treeView);
this.PackStart (sc, true, true, 0);
ShowAll ();
BorderWidth = 6;
}
示例2: ErrorsSource
public ErrorsSource(string name, Source source)
: base(name, 50)
{
this.source = source;
this.source.AddChildSource (this);
scrolled_window = new ScrolledWindow();
scrolled_window.ShadowType = ShadowType.In;
scrolled_window.VscrollbarPolicy = PolicyType.Automatic;
scrolled_window.HscrollbarPolicy = PolicyType.Automatic;
view = new TreeView();
scrolled_window.Add(view);
scrolled_window.ShowAll();
TreeViewColumn message_col = view.AppendColumn(Catalog.GetString("Message"),
new CellRendererText(), "text", 0);
TreeViewColumn file_col = view.AppendColumn(Catalog.GetString("File Name"),
new CellRendererText(), "text", 1);
message_col.Resizable = true;
file_col.Resizable = true;
store = new ListStore(typeof(string), typeof(string), typeof(Exception));
view.Model = store;
}
示例3: GetIter
public TreeIter GetIter(TreeView view, TreePath path)
{
TreeIter iter;
if(!GetIter(out iter, path))
throw new InvalidOperationException("Cesta ve stromu není platná");
return iter;
}
示例4: ContentDirectoryInfo
public ContentDirectoryInfo (RemoteContentDirectory contentDirectory)
{
if (contentDirectory == null) {
throw new ArgumentNullException ("contentDirectory");
}
this.content_directry = contentDirectory;
this.store = new TreeStore (typeof (ObjectRow));
var objects = new TreeView ();
var column = new TreeViewColumn ();
var cell = new CellRendererText ();
column.PackStart (cell, true);
column.SetCellDataFunc (cell, RenderObject);
column.Title = "Objects";
objects.AppendColumn (column);
objects.Selection.Changed += HandleObjectsSelectionChanged;
objects.RowExpanded += HandleObjectsRowExpanded;
objects.Model = store;
var root = contentDirectory.GetRootObject ();
store.AppendValues (new ObjectRow (root));
TreeIter iter;
store.GetIterFirst (out iter);
store.AppendValues (iter, loading);
Add (objects);
}
示例5: MultiChooserDialog
public MultiChooserDialog(IList options, IList banned)
{
base.Modal = true;
base.HeightRequest = 400;
base.WidthRequest = 250;
//TODO: i18n
base.Title = GettextCatalog.GetString ("Choose elements");
base.AddButton(GettextCatalog.GetString ("_Cancel"), Gtk.ResponseType.Cancel);
base.AddButton(GettextCatalog.GetString ("_Accept"), Gtk.ResponseType.Accept);
base.Response += new Gtk.ResponseHandler(OnResponse);
TreeView treeView = new TreeView();
treeView.HeadersVisible = false;
_store = new ListStore(typeof(bool), typeof(string));
treeView.Model = _store;
CellRendererToggle crtgl = new CellRendererToggle();
crtgl.Activatable = true;
crtgl.Toggled += new ToggledHandler(CheckboxToggledHandler);
TreeViewColumn column = new TreeViewColumn ();
column.PackStart(crtgl, false);
column.AddAttribute(crtgl, "active", 0);
treeView.AppendColumn(column);
CellRendererText crtxt = new CellRendererText ();
column = new TreeViewColumn ();
column.PackStart(crtxt, false);
column.AddAttribute(crtxt, "text", 1);
treeView.AppendColumn(column);
Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
sw.ShadowType = Gtk.ShadowType.In;
sw.Add(treeView);
treeView.Show();
base.VBox.Add(sw);
ShowList(options, banned);
sw.Show();
}
示例6: DemoTreeStore
public DemoTreeStore () : base ("Card planning sheet")
{
VBox vbox = new VBox (false, 8);
vbox.BorderWidth = 8;
Add (vbox);
vbox.PackStart (new Label ("Jonathan's Holiday Card Planning Sheet"),
false, false, 0);
ScrolledWindow sw = new ScrolledWindow ();
sw.ShadowType = ShadowType.EtchedIn;
sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
vbox.PackStart (sw, true, true, 0);
// create model
CreateModel ();
// create tree view
TreeView treeView = new TreeView (store);
treeView.RulesHint = true;
treeView.Selection.Mode = SelectionMode.Multiple;
AddColumns (treeView);
sw.Add (treeView);
// expand all rows after the treeview widget has been realized
treeView.Realized += new EventHandler (ExpandRows);
SetDefaultSize (650, 400);
ShowAll ();
}
示例7: EnvVarList
public EnvVarList()
{
list = new TreeView ();
store = new ListStore (typeof(string), typeof(string), typeof(bool), typeof(string));
list.Model = store;
Add (list);
CellRendererText crt = new CellRendererText ();
crt.Editable = true;
TreeViewColumn col = list.AppendColumn (GettextCatalog.GetString ("Variable"), crt, "text", 0, "foreground", 3);
col.Resizable = true;
CellRendererText crv = new CellRendererText ();
col = list.AppendColumn (GettextCatalog.GetString ("Value"), crv, "text", 1, "editable", 2);
col.Resizable = true;
crt.Edited += OnExpEdited;
crt.EditingStarted += OnExpEditing;
crv.Edited += OnValEdited;
createMsg = GettextCatalog.GetString ("Click here to add a new variable");
AppendInserter ();
ShowAll ();
}
示例8: HelpTree
public HelpTree()
: base(GettextCatalog.GetString ("Help"), Gtk.Stock.Help)
{
tree_view = new TreeView ();
tree_view.AppendColumn ("name_col", new CellRendererText (), "text", 0);
tree_view.RowExpanded += new Gtk.RowExpandedHandler (RowExpanded);
tree_view.Selection.Changed += new EventHandler (RowActivated);
store = new TreeStore (typeof (string), typeof (Node));
root_iter = store.AppendValues (GettextCatalog.GetString ("Mono Documentation"), Runtime.Documentation.HelpTree);
PopulateNode (root_iter);
tree_view.Model = store;
tree_view.HeadersVisible = false;
scroller = new ScrolledWindow ();
scroller.ShadowType = Gtk.ShadowType.In;
scroller.Add (tree_view);
tree_view.ExpandRow (new TreePath ("0"), false);
TreeIter child_iter;
start:
store.IterChildren (out child_iter, root_iter);
do {
if (!store.IterHasChild (child_iter)) {
store.Remove (ref child_iter);
goto start;
}
} while (store.IterNext (ref child_iter));
Control.ShowAll ();
}
示例9: TableMappingWidget
public TableMappingWidget (bool showCheckBoxes)
{
store = new ListStore (typeof (bool), typeof (TableContainer));
list = new TreeView (store);
TreeViewColumn colName = new TreeViewColumn ();
colName.Title = AddinCatalog.GetString ("Name");
CellRendererToggle toggleRenderer = new CellRendererToggle ();
toggleRenderer.Activatable = true;
toggleRenderer.Toggled += new ToggledHandler (SelectToggled);
colName.PackStart (toggleRenderer, false);
CellRendererText nameRenderer = new CellRendererText ();
colName.PackStart (nameRenderer, true);
TreeViewColumn colClassName = new TreeViewColumn ();
colClassName.Title = AddinCatalog.GetString ("Class Name");
CellRendererText propNameRenderer = new CellRendererText ();
propNameRenderer.Editable = true;
propNameRenderer.Edited += new EditedHandler (ClassNameEdited);
colClassName.PackStart (propNameRenderer, true);
colName.SetCellDataFunc (nameRenderer, new CellLayoutDataFunc (NameDataFunc));
colClassName.SetCellDataFunc (propNameRenderer, new CellLayoutDataFunc (ClassNameDataFunc));
list.AppendColumn (colName);
list.AppendColumn (colClassName);
list.HeadersVisible = true;
this.Add (list);
}
示例10: SortFuncListViewDialog
public SortFuncListViewDialog ()
{
Title = "Gtk Sort Func List View Box Dialog";
WidthRequest = 500;
HeightRequest = 400;
var vbox = new HBox ();
VBox.PackStart (vbox);
listView = new TreeView ();
listView.HeadersVisible = false;
vbox.PackStart (listView);
listStore = new ListStore (typeof(SortedListViewItem));
listView.Model = listStore;
// listStore.SetSortFunc (0,
// (model, a, b) => string.Compare (GetItem (a).Id, GetItem (b).Id, StringComparison.Ordinal));
listStore.SetSortFunc (0, SortListItems);
listStore.SetSortColumnId (0, SortType.Ascending);
// var textRenderer = new CellRendererText ();
// listView.AppendColumn ("id", textRenderer,
// (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) => {
// ((CellRendererText)cell).Text = GetItem (iter).Id;
// }
// );
AddItems ();
ShowAll ();
}
示例11: OpenImagesListWidget
public OpenImagesListWidget()
{
CanFocus = false;
SetSizeRequest (200, 200);
SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
tree = new TreeView ();
tree.HeadersVisible = false;
tree.EnableGridLines = TreeViewGridLines.None;
tree.Selection.Mode = SelectionMode.Single;
tree.Selection.SelectFunction = HandleDocumentSelected;
file_name_column = new TreeViewColumn ();
CellRendererText file_name_cell = new CellRendererText ();
file_name_column.PackStart (file_name_cell, true);
file_name_column.AddAttribute (file_name_cell, "text", 0);
file_close_cell = new CellRendererPixbuf ();
file_name_column.PackStart (file_close_cell, false);
file_name_column.AddAttribute (file_close_cell, "pixbuf", 1);
tree.AppendColumn (file_name_column);
store = new ListStore (typeof (string), typeof (Gdk.Pixbuf));
tree.Model = store;
tree.ButtonPressEvent += HandleTreeButtonPressEvent;
Add (tree);
ShowAll ();
PintaCore.Workspace.DocumentOpened += HandleDocumentOpenedOrClosed;
PintaCore.Workspace.DocumentClosed += HandleDocumentOpenedOrClosed;
PintaCore.Workspace.DocumentCreated += HandleDocumentOpenedOrClosed;
PintaCore.Workspace.ActiveDocumentChanged += HandleActiveDocumentChanged;
}
示例12: removeAllColumns
private static void removeAllColumns(TreeView treeView)
{
//vaciar el array
TreeViewColumn[] treeViewColumns = treeView.Columns;
foreach (TreeViewColumn treeViewColumn in treeViewColumns)
treeView.RemoveColumn (treeViewColumn);
}
示例13: AppendColumns
public void AppendColumns(TreeView treeView, IDataReader dataReader)
{
for (int index = 0; index < dataReader.FieldCount; index++)
{
//Console.WriteLine("el indice es: {0}", index);
treeView.AppendColumn (dataReader.GetName (index), new CellRendererText(), "text", index);
//treeView.AppendColumn ("columna1", new CellRendererText(), "text",index);
}
//Añadimos la columna de la cantidad porque en la BBDD no tenemos este campo.
TreeViewColumn cantidad = new TreeViewColumn();
cantidad.Title = "Cantidad";
CellRendererText cant = new CellRendererText();
cantidad.PackStart(cant, true);
cantidad.AddAttribute(cant,"text",4);
//para mostrar las imágenes
//CellRendererPixbuf cellRendererPixbuf = new CellRendererPixbuf();
//prueba para cambiar tamaño letra
cantidad.Sizing = TreeViewColumnSizing.Fixed;
cantidad.FixedWidth = 200;
treeView.AppendColumn(cantidad);
}
示例14: TreeViewDemo
public TreeViewDemo ()
{
DateTime start = DateTime.Now;
Application.Init ();
PopulateStore ();
Window win = new Window ("TreeView demo");
win.DeleteEvent += new DeleteEventHandler (DeleteCB);
win.SetDefaultSize (640,480);
ScrolledWindow sw = new ScrolledWindow ();
win.Add (sw);
TreeView tv = new TreeView (store);
tv.HeadersVisible = true;
tv.EnableSearch = false;
tv.AppendColumn ("Name", new CellRendererText (), "text", 0);
tv.AppendColumn ("Type", new CellRendererText (), "text", 1);
sw.Add (tv);
dialog.Destroy ();
dialog = null;
win.ShowAll ();
Console.WriteLine (count + " nodes added.");
Console.WriteLine ("Startup time: " + DateTime.Now.Subtract (start));
Application.Run ();
}
示例15: ObjectWindow
public ObjectWindow(RuntimeThread runtimeThread, object root)
: base(GetTitle(root))
{
SetDefaultSize(250, 300);
SkipPagerHint = true;
SkipTaskbarHint = true;
scroller = new ScrolledWindow();
scroller.BorderWidth = 5;
scroller.ShadowType = ShadowType.In;
Add(scroller);
store = new TreeStore(typeof(string), typeof(object), typeof(bool));
//TreeModelSort storeSort = new TreeModelSort(store);
//storeSort.SetSortColumnId(0, SortType.Ascending);
view = new TreeView(store);
view.AppendColumn(null, new CellRendererText(), "text", VALUE_TEXT);
view.HeadersVisible = false;
view.RowExpanded += OnTreeRowExpanded;
view.RowCollapsed += OnTreeRowCollapsed;
scroller.Add(view);
Add(false, new TreeIter(), "", root, false, false);
TreeIter first;
store.GetIterFirst(out first);
view.ExpandRow(store.GetPath(first), false);
}