本文整理汇总了C#中Gtk.ListStore.IterNChildren方法的典型用法代码示例。如果您正苦于以下问题:C# ListStore.IterNChildren方法的具体用法?C# ListStore.IterNChildren怎么用?C# ListStore.IterNChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.ListStore
的用法示例。
在下文中一共展示了ListStore.IterNChildren方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveList
public static void SaveList(ListStore list, string path)
{
path = path + "streams.list";
File.Delete(path);
for (int i = 0; i < list.IterNChildren(); i++) {
TreeIter iter;
list.GetIterFromString (out iter, i.ToString ());
File.AppendAllText(path, list.GetValue(iter, 0).ToString());
File.AppendAllText(path, " ");
File.AppendAllText(path, list.GetValue(iter, 1).ToString());
File.AppendAllText(path, "\n");
}
}
示例2: PopulateForm
public void PopulateForm ()
{
//for (int i = 0; i < comboboxDevices.Model.IterNChildren(); i++)
// comboboxDevices.RemoveText(i);
/*
List<String> deviceNames = new List<string> ();
foreach (LedController controller in Manager.Controllers) {
deviceNames.Add (controller.DeviceVisibleName);
}
deviceNames.Sort ();
*/
string previousDeviceSerial = "";
if (comboboxDevices.Active >= 0)
previousDeviceSerial = DeviceEntities[comboboxDevices.Active].Serial;
ListStore store = new ListStore(typeof (string));
comboboxDevices.Model = store;
DeviceEntities = Manager.GetOnlineDeviceList();
int previousDeviceIndex = -1;
int index = -1;
foreach (DeviceEntity entity in DeviceEntities) {
store.AppendValues(entity.ToString());
index++;
if (entity.ToString() == previousDeviceSerial)
{
previousDeviceIndex = index;
}
}
SelectedController = null;
if (store.IterNChildren() >= 1 && previousDeviceIndex == -1)
{
comboboxDevices.Active = 0;
}
else if (previousDeviceIndex >= 0)
{
comboboxDevices.Active = previousDeviceIndex;
}
else
{
UpdateFormComponents();
}
}
示例3: ConnectDialog
public ConnectDialog()
: base(Gui.MainWindow.Window, "ConnectDialog")
{
store = new ListStore(typeof(object), typeof(string));
ipCombo.Model = store;
ipCombo.TextColumn = 1;
CellRendererPixbuf imageCell = new CellRendererPixbuf();
CellRendererText textCell = new CellRendererText();
ipCombo.Clear();
ipCombo.PackStart(imageCell, false);
ipCombo.PackStart(textCell, true);
ipCombo.SetCellDataFunc(imageCell, ShowImage);
ipCombo.SetCellDataFunc(textCell, ShowText);
ipCombo.WrapWidth = 3;
ipCombo.Entry.ActivatesDefault = true;
PopulateAddressCombo();
networksListStore = new ListStore(typeof(object));
networksListStore.AppendValues(new object());
foreach (Network network in Core.Networks) {
networksListStore.AppendValues(network);
}
networksComboBox.Clear();
CellRendererText networkNameCell = new CellRendererText();
networksComboBox.PackStart(networkNameCell, false);
networksComboBox.SetCellDataFunc(networkNameCell, new CellLayoutDataFunc(NetworkTextFunc));
networksComboBox.Model = networksListStore;
networksComboBox.Changed += delegate { PopulateAddressCombo(); };
networksComboBox.Active = Math.Min(networksListStore.IterNChildren(), 1);
notImage = Gui.LoadIcon(16, "dialog-warning");
localImage = Gui.LoadIcon(16, "stock_channel");
}
示例4: BuildCombo
private Widget BuildCombo(PipelineVariable variable)
{
ListStore model = new ListStore(typeof(string), typeof(string));
PipelineVariableComboBox box = new PipelineVariableComboBox(variable, model);
TreeIter active_iter = TreeIter.Zero;
box.Changed += OnComboChanged;
if(variable.PossibleValuesCount > 0) {
foreach(string key in variable.PossibleValuesKeys) {
TreeIter iter = ComboAppend(model, variable, variable.PossibleValues[key].Display, key);
if(variable.CurrentValue == key || (active_iter.Equals(TreeIter.Zero) &&
variable.DefaultValue == key)) {
active_iter = iter;
}
}
} else {
double min = variable.MinValue;
double max = variable.MaxValue;
double step = variable.StepValue;
double current = min;
for(; current <= max; current += step) {
ComboAppend(model, variable, current.ToString(), current.ToString());
}
}
if(active_iter.Equals(TreeIter.Zero)) {
for(int i = 0, n = model.IterNChildren(); i < n; i++) {
TreeIter iter;
if(model.IterNthChild(out iter, i)) {
string value = (string)model.GetValue(iter, 1);
if(value == variable.CurrentValue) {
active_iter = iter;
break;
}
}
}
}
CellRendererText text_renderer = new CellRendererText();
box.PackStart(text_renderer, true);
box.AddAttribute(text_renderer, "text", 0);
box.Model = model;
if(active_iter.Equals(TreeIter.Zero)) {
if(model.IterNthChild(out active_iter, 0)) {
box.SetActiveIter(active_iter);
}
} else {
box.SetActiveIter(active_iter);
}
return box;
}
示例5: SharedConstructor
private void SharedConstructor()
{
fileListStore = new ListStore(typeof(string));
fileList.Model = fileListStore;
TreeViewColumn theCol = fileList.AppendColumn("File Attachments", new CellRendererText(), "text", 0 );
theCol.Sizing = TreeViewColumnSizing.Autosize;
networksListStore = new ListStore(typeof (object));
networksListStore.AppendValues(new object());
foreach (Network network in Core.Networks) {
networksListStore.AppendValues (network);
}
networksComboBox.Clear ();
CellRendererText networkNameCell = new CellRendererText ();
networksComboBox.PackStart (networkNameCell, true);
networksComboBox.SetCellDataFunc (networkNameCell, NetworkTextFunc);
networksComboBox.Model = networksListStore;
networksComboBox.Active = Math.Min(networksListStore.IterNChildren(), 1);
}
示例6: SetupProviders
private void SetupProviders()
{
providers = Daemon.GetProviders ();
providerStore = new ListStore (typeof (string), typeof (string));
providerCombo.Model = providerStore;
CellRendererText renderer = new CellRendererText ();
providerCombo.PackStart (renderer, false);
providerCombo.AddAttribute (renderer, "text", 0);
foreach (Provider p in providers) {
if (p.Plugin != "beagle") {
providerStore.AppendValues (p.Name, p.Plugin);
}
}
if (providerStore.IterNChildren () == 0) {
providerRadio.Sensitive = false;
providerCombo.Sensitive = false;
specifyRadio.Active = true;
providerStore.AppendValues ("None", "None");
providerCombo.Active = 0;
} else {
providerCombo.Active = 0;
}
beagleRadio.Sensitive = FindProvider ("beagle") != null;
}
示例7: JoinChatroomDialog
public JoinChatroomDialog(Window parent)
: base(parent, "JoinChatroomDialog")
{
passwordEntry.Text = "";
networksListStore = new ListStore (typeof (object));
networksListStore.AppendValues (new object());
foreach (Network network in Core.Networks) {
networksListStore.AppendValues (network);
}
roomListStore = new ListStore (typeof(string), typeof(ChatRoom));
CellRendererText textCell = new CellRendererText ();
networkCombo.PackStart (textCell, true);
networkCombo.SetCellDataFunc (textCell, new CellLayoutDataFunc (networkComboBox_TextFunc));
networkCombo.Model = networksListStore;
roomNameCombo.Entry.Changed += roomNameCombo_Entry_Changed;
roomNameCombo.Entry.ActivatesDefault = true;
roomNameCombo.Entry.Text = "#";
var imageCell = new CellRendererPixbuf ();
roomNameCombo.PackEnd(imageCell, false);
roomNameCombo.SetCellDataFunc(imageCell, RoomComboImageFunc);
roomNameCombo.Model = roomListStore;
roomNameCombo.TextColumn = 0;
if (networksListStore.IterNChildren() > 0) {
networkCombo.Active = 1;
roomNameCombo.Entry.GrabFocus();
roomNameCombo.Entry.SelectRegion(1,1);
} else {
networkCombo.Active = 0;
}
base.Dialog.Shown += delegate {
roomNameCombo.Entry.SelectRegion (1,1);
};
EnableDisableOkButton();
}