本文整理汇总了C#中Gtk.ComboBox.SetAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# ComboBox.SetAttributes方法的具体用法?C# ComboBox.SetAttributes怎么用?C# ComboBox.SetAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.ComboBox
的用法示例。
在下文中一共展示了ComboBox.SetAttributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeExtraWidget
protected void InitializeExtraWidget()
{
PlaylistFormatDescription [] formats = PlaylistFileUtil.ExportFormats;
int default_export_index = PlaylistFileUtil.GetFormatIndex(formats, playlist);
// Build custom widget used to select the export format.
store = new ListStore(typeof(string), typeof(PlaylistFormatDescription));
foreach (PlaylistFormatDescription format in formats) {
store.AppendValues(format.FormatName, format);
}
HBox hBox = new HBox(false, 2);
combobox = new ComboBox(store);
CellRendererText crt = new CellRendererText();
combobox.PackStart(crt, true);
combobox.SetAttributes(crt, "text", 0);
combobox.Active = default_export_index;
combobox.Changed += OnComboBoxChange;
hBox.PackStart(new Label(Catalog.GetString("Select Format: ")), false, false, 0);
hBox.PackStart(combobox, true, true, 0);
combobox.ShowAll();
hBox.ShowAll();
ExtraWidget = hBox;
}
示例2: FilterComboBox
private Gtk.ComboBox FilterComboBox ()
{
filter_data = new Gtk.ListStore (new Type[] { typeof (string), typeof (string) });
Gtk.TreeIter iter;
iter = filter_data.Append ();
filter_data.SetValue (iter, 0, Catalog.GetString ("Anywhere"));
filter_data.SetValue (iter, 1, null);
iter = filter_data.Append ();
filter_data.SetValue (iter, 0, Catalog.GetString ("in Files"));
filter_data.SetValue (iter, 1, "File");
iter = filter_data.Append ();
filter_data.SetValue (iter, 0, Catalog.GetString ("in Addressbook"));
filter_data.SetValue (iter, 1, "Contact");
iter = filter_data.Append ();
filter_data.SetValue (iter, 0, Catalog.GetString ("in Mail"));
filter_data.SetValue (iter, 1, "MailMessage");
iter = filter_data.Append ();
filter_data.SetValue (iter, 0, Catalog.GetString ("in Web Pages"));
filter_data.SetValue (iter, 1, "WebHistory");
iter = filter_data.Append ();
filter_data.SetValue (iter, 0, Catalog.GetString ("in Chats"));
filter_data.SetValue (iter, 1, "IMLog");
Gtk.ComboBox combo = new Gtk.ComboBox (filter_data);
combo.Active = 0;
Gtk.CellRendererText renderer = new Gtk.CellRendererText ();
combo.PackStart (renderer, false);
combo.SetAttributes (renderer, new object[] { "text", 0 });
return combo;
}
示例3: BuildLayout
void BuildLayout ()
{
var primary_vbox = new VBox () {
Spacing = 6
};
// Source selector
var combo_align = new Alignment (0, .5f, 0, 0);
var combo_hbox = new HBox (false, 6);
combo_hbox.Add (new Label (Catalog.GetString ("Import from:")));
sources_combo = new ComboBox (sources_model);
var render = new CellRendererText ();
sources_combo.PackStart (render, true);
sources_combo.SetAttributes (render, "text", 1);
combo_hbox.Add (sources_combo);
combo_align.Add (combo_hbox);
combo_align.ShowAll ();
primary_vbox.Add (combo_align);
// Button row near the top
var align = new Alignment (1, .5f, 0, 0);
var button_box = new HButtonBox () {
Spacing = 6
};
button_box.Add (cancel_button = new Button (Stock.Cancel));
button_box.Add (import_button = new Button (Stock.Add));
align.Add (button_box);
align.ShowAll ();
primary_vbox.Add (align);
primary_vbox.Show ();
Add (primary_vbox);
}