本文整理汇总了C#中TreeModel.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# TreeModel.GetValue方法的具体用法?C# TreeModel.GetValue怎么用?C# TreeModel.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeModel
的用法示例。
在下文中一共展示了TreeModel.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: CompareTagsSortFunc
static int CompareTagsSortFunc (TreeModel model, TreeIter a, TreeIter b)
{
Tag tag_a = model.GetValue (a, 0) as Tag;
Tag tag_b = model.GetValue (b, 0) as Tag;
if (tag_a == null || tag_b == null)
return 0;
return string.Compare (tag_a.NormalizedName, tag_b.NormalizedName);
}
示例4: ProfileNameDataFunc
public static void ProfileNameDataFunc (CellLayout layout, CellRenderer renderer, TreeModel model, TreeIter iter)
{
if (model.GetValue (iter, 0) != null) {
Cms.Profile profile = (Cms.Profile) model.GetValue (iter, 0);
if (profile.ProductName.Length < NameLenth)
(renderer as Gtk.CellRendererText).Text = profile.ProductName;
else
(renderer as Gtk.CellRendererText).Text = profile.ProductName.Substring(0, NameLenth) + "...";
}
else
(renderer as Gtk.CellRendererText).Text = "";
}
示例5: GetActionByAccel
private bool GetActionByAccel(TreeModel model, TreePath path, TreeIter iter, uint accelKey, Gdk.ModifierType accelMods)
{
var rowAccelKey = (uint)model.GetValue(iter, (int)Column.AccelKey);
var rowAccelMods = (Gdk.ModifierType)model.GetValue(iter, (int)Column.AccelMods);
if (rowAccelKey == accelKey && rowAccelMods == accelMods)
{
this.actionConflict = (string)model.GetValue(iter, (int)Column.Action);
return true;
}
return false;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
}
示例9: 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;
}
示例10: AlbumCellDataFunc
private void AlbumCellDataFunc(TreeViewColumn column,
CellRenderer renderer,
TreeModel model,
TreeIter iter)
{
MusicStoreTrackInfo track = (MusicStoreTrackInfo) model.GetValue (iter, 0);
((CellRendererText)renderer).Text = track.Album;
}
示例11: 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);
}
示例12: 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;
}
示例13: RenderCoverage
public static void RenderCoverage (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter)
{
var txt = cell as CellRendererText;
CodeRecord rc = (CodeRecord)model.GetValue (iter, 0);
if (txt != null) {
txt.Foreground = CellColor (rc.Coverage);
txt.Text = String.Format ("{0:00.0}%", rc.Coverage * 100.0);
}
}
示例14: RenderFont
private void RenderFont (CellLayout layout, CellRenderer renderer, TreeModel model, TreeIter iter)
{
string fontName = (string)model.GetValue (iter, 0);
CellRendererText cell = renderer as CellRendererText;
cell.Text = fontName;
cell.Font = string.Format ("{0} 10", fontName);
cell.Family = fontName;
}
示例15: CheckForText
bool CheckForText (TreeModel model, TreeIter iter, bool exact)
{
string modelText = model.GetValue (iter, Column) as string;
if (modelText == null) {
return false;
}
if (exact) {
return modelText == DesiredText;
} else {
return (modelText.IndexOf (DesiredText) > -1);
}
}