本文整理汇总了C#中TreeModel类的典型用法代码示例。如果您正苦于以下问题:C# TreeModel类的具体用法?C# TreeModel怎么用?C# TreeModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeModel类属于命名空间,在下文中一共展示了TreeModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMatchSelected
protected override bool OnMatchSelected (TreeModel filter, TreeIter iter){
Entry entry = (Entry)Entry;
entry.Text = ((ItemTag)filter.GetValue(iter,0)).Name;
entry.FinishEditing();
entry.RemoveWidget();
return true;
}
示例2: LoadData
public void LoadData(TreeViewBackend treeBackend, TreeModel treeModel, TreeIter iter)
{
this.treeModel = treeModel;
this.iter = iter;
cellView.Initialize (this);
Visible = cellView.Visible;
}
示例3: TextDataFunc
private void TextDataFunc(CellLayout cell_layout, CellRenderer renderer, TreeModel model, TreeIter iter)
{
CellRendererText textRenderer = (CellRendererText) renderer;
Tilegroup group = (Tilegroup) Model.GetValue(iter, 0);
textRenderer.Text = group.Name;
}
示例4: FilterTasks
/// <summary>
/// Override the default filter mechanism so that we show only
/// completed tasks in this group.
/// </summary>
/// <param name="model">
/// A <see cref="TreeModel"/>
/// </param>
/// <param name="iter">
/// A <see cref="TreeIter"/>
/// </param>
/// <returns>
/// A <see cref="System.Boolean"/>
/// </returns>
protected override bool FilterTasks(TreeModel model, TreeIter iter)
{
// Don't show any task here if showCompletedTasks is false
if (!showCompletedTasks)
return false;
ITask task = model.GetValue (iter, 0) as ITask;
if (task == null || task.State != TaskState.Completed)
return false;
// Make sure that the task fits into the specified range depending
// on what the user has set the range slider to be.
if (task.CompletionDate < this.timeRangeStart)
return false;
if (task.CompletionDate == DateTime.MinValue)
return true; // Just in case
// Don't show tasks in the completed group that were completed
// today. Tasks completed today should still appear under their
// original group until tomorrow.
DateTime today = DateTime.Now;
if (today.Year == task.CompletionDate.Year
&& today.DayOfYear == task.CompletionDate.DayOfYear)
return false;
return true;
}
示例5: EventsListFromPaths
/// <summary>
/// Fill a list of events from a list of paths, if the first and unique path is an EventType the list
/// is filled with al the child events in this EventType category.
/// </summary>
/// <param name = "model">Model.</param>
/// <param name="events">Events.</param>
/// <param name="paths">Paths.</param>
public static List<TimelineEventLongoMatch> EventsListFromPaths(TreeModel model, TreePath[] paths)
{
List<TimelineEventLongoMatch> events = new List<TimelineEventLongoMatch> ();
// If it's an EventType or a Player, traverse all children to fill the list
if (paths.Length == 1 && !(model.GetValue (paths [0]) is TimelineEventLongoMatch)) {
TreeIter parentIter;
TreeIter child;
bool hasChild;
model.GetIter (out parentIter, paths [0]);
hasChild = model.IterHasChild (parentIter);
model.IterChildren (out child, parentIter);
while (hasChild) {
TimelineEventLongoMatch evt = model.GetValue (child, 0) as TimelineEventLongoMatch;
if (evt != null) {
events.Add (evt);
}
hasChild = model.IterNext (ref child);
}
} else {
foreach (var path in paths) {
TimelineEventLongoMatch evt = model.GetValue (path) as TimelineEventLongoMatch;
if (evt != null) {
events.Add (evt);
}
}
}
return events;
}
示例6: OnPixbufCellLayout
private void OnPixbufCellLayout(CellLayout layout, CellRenderer cell,
TreeModel model, TreeIter iter)
{
CellRendererPixbuf pixbufCell = (cell as CellRendererPixbuf);
IVirtualDevice device = (IVirtualDevice) model.GetValue (iter, 0);
switch (device.DeviceType) {
case VirtualDeviceType.HardDisk:
pixbufCell.Pixbuf = hdPixbuf;
break;
case VirtualDeviceType.CdRom:
pixbufCell.Pixbuf = cdromPixbuf;
break;
case VirtualDeviceType.Ethernet:
pixbufCell.Pixbuf = ethernetPixbuf;
break;
case VirtualDeviceType.Floppy:
pixbufCell.Pixbuf = floppyPixbuf;
break;
default:
pixbufCell.Pixbuf = null;
break;
}
}
示例7: CellDataHandler
public static void CellDataHandler (CellLayout layout, CellRenderer cell, TreeModel model, TreeIter iter)
{
SourceRowRenderer renderer = cell as SourceRowRenderer;
if (renderer == null) {
return;
}
var type = model.GetValue (iter, (int)SourceModel.Columns.Type);
if (type == null || (SourceModel.EntryType) type != SourceModel.EntryType.Source) {
renderer.Visible = false;
return;
}
Source source = model.GetValue (iter, 0) as Source;
renderer.Source = source;
renderer.Iter = iter;
if (source == null) {
return;
}
renderer.Visible = true;
renderer.Text = source.Name;
renderer.Sensitive = source.CanActivate;
}
示例8: GtkTreeModelResult
public GtkTreeModelResult (Widget parent, TreeModel treeModel, int column, TreeIter iter) : base (parent)
{
ParentWidget = parent;
TModel = treeModel;
Column = column;
resultIter = iter;
}
示例9: tree_select
// the treeview is selected
private bool tree_select(TreeSelection selection, TreeModel model, TreePath path, bool selected)
{
if (this != Global.Core.Library.DynamicTree)
Global.Core.Library.DynamicTree.Selection.UnselectAll ();
if (this != Global.Core.Library.FolderTree)
Global.Core.Library.FolderTree.Selection.UnselectAll ();
if (this != Global.Core.Library.PlaylistTree)
Global.Core.Library.PlaylistTree.Selection.UnselectAll ();
//if it isnt already selected
if (!selected)
{
Global.Core.TopBar.SelectedTree = this;
Global.Core.Library.MediaTree.SetFilter (FilterMedia);
Global.Core.Library.MediaTree.Refilter ();
//raise the event
if (TreeSelected != null)
{
TreeIter iter;
if (model.GetIter (out iter, path))
TreeSelected (model, iter);
}
}
return true;
}
示例10: FindBar
/*
* Constructor
*/
public FindBar(PhotoQuery query, TreeModel model)
: base(new HBox())
{
this.query = query;
box = Child as HBox;
box.Spacing = 6;
box.BorderWidth = 2;
box.PackStart (new Label (Catalog.GetString ("Find:")), false, false, 0);
entry = new Entry ();
entry.Completion = new LogicEntryCompletion (entry, model);
entry.TextInserted += HandleEntryTextInserted;
entry.TextDeleted += HandleEntryTextDeleted;
entry.KeyPressEvent += HandleEntryKeyPress;
box.PackStart (entry, true, true, 0);
Button clear_button = new Gtk.Button ();
clear_button.Add (new Gtk.Image ("gtk-close", Gtk.IconSize.Button));
clear_button.Clicked += HandleCloseButtonClicked;
clear_button.Relief = Gtk.ReliefStyle.None;
box.PackStart (clear_button, false, false, 0);
}
示例11: OnMatchSelected
protected override bool OnMatchSelected (TreeModel filter, TreeIter iter){
Location.Item = (Model.Item)filter.GetValue(iter,0);
Entry entry = (Entry)Entry;
entry.FinishEditing();
entry.RemoveWidget();
return true;
}
示例12: AlbumCellDataFunc
private void AlbumCellDataFunc(TreeViewColumn column,
CellRenderer renderer,
TreeModel model,
TreeIter iter)
{
MusicStoreTrackInfo track = (MusicStoreTrackInfo) model.GetValue (iter, 0);
((CellRendererText)renderer).Text = track.Album;
}
示例13: compareLayer
/// <summary> Compare ZPos Values and return which comes first </summary>
public int compareLayer(TreeModel model, TreeIter tia, TreeIter tib)
{
object objA = model.GetValue (tia, 0);
object objB = model.GetValue (tib, 0);
int a = getZPos(objA);
int b = getZPos(objB);
return a.CompareTo(b);
}
示例14: ContentDataFunc
private void ContentDataFunc (CellLayout layout, CellRenderer cell, TreeModel model, TreeIter iter)
{
object dataObject = model.GetValue (iter, columnIndex);
if (dataObject == null)
nullRenderer.SetContent (cell as CellRendererText, dataObject);
else
contentRenderer.SetContent (cell as CellRendererText, dataObject);
}
示例15: ImageDataFunc
static void ImageDataFunc (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
{
var isError = (bool)tree_model.GetValue (iter, 2);
var crpixbuf = (CellRendererPixbuf)cell;
crpixbuf.Visible = isError;
crpixbuf.Pixbuf = isError ? errorPixbuf.Value : null;
}