本文整理汇总了C#中Gtk.TreeViewColumn.SetAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# TreeViewColumn.SetAttributes方法的具体用法?C# TreeViewColumn.SetAttributes怎么用?C# TreeViewColumn.SetAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TreeViewColumn
的用法示例。
在下文中一共展示了TreeViewColumn.SetAttributes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DemoStockBrowser
public DemoStockBrowser () : base ("Stock Icons and Items")
{
SetDefaultSize (-1, 500);
BorderWidth = 8;
HBox hbox = new HBox (false, 8);
Add (hbox);
ScrolledWindow sw = new ScrolledWindow ();
sw.SetPolicy (PolicyType.Never, PolicyType.Automatic);
hbox.PackStart (sw, false, false, 0);
ListStore model = CreateModel ();
TreeView treeview = new TreeView (model);
sw.Add (treeview);
TreeViewColumn column = new TreeViewColumn ();
column.Title = "Name";
CellRenderer renderer = new CellRendererPixbuf ();
column.PackStart (renderer, false);
column.SetAttributes (renderer, "stock_id", Column.Id);
renderer = new CellRendererText ();
column.PackStart (renderer, true);
column.SetAttributes (renderer, "text", Column.Name);
treeview.AppendColumn (column);
treeview.AppendColumn ("Label", new CellRendererText (), "text", Column.Label);
treeview.AppendColumn ("Accel", new CellRendererText (), "text", Column.Accel);
treeview.AppendColumn ("ID", new CellRendererText (), "text", Column.Id);
Alignment align = new Alignment (0.5f, 0.0f, 0.0f, 0.0f);
hbox.PackEnd (align, false, false, 0);
Frame frame = new Frame ("Selected Item");
align.Add (frame);
VBox vbox = new VBox (false, 8);
vbox.BorderWidth = 8;
frame.Add (vbox);
typeLabel = new Label ();
vbox.PackStart (typeLabel, false, false, 0);
iconImage = new Gtk.Image ();
vbox.PackStart (iconImage, false, false, 0);
accelLabel = new Label ();
vbox.PackStart (accelLabel, false, false, 0);
nameLabel = new Label ();
vbox.PackStart (nameLabel, false, false, 0);
idLabel = new Label ();
vbox.PackStart (idLabel, false, false, 0);
treeview.Selection.Mode = Gtk.SelectionMode.Single;
treeview.Selection.Changed += new EventHandler (SelectionChanged);
ShowAll ();
}
示例2: appendColumns
/// <summary>
/// Appends the columns.
/// </summary>
public void appendColumns()
{
try {
try {
for (int i = 0; i < treeview1.Columns.Length; i++)
treeview1.RemoveColumn (treeview1.Columns [i]);
} catch {
}
g_regexList = new ListStore (typeof(string), typeof(string));
TreeViewColumn ausdruck = new TreeViewColumn ();
ausdruck.Title = "Ausdruck";
ausdruck.PackStart (new CellRendererText (), true);
ausdruck.SetAttributes (ausdruck.CellRenderers [0], "text", 0);
TreeViewColumn datum = new TreeViewColumn ();
datum.Title = "Datum";
datum.PackStart (new CellRendererText (), true);
datum.SetAttributes (datum.CellRenderers [0], "text", 1);
treeview1.Model = g_regexList;
treeview1.AppendColumn (ausdruck);
treeview1.AppendColumn (datum);
} catch (Exception ex) {
MessageBox.Show (ex.Message, cTerminus.g_programName, ButtonsType.Close, MessageType.Error);
}
}
示例3: RefactoringPreviewDialog
public RefactoringPreviewDialog (ProjectDom ctx, List<Change> changes)
{
this.Build ();
this.changes = changes;
treeviewPreview.Model = store;
TreeViewColumn column = new TreeViewColumn ();
// pixbuf column
var pixbufCellRenderer = new CellRendererPixbuf ();
column.PackStart (pixbufCellRenderer, false);
column.SetAttributes (pixbufCellRenderer, "pixbuf", pixbufColumn);
column.AddAttribute (pixbufCellRenderer, "visible", statusVisibleColumn);
// text column
CellRendererText cellRendererText = new CellRendererText ();
column.PackStart (cellRendererText, false);
column.SetAttributes (cellRendererText, "text", textColumn);
column.AddAttribute (cellRendererText, "visible", statusVisibleColumn);
// location column
CellRendererText cellRendererText2 = new CellRendererText ();
column.PackStart (cellRendererText2, false);
column.SetCellDataFunc (cellRendererText2, new TreeCellDataFunc (SetLocationTextData));
CellRendererDiff cellRendererDiff = new CellRendererDiff ();
column.PackStart (cellRendererDiff, true);
column.SetCellDataFunc (cellRendererDiff, new TreeCellDataFunc (SetDiffCellData));
treeviewPreview.AppendColumn (column);
treeviewPreview.HeadersVisible = false;
buttonCancel.Clicked += delegate {
Destroy ();
};
buttonOk.Clicked += delegate {
IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetBackgroundProgressMonitor (this.Title, null);
RefactoringService.AcceptChanges (monitor, ctx, changes);
Destroy ();
};
FillChanges ();
Resize (IdeApp.Workbench.ActiveDocument.ActiveView.Control.Allocation.Width,
IdeApp.Workbench.ActiveDocument.ActiveView.Control.Allocation.Height);
}
示例4: RefactoringPreviewDialog
public RefactoringPreviewDialog (IList<Change> changes)
{
this.Build ();
this.changes = changes;
treeviewPreview.Model = store;
treeviewPreview.SearchColumn = -1; // disable the interactive search
TreeViewColumn column = new TreeViewColumn ();
// pixbuf column
var pixbufCellRenderer = new CellRendererImage ();
column.PackStart (pixbufCellRenderer, false);
column.SetAttributes (pixbufCellRenderer, "image", pixbufColumn);
column.AddAttribute (pixbufCellRenderer, "visible", statusVisibleColumn);
// text column
CellRendererText cellRendererText = new CellRendererText ();
column.PackStart (cellRendererText, false);
column.SetAttributes (cellRendererText, "text", textColumn);
column.AddAttribute (cellRendererText, "visible", statusVisibleColumn);
// location column
CellRendererText cellRendererText2 = new CellRendererText ();
column.PackStart (cellRendererText2, false);
column.SetCellDataFunc (cellRendererText2, new TreeCellDataFunc (SetLocationTextData));
CellRendererDiff cellRendererDiff = new CellRendererDiff ();
column.PackStart (cellRendererDiff, true);
column.SetCellDataFunc (cellRendererDiff, new TreeCellDataFunc (SetDiffCellData));
treeviewPreview.AppendColumn (column);
treeviewPreview.HeadersVisible = false;
buttonCancel.Clicked += delegate {
Destroy ();
};
buttonOk.Clicked += delegate {
ProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetBackgroundProgressMonitor (this.Title, null);
RefactoringService.AcceptChanges (monitor, changes);
Destroy ();
};
FillChanges ();
}
示例5: HighlightingPanel
public HighlightingPanel ()
{
this.Build ();
var col = new TreeViewColumn ();
var crpixbuf = new CellRendererPixbuf ();
col.PackStart (crpixbuf, false);
col.SetCellDataFunc (crpixbuf, ImageDataFunc);
var crtext = new CellRendererText ();
col.PackEnd (crtext, true);
col.SetAttributes (crtext, "markup", 0);
styleTreeview.AppendColumn (col);
styleTreeview.Model = styleStore;
styleTreeview.SearchColumn = -1; // disable the interactive search
schemeName = DefaultSourceEditorOptions.Instance.ColorScheme;
MonoDevelop.Ide.Gui.Styles.Changed += HandleThemeChanged;
}
示例6: HighlightingPanel
public HighlightingPanel ()
{
this.Build ();
var col = new TreeViewColumn ();
var crpixbuf = new CellRendererPixbuf ();
col.PackStart (crpixbuf, false);
col.SetCellDataFunc (crpixbuf, (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) => {
var isError = (bool)styleStore.GetValue (iter, 2);
crpixbuf.Visible = isError;
crpixbuf.Pixbuf = isError ? errorPixbuf.Value : null;
});
var crtext = new CellRendererText ();
col.PackEnd (crtext, true);
col.SetAttributes (crtext, "markup", 0);
styleTreeview.AppendColumn (col);
styleTreeview.Model = styleStore;
schemeName = DefaultSourceEditorOptions.Instance.ColorScheme;
}
示例7: Toolbox
public Toolbox(ServiceContainer parentServices)
{
this.parentServices = parentServices;
//we need this service, so create it if not present
toolboxService = parentServices.GetService (typeof (IToolboxService)) as ToolboxService;
if (toolboxService == null) {
toolboxService = new ToolboxService ();
parentServices.AddService (typeof (IToolboxService), toolboxService);
}
#region Toolbar
toolbar = new Toolbar ();
toolbar.ToolbarStyle = ToolbarStyle.Icons;
toolbar.IconSize = IconSize.SmallToolbar;
base.PackStart (toolbar, false, false, 0);
filterToggleButton = new ToggleToolButton ();
filterToggleButton.IconWidget = new Image (Stock.MissingImage, IconSize.SmallToolbar);
filterToggleButton.Toggled += new EventHandler (toggleFiltering);
toolbar.Insert (filterToggleButton, 0);
catToggleButton = new ToggleToolButton ();
catToggleButton.IconWidget = new Image (Stock.MissingImage, IconSize.SmallToolbar);
catToggleButton.Toggled += new EventHandler (toggleCategorisation);
toolbar.Insert (catToggleButton, 1);
SeparatorToolItem sep = new SeparatorToolItem();
toolbar.Insert (sep, 2);
filterEntry = new Entry();
filterEntry.WidthRequest = 150;
filterEntry.Changed += new EventHandler (filterTextChanged);
#endregion
scrolledWindow = new ScrolledWindow ();
base.PackEnd (scrolledWindow, true, true, 0);
//Initialise model
store = new ToolboxStore ();
//initialise view
nodeView = new NodeView (store);
nodeView.Selection.Mode = SelectionMode.Single;
nodeView.HeadersVisible = false;
//cell renderers
CellRendererPixbuf pixbufRenderer = new CellRendererPixbuf ();
CellRendererText textRenderer = new CellRendererText ();
textRenderer.Ellipsize = Pango.EllipsizeMode.End;
//Main column with text, icons
TreeViewColumn col = new TreeViewColumn ();
col.PackStart (pixbufRenderer, false);
col.SetAttributes (pixbufRenderer,
"pixbuf", ToolboxStore.Columns.Icon,
"visible", ToolboxStore.Columns.IconVisible,
"cell-background-gdk", ToolboxStore.Columns.BackgroundColour);
col.PackEnd (textRenderer, true);
col.SetAttributes (textRenderer,
"text", ToolboxStore.Columns.Label,
"weight", ToolboxStore.Columns.FontWeight,
"cell-background-gdk", ToolboxStore.Columns.BackgroundColour);
nodeView.AppendColumn (col);
//Initialise self
scrolledWindow.VscrollbarPolicy = PolicyType.Automatic;
scrolledWindow.HscrollbarPolicy = PolicyType.Never;
scrolledWindow.WidthRequest = 150;
scrolledWindow.AddWithViewport (nodeView);
//selection events
nodeView.NodeSelection.Changed += OnSelectionChanged;
nodeView.RowActivated += OnRowActivated;
//update view when toolbox service updated
toolboxService.ToolboxChanged += new EventHandler (tbsChanged);
Refresh ();
//track expanded state of nodes
nodeView.RowCollapsed += new RowCollapsedHandler (whenRowCollapsed);
nodeView.RowExpanded += new RowExpandedHandler (whenRowExpanded);
//set initial state
filterToggleButton.Active = false;
catToggleButton.Active = true;
}
示例8: CSharpFormattingProfileDialog
public CSharpFormattingProfileDialog (CSharpFormattingPolicy profile)
{
// ReSharper disable once DoNotCallOverridableMethodsInConstructor
this.Build ();
this.profile = profile;
this.Title = profile.IsBuiltIn ? GettextCatalog.GetString ("Show built-in profile") : GettextCatalog.GetString ("Edit Profile");
notebookCategories.SwitchPage += delegate {
TreeView treeView;
switch (notebookCategories.Page) {
case 0:
treeView = treeviewIndentOptions;
break;
case 1:
treeView = treeviewNewLines;
break;
case 2: // Blank lines
treeView = treeviewSpacing;
break;
case 3:
treeView = treeviewWrapping;
break;
default:
return;
}
TreeModel model;
TreeIter iter;
if (treeView.Selection.GetSelected (out model, out iter))
UpdateExample (model, iter);
};
notebookCategories.ShowTabs = false;
comboboxCategories.AppendText (GettextCatalog.GetString ("Indentation"));
comboboxCategories.AppendText (GettextCatalog.GetString ("New Lines"));
comboboxCategories.AppendText (GettextCatalog.GetString ("Spacing"));
// comboboxCategories.AppendText (GettextCatalog.GetString ("Style"));
comboboxCategories.AppendText (GettextCatalog.GetString ("Wrapping"));
comboboxCategories.Changed += delegate {
texteditor.Text = "";
notebookCategories.Page = comboboxCategories.Active;
};
comboboxCategories.Active = 0;
var options = DefaultSourceEditorOptions.Instance;
texteditor.Options = DefaultSourceEditorOptions.PlainEditor;
texteditor.IsReadOnly = true;
texteditor.MimeType = CSharpFormatter.MimeType;
scrolledwindow.Child = texteditor;
ShowAll ();
#region Indent options
indentationOptions = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));
var column = new TreeViewColumn ();
// pixbuf column
var pixbufCellRenderer = new CellRendererImage ();
column.PackStart (pixbufCellRenderer, false);
column.SetCellDataFunc (pixbufCellRenderer, RenderIcon);
// text column
var cellRendererText = new CellRendererText ();
cellRendererText.Ypad = 1;
column.PackStart (cellRendererText, true);
column.SetAttributes (cellRendererText, "text", 1);
treeviewIndentOptions.Model = indentationOptions;
treeviewIndentOptions.HeadersVisible = false;
treeviewIndentOptions.Selection.Changed += TreeSelectionChanged;
treeviewIndentOptions.AppendColumn (column);
column = new TreeViewColumn ();
var cellRendererCombo = new CellRendererCombo ();
cellRendererCombo.Ypad = 1;
cellRendererCombo.Mode = CellRendererMode.Editable;
cellRendererCombo.TextColumn = 1;
cellRendererCombo.Model = ComboBoxStore;
cellRendererCombo.HasEntry = false;
cellRendererCombo.Editable = !profile.IsBuiltIn;
cellRendererCombo.Edited += new ComboboxEditedHandler (this, indentationOptions).ComboboxEdited;
column.PackStart (cellRendererCombo, false);
column.SetAttributes (cellRendererCombo, "visible", comboVisibleColumn);
column.SetCellDataFunc (cellRendererCombo, ComboboxDataFunc);
var cellRendererToggle = new CellRendererToggle ();
cellRendererToggle.Ypad = 1;
cellRendererToggle.Activatable = !profile.IsBuiltIn;
cellRendererToggle.Toggled += new CellRendererToggledHandler (this, treeviewIndentOptions, indentationOptions).Toggled;
column.PackStart (cellRendererToggle, false);
column.SetAttributes (cellRendererToggle, "visible", toggleVisibleColumn);
column.SetCellDataFunc (cellRendererToggle, ToggleDataFunc);
treeviewIndentOptions.AppendColumn (column);
AddOption (indentationOptions, "IndentBlock", GettextCatalog.GetString ("Indent block contents"), "namespace Test { class AClass { void Method () { int x; int y; } } }");
AddOption (indentationOptions, "IndentBraces", GettextCatalog.GetString ("Indent open and close braces"), "class AClass { int aField; void AMethod () {}}");
AddOption (indentationOptions, "IndentSwitchSection", GettextCatalog.GetString ("Indent case contents"), "class AClass { void Method (int x) { switch (x) { case 1: break; } } }");
AddOption (indentationOptions, "IndentSwitchCaseSection", GettextCatalog.GetString ("Indent case labels"), "class AClass { void Method (int x) { switch (x) { case 1: break; } } }");
AddOption (indentationOptions, "LabelPositioning", GettextCatalog.GetString ("Label indentation"), "enum AEnum { A, B, C }");
//.........这里部分代码省略.........
示例9: ExplorerView
/// <summary>Default constructor for ExplorerView</summary>
public ExplorerView(ViewBase owner)
: base(owner)
{
Glade.XML gxml = new Glade.XML("ApsimNG.Resources.Glade.ExplorerView.glade", "vbox1");
gxml.Autoconnect(this);
_mainWidget = vbox1;
treeview1.Model = treemodel;
TreeViewColumn column = new TreeViewColumn();
CellRendererPixbuf iconRender = new Gtk.CellRendererPixbuf();
column.PackStart(iconRender, false);
textRender = new Gtk.CellRendererText();
textRender.Editable = true;
textRender.EditingStarted += OnBeforeLabelEdit;
textRender.Edited += OnAfterLabelEdit;
column.PackStart(textRender, true);
column.SetAttributes(iconRender, "pixbuf", 1);
column.SetAttributes(textRender, "text", 0);
// column.SetCellDataFunc(textRender, treecelldatafunc);
treeview1.AppendColumn(column);
treeview1.TooltipColumn = 2;
treeview1.CursorChanged += OnAfterSelect;
treeview1.ButtonReleaseEvent += OnButtonUp;
TargetEntry[] target_table = new TargetEntry[] {
new TargetEntry ("application/x-model-component", TargetFlags.App, 0)
};
Gdk.DragAction actions = Gdk.DragAction.Copy | Gdk.DragAction.Link | Gdk.DragAction.Move;
//treeview1.EnableModelDragDest(target_table, actions);
//treeview1.EnableModelDragSource(Gdk.ModifierType.Button1Mask, target_table, actions);
Drag.SourceSet(treeview1, Gdk.ModifierType.Button1Mask, target_table, actions);
Drag.DestSet(treeview1, 0, target_table, actions);
treeview1.DragMotion += OnDragOver;
treeview1.DragDrop += OnDragDrop;
treeview1.DragBegin += OnDragBegin;
treeview1.DragDataGet += OnDragDataGet;
treeview1.DragDataReceived += OnDragDataReceived;
treeview1.DragEnd += OnDragEnd;
treeview1.DragDataDelete += OnDragDataDelete;
treeview1.FocusInEvent += Treeview1_FocusInEvent;
treeview1.FocusOutEvent += Treeview1_FocusOutEvent;
_mainWidget.Destroyed += _mainWidget_Destroyed;
}
示例10: CategoryView
public CategoryView()
{
PIXBUF_ALL_ITEMS = RenderIcon(Icons.Icon.Stock_File, ICON_SIZE);
// all categories
CATEGORIES = new CategoryInfo[] {
_ci(Icons.Icon.Stock_Directory, S._("Directories")),
_ci(Icons.Icon.Category_Texts, S._("Text")),
_ci(Icons.Icon.Category_Documents, S._("Documents")),
_ci(Icons.Icon.Category_Music, S._("Music")),
_ci(Icons.Icon.Category_Movies, S._("Movies")),
_ci(Icons.Icon.Category_Images , S._("Images")),
_ci(Icons.Icon.Category_Applications, S._("Applications")),
_ci(Icons.Icon.Category_Archives, S._("Archives")),
_ci(Icons.Icon.Category_Development, S._("Development"))
};
// mimetype -> category mapping
MIME_MAPPING = MimeCategoryMapping
.GetMapping<CategoryInfo>(/*directoryCategoryData:*/ CATEGORIES[0],
/*textCategoryData:*/ CATEGORIES[1],
/*documentCategoryData:*/ CATEGORIES[2],
/*musicCategoryData:*/ CATEGORIES[3],
/*movieCategoryData:*/ CATEGORIES[4],
/*imageCategoryData:*/ CATEGORIES[5],
/*applicationCategoryData:*/ CATEGORIES[6],
/*archiveCategoryData:*/ CATEGORIES[7],
/*textCategoryData:*/ CATEGORIES[8]);
allItems = new VolumeItem[0];
//
// set up columns
//
HeadersVisible = true;
TreeViewColumn col;
// column icon/category
CellRendererPixbuf pix = new CellRendererPixbuf();
CellRendererText txt = new CellRendererText();
col = new TreeViewColumn();
col.SortColumnId = 1;
col.Resizable = true;
col.Title = S._("Category");
col.PackStart(pix, false);
col.PackStart(txt, false);
col.SetAttributes(pix, "pixbuf", 0);
col.SetAttributes(txt, "text", 1);
AppendColumn(col);
Model = GetNewStore();
}
示例11: InitView
private void InitView(VolumeType volType, out TreeModel model)
{
currentVolumeType = volType;
TreeViewColumn col;
switch (volType) {
case VolumeType.FileSystemVolume:
HeadersVisible = false;
CellRendererPixbuf pix = new CellRendererPixbuf();
CellRendererText txt = new CellRendererText();
col = new TreeViewColumn();
col.PackStart(pix, false);
col.PackStart(txt, false);
col.SetAttributes(pix, "pixbuf", 0);
col.SetAttributes(txt, "text", 1);
col.SetCellDataFunc(txt, CellDataFunc);
AppendColumn(col);
// set up store
model = new TreeStore(typeof(Gdk.Pixbuf),
typeof(string),
/* VolumeItem - not visible */
typeof(FileSystemVolumeItem));
item_col = 2;
break;
case VolumeType.AudioCdVolume:
HeadersVisible = true;
col = new TreeViewColumn(string.Empty, new CellRendererPixbuf(), "pixbuf", 0);
col.Resizable = false;
col.Expand = false;
AppendColumn(col);
var tmp = new CellRendererText();
col = new TreeViewColumn(S._("Name"), tmp, "text", 1);
col.Resizable = true;
col.Expand = true;
col.SetCellDataFunc(tmp, CellDataFunc);
AppendColumn(col);
col = new TreeViewColumn(S._("Artist"), new CellRendererText(), "text", 2);
col.Resizable = true;
col.Expand = true;
AppendColumn(col);
col = new TreeViewColumn(S._("Duration"), new CellRendererText(), "text", 3);
col.Resizable = true;
col.Expand = false;
AppendColumn(col);
// set up store
model = new ListStore(typeof(Gdk.Pixbuf),
typeof(string),
typeof(string),
typeof(string),
/* VolumeItem - not visible */
typeof(AudioTrackVolumeItem));
item_col = 4;
break;
default:
throw new NotImplementedException("View initialization has not been implemented for this volumetype");
}
}
示例12: BuildGui
private void BuildGui()
{
HBox headerBox = new HBox();
headerBox.PackStart(new Label(GettextCatalog.GetString("Workspace") + ":"), false, false, 0);
_workspaceComboBox.Model = _workspaceStore;
var workspaceTextRenderer = new CellRendererText();
_workspaceComboBox.PackStart(workspaceTextRenderer, true);
_workspaceComboBox.SetAttributes(workspaceTextRenderer, "text", 1);
headerBox.PackStart(_workspaceComboBox, false, false, 0);
headerBox.PackStart(manageButton, false, false, 0);
headerBox.PackStart(refreshButton, false, false, 0);
_view.PackStart(headerBox, false, false, 0);
HPaned mainBox = new HPaned();
VBox treeViewBox = new VBox();
TreeViewColumn treeColumn = new TreeViewColumn();
treeColumn.Title = "Folders";
var repoImageRenderer = new CellRendererPixbuf();
treeColumn.PackStart(repoImageRenderer, false);
treeColumn.SetAttributes(repoImageRenderer, "pixbuf", 1);
var folderTextRenderer = new CellRendererText();
treeColumn.PackStart(folderTextRenderer, true);
treeColumn.SetAttributes(folderTextRenderer, "text", 2);
_treeView.AppendColumn(treeColumn);
treeViewBox.WidthRequest = 250;
ScrolledWindow scrollContainer = new ScrolledWindow();
scrollContainer.Add(_treeView);
treeViewBox.PackStart(scrollContainer, true, true, 0);
mainBox.Pack1(treeViewBox, false, false);
VBox rightBox = new VBox();
HBox headerRightBox = new HBox();
headerRightBox.PackStart(new Label(GettextCatalog.GetString("Local Path") + ":"), false, false, 0);
Alignment leftAlign = new Alignment(0, 0, 0, 0);
_localFolder.Justify = Justification.Left;
leftAlign.Add(_localFolder);
headerRightBox.PackStart(leftAlign);
rightBox.PackStart(headerRightBox, false, false, 0);
var itemNameColumn = new TreeViewColumn();
itemNameColumn.Title = "Name";
var itemIconRenderer = new CellRendererPixbuf();
itemNameColumn.PackStart(itemIconRenderer, false);
itemNameColumn.SetAttributes(itemIconRenderer, "pixbuf", 1);
var itemNameRenderer = new CellRendererText();
itemNameColumn.PackStart(itemNameRenderer, true);
itemNameColumn.SetAttributes(itemNameRenderer, "text", 2);
_listView.AppendColumn(itemNameColumn);
_listView.AppendColumn("Pending Change", new CellRendererText(), "text", 3);
_listView.AppendColumn("User", new CellRendererText(), "text", 4);
_listView.AppendColumn("Latest", new CellRendererText(), "text", 5);
_listView.AppendColumn("Last Check-in", new CellRendererText(), "text", 6);
_listView.Selection.Mode = SelectionMode.Multiple;
_listView.Model = _listStore;
var listViewScollWindow = new ScrolledWindow();
listViewScollWindow.Add(_listView);
rightBox.PackStart(listViewScollWindow, true, true, 0);
mainBox.Pack2(rightBox, true, true);
_view.PackStart(mainBox, true, true, 0);
AttachEvents();
_view.ShowAll();
}
示例13: POEditorWidget
public POEditorWidget (TranslationProject project)
{
this.project = project;
this.Build ();
this.headersEditor = new CatalogHeadersWidget ();
this.notebookPages.AppendPage (headersEditor, new Gtk.Label ());
updateThread = new BackgroundWorker ();
updateThread.WorkerSupportsCancellation = true;
updateThread.DoWork += FilterWorker;
updateTaskThread = new BackgroundWorker ();
updateTaskThread.WorkerSupportsCancellation = true;
updateTaskThread.DoWork += TaskUpdateWorker;
AddButton (GettextCatalog.GetString ("Translation")).Active = true;
AddButton (GettextCatalog.GetString ("Headers")).Active = false;
// entries tree view
store = new ListStore (typeof(string), typeof(bool), typeof(string), typeof(string), typeof(CatalogEntry), typeof(Gdk.Color), typeof(int), typeof(Gdk.Color));
this.treeviewEntries.Model = store;
treeviewEntries.AppendColumn (String.Empty, new CellRendererIcon (), "stock_id", Columns.Stock, "cell-background-gdk", Columns.RowColor);
CellRendererToggle cellRendFuzzy = new CellRendererToggle ();
cellRendFuzzy.Toggled += new ToggledHandler (FuzzyToggled);
cellRendFuzzy.Activatable = true;
treeviewEntries.AppendColumn (GettextCatalog.GetString ("Fuzzy"), cellRendFuzzy, "active", Columns.Fuzzy, "cell-background-gdk", Columns.RowColor);
CellRendererText original = new CellRendererText ();
original.Ellipsize = Pango.EllipsizeMode.End;
treeviewEntries.AppendColumn (GettextCatalog.GetString ("Original string"), original, "text", Columns.String, "cell-background-gdk", Columns.RowColor, "foreground-gdk", Columns.ForeColor);
CellRendererText translation = new CellRendererText ();
translation.Ellipsize = Pango.EllipsizeMode.End;
treeviewEntries.AppendColumn (GettextCatalog.GetString ("Translated string"), translation, "text", Columns.Translation, "cell-background-gdk", Columns.RowColor, "foreground-gdk", Columns.ForeColor);
treeviewEntries.Selection.Changed += new EventHandler (OnEntrySelected);
treeviewEntries.GetColumn (0).SortIndicator = true;
treeviewEntries.GetColumn (0).SortColumnId = (int)Columns.TypeSortIndicator;
treeviewEntries.GetColumn (1).SortIndicator = true;
treeviewEntries.GetColumn (1).SortColumnId = (int)Columns.Fuzzy;
treeviewEntries.GetColumn (2).SortIndicator = true;
treeviewEntries.GetColumn (2).SortColumnId = (int)Columns.String;
treeviewEntries.GetColumn (2).Resizable = true;
treeviewEntries.GetColumn (2).Expand = true;
treeviewEntries.GetColumn (3).SortIndicator = true;
treeviewEntries.GetColumn (3).SortColumnId = (int)Columns.Translation;
treeviewEntries.GetColumn (3).Resizable = true;
treeviewEntries.GetColumn (3).Expand = true;
// found in tree view
foundInStore = new ListStore (typeof(string), typeof(string), typeof(string), typeof(Pixbuf));
this.treeviewFoundIn.Model = foundInStore;
TreeViewColumn fileColumn = new TreeViewColumn ();
var pixbufRenderer = new CellRendererPixbuf ();
fileColumn.PackStart (pixbufRenderer, false);
fileColumn.SetAttributes (pixbufRenderer, "pixbuf", FoundInColumns.Pixbuf);
CellRendererText textRenderer = new CellRendererText ();
fileColumn.PackStart (textRenderer, true);
fileColumn.SetAttributes (textRenderer, "text", FoundInColumns.File);
treeviewFoundIn.AppendColumn (fileColumn);
treeviewFoundIn.AppendColumn ("", new CellRendererText (), "text", FoundInColumns.Line);
treeviewFoundIn.HeadersVisible = false;
treeviewFoundIn.GetColumn (1).FixedWidth = 100;
treeviewFoundIn.RowActivated += delegate(object sender, RowActivatedArgs e) {
Gtk.TreeIter iter;
foundInStore.GetIter (out iter, e.Path);
string line = foundInStore.GetValue (iter, (int)FoundInColumns.Line) as string;
string file = foundInStore.GetValue (iter, (int)FoundInColumns.FullFileName) as string;
int lineNr = 1;
try {
lineNr = 1 + int.Parse (line);
} catch {
}
IdeApp.Workbench.OpenDocument (file, lineNr, 1, true);
};
this.notebookTranslated.RemovePage (0);
this.searchEntryFilter.Entry.Text = "";
searchEntryFilter.Entry.Changed += delegate {
UpdateFromCatalog ();
};
this.togglebuttonFuzzy.Active = PropertyService.Get ("Gettext.ShowFuzzy", true);
this.togglebuttonFuzzy.TooltipText = GettextCatalog.GetString ("Show fuzzy translations");
this.togglebuttonFuzzy.Toggled += delegate {
MonoDevelop.Core.PropertyService.Set ("Gettext.ShowFuzzy", this.togglebuttonFuzzy.Active);
UpdateFromCatalog ();
};
this.togglebuttonMissing.Active = PropertyService.Get ("Gettext.ShowMissing", true);
this.togglebuttonMissing.TooltipText = GettextCatalog.GetString ("Show missing translations");
this.togglebuttonMissing.Toggled += delegate {
MonoDevelop.Core.PropertyService.Set ("Gettext.ShowMissing", this.togglebuttonMissing.Active);
//.........这里部分代码省略.........
示例14: CreateEdit
/// <summary>
/// Create the UI
/// </summary>
private void CreateEdit()
{
CmisTreeStore cmisStore = new CmisTreeStore ();
Gtk.TreeView treeView = new Gtk.TreeView (cmisStore.CmisStore);
RootFolder root = new RootFolder () {
Name = this.Name,
Id = credentials.RepoId,
Address = credentials.Address.ToString()
};
IgnoredFolderLoader.AddIgnoredFolderToRootNode(root, Ignores);
LocalFolderLoader.AddLocalFolderToRootNode(root, localPath);
AsyncNodeLoader asyncLoader = new AsyncNodeLoader (root, credentials, PredefinedNodeLoader.LoadSubFolderDelegate, PredefinedNodeLoader.CheckSubFolderDelegate);
asyncLoader.UpdateNodeEvent += delegate {
cmisStore.UpdateCmisTree(root);
};
cmisStore.UpdateCmisTree (root);
asyncLoader.Load (root);
Header = CmisSync.Properties_Resources.EditTitle;
VBox layout_vertical = new VBox (false, 12);
Controller.CloseWindowEvent += delegate
{
asyncLoader.Cancel();
};
Button cancel_button = new Button (CmisSync.Properties_Resources.Cancel);
cancel_button.Clicked += delegate {
Close();
};
Button finish_button = new Button (CmisSync.Properties_Resources.SaveChanges);
finish_button.Clicked += delegate {
Ignores = NodeModelUtils.GetIgnoredFolder(root);
Controller.SaveFolder();
Close();
};
Gtk.TreeIter iter;
treeView.HeadersVisible = false;
treeView.Selection.Mode = SelectionMode.Single;
TreeViewColumn column = new TreeViewColumn ();
column.Title = "Name";
CellRendererToggle renderToggle = new CellRendererToggle ();
column.PackStart (renderToggle, false);
renderToggle.Activatable = true;
column.AddAttribute (renderToggle, "active", (int)CmisTreeStore.Column.ColumnSelected);
column.AddAttribute (renderToggle, "inconsistent", (int)CmisTreeStore.Column.ColumnSelectedThreeState);
column.AddAttribute (renderToggle, "radio", (int)CmisTreeStore.Column.ColumnRoot);
renderToggle.Toggled += delegate (object render, ToggledArgs args) {
TreeIter iterToggled;
if (! cmisStore.CmisStore.GetIterFromString (out iterToggled, args.Path))
{
Console.WriteLine("Toggled GetIter Error " + args.Path);
return;
}
Node node = cmisStore.CmisStore.GetValue(iterToggled,(int)CmisTreeStore.Column.ColumnNode) as Node;
if (node == null)
{
Console.WriteLine("Toggled GetValue Error " + args.Path);
return;
}
if (node.Parent == null)
{
node.Selected = true;
}
else
{
if (node.Selected == false)
{
node.Selected = true;
}
else
{
node.Selected = false;
}
}
cmisStore.UpdateCmisTree(root);
};
CellRendererText renderText = new CellRendererText ();
column.PackStart (renderText, false);
column.SetAttributes (renderText, "text", (int)CmisTreeStore.Column.ColumnName);
column.Expand = true;
treeView.AppendColumn (column);
treeView.AppendColumn ("Status", new StatusCellRenderer (), "text", (int)CmisTreeStore.Column.ColumnStatus);
treeView.RowExpanded += delegate (object o, RowExpandedArgs args) {
Node node = cmisStore.CmisStore.GetValue(args.Iter, (int)CmisTreeStore.Column.ColumnNode) as Node;
asyncLoader.Load(node);
};
//.........这里部分代码省略.........
示例15: appendColumns
/// <summary>
/// Appends the columns.
/// </summary>
public void appendColumns()
{
try {
try {
//Clearing collumns
for (int i = 0; i < treeview1.Columns.Length; i++)
treeview1.RemoveColumn (treeview1.Columns [i]);
} catch {
}
//Add new Columns
//TODO: i18n
TreeViewColumn ausdruck = new TreeViewColumn ();
ausdruck.Title = "Ausdruck";
TreeViewColumn titel = new TreeViewColumn ();
titel.Title = "Titel";
TreeViewColumn description = new TreeViewColumn ();
description.Title = "Beschreibung";
treeview1.AppendColumn (ausdruck);
treeview1.AppendColumn (titel);
treeview1.AppendColumn (description);
//treeview1.AppendColumn (new TreeViewColumn () {Title = "Pfad" });
g_regexList = new ListStore (typeof(string), typeof(string), typeof(string), typeof(string));
treeview1.Model = g_regexList;
ausdruck.PackStart (new CellRendererText (), true);
titel.PackStart (new CellRendererText (), true);
description.PackStart (new CellRendererText (), true);
ausdruck.SetAttributes (ausdruck.CellRenderers [0], "text", 0);
//treeview1.Columns [3].PackStart (new CellRendererText (), true);
//treeview1.Columns [3].SetAttributes (treeview1.Columns [3].CellRenderers [0], "text", 3);
titel.SetAttributes (titel.CellRenderers [0], "text", 1);
description.SetAttributes (description.CellRenderers [0], "text", 2);
} catch (Exception ex) {
MessageBox.Show (ex.Message, cTerminus.g_programName, ButtonsType.Close, MessageType.Error);
}
}