本文整理汇总了C#中Gtk.ListStore.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.ListStore.GetValue方法的具体用法?C# Gtk.ListStore.GetValue怎么用?C# Gtk.ListStore.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.ListStore
的用法示例。
在下文中一共展示了Gtk.ListStore.GetValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
void Init()
{
f_ProtocolListStore = new Gtk.ListStore(typeof(string));
f_ListStore = new Gtk.ListStore(
typeof(FilterModel),
typeof(int), // filter key
typeof(string) // tool tip
);
f_TreeView.Model = f_ListStore;
int i = 1;
Gtk.TreeViewColumn column;
Gtk.CellRendererText textCellr;
Gtk.CellRendererCombo comboCellr;
Gtk.CellRendererToggle toggleCellr;
comboCellr = new Gtk.CellRendererCombo();
comboCellr.Model = f_ProtocolListStore;
comboCellr.TextColumn = 0;
comboCellr.HasEntry = false;
comboCellr.Editable = true;
comboCellr.Edited += OnProtocolEdited;
column = f_TreeView.AppendColumn(_("Protocol"), comboCellr);
column.SetCellDataFunc(comboCellr, RenderProtocol);
f_ChatTypeListStore = new Gtk.ListStore(typeof(string),
typeof(ChatType?));
f_ChatTypeListStore.AppendValues(String.Empty, null);
f_ChatTypeListStore.AppendValues(_("Person / Private"), ChatType.Person);
f_ChatTypeListStore.AppendValues(_("Group / Public"), ChatType.Group);
f_ChatTypeListStore.AppendValues(_("Protocol / Server"), ChatType.Protocol);
comboCellr = new Gtk.CellRendererCombo();
comboCellr.Model = f_ChatTypeListStore;
comboCellr.TextColumn = 0;
comboCellr.HasEntry = false;
comboCellr.Editable = true;
comboCellr.Edited += OnChatTypeEdited;
column = f_TreeView.AppendColumn(_("Chat Type"), comboCellr);
column.Resizable = true;
column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly;
column.SetCellDataFunc(comboCellr, RenderChatType);
textCellr = new Gtk.CellRendererText();
textCellr.Editable = true;
textCellr.Edited += delegate(object sender, Gtk.EditedArgs e) {
Gtk.TreeIter iter;
if (!f_ListStore.GetIterFromString(out iter, e.Path)) {
return;
}
FilterModel filter = (FilterModel) f_ListStore.GetValue(iter, 0);
int key = (int) f_ListStore.GetValue(iter, 1);
filter.ChatID = e.NewText;
f_ListStore.EmitRowChanged(new Gtk.TreePath(e.Path), iter);
OnChanged(EventArgs.Empty);
};
column = f_TreeView.AppendColumn(_("Name"), textCellr);
column.MinWidth = 80;
column.Resizable = true;
column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly;
column.SetCellDataFunc(textCellr,
delegate(Gtk.TreeViewColumn col,
Gtk.CellRenderer cellr,
Gtk.TreeModel model, Gtk.TreeIter iter ) {
FilterModel filter = (FilterModel) model.GetValue(iter, 0);
(cellr as Gtk.CellRendererText).Text = filter.ChatID;
}
);
f_MessageTypeListStore = new Gtk.ListStore(typeof(string),
typeof(MessageType?));
f_MessageTypeListStore.AppendValues(String.Empty, null);
f_MessageTypeListStore.AppendValues(_("Normal"), MessageType.Normal);
f_MessageTypeListStore.AppendValues(_("Event"), MessageType.Event);
comboCellr = new Gtk.CellRendererCombo();
comboCellr.Model = f_MessageTypeListStore;
comboCellr.TextColumn = 0;
comboCellr.HasEntry = false;
comboCellr.Editable = true;
comboCellr.Edited += OnMessageTypeEdited;
column = f_TreeView.AppendColumn(_("Type"), comboCellr);
column.Resizable = true;
column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly;
column.SetCellDataFunc(comboCellr, RenderMessageType);
/*
f_TreeView.HasTooltip = true;
f_TreeView.QueryTooltip += delegate(object sender, Gtk.QueryTooltipArgs e) {
e.Tooltip.Text = "Message Type";
f_TreeView.SetTooltipCell(e.Tooltip, null, column, null);
e.RetVal = true;
};
*/
textCellr = new Gtk.CellRendererText();
textCellr.Editable = true;
textCellr.Edited += delegate(object sender, Gtk.EditedArgs e) {
Gtk.TreeIter iter;
if (!f_ListStore.GetIterFromString(out iter, e.Path)) {
return;
}
FilterModel filter = (FilterModel) f_ListStore.GetValue(iter, 0);
//.........这里部分代码省略.........
示例2: MakeSyncPane
public Gtk.Widget MakeSyncPane ()
{
Gtk.VBox vbox = new Gtk.VBox (false, 0);
vbox.Spacing = 4;
vbox.BorderWidth = 8;
Gtk.HBox hbox = new Gtk.HBox (false, 4);
Gtk.Label label = new Gtk.Label (Catalog.GetString ("Ser_vice:"));
label.Xalign = 0;
label.Show ();
hbox.PackStart (label, false, false, 0);
// Populate the store with all the available SyncServiceAddins
syncAddinStore = new Gtk.ListStore (typeof (SyncServiceAddin));
syncAddinIters = new Dictionary<string,Gtk.TreeIter> ();
SyncServiceAddin [] addins = Tomboy.DefaultNoteManager.AddinManager.GetSyncServiceAddins ();
Array.Sort (addins, CompareSyncAddinsByName);
foreach (SyncServiceAddin addin in addins) {
Gtk.TreeIter iter = syncAddinStore.Append ();
syncAddinStore.SetValue (iter, 0, addin);
syncAddinIters [addin.Id] = iter;
}
syncAddinCombo = new Gtk.ComboBox (syncAddinStore);
label.MnemonicWidget = syncAddinCombo;
Gtk.CellRendererText crt = new Gtk.CellRendererText ();
syncAddinCombo.PackStart (crt, true);
syncAddinCombo.SetCellDataFunc (crt,
new Gtk.CellLayoutDataFunc (ComboBoxTextDataFunc));
// Read from Preferences which service is configured and select it
// by default. Otherwise, just select the first one in the list.
string addin_id = Preferences.Get (
Preferences.SYNC_SELECTED_SERVICE_ADDIN) as String;
Gtk.TreeIter active_iter;
if (addin_id != null && syncAddinIters.ContainsKey (addin_id)) {
active_iter = syncAddinIters [addin_id];
syncAddinCombo.SetActiveIter (active_iter);
} else {
if (syncAddinStore.GetIterFirst (out active_iter) == true) {
syncAddinCombo.SetActiveIter (active_iter);
}
}
syncAddinCombo.Changed += OnSyncAddinComboChanged;
syncAddinCombo.Show ();
hbox.PackStart (syncAddinCombo, true, true, 0);
hbox.Show ();
vbox.PackStart (hbox, false, false, 0);
// Get the preferences GUI for the Sync Addin
if (active_iter.Stamp != Gtk.TreeIter.Zero.Stamp)
selectedSyncAddin = syncAddinStore.GetValue (active_iter, 0) as SyncServiceAddin;
if (selectedSyncAddin != null)
syncAddinPrefsWidget = selectedSyncAddin.CreatePreferencesControl (OnSyncAddinPrefsChanged);
if (syncAddinPrefsWidget == null) {
Gtk.Label l = new Gtk.Label (Catalog.GetString ("Not configurable"));
l.Yalign = 0.5f;
l.Yalign = 0.5f;
syncAddinPrefsWidget = l;
}
if (syncAddinPrefsWidget != null && addin_id != null &&
syncAddinIters.ContainsKey (addin_id) && selectedSyncAddin.IsConfigured)
syncAddinPrefsWidget.Sensitive = false;
syncAddinPrefsWidget.Show ();
syncAddinPrefsContainer = new Gtk.VBox (false, 0);
syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, false, false, 0);
syncAddinPrefsContainer.Show ();
vbox.PackStart (syncAddinPrefsContainer, true, true, 10);
// Autosync preference
int timeout = (int) Preferences.Get (Preferences.SYNC_AUTOSYNC_TIMEOUT);
if (timeout > 0 && timeout < 5) {
timeout = 5;
Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT, 5);
}
Gtk.HBox autosyncBox = new Gtk.HBox (false, 5);
// Translators: This is and the next string go together.
// Together they look like "Automatically Sync in Background Every [_] Minutes",
// where "[_]" is a GtkSpinButton.
autosyncCheck =
new Gtk.CheckButton (Catalog.GetString ("Automaticall_y Sync in Background Every"));
autosyncSpinner = new Gtk.SpinButton (5, 1000, 1);
autosyncSpinner.Value = timeout >= 5 ? timeout : 10;
Gtk.Label autosyncExtraText =
// Translators: See above comment for details on
// this string.
new Gtk.Label (Catalog.GetString ("Minutes"));
autosyncCheck.Active = autosyncSpinner.Sensitive = timeout >= 5;
EventHandler updateTimeoutPref = (o, e) => {
Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT,
autosyncCheck.Active ? (int) autosyncSpinner.Value : -1);
};
autosyncCheck.Toggled += (o, e) => {
//.........这里部分代码省略.........