本文整理汇总了C#中Gtk.TreeView类的典型用法代码示例。如果您正苦于以下问题:C# TreeView类的具体用法?C# TreeView怎么用?C# TreeView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeView类属于Gtk命名空间,在下文中一共展示了TreeView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:34,代码来源:GacReferencePanel.cs
示例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;
}
开发者ID:jrmuizel,项目名称:banshee-unofficial-plugins,代码行数:27,代码来源:ErrorsSource.cs
示例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;
}
开发者ID:langpavel,项目名称:LPS-old,代码行数:7,代码来源:TreeStore.cs
示例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);
}
开发者ID:pacificIT,项目名称:mono-upnp,代码行数:27,代码来源:ContentDirectoryInfo.cs
示例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();
}
开发者ID:MonoBrasil,项目名称:historico,代码行数:35,代码来源:MultiChooserDialog.cs
示例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 ();
}
开发者ID:arkydon,项目名称:gtk-sharp,代码行数:31,代码来源:DemoTreeStore.cs
示例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 ();
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:25,代码来源:EnvVarList.cs
示例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 ();
}
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:34,代码来源:MonodocTreePad.cs
示例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);
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:31,代码来源:TableMappingWidget.cs
示例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 ();
}
开发者ID:mrward,项目名称:test-xwt-memory-leak,代码行数:33,代码来源:SortFuncListViewDialog.cs
示例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;
}
开发者ID:rolandixor,项目名称:Pinta,代码行数:35,代码来源:OpenImagesListWidget.cs
示例12: removeAllColumns
private static void removeAllColumns(TreeView treeView)
{
//vaciar el array
TreeViewColumn[] treeViewColumns = treeView.Columns;
foreach (TreeViewColumn treeViewColumn in treeViewColumns)
treeView.RemoveColumn (treeViewColumn);
}
开发者ID:alvarorovira5,项目名称:ad,代码行数:7,代码来源:TreeViewHelper.cs
示例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);
}
开发者ID:JulianaCFS,项目名称:Proyecto,代码行数:26,代码来源:TreeViewExtension.cs
示例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 ();
}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:33,代码来源:TreeViewDemo.cs
示例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);
}
开发者ID:KevinKelley,项目名称:katahdin,代码行数:30,代码来源:ObjectWindow.cs
示例16: SelectSchemaWidget
public SelectSchemaWidget ()
{
store = new ListStore (typeof (bool), typeof (ISchemaContainer));
list = new TreeView (store);
TreeViewColumn col = new TreeViewColumn ();
CellRendererToggle toggleRenderer = new CellRendererToggle ();
toggleRenderer.Activatable = true;
toggleRenderer.Toggled += new ToggledHandler (ItemToggled);
col.PackStart (toggleRenderer, false);
CellRendererPixbuf pixbufRenderer = new CellRendererPixbuf ();
col.PackStart (pixbufRenderer, false);
CellRendererText textRenderer = new CellRendererText ();
col.PackStart (textRenderer, true);
col.SetCellDataFunc (textRenderer, new CellLayoutDataFunc (TextDataFunc));
col.SetCellDataFunc (pixbufRenderer, new CellLayoutDataFunc (PixbufDataFunc));
list.AppendColumn (col);
list.HeadersVisible = false;
this.Add (list);
}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:26,代码来源:SelectSchemaWidget.cs
示例17: BookmarkOutput
public BookmarkOutput()
{
this.ShadowType = ShadowType.Out;
treeView = new TreeView();
treeView.Selection.Mode = Gtk.SelectionMode.Single;
treeView.Model = outputModel;
FontDescription customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont);
treeView.ModifyFont(customFont);
TreeViewColumn tvcState = new TreeViewColumn (MainClass.Languages.Translate("Line"), new CellRendererText(), "text", 1);
tvcState.MinWidth = 25;
treeView.AppendColumn(tvcState);
TreeViewColumn tvcName = new TreeViewColumn (MainClass.Languages.Translate("file"), new CellRendererText(), "text", 0);
tvcName.MinWidth = 100;
treeView.AppendColumn(tvcName);
TreeViewColumn tvcText = new TreeViewColumn (MainClass.Languages.Translate("name"), new CellRendererText(), "text", 2);
tvcText.MinWidth = 100;
treeView.AppendColumn(tvcText);
treeView.HeadersVisible = true;
treeView.EnableTreeLines = true;
treeView.RowActivated += new RowActivatedHandler(OnRowActivate);
treeView.EnableSearch =false;
treeView.HasFocus = false;
this.Add(treeView);
this.ShowAll();
}
开发者ID:moscrif,项目名称:ide,代码行数:34,代码来源:BookmarkOutput.cs
示例18: GrammarWindow
public GrammarWindow(RuntimeThread runtimeThread) : base("Grammar")
{
runtimeThread.Runtime.Grammar.Trace.PatternDefinedEvent += OnGrammarPatternDefined;
runtimeThread.Runtime.Grammar.Trace.PatternChangedEvent += OnGrammarPatternChanged;
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(Source));
// FIXME - only want to sort top level
//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.RowActivated += OnTreeRowActivated;
view.ButtonPressEvent += OnTreeButtonPress;
scroller.Add(view);
MenuBuilder menuBuilder = new MenuBuilder();
menu = menuBuilder.StartMenu();
menuBuilder.Add("Show source", OnMenuShowSource);
menuBuilder.Add("Show object", OnMenuShowObject);
menu.ShowAll();
}
开发者ID:KevinKelley,项目名称:katahdin,代码行数:35,代码来源:GrammarWindow.cs
示例19: BuildView
private void BuildView ()
{
VBox box = new VBox ();
Add (box);
ScrolledWindow sw = new ScrolledWindow ();
sw.HscrollbarPolicy = PolicyType.Never;
TreeView view = new TreeView ();
view.RowActivated += delegate (object o, RowActivatedArgs args) {
TreeIter iter;
if (store.GetIter (out iter, args.Path)) {
Type type = (Type)store.GetValue (iter, 1);
Window window = (Window)Activator.CreateInstance (type);
window.WindowPosition = WindowPosition.Center;
window.DeleteEvent += delegate { window.Destroy (); };
window.Show ();
}
};
view.Model = store;
view.AppendColumn ("Module", new CellRendererText (), "text", 0);
sw.Add (view);
box.PackStart (sw, true, true, 0);
sw.ShowAll ();
Button button = new Button (Stock.Quit);
button.Clicked += delegate { Destroy (); Application.Quit (); };
box.PackStart (button, false, false, 0);
box.ShowAll ();
}
开发者ID:rubenv,项目名称:tripod,代码行数:32,代码来源:TestModuleRunner.cs
示例20: StackTracePad
public StackTracePad()
{
this.ShadowType = ShadowType.In;
store = new TreeStore (typeof (string));
tree = new TreeView (store);
tree.RulesHint = true;
tree.HeadersVisible = true;
TreeViewColumn FrameCol = new TreeViewColumn ();
CellRenderer FrameRenderer = new CellRendererText ();
FrameCol.Title = "Frame";
FrameCol.PackStart (FrameRenderer, true);
FrameCol.AddAttribute (FrameRenderer, "text", 0);
FrameCol.Resizable = true;
FrameCol.Alignment = 0.0f;
tree.AppendColumn (FrameCol);
Add (tree);
ShowAll ();
Runtime.DebuggingService.PausedEvent += (EventHandler) Runtime.DispatchService.GuiDispatch (new EventHandler (OnPausedEvent));
Runtime.DebuggingService.ResumedEvent += (EventHandler) Runtime.DispatchService.GuiDispatch (new EventHandler (OnResumedEvent));
Runtime.DebuggingService.StoppedEvent += (EventHandler) Runtime.DispatchService.GuiDispatch (new EventHandler (OnStoppedEvent));
}
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:26,代码来源:StackTracePad.cs
注:本文中的Gtk.TreeView类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论