本文整理汇总了C#中Gtk.TreeStore.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# TreeStore.GetValue方法的具体用法?C# TreeStore.GetValue怎么用?C# TreeStore.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TreeStore
的用法示例。
在下文中一共展示了TreeStore.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ElementHelpWidget
// IWorkbenchWindow workbenchWindow;
// RegexToolkitWidget regexWidget;
public ElementHelpWidget (IWorkbenchWindow workbenchWindow, RegexToolkitWidget regexWidget)
{
// this.workbenchWindow = workbenchWindow;
// this.regexWidget = regexWidget;
this.Build ();
elementsStore = new Gtk.TreeStore (typeof(string), typeof(string), typeof(string), typeof(string));
this.elementsTreeview.Model = this.elementsStore;
this.elementsTreeview.HeadersVisible = false;
this.elementsTreeview.Selection.Mode = SelectionMode.Browse;
var col = new TreeViewColumn ();
this.elementsTreeview.AppendColumn (col);
var pix = new CellRendererPixbuf ();
var cellRendText = new CellRendererText ();
col.PackStart (pix, false);
col.AddAttribute (pix, "stock_id", 0);
col.PackStart (cellRendText, false);
col.AddAttribute (cellRendText, "text", 1);
var cellRendText2 = new CellRendererText ();
col.PackStart (cellRendText2, true);
col.SetCellDataFunc (cellRendText2, ElementDescriptionFunc);
// this.elementsTreeview.Selection.Changed += delegate {
// ShowTooltipForSelectedEntry ();
// };
// this.elementsTreeview.MotionNotifyEvent += HandleMotionNotifyEvent;
this.elementsTreeview.RowActivated += delegate (object sender, RowActivatedArgs e) {
Gtk.TreeIter iter;
if (elementsStore.GetIter (out iter, e.Path)) {
string text = elementsStore.GetValue (iter, 3) as string;
if (!System.String.IsNullOrEmpty (text)) {
regexWidget.InsertText (text);
workbenchWindow.SwitchView (0);
}
}
};
this.LeaveNotifyEvent += delegate {
this.HideTooltipWindow ();
};
FillElementsBox ();
Show ();
}
示例2: FormatTreeView
void FormatTreeView(TreeStore treeStore)
{
treeView.HeadersVisible = false;
treeView.EnableTreeLines = true;
CellRendererToggle checkboxCellRenderer = new CellRendererToggle();
checkboxCellRenderer.Activatable = true;
checkboxCellRenderer.Toggled += delegate(object o, ToggledArgs args)
{
TreeIter iter;
if (treeStore.GetIter(out iter, new TreePath(args.Path)))
{
PackageReferenceNode node = (PackageReferenceNode)treeStore.GetValue(iter, 0);
node.State = !node.State;
}
};
treeView.AppendColumn("CheckBox", checkboxCellRenderer);
CellRendererText nameCellRenderer = new CellRendererText();
treeView.AppendColumn("Name", nameCellRenderer);
treeView.Columns[0].SetCellDataFunc(checkboxCellRenderer, new TreeCellDataFunc(RenderCheckBox));
treeView.Columns[1].SetCellDataFunc(nameCellRenderer, new TreeCellDataFunc(RenderName));
}
示例3: TreeStore
Widget IOutlinedDocument.GetOutlineWidget ()
{
if (outlineTreeView != null)
return outlineTreeView;
outlineTreeStore = new TreeStore (typeof (object));
outlineTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView (outlineTreeStore);
System.Reflection.PropertyInfo prop = typeof (TreeView).GetProperty ("EnableTreeLines");
if (prop != null)
prop.SetValue (outlineTreeView, true, null);
outlineTreeView.Realized += delegate { refillOutlineStore (); };
InitializeOutlineColumns (outlineTreeView);
outlineTreeView.HeadersVisible = false;
outlineTreeView.Selection.Changed += delegate {
TreeIter iter;
if (!outlineTreeView.Selection.GetSelected (out iter))
return;
OutlineSelectionChanged (outlineTreeStore.GetValue (iter, 0));
};
refillOutlineStore ();
var sw = new CompactScrolledWindow ();
sw.Add (outlineTreeView);
sw.ShowAll ();
return sw;
}
示例4: RegexToolkitWidget
public RegexToolkitWidget ()
{
this.Build ();
optionsStore = new ListStore (typeof(bool), typeof(string), typeof(Options));
resultStore = new Gtk.TreeStore (typeof(string), typeof(string), typeof(int), typeof(int));
FillOptionsBox ();
this.entryRegEx.Changed += UpdateStartButtonSensitivity;
this.inputTextview.Buffer.Changed += UpdateStartButtonSensitivity;
SetFindMode (true);
var cellRendText = new CellRendererText ();
cellRendText.Ellipsize = Pango.EllipsizeMode.End;
this.optionsTreeview.Model = this.optionsStore;
this.optionsTreeview.HeadersVisible = false;
CellRendererToggle cellRendToggle = new CellRendererToggle ();
cellRendToggle.Toggled += new ToggledHandler (OptionToggled);
cellRendToggle.Activatable = true;
this.optionsTreeview.AppendColumn ("", cellRendToggle, "active", 0);
this.optionsTreeview.AppendColumn ("", cellRendText, "text", 1);
this.resultsTreeview.Model = this.resultStore;
this.resultsTreeview.HeadersVisible = false;
var col = new TreeViewColumn ();
this.resultsTreeview.AppendColumn (col);
var pix = new CellRendererImage ();
col.PackStart (pix, false);
col.AddAttribute (pix, "stock_id", 0);
col.PackStart (cellRendText, true);
col.AddAttribute (cellRendText, "text", 1);
this.resultsTreeview.RowActivated += delegate(object sender, RowActivatedArgs e) {
Gtk.TreeIter iter;
if (resultStore.GetIter (out iter, e.Path)) {
int index = (int)resultStore.GetValue (iter, 2);
int length = (int)resultStore.GetValue (iter, 3);
if (index >= 0) {
this.inputTextview.Buffer.SelectRange (this.inputTextview.Buffer.GetIterAtOffset (index),
this.inputTextview.Buffer.GetIterAtOffset (index + length));
} else {
this.inputTextview.Buffer.SelectRange (this.inputTextview.Buffer.GetIterAtOffset (0), this.inputTextview.Buffer.GetIterAtOffset (0));
}
}
};
this.entryReplace.Sensitive = this.checkbuttonReplace.Active = false;
this.entryReplace.Changed += delegate {
UpdateRegex ();
};
this.checkbuttonReplace.Toggled += delegate {
this.entryReplace.Sensitive = this.checkbuttonReplace.Active;
UpdateRegex ();
};
this.expandMatches.Toggled += delegate {
UpdateRegex ();
};
this.vbox4.WidthRequest = 380;
this.scrolledwindow5.HeightRequest = 150;
this.scrolledwindow1.HeightRequest = 150;
Show ();
}
示例5: RegexToolkitWidget
public RegexToolkitWidget ()
{
this.Build ();
optionsStore = new ListStore (typeof(bool), typeof(string), typeof(Options));
resultStore = new Gtk.TreeStore (typeof(string), typeof(string), typeof(int), typeof(int));
FillOptionsBox ();
this.buttonStart.Sensitive = false;
this.entryRegEx.Changed += UpdateStartButtonSensitivity;
this.inputTextview.Buffer.Changed += UpdateStartButtonSensitivity;
this.buttonStart.Clicked += delegate {
if (regexThread != null && regexThread.IsAlive) {
regexThread.Abort ();
regexThread.Join ();
SetButtonStart (GettextCatalog.GetString ("Start Regular E_xpression"), "gtk-execute");
regexThread = null;
return;
}
regexThread = new Thread (delegate() {
PerformQuery (inputTextview.Buffer.Text, this.entryRegEx.Text, this.entryReplace.Text, GetOptions ());
});
regexThread.IsBackground = true;
regexThread.Name = "regex thread";
regexThread.Start ();
SetButtonStart (GettextCatalog.GetString ("Stop e_xecution"), "gtk-media-stop");
SetFindMode (!checkbuttonReplace.Active);
};
SetFindMode (true);
var cellRendText = new CellRendererText ();
cellRendText.Ellipsize = Pango.EllipsizeMode.End;
this.optionsTreeview.Model = this.optionsStore;
this.optionsTreeview.HeadersVisible = false;
CellRendererToggle cellRendToggle = new CellRendererToggle ();
cellRendToggle.Toggled += new ToggledHandler (OptionToggled);
cellRendToggle.Activatable = true;
this.optionsTreeview.AppendColumn ("", cellRendToggle, "active", 0);
this.optionsTreeview.AppendColumn ("", cellRendText, "text", 1);
this.resultsTreeview.Model = this.resultStore;
this.resultsTreeview.HeadersVisible = false;
var col = new TreeViewColumn ();
this.resultsTreeview.AppendColumn (col);
var pix = new CellRendererImage ();
col.PackStart (pix, false);
col.AddAttribute (pix, "stock_id", 0);
col.PackStart (cellRendText, true);
col.AddAttribute (cellRendText, "text", 1);
this.resultsTreeview.RowActivated += delegate(object sender, RowActivatedArgs e) {
Gtk.TreeIter iter;
if (resultStore.GetIter (out iter, e.Path)) {
int index = (int)resultStore.GetValue (iter, 2);
int length = (int)resultStore.GetValue (iter, 3);
if (index >= 0) {
this.inputTextview.Buffer.SelectRange (this.inputTextview.Buffer.GetIterAtOffset (index),
this.inputTextview.Buffer.GetIterAtOffset (index + length));
} else {
this.inputTextview.Buffer.SelectRange (this.inputTextview.Buffer.GetIterAtOffset (0), this.inputTextview.Buffer.GetIterAtOffset (0));
}
}
};
this.entryReplace.Sensitive = this.checkbuttonReplace.Active = false;
this.checkbuttonReplace.Toggled += delegate {
this.entryReplace.Sensitive = this.checkbuttonReplace.Active;
};
this.vbox4.WidthRequest = 380;
this.scrolledwindow5.HeightRequest = 150;
this.scrolledwindow1.HeightRequest = 150;
Show ();
}
示例6: FillInnerExceptionsStore
void FillInnerExceptionsStore (TreeStore store, ExceptionInfo exception, TreeIter parentIter = default (TreeIter))
{
TreeIter iter;
if (parentIter.Equals (TreeIter.Zero)) {
iter = store.AppendValues (exception);
ReverseInnerExceptions [exception] = null;
} else {
ReverseInnerExceptions [exception] = (ExceptionInfo)store.GetValue (parentIter, 0);
iter = store.AppendValues (parentIter, exception);
}
var updateInnerExceptions = new System.Action (() => {
if (!InnerExceptionsStore.IterHasChild (iter)) {
var innerExceptions = exception.InnerExceptions;
if (innerExceptions != null && innerExceptions.Count > 0) {
foreach (var inner in innerExceptions) {
FillInnerExceptionsStore (store, inner, iter);
}
} else {
var inner = exception.InnerException;
if (inner != null)
FillInnerExceptionsStore (store, inner, iter);
}
}
});
exception.Changed += delegate {
Application.Invoke (delegate {
InnerExceptionsStore.EmitRowChanged (InnerExceptionsStore.GetPath (iter), iter);
updateInnerExceptions ();
InnerExceptionsTreeView.ExpandRow (InnerExceptionsStore.GetPath (iter), true);
});
};
updateInnerExceptions ();
}
示例7: TreeStore
Widget MonoDevelop.DesignerSupport.IOutlinedDocument.GetOutlineWidget ()
{
if (outlineTreeView != null)
return outlineTreeView;
outlineTreeStore = new TreeStore (typeof(object));
outlineTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView (outlineTreeStore);
var pixRenderer = new CellRendererPixbuf ();
pixRenderer.Xpad = 0;
pixRenderer.Ypad = 0;
outlineTreeView.TextRenderer.Xpad = 0;
outlineTreeView.TextRenderer.Ypad = 0;
TreeViewColumn treeCol = new TreeViewColumn ();
treeCol.PackStart (pixRenderer, false);
treeCol.SetCellDataFunc (pixRenderer, new TreeCellDataFunc (OutlineTreeIconFunc));
treeCol.PackStart (outlineTreeView.TextRenderer, true);
treeCol.SetCellDataFunc (outlineTreeView.TextRenderer, new TreeCellDataFunc (OutlineTreeTextFunc));
outlineTreeView.AppendColumn (treeCol);
outlineTreeView.HeadersVisible = false;
outlineTreeView.Selection.Changed += delegate {
TreeIter iter;
if (!outlineTreeView.Selection.GetSelected (out iter))
return;
object o = outlineTreeStore.GetValue (iter, 0);
int line = -1, col = -1;
if (o is IType) {
line = ((IType)o).BodyRegion.Start.Line;
col = ((IType)o).BodyRegion.Start.Column;
} else if (o is IMember) {
line = ((IMember)o).BodyRegion.Start.Line;
col = ((IMember)o).BodyRegion.Start.Column;
}
if (line > -1) {
Editor.JumpTo (line, Math.Max (1, col));
}
};
this.lastCU = Document.ParsedDocument;
outlineTreeView.Realized += delegate { RefillOutlineStore (); };
var sw = new CompactScrolledWindow ();
sw.Add (outlineTreeView);
sw.ShowAll ();
return sw;
}
示例8: RegexToolkitWindow
public RegexToolkitWindow () : base(Gtk.WindowType.Toplevel)
{
this.Build ();
this.TransientFor = IdeApp.Workbench.RootWindow;
optionsStore = new ListStore (typeof(bool), typeof(string), typeof(Options));
resultStore = new Gtk.TreeStore (typeof(string), typeof(string), typeof(int), typeof(int));
FillOptionsBox ();
this.buttonCancel.Clicked += delegate {
this.Destroy ();
};
var isWindows = System.IO.Path.DirectorySeparatorChar == '\\';
this.buttonLibrary.Visible = !isWindows;
this.buttonStart.Sensitive = false;
this.entryRegEx.Changed += UpdateStartButtonSensitivity;
this.inputTextview.Buffer.Changed += UpdateStartButtonSensitivity;
this.buttonStart.Clicked += delegate {
if (regexThread != null && regexThread.IsAlive) {
regexThread.Abort ();
regexThread.Join ();
SetButtonStart (GettextCatalog.GetString ("_Start Regular Expression"), "gtk-media-play");
regexThread = null;
return;
}
regexThread = new Thread (delegate() {
PerformQuery (inputTextview.Buffer.Text, this.entryRegEx.Text, this.entryReplace.Text, GetOptions ());
});
regexThread.IsBackground = true;
regexThread.Name = "regex thread";
regexThread.Start ();
SetButtonStart (GettextCatalog.GetString ("_Stop execution"), "gtk-media-stop");
SetFindMode (!checkbuttonReplace.Active);
};
this.buttonLibrary.Clicked += delegate {
if (regexLib == null) {
regexLib = new RegexLibraryWindow ();
regexLib.TransientFor = this;
regexLib.Destroyed += delegate {
regexLib = null;
};
regexLib.Show ();
}
};
SetFindMode (true);
var cellRendText = new CellRendererText ();
cellRendText.Ellipsize = Pango.EllipsizeMode.End;
var pix = new CellRendererPixbuf ();
this.optionsTreeview.Model = this.optionsStore;
this.optionsTreeview.HeadersVisible = false;
CellRendererToggle cellRendToggle = new CellRendererToggle ();
cellRendToggle.Toggled += new ToggledHandler (OptionToggled);
cellRendToggle.Activatable = true;
this.optionsTreeview.AppendColumn ("", cellRendToggle, "active", 0);
this.optionsTreeview.AppendColumn ("", cellRendText, "text", 1);
this.resultsTreeview.Model = this.resultStore;
this.resultsTreeview.HeadersVisible = false;
var col = new TreeViewColumn ();
this.resultsTreeview.AppendColumn (col);
col.PackStart (pix, false);
col.AddAttribute (pix, "stock_id", 0);
col.PackStart (cellRendText, true);
col.AddAttribute (cellRendText, "text", 1);
this.resultsTreeview.RowActivated += delegate(object sender, RowActivatedArgs e) {
Gtk.TreeIter iter;
if (resultStore.GetIter (out iter, e.Path)) {
int index = (int)resultStore.GetValue (iter, 2);
int length = (int)resultStore.GetValue (iter, 3);
if (index >= 0) {
this.inputTextview.Buffer.SelectRange (this.inputTextview.Buffer.GetIterAtOffset (index),
this.inputTextview.Buffer.GetIterAtOffset (index + length));
} else {
this.inputTextview.Buffer.SelectRange (this.inputTextview.Buffer.GetIterAtOffset (0), this.inputTextview.Buffer.GetIterAtOffset (0));
}
}
};
elementsStore = new Gtk.TreeStore (typeof(string), typeof(string), typeof(string), typeof(string));
this.elementsTreeview.Model = this.elementsStore;
this.elementsTreeview.HeadersVisible = false;
this.elementsTreeview.Selection.Mode = SelectionMode.Browse;
col = new TreeViewColumn ();
this.elementsTreeview.AppendColumn (col);
col.PackStart (pix, false);
col.AddAttribute (pix, "stock_id", 0);
col.PackStart (cellRendText, true);
//.........这里部分代码省略.........
示例9: FontChooserPanelWidget
public FontChooserPanelWidget ()
{
this.Build ();
fontStore = new TreeStore (typeof (string), typeof (string), typeof (string));
treeviewFonts.Model = fontStore;
treeviewFonts.AppendColumn (GettextCatalog.GetString ("Name"), textRenderer, "text", colDisplayName);
comboRenderer.Edited += delegate(object o, Gtk.EditedArgs args) {
TreeIter iter;
if (!fontStore.GetIterFromString (out iter, args.Path))
return;
string fontName = (string)fontStore.GetValue (iter, colName);
if (args.NewText == GettextCatalog.GetString ("Default")) {
SetFont (fontName, FontService.GetFont (fontName).FontDescription);
fontStore.SetValue (iter, colValue, GettextCatalog.GetString ("Default"));
return;
}
var selectionDialog = new FontSelectionDialog (GettextCatalog.GetString ("Select Font"));
string fontValue = FontService.FilterFontName (GetFont (fontName));
selectionDialog.SetFontName (fontValue);
selectionDialog.OkButton.Clicked += delegate {
fontValue = selectionDialog.FontName;
if (fontValue == FontService.FilterFontName (FontService.GetFont (fontName).FontDescription))
fontValue = FontService.GetFont (fontName).FontDescription;
SetFont (fontName, fontValue);
fontStore.SetValue (iter, colValue, selectionDialog.FontName);
};
MessageService.ShowCustomDialog (selectionDialog);
selectionDialog.Destroy ();
};
comboRenderer.EditingStarted += delegate(object o, EditingStartedArgs args) {
TreeIter iter;
if (!fontStore.GetIterFromString (out iter, args.Path))
return;
string fontName = (string)fontStore.GetValue (iter, colName);
string fontValue = GetFont (fontName);
comboBoxStore.Clear ();
if (fontValue != FontService.GetFont (fontName).FontDescription)
comboBoxStore.AppendValues (fontValue);
comboBoxStore.AppendValues (GettextCatalog.GetString ("Default"));
comboBoxStore.AppendValues (GettextCatalog.GetString ("Edit..."));
};
var fontCol = new TreeViewColumn ();
fontCol.Title = GettextCatalog.GetString ("Font");
comboRenderer.HasEntry = false;
comboRenderer.Mode = CellRendererMode.Activatable;
comboRenderer.TextColumn = 0;
comboRenderer.Editable = true;
fontCol.PackStart (comboRenderer, true);
fontCol.SetCellDataFunc (comboRenderer, delegate (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) {
string fontValue = (string)fontStore.GetValue (iter, colValue);
string fontName = (string)fontStore.GetValue (iter, colName);
var d = FontService.GetFont (fontName);
if (d == null || d.FontDescription != fontValue) {
comboRenderer.Text = fontValue;
} else {
comboRenderer.Text = GettextCatalog.GetString ("Default");
}
});
treeviewFonts.AppendColumn (fontCol);
comboBoxStore = new ListStore (typeof (string));
comboRenderer.Model = comboBoxStore;
LoadFonts ();
}
示例10: AddinView
public AddinView()
{
var hbox = new HBox () { Spacing = 6 };
var filter_label = new Label (Catalog.GetString ("Show:"));
var filter_combo = new ComboBoxText ();
filter_combo.AppendText (Catalog.GetString ("All"));
filter_combo.AppendText (Catalog.GetString ("Enabled"));
filter_combo.AppendText (Catalog.GetString ("Not Enabled"));
filter_combo.Active = 0;
var search_label = new Label (Catalog.GetString ("Search:"));
var search_entry = new Banshee.Widgets.SearchEntry () {
WidthRequest = 160,
Visible = true,
Ready = true
};
hbox.PackStart (filter_label, false, false, 0);
hbox.PackStart (filter_combo, false, false, 0);
hbox.PackEnd (search_entry, false, false, 0);
hbox.PackEnd (search_label, false, false, 0);
var model = new TreeStore (typeof(bool), typeof(bool), typeof (string), typeof (Addin));
var addins = AddinManager.Registry.GetAddins ().Where (a => { return
a.Name != a.Id && a.Description != null &&
!String.IsNullOrEmpty (a.Description.Category) && !a.Description.Category.StartsWith ("required:") &&
(!a.Description.Category.Contains ("Debug") || ApplicationContext.Debugging);
});
var categorized_addins = addins.GroupBy<Addin, string> (a => a.Description.Category)
.Select (c => new {
Addins = c.OrderBy (a => Catalog.GetString (a.Name)).ToList (),
Name = c.Key,
NameLocalized = Catalog.GetString (c.Key) })
.OrderBy (c => c.NameLocalized)
.ToList ();
tree_view = new TreeView () {
FixedHeightMode = false,
HeadersVisible = false,
SearchColumn = 1,
RulesHint = true,
Model = model
};
var update_model = new System.Action (() => {
string search = search_entry.Query;
bool? enabled = filter_combo.Active > 0 ? (bool?) (filter_combo.Active == 1 ? true : false) : null;
model.Clear ();
foreach (var cat in categorized_addins) {
var cat_iter = model.AppendValues (false, false, String.Format ("<b>{0}</b>", GLib.Markup.EscapeText (cat.NameLocalized)), null);
bool any = false;
foreach (var a in cat.Addins.Matching (search)) {
if (enabled == null || (a.Enabled == enabled.Value)) {
model.AppendValues (cat_iter, true,
a.Enabled,
String.Format (
"<b>{0}</b>\n<small>{1}</small>",
GLib.Markup.EscapeText (Catalog.GetString (a.Name)),
GLib.Markup.EscapeText (Catalog.GetString (a.Description.Description))),
a
);
any = true;
}
}
if (!any) {
model.Remove (ref cat_iter);
}
}
tree_view.ExpandAll ();
});
var txt_cell = new CellRendererText () { WrapMode = Pango.WrapMode.Word };
tree_view.AppendColumn ("Name", txt_cell , "markup", Columns.Name);
var check_cell = new CellRendererToggle () { Activatable = true };
tree_view.AppendColumn ("Enable", check_cell, "visible", Columns.IsAddin, "active", Columns.IsEnabled);
check_cell.Toggled += (o, a) => {
TreeIter iter;
if (model.GetIter (out iter, new TreePath (a.Path))) {
var addin = model.GetValue (iter, 3) as Addin;
bool enabled = (bool) model.GetValue (iter, 1);
addin.Enabled = !enabled;
model.SetValue (iter, 1, addin.Enabled);
model.Foreach (delegate (ITreeModel current_model, TreePath path, TreeIter current_iter) {
var an = current_model.GetValue (current_iter, 3) as Addin;
if (an != null) {
current_model.SetValue (current_iter, 1, an.Enabled);
}
return false;
});
}
};
update_model ();
search_entry.Changed += (o, a) => update_model ();
filter_combo.Changed += (o, a) => update_model ();
//.........这里部分代码省略.........
示例11: GitConfigurationDialog
public GitConfigurationDialog (GitRepository repo)
{
this.Build ();
this.repo = repo;
this.HasSeparator = false;
this.UseNativeContextMenus ();
// Branches list
storeBranches = new ListStore (typeof(Branch), typeof(string), typeof(string), typeof(string));
listBranches.Model = storeBranches;
listBranches.HeadersVisible = true;
SemanticModelAttribute modelAttr = new SemanticModelAttribute ("storeBranches__Branch", "storeBranches__DisplayName", "storeBranches__Tracking", "storeBranches__Name");
TypeDescriptor.AddAttributes (storeBranches, modelAttr);
listBranches.AppendColumn (GettextCatalog.GetString ("Branch"), new CellRendererText (), "markup", 1);
listBranches.AppendColumn (GettextCatalog.GetString ("Tracking"), new CellRendererText (), "text", 2);
listBranches.Selection.Changed += delegate {
TreeIter it;
bool anythingSelected =
buttonRemoveBranch.Sensitive = buttonEditBranch.Sensitive = buttonSetDefaultBranch.Sensitive = listBranches.Selection.GetSelected (out it);
if (!anythingSelected)
return;
string currentBranch = repo.GetCurrentBranch ();
var b = (Branch) storeBranches.GetValue (it, 0);
buttonRemoveBranch.Sensitive = b.FriendlyName != currentBranch;
};
buttonRemoveBranch.Sensitive = buttonEditBranch.Sensitive = buttonSetDefaultBranch.Sensitive = false;
// Sources tree
storeRemotes = new TreeStore (typeof(Remote), typeof(string), typeof(string), typeof(string), typeof(string));
treeRemotes.Model = storeRemotes;
treeRemotes.HeadersVisible = true;
SemanticModelAttribute remotesModelAttr = new SemanticModelAttribute ("storeRemotes__Remote", "storeRemotes__Name", "storeRemotes__Url", "storeRemotes__BranchName", "storeRemotes__FullName");
TypeDescriptor.AddAttributes (storeRemotes, remotesModelAttr);
treeRemotes.AppendColumn ("Remote Source / Branch", new CellRendererText (), "markup", 1);
treeRemotes.AppendColumn ("Url", new CellRendererText (), "text", 2);
treeRemotes.Selection.Changed += delegate {
TreeIter it;
bool anythingSelected = treeRemotes.Selection.GetSelected (out it);
buttonTrackRemote.Sensitive = false;
buttonFetch.Sensitive = buttonEditRemote.Sensitive = buttonRemoveRemote.Sensitive = anythingSelected;
if (!anythingSelected)
return;
string branchName = (string) storeRemotes.GetValue (it, 3);
if (branchName != null)
buttonTrackRemote.Sensitive = true;
};
buttonTrackRemote.Sensitive = buttonFetch.Sensitive = buttonEditRemote.Sensitive = buttonRemoveRemote.Sensitive = false;
// Tags list
storeTags = new ListStore (typeof(string));
listTags.Model = storeTags;
listTags.HeadersVisible = true;
listTags.AppendColumn (GettextCatalog.GetString ("Tag"), new CellRendererText (), "text", 0);
listTags.Selection.Changed += delegate {
TreeIter it;
buttonRemoveTag.Sensitive = buttonPushTag.Sensitive = listTags.Selection.GetSelected (out it);
};
buttonRemoveTag.Sensitive = buttonPushTag.Sensitive = false;
// Fill data
FillBranches ();
FillRemotes ();
FillTags ();
}
示例12: TreeStore
Widget MonoDevelop.DesignerSupport.IOutlinedDocument.GetOutlineWidget ()
{
if (outlineTreeView != null)
return outlineTreeView;
outlineTreeStore = new TreeStore (typeof(object));
outlineTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView (outlineTreeStore);
var pixRenderer = new CellRendererPixbuf ();
pixRenderer.Xpad = 0;
pixRenderer.Ypad = 0;
outlineTreeView.TextRenderer.Xpad = 0;
outlineTreeView.TextRenderer.Ypad = 0;
TreeViewColumn treeCol = new TreeViewColumn ();
treeCol.PackStart (pixRenderer, false);
treeCol.SetCellDataFunc (pixRenderer, new TreeCellDataFunc (OutlineTreeIconFunc));
treeCol.PackStart (outlineTreeView.TextRenderer, true);
treeCol.SetCellDataFunc (outlineTreeView.TextRenderer, new TreeCellDataFunc (OutlineTreeTextFunc));
outlineTreeView.AppendColumn (treeCol);
outlineTreeView.HeadersVisible = false;
outlineTreeView.Selection.Changed += delegate {
TreeIter iter;
if (!outlineTreeView.Selection.GetSelected (out iter))
return;
object o = outlineTreeStore.GetValue (iter, 0);
IdeApp.ProjectOperations.JumpToDeclaration (o as INode);
};
this.lastCU = Document.ParsedDocument;
outlineTreeView.Realized += delegate { RefillOutlineStore (); };
var sw = new CompactScrolledWindow ();
sw.Add (outlineTreeView);
sw.ShowAll ();
return sw;
}
示例13: GetMember
private IMember GetMember(TreeStore store, TreeIter iter)
{
return (IMember)store.GetValue (iter, 3);
}
示例14: GetChecked
private bool GetChecked(TreeStore store, TreeIter iter)
{
return (bool)store.GetValue (iter, 0);
}
示例15: CreateTreeView
void CreateTreeView()
{
//CreateColumns
TreeViewColumn col = new TreeViewColumn ();
CellRendererText cell = new CellRendererText ();
cell.Editable = true;
col.Title = "Nodes";
col.PackStart (cell, true);
col.AddAttribute (cell, "text", 0);
treeview1.AppendColumn (col);
TreeViewColumn col2 = new TreeViewColumn ();
CellRendererText cell2 = new CellRendererText ();
cell2.Editable = true;
col2.Title = "Url";
col2.PackStart (cell2, true);
col2.AddAttribute (cell2, "text", 1);
col2.Visible = false;
treeview1.AppendColumn (col2);
treeview1.HeadersVisible = false;
//Add Store
treestore = new TreeStore (typeof(string), typeof(string));
treeview1.Model = treestore;
cell.Edited += (o, args) => {
Gtk.TreeIter iter;
treestore.GetIter (out iter, new Gtk.TreePath (args.Path));
String newvalue = (String)treestore.GetValue (iter, 0);
Console.WriteLine (newvalue);
treestore.SetValue (iter, 0, args.NewText);
};
cell2.Edited += (o, args) => {
Gtk.TreeIter iter;
treestore.GetIter (out iter, new Gtk.TreePath (args.Path));
String newvalue = (String)treestore.GetValue (iter, 1);
Console.WriteLine (newvalue);
treestore.SetValue (iter, 1, args.NewText);
};
TargetEntry[] ten = new TargetEntry[]{ new TargetEntry ("tree", TargetFlags.App, 1) };
treeview1.EnableModelDragDest (ten, Gdk.DragAction.Move);
treeview1.EnableModelDragSource (Gdk.ModifierType.Button1Mask, ten, Gdk.DragAction.Move);
ShowAll ();
treeview1.DragDataGet += (o, args) => {
TreeModel model;
((TreeSelection)treeview1.Selection).GetSelected (out model, out SourceIter);
args.SelectionData.Set (args.SelectionData.Target, 8, Encoding.UTF8.GetBytes (model.GetValue (SourceIter, 0).ToString ()));
};
treeview1.DragDataReceived += Tree_DragDataReceived;
treeview1.ButtonPressEvent += Tree_ButtonPressEvent;
}