本文整理汇总了C#中Gtk.CellRenderer类的典型用法代码示例。如果您正苦于以下问题:C# CellRenderer类的具体用法?C# CellRenderer怎么用?C# CellRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CellRenderer类属于Gtk命名空间,在下文中一共展示了CellRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
}
示例4: AlbumCellDataFunc
private void AlbumCellDataFunc(TreeViewColumn column,
CellRenderer renderer,
TreeModel model,
TreeIter iter)
{
MusicStoreTrackInfo track = (MusicStoreTrackInfo) model.GetValue (iter, 0);
((CellRendererText)renderer).Text = track.Album;
}
示例5: 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;
}
示例6: 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);
}
示例7: 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);
}
}
示例8: 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;
}
示例9: AppendColumn
public TreeViewColumn AppendColumn(string title, CellRenderer cell, CellLayoutDataFunc cell_data)
{
Gtk.TreeViewColumn col = new Gtk.TreeViewColumn ();
col.Title = title;
col.PackStart (cell, true);
col.SetCellDataFunc (cell, cell_data);
AppendColumn (col);
return col;
}
示例10: SetAttributes
public void SetAttributes (CellRenderer cell, params object[] attrs)
{
if (attrs.Length % 2 != 0)
throw new ArgumentException ("attrs should contain pairs of attribute/col");
ClearAttributes (cell);
for (int i = 0; i < attrs.Length - 1; i += 2) {
AddAttribute (cell, (string) attrs [i], (int) attrs [i + 1]);
}
}
示例11: SetCellDataFunc
public void SetCellDataFunc (CellRenderer cell_renderer, NodeCellDataFunc func)
{
if (func == null) {
gtk_tree_view_column_set_cell_data_func (Handle, cell_renderer == null ? IntPtr.Zero : cell_renderer.Handle, (GtkSharp.TreeCellDataFuncNative) null, IntPtr.Zero, null);
return;
}
NodeCellDataFuncWrapper func_wrapper = new NodeCellDataFuncWrapper (func);
GCHandle gch = GCHandle.Alloc (func_wrapper);
gtk_cell_layout_set_cell_data_func (Handle, cell_renderer == null ? IntPtr.Zero : cell_renderer.Handle, func_wrapper.NativeDelegate, (IntPtr) gch, GLib.DestroyHelper.NotifyHandler);
}
示例12: 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 = "";
}
示例13: LocalizationColumn
public LocalizationColumn(bool editable = false)
: base()
{
CellRendererText textRenderer = new CellRendererText () { Editable = editable };
textRenderer.Edited += (_, args) => this.Edited (this, new ResourceEditedEventArgs () {
Path = args.Path,
NextText = args.NewText
});
m_renderer = textRenderer;
m_columnType = typeof(string);
this.PackStart (m_renderer, true);
}
示例14: CreateTreeViewColumn
public static TreeViewColumn CreateTreeViewColumn (string title, int width, CellRenderer cell, TreeCellDataFunc dataFunction) {
cell.Xalign = 0.5f;
cell.Yalign = 0;
TreeViewColumn column = new TreeViewColumn();
column.Alignment = 0.5f;
column.Title = title;
if (width != -1) {
column.FixedWidth = width;
column.Sizing = TreeViewColumnSizing.Fixed;
}
column.Resizable = true;
column.PackStart(cell, true);
column.SetCellDataFunc(cell, dataFunction);
return column;
}
示例15: CellDataHandler
public static void CellDataHandler (CellLayout layout, CellRenderer cell, TreeModel model, TreeIter iter)
{
SourceRowRenderer renderer = cell as SourceRowRenderer;
Source source = model.GetValue (iter, 0) as Source;
if (renderer == null) {
return;
}
renderer.Source = source;
renderer.Iter = iter;
if (source == null) {
return;
}
renderer.Text = source.Name;
renderer.Sensitive = source.CanActivate;
}