本文整理汇总了C#中Gtk.CellRendererText类的典型用法代码示例。如果您正苦于以下问题:C# Gtk.CellRendererText类的具体用法?C# Gtk.CellRendererText怎么用?C# Gtk.CellRendererText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Gtk.CellRendererText类属于命名空间,在下文中一共展示了Gtk.CellRendererText类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FlagsSelectorDialog
public FlagsSelectorDialog(Gtk.Window parent, EnumDescriptor enumDesc, uint flags, string title)
{
this.flags = flags;
this.parent = parent;
Glade.XML xml = new Glade.XML (null, "stetic.glade", "FlagsSelectorDialog", null);
xml.Autoconnect (this);
store = new Gtk.ListStore (typeof(bool), typeof(string), typeof(uint));
treeView.Model = store;
Gtk.TreeViewColumn col = new Gtk.TreeViewColumn ();
Gtk.CellRendererToggle tog = new Gtk.CellRendererToggle ();
tog.Toggled += new Gtk.ToggledHandler (OnToggled);
col.PackStart (tog, false);
col.AddAttribute (tog, "active", 0);
Gtk.CellRendererText crt = new Gtk.CellRendererText ();
col.PackStart (crt, true);
col.AddAttribute (crt, "text", 1);
treeView.AppendColumn (col);
foreach (Enum value in enumDesc.Values) {
EnumValue eval = enumDesc[value];
if (eval.Label == "")
continue;
uint val = (uint) (int) eval.Value;
store.AppendValues (((flags & val) != 0), eval.Label, val);
}
}
示例2: NoteEditor
public NoteEditor()
{
this.Build();
var store = new Gtk.ListStore(typeof(string), typeof(string));
store.AppendValues("gtk-edit", "no, you are the fuel");
var column = new Gtk.TreeViewColumn();
var iconRenderer = new Gtk.CellRendererPixbuf();
column.PackStart(iconRenderer, false);
column.AddAttribute(iconRenderer, "stock-id", 0);
var textRenderer = new Gtk.CellRendererText();
column.PackStart(textRenderer, true);
column.AddAttribute(textRenderer, "text", 1);
NoteChildrenTreeView.Model = store;
NoteChildrenTreeView.AppendColumn(column);
// http://www.mono-project.com/GtkSharp_TreeView_Tutorial
// http://afaikblog.files.wordpress.com/2012/05/edit-item1.png
// http://james.newtonking.com/projects/json/help/
// http://mono.1490590.n4.nabble.com/NodeView-TreeView-Image-and-Text-into-the-same-column-td1546566.html
// OKAY, I NEED TO DECIDE HOW I AM GOING TO BIND THINGS
// I definitely want a ViewModel.
}
示例3: BuildTreeColumns
/// <summary>
/// Creates the static columns in the downloader.
/// </summary>
/// TODO: i18n
protected void BuildTreeColumns()
{
// New column for the filename
Gtk.TreeViewColumn filenameColumn = new Gtk.TreeViewColumn ();
filenameColumn.Title = "Filename";
// Set this to be the largest column
filenameColumn.Expand = true;
// The cell that stores the filename
Gtk.CellRendererText filenameCell = new Gtk.CellRendererText ();
// Add the cell to the column and expand
filenameColumn.PackStart (filenameCell, true);
// Let's add a speed column
Gtk.TreeViewColumn speedColumn = new Gtk.TreeViewColumn ();
speedColumn.Title = "Speed";
speedColumn.Expand = true;
Gtk.CellRendererText speedCell = new Gtk.CellRendererText ();
speedColumn.PackStart (speedCell, true);
// Think about additional columns, but avoid redundant infos or
// uninteresting stuff at all cost! Can always be added later if
// it's possible to select wanted columns as in banshee.
// Add all the columns to the tree view.
downloadTree.AppendColumn (filenameColumn);
downloadTree.AppendColumn (speedColumn);
// Tell the cell renderers how to display the model
filenameColumn.AddAttribute (filenameCell, "text", 0);
speedColumn.AddAttribute (speedCell, "text", 1);
}
示例4: SourceCitationList
public SourceCitationList()
{
this.Build();
_listModel = new SourceCitationListModel();
Gtk.TreeViewColumn buttonCol = new Gtk.TreeViewColumn();
GtkCellRendererButton butRend = new GtkCellRendererButton();
butRend.StockId = "gtk-remove";
buttonCol.PackStart(butRend,true);
Gtk.TreeViewColumn citationCountCol = new Gtk.TreeViewColumn();
Gtk.CellRenderer rend = new Gtk.CellRendererText();
citationCountCol.Title = "No.";
citationCountCol.PackStart(rend,true);
citationCountCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderCitationCount));
Gtk.TreeViewColumn citationCol = new Gtk.TreeViewColumn();
rend = new Gtk.CellRendererText();
citationCol.Title = "Text";
citationCol.PackStart(rend,true);
citationCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderSourceCitation));
SourceCitationTreeView.AppendColumn(buttonCol);
SourceCitationTreeView.AppendColumn(citationCountCol);
SourceCitationTreeView.AppendColumn(citationCol);
SourceCitationTreeView.Model = _listModel.Adapter;
Gtk.TreeSelection selection = SourceCitationTreeView.Selection;
selection.Changed += new EventHandler(OnSelection_Changed);
}
示例5: SignalsEditorBackend
public SignalsEditorBackend (SignalsEditorFrontend frontend)
{
this.frontend = frontend;
tree = new Gtk.TreeView ();
store = new Gtk.TreeStore (typeof(string), typeof(string), typeof(bool), typeof(bool), typeof(bool), typeof(int));
tree.Model = store;
tree.RowActivated += new Gtk.RowActivatedHandler (OnRowActivated);
Gtk.CellRendererText crtSignal = new Gtk.CellRendererText ();
Gtk.CellRendererText crtHandler = new Gtk.CellRendererText ();
crtHandler.Editable = true;
crtHandler.Edited += new Gtk.EditedHandler (OnHandlerEdited);
Gtk.CellRendererToggle crtogAfter = new Gtk.CellRendererToggle ();
crtogAfter.Activatable = true;
crtogAfter.Toggled += new Gtk.ToggledHandler (OnAfterToggled);
tree.AppendColumn (Catalog.GetString ("Signal"), crtSignal, "text", ColSignal, "weight", ColSignalTextWeight);
tree.AppendColumn (Catalog.GetString ("Handler"), crtHandler, "markup", ColHandler, "visible", ColIsSignal);
tree.AppendColumn (Catalog.GetString ("After"), crtogAfter, "active", ColAfter, "visible", ColHasHandler);
tree.Columns[0].Resizable = true;
tree.Columns[1].Resizable = true;
tree.Columns[2].Resizable = true;
Add (tree);
ShowAll ();
}
示例6: ComponentList
public ComponentList()
{
this.Build();
this.Name = "Component List";
Gtk.TreeViewColumn componentColumn = new TreeViewColumnLocalized() { Title = "Component", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 200 };
Gtk.TreeViewColumn instanceCountColumn = new TreeViewColumnLocalized() { Title = "Instances", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 50 };
Gtk.TreeViewColumn descriptionColumn = new TreeViewColumnLocalized() { Title = "Description", Sizing = Gtk.TreeViewColumnSizing.Fixed, FixedWidth = 300 };
// Add the columns to the TreeView
treeview1.AppendColumn(instanceCountColumn);
treeview1.AppendColumn(componentColumn);
treeview1.AppendColumn(descriptionColumn);
// Create the text cells that will display the content
Gtk.CellRendererText componentsCell = new Gtk.CellRendererText();
componentColumn.PackStart(componentsCell, true);
Gtk.CellRendererText instanceCountCell = new Gtk.CellRendererText();
instanceCountColumn.PackStart(instanceCountCell, true);
Gtk.CellRendererText descriptionCell = new Gtk.CellRendererText();
descriptionColumn.PackStart(descriptionCell, true);
componentColumn.AddAttribute(componentsCell, "text", TypenameIndex);
instanceCountColumn.AddAttribute(instanceCountCell, "text", InstanceCountIndex);
descriptionColumn.AddAttribute(descriptionCell, "text", DescriptionIndex);
// Create a model that will hold some value, assign the model to the TreeView
listStore = new Gtk.ListStore(typeof(ComponentFactoryInformation), typeof(int), typeof(string), typeof(string));
treeview1.Model = listStore;
treeview1.Selection.Changed += HandleCursorChanged; // do not use treeview1.CursorChanged - see http://ntswiki.nts.neusoft.local/wiki/Known_GTKSharp_Issues
}
示例7: BuildFontFamilyTree
private void BuildFontFamilyTree()
{
// Create a column
Gtk.TreeViewColumn fontNameColumn = new Gtk.TreeViewColumn ();
fontNameColumn.Title = "Font";
// Create the text cell that will display content
Gtk.CellRendererText fontNameCell = new Gtk.CellRendererText ();
// Add the cell to the column
fontNameColumn.PackStart (fontNameCell, false);
// Add the columns to the TreeView
treeFont.AppendColumn (fontNameColumn);
// Create a model
this.fontListStore = new Gtk.ListStore (typeof(string), typeof(Pango.FontFamily));
// Assign the model to the TreeView
treeFont.Model = fontListStore;
fontNameColumn.SetCellDataFunc(fontNameCell, new Gtk.TreeCellDataFunc (RenderCellFamilyName));
treeFont.Selection.Changed += HandleSelectionFontFamily;
LoadFonts();
}
示例8: AddColumn
public static void AddColumn(this Gtk.TreeView self, string name, int index)
{
var nameRenderer = new Gtk.CellRendererText();
var nameColumn = new Gtk.TreeViewColumn(name, nameRenderer);
nameColumn.AddAttribute(nameRenderer, "text", index);
self.AppendColumn(nameColumn);
}
示例9: SourceList
public SourceList()
{
_listModel = new SourceListModel();
this.Build();
Gtk.TreeViewColumn titleCol = new Gtk.TreeViewColumn();
Gtk.CellRenderer rend = new Gtk.CellRendererText();
titleCol.Title = "Title";
titleCol.Sizing = Gtk.TreeViewColumnSizing.Fixed;
titleCol.PackStart(rend,true);
titleCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderSourceTitle));
titleCol.Resizable = true;
rend.Width = 200;
titleCol.MinWidth = 200;
// Gtk.TreeViewColumn dateCol = new Gtk.TreeViewColumn();
// rend = new Gtk.CellRendererText();
// dateCol.Title = "Date";
// dateCol.Sizing = Gtk.TreeViewColumnSizing.Fixed;
// dateCol.PackStart(rend,false);
// dateCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderSourceDate));
// dateCol.MinWidth = 150;
SourceTreeView.AppendColumn(titleCol);
// SourceTreeView.AppendColumn(dateCol);
SourceTreeView.Model = null;
_filterText = string.Empty;
Gtk.TreeSelection selection = SourceTreeView.Selection;
selection.Changed += new EventHandler(OnSelection_Changed);
}
示例10: NotesView
public NotesView()
{
this.Build();
Gtk.TreeViewColumn buttonCol = new Gtk.TreeViewColumn();
GtkCellRendererButton butRend = new GtkCellRendererButton();
butRend.StockId = "gtk-index";
buttonCol.PackStart(butRend,true);
butRend = new GtkCellRendererButton();
butRend.StockId = "gtk-remove";
buttonCol.PackStart(butRend,true);
Gtk.TreeViewColumn noteCountCol = new Gtk.TreeViewColumn();
Gtk.CellRenderer rend = new Gtk.CellRendererText();
noteCountCol.Title = "No.";
noteCountCol.PackStart(rend,true);
noteCountCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderNoteCount));
Gtk.TreeViewColumn noteCol = new Gtk.TreeViewColumn();
rend = new Gtk.CellRendererText();
noteCol.Title = "Text";
noteCol.PackStart(rend,true);
noteCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderNote));
NotesTreeView.AppendColumn(buttonCol);
NotesTreeView.AppendColumn(noteCountCol);
NotesTreeView.AppendColumn(noteCol);
Model = new NoteListModel();
Gtk.TreeSelection selection = NotesTreeView.Selection;
selection.Changed += new EventHandler(OnNoteSelection_Changed);
}
示例11: ChatTreeView
public ChatTreeView()
{
ThemeSettings = new ThemeSettings();
TreeStore = new Gtk.TreeStore(typeof(ChatView));
TreeStore.SetSortColumnId(0, Gtk.SortType.Ascending);
TreeStore.SetSortFunc(0, SortTreeStore);
Model = TreeStore;
HeadersVisible = false;
BorderWidth = 0;
Selection.Mode = Gtk.SelectionMode.Browse;
Selection.Changed += (sender, e) => {
Gtk.TreeIter iter;
if (!Selection.GetSelected(out iter)) {
return;
}
var path = TreeStore.GetPath(iter);
f_CurrentChatNumber = GetRowNumber(path);
};
var iconRenderer = new Gtk.CellRendererPixbuf();
var column = new Gtk.TreeViewColumn(null, iconRenderer);
column.Spacing = 0;
column.Sizing = Gtk.TreeViewColumnSizing.Autosize;
column.SetCellDataFunc(iconRenderer, new Gtk.TreeCellDataFunc(RenderChatViewIcon));
AppendColumn(column);
var cellRenderer = new Gtk.CellRendererText();
column = new Gtk.TreeViewColumn(null, cellRenderer);
column.Spacing = 0;
column.Sizing = Gtk.TreeViewColumnSizing.Autosize;
column.SetCellDataFunc(cellRenderer, new Gtk.TreeCellDataFunc(RenderChatViewName));
AppendColumn(column);
}
示例12: IndividualView
public IndividualView()
{
this.Build();
FactView.EventAdded += new EventHandler(OnFactView_EventAdded);
FactView.EventRemoved += new EventHandler(OnFactView_EventRemoved);
FactView.ShowSourceCitation += new EventHandler<SourceCitationArgs>(OnFactView_ShowSourceCitation);
FactView.ShowScrapBook += new EventHandler<ScrapBookArgs>(OnEventScrapbookButton_Clicked);
Gtk.TreeViewColumn placeCol = new Gtk.TreeViewColumn();
Gtk.CellRenderer rend = new Gtk.CellRendererText();
placeCol.Title = "Place";
placeCol.PackStart(rend,true);
placeCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderEventPlace));
Gtk.TreeViewColumn dateCol = new Gtk.TreeViewColumn();
rend = new Gtk.CellRendererText();
dateCol.Title = "Date";
dateCol.PackStart(rend,true);
dateCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderEventDate));
dateCol.SortColumnId = 0;
MarriageView.ShowScrapBook += new EventHandler<ScrapBookArgs>(OnMarriageScrapbookButton_Clicked);
MarriageView.ShowSourceCitation += new EventHandler<SourceCitationArgs>(OnMarriageSourceButton_Clicked);
MarriageView.MoreFamilyInformation += new EventHandler<FamilyArgs>(OnMarriageMoreButton_Clicked);
Gtk.TreeViewColumn marriageToCol = new Gtk.TreeViewColumn();
rend = new Gtk.CellRendererText();
marriageToCol.Title = "To";
marriageToCol.PackStart(rend,true);
marriageToCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderMarriageTo));
MarriageTreeView.AppendColumn(placeCol);
MarriageTreeView.AppendColumn(dateCol);
MarriageTreeView.AppendColumn(marriageToCol);
MarriageListModel marriageListModel = new MarriageListModel();
MarriageTreeView.Model = marriageListModel;
Gtk.TreeSelection selection = MarriageTreeView.Selection;
selection.Changed += new EventHandler(OnMarriageSelection_Changed);
_parents = new ParentsListModel();
ParentsCombo.ListModel = _parents;
_children = new ChildrenListModel();
ChildrenCombo.ListModel = _children;
_spouses = new SpouseListModel();
SpousesCombo.ListModel = _spouses;
_siblings = new SiblingsListModel();
SiblingsCombo.ListModel = _siblings;
Notebook.Page = 0;
}
示例13: FileList
public FileList()
{
Items = new ArrayList ();
store = new Gtk.ListStore (typeof (string), typeof (string), typeof(string), typeof(FileListItem), typeof (Gdk.Pixbuf));
Model = store;
HeadersVisible = true;
HeadersClickable = true;
Reorderable = true;
RulesHint = true;
Gtk.TreeViewColumn name_column = new Gtk.TreeViewColumn ();
name_column.Title = GettextCatalog.GetString ("Files");
Gtk.TreeViewColumn size_column = new Gtk.TreeViewColumn ();
size_column.Title = GettextCatalog.GetString ("Size");
Gtk.TreeViewColumn modi_column = new Gtk.TreeViewColumn ();
modi_column.Title = GettextCatalog.GetString ("Last modified");
Gtk.CellRendererPixbuf pix_render = new Gtk.CellRendererPixbuf ();
name_column.PackStart (pix_render, false);
name_column.AddAttribute (pix_render, "pixbuf", 4);
Gtk.CellRendererText render1 = new Gtk.CellRendererText ();
name_column.PackStart (render1, false);
name_column.AddAttribute (render1, "text", 0);
Gtk.CellRendererText render2 = new Gtk.CellRendererText ();
size_column.PackStart (render2, false);
size_column.AddAttribute (render2, "text", 1);
Gtk.CellRendererText render3 = new Gtk.CellRendererText ();
modi_column.PackStart (render3, false);
modi_column.AddAttribute (render3, "text", 2);
AppendColumn(name_column);
AppendColumn(size_column);
AppendColumn(modi_column);
this.PopupMenu += new Gtk.PopupMenuHandler (OnPopupMenu);
this.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler (OnButtonReleased);
this.Selection.Changed += new EventHandler (OnSelectionChanged);
watcher = new FileSystemWatcher ();
if(watcher != null) {
watcher.NotifyFilter = NotifyFilters.FileName;
watcher.EnableRaisingEvents = false;
watcher.Renamed += new RenamedEventHandler(fileRenamed);
watcher.Deleted += new FileSystemEventHandler(fileDeleted);
watcher.Created += new FileSystemEventHandler(fileCreated);
watcher.Changed += new FileSystemEventHandler(fileChanged);
}
}
示例14: FactView
public FactView()
{
this.Build();
FactTypeCombo.Clear();
Gtk.CellRendererText rend = new Gtk.CellRendererText();
rend.Ellipsize = Pango.EllipsizeMode.End;
FactTypeCombo.PackStart(rend, true);
FactTypeCombo.SetAttributes(rend, "text", EventModel.Columns.Readable);
Gtk.TreeViewColumn buttonCol = new Gtk.TreeViewColumn();
GtkCellRendererButton butRend = new GtkCellRendererButton();
butRend.StockId = "gtk-index";
buttonCol.PackStart(butRend,true);
butRend = new GtkCellRendererButton();
butRend.StockId = "gtk-remove";
buttonCol.PackStart(butRend,true);
butRend = new GtkCellRendererButton();
butRend.StockId = "gtk-edit";
buttonCol.PackStart(butRend,true);
Gtk.TreeViewColumn nameCol = new Gtk.TreeViewColumn();
rend = new Gtk.CellRendererText();
nameCol.Title = "Type";
nameCol.PackStart(rend,true);
nameCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderEventName));
Gtk.TreeViewColumn dateCol = new Gtk.TreeViewColumn();
rend = new Gtk.CellRendererText();
dateCol.Title = "Date";
dateCol.PackStart(rend,true);
dateCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderEventDate));
dateCol.SortColumnId = 0;
FactsTreeView.AppendColumn(buttonCol);
FactsTreeView.AppendColumn(nameCol);
FactsTreeView.AppendColumn(dateCol);
_eventListModel = new EventListModel();
// we need more complicated filtering than just the event type so
// hookup to the event
_eventListModel.FilterGedcomEvent += new EventHandler<EventListModel.FilterArgs>(FilterEvents);
FactsTreeView.Model = _eventListModel;
Gtk.TreeSelection selection = FactsTreeView.Selection;
selection.Mode = Gtk.SelectionMode.Browse;
selection.Changed += new EventHandler(OnFactSelection_Changed);
_moreInfoArgs = new FactArgs();
}
示例15: ScrapBookView
public ScrapBookView()
{
_recListModel = new MultimediaRecordListModel();
_listModel = new MultimediaFileListModel();
this.Build();
Gtk.TreeViewColumn titleCol = new Gtk.TreeViewColumn();
Gtk.CellRenderer rend = new Gtk.CellRendererText();
titleCol.Title = "Record Title";
titleCol.PackStart(rend,true);
titleCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderMultimediaRecordTitle));
RecordTreeView.AppendColumn(titleCol);
RecordTreeView.Model = null;
Gtk.TreeSelection selection = RecordTreeView.Selection;
selection.Changed += new EventHandler(OnRecordSelection_Changed);
Gtk.TreeViewColumn buttonCol = new Gtk.TreeViewColumn();
GtkCellRendererButton butRend = new GtkCellRendererButton();
butRend.StockId = "gtk-open";
buttonCol.PackStart(butRend,true);
Gtk.TreeViewColumn filenameCol = new Gtk.TreeViewColumn();
rend = new Gtk.CellRendererText();
filenameCol.Title = "Filename";
filenameCol.PackStart(rend,true);
filenameCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderMultimediaFilename));
Gtk.TreeViewColumn typeCol = new Gtk.TreeViewColumn();
rend = new Gtk.CellRendererText();
typeCol.Title = "Type";
typeCol.PackStart(rend,true);
typeCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderMultimediaType));
Gtk.TreeViewColumn formatCol = new Gtk.TreeViewColumn();
rend = new Gtk.CellRendererText();
formatCol.Title = "Format";
formatCol.PackStart(rend,true);
formatCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderMultimediaFormat));
FileTreeView.AppendColumn(buttonCol);
FileTreeView.AppendColumn(filenameCol);
FileTreeView.AppendColumn(typeCol);
FileTreeView.AppendColumn(formatCol);
FileTreeView.Model = null;
selection = FileTreeView.Selection;
selection.Changed += new EventHandler(OnSelection_Changed);
}