本文整理汇总了C#中Gtk.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.GetValue方法的具体用法?C# Gtk.GetValue怎么用?C# Gtk.GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk
的用法示例。
在下文中一共展示了Gtk.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompareCheckNumberFunc
private int CompareCheckNumberFunc(Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b)
{
CheckClass check1 = (CheckClass)model.GetValue (a, 0);
CheckClass check2 = (CheckClass)model.GetValue (b, 0);
return Formatter.NumericStringSort (check1.Number, check2.Number);
}
示例2: ValuePropertyDataFunc
private static void ValuePropertyDataFunc(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
var treeView = (Gtk.TreeView)column.TreeView;
var info = Templating.GetTemplate(treeView) as TreeViewTemplate;
var textCell = (cell as Gtk.CellRendererText);
textCell.Text = string.Empty;
var value = model.GetValue(iter, 0);
if (value == null)
return;
foreach (var rowTemplate in info.RowTemplates) {
if (value.GetType() == rowTemplate.TargetType) {
//Here we have a value, which is the source for Binding, and a BindingInfo that is given by rowTemplate.ColumnBindings[column.Title] .
//The instance of the BindingInfo is shared among all values (rows), since it was defined once in the rowTemplate.
BindingInfo bindingInfo = null;
if (!rowTemplate.ColumnBindings.TryGetValue(column.Title, out bindingInfo))
return;
//The actual binding, on the other hand, is specific to the current (row,column) pair.
Binding binding = BindingEngine.GetOrCreateBinding(treeView, value, new TreeViewIterBindingTarget(treeView, iter, column), bindingInfo);
var propValue = binding.GetSourceValue();
textCell.Text = propValue == null ? String.Empty : propValue.ToString();
return;
}
}
}
示例3: FilterTasks
/// <summary>
/// Filter out tasks that don't fit within the group's date range
/// </summary>
protected virtual bool FilterTasks(Gtk.TreeModel model, Gtk.TreeIter iter)
{
ITask task = model.GetValue (iter, 0) as ITask;
if (task == null || task.State == TaskState.Deleted)
return false;
// Do something special when task.DueDate == DateTime.MinValue since
// these tasks should always be in the very last category.
if (task.DueDate == DateTime.MinValue) {
if (timeRangeEnd == DateTime.MaxValue) {
if (!ShowCompletedTask (task))
return false;
return true;
} else {
return false;
}
}
if (task.DueDate < timeRangeStart || task.DueDate > timeRangeEnd)
return false;
if (!ShowCompletedTask (task))
return false;
return true;
}
示例4: RowSeparatorFunc
bool RowSeparatorFunc (Gtk.TreeModel model, Gtk.TreeIter iter)
{
GLib.Value val = new GLib.Value ();
model.GetValue (iter, 0, ref val);
bool sep = ((string)val) == "";
val.Dispose ();
return sep;
}
示例5: RenderCustomer
static public void RenderCustomer(Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
{
CellRendererText celltxt = (CellRendererText)cell;
SuposDataSet.CustomersRow customer = (SuposDataSet.CustomersRow)tree_model.GetValue(iter, 0);
if (customer != null)
{
celltxt.Markup = "<b>" + customer.Name + "</b>";
}
}
示例6: RenderName
static public void RenderName(Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
{
CellRendererText text = (CellRendererText)cell;
DataRow row = (DataRow)tree_model.GetValue(iter, 0);
if(row != null)
{
text.Text = row["Name"].ToString();
}
}
示例7: RenderBranchNumber
private void RenderBranchNumber(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
CheckClass check = (CheckClass)model.GetValue (iter, 0);
if (check != null) {
if (check.BankNumber != null) {
(cell as Gtk.CellRendererText).Text = check.BranchNumber;
return;
}
}
(cell as Gtk.CellRendererText).Text = "";
}
示例8: RenderTax
static public void RenderTax(Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
{
CellRendererText celltxt = (CellRendererText)cell;
SuposDataSet.TaxesRow tax = (SuposDataSet.TaxesRow)tree_model.GetValue(iter, 0);
if (tax != null)
{
celltxt.Markup = "<b>" + tax.Name + ": </b> " + (tax.Rate*100) + "%";
}
else
celltxt.Markup = "<b>None</b>";
}
示例9: RenderIcon
static public void RenderIcon(Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
{
CellRendererPixbuf pix = (CellRendererPixbuf)cell;
DataRow row = (DataRow)tree_model.GetValue(iter, 0);
if(row != null)
{
byte[] icon = SuposDb.GetMedia( row["icon"].ToString() );
if ( icon != null )
pix.Pixbuf = new Gdk.Pixbuf( icon ).ScaleSimple(iconsize, iconsize, Gdk.InterpType.Bilinear);
else
pix.Pixbuf = null;
}
}
示例10: RenderObject
private void RenderObject(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
object obj = model.GetValue (iter, 1);
Type dossierType = typeof (Dossier);
Type documentType = typeof (Document);
if ( dossierType.IsInstanceOfType(obj) ) {
Dossier dossier = (Dossier) obj;
(cell as Gtk.CellRendererText).Text = dossier.Caption;
} else
if ( documentType.IsInstanceOfType(obj) ) {
Document document = (Document) obj;
(cell as Gtk.CellRendererText).Text = document.Caption;
}
}
示例11: RenderPayment
static public void RenderPayment(Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
{
CellRendererText celltxt = (CellRendererText)cell;
SuposDataSet.PaymentsRow payment = (SuposDataSet.PaymentsRow)tree_model.GetValue(iter, 0);
if (payment != null)
{
celltxt.Markup = "<b>" + payment.Name + "</b>";
celltxt.Sensitive = payment.Allowed;
}
else
{
celltxt.Markup = "<b>None</b>";
celltxt.Sensitive = true;
}
}
示例12: FilterTreeObject
private bool FilterTreeObject(Gtk.TreeModel model, Gtk.TreeIter iter)
{
if (entryObjectSearch.Text == "")
return true;
bool filterName = true;
bool filterAddress = true;
string cellvalue;
if(model.GetValue (iter, 1) == null)
return false;
if (entryObjectSearch.Text != "" && model.GetValue (iter, 1) != null)
{
cellvalue = model.GetValue (iter, 1).ToString();
filterName = cellvalue.IndexOf (entryObjectSearch.Text, StringComparison.CurrentCultureIgnoreCase) > -1;
}
if (entryObjectSearch.Text != "" && model.GetValue (iter, 2) != null)
{
cellvalue = model.GetValue (iter, 2).ToString();
filterAddress = cellvalue.IndexOf (entryObjectSearch.Text, StringComparison.CurrentCultureIgnoreCase) > -1;
}
return (filterName || filterAddress);
}
示例13: RenderCustID
//
// RENDERERS
//
private void RenderCustID(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
CheckClass check = (CheckClass)model.GetValue (iter, 0);
if (check != null) {
if (check.CustomerID != null) {
if (Formatter.IsCPF (check.CustomerID)) {
(cell as Gtk.CellRendererText).Text = Formatter.FormatCPF (check.CustomerID);
return;
} else if (Formatter.IsCNPJ (check.CustomerID)) {
(cell as Gtk.CellRendererText).Text = Formatter.FormatCNPJ (check.CustomerID);
return;
}
}
}
(cell as Gtk.CellRendererText).Text = "";
}
示例14: RenderCell
private void RenderCell(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
//Console.WriteLine("SyncMenuWindow - RenderCell");
SyncMenuItemEntity entity = (SyncMenuItemEntity)model.GetValue(iter, 0);
if (cell is Gtk.CellRendererText)
{
string title = string.Empty;
switch (entity.ItemType)
{
case SyncMenuItemEntityType.Artist:
title = entity.ArtistName;
break;
case SyncMenuItemEntityType.Album:
title = entity.AlbumTitle;
break;
case SyncMenuItemEntityType.Song:
if(entity.Song != null)
title = entity.Song.Title;
break;
}
if(title == "dummy") title = string.Empty;
(cell as Gtk.CellRendererText).Text = title;
}
else if (cell is Gtk.CellRendererPixbuf)
{
var cellPixbuf = (Gtk.CellRendererPixbuf)cell;
Gdk.Pixbuf pixbuf = null;
switch (entity.ItemType)
{
case SyncMenuItemEntityType.Artist:
pixbuf = ResourceHelper.GetEmbeddedImageResource("icon_user.png");
break;
case SyncMenuItemEntityType.Album:
pixbuf = ResourceHelper.GetEmbeddedImageResource("icon_vinyl.png");
break;
case SyncMenuItemEntityType.Song:
pixbuf = ResourceHelper.GetEmbeddedImageResource("icon_song.png");
break;
}
if(pixbuf != null)
cellPixbuf.Pixbuf = pixbuf;
}
}
示例15: RenderIndividualName
public static void RenderIndividualName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
Gtk.CellRendererText rend = (Gtk.CellRendererText)cell;
object o = model.GetValue(iter,0);
Gtk.TreeModelImplementor impl = null;
if (model is Gtk.TreeModelAdapter)
{
impl = ((Gtk.TreeModelAdapter)model).Implementor;
}
if (o is GedcomIndividualRecord)
{
GedcomIndividualRecord indi = o as GedcomIndividualRecord;
if (indi.Names.Count > 0)
{
GedcomName name = indi.GetName();
rend.Text = name.Name;
}
else
{
rend.Text = UnknownName;
}
}
else if (impl is IGedcomIndividualList)
{
IGedcomIndividualList indiList = impl as IGedcomIndividualList;
(cell as Gtk.CellRendererText).Text = indiList.NoIndividualLabel;
}
else if (model is IGedcomIndividualList)
{
IGedcomIndividualList indiList = model as IGedcomIndividualList;
rend.Text = indiList.NoIndividualLabel;
}
else
{
rend.Text = "not set";
}
}