private void PopulateCategoryOptionMenu() { categories = new List <Tag> (); categories.Add(tag_store.RootCategory); PopulateCategories(categories, tag_store.RootCategory); ListStore category_store = new ListStore(typeof(Pixbuf), typeof(string)); foreach (Category category in categories) { category_store.AppendValues(category.SizedIcon, Indentation(category) + category.Name); } category_option_menu.Sensitive = true; category_option_menu.Model = category_store; var icon_renderer = new CellRendererPixbuf(); icon_renderer.Width = (int)Tag.TagIconSize; category_option_menu.PackStart(icon_renderer, true); var text_renderer = new CellRendererText(); text_renderer.Alignment = Pango.Alignment.Left; text_renderer.Width = 150; category_option_menu.PackStart(text_renderer, true); category_option_menu.AddAttribute(icon_renderer, "pixbuf", 0); category_option_menu.AddAttribute(text_renderer, "text", 1); category_option_menu.ShowAll(); }
protected override void CreateComponents() { var options = GetTextEditorOptions(); this.editors = new [] { new MonoTextEditor(new TextDocument(), options), new MonoTextEditor(new TextDocument(), options), }; editors [0].Accessible.SetShouldIgnore(false); editors [0].Accessible.SetRole(AtkCocoa.Roles.AXGroup); editors [0].Accessible.SetTitle(GettextCatalog.GetString("Comparing Revision Editor")); editors [1].Accessible.SetShouldIgnore(false); editors [1].Accessible.SetRole(AtkCocoa.Roles.AXGroup); editors [1].Accessible.SetTitle(GettextCatalog.GetString("Original Revision Editor")); if (!viewOnly) { revisionStore = new ListStore(typeof(Revision), typeof(string), typeof(string), typeof(string)); revisionStore.AppendValues(GettextCatalog.GetString("Loading…"), "", ""); originalComboBox = new ComboBox(revisionStore); originalComboBox.Changed += OriginalComboBox_Changed; var revRenderer = new CellRendererText(); revRenderer.WidthChars = 62; originalComboBox.PackStart(revRenderer, false); originalComboBox.AddAttribute(revRenderer, "text", 1); var timeRenderer = new CellRendererText(); timeRenderer.WidthChars = 21; originalComboBox.PackStart(timeRenderer, false); originalComboBox.AddAttribute(timeRenderer, "text", 2); var authorRenderer = new CellRendererText(); originalComboBox.PackStart(authorRenderer, true); originalComboBox.AddAttribute(authorRenderer, "text", 3); originalComboBox.Accessible.SetTitle(GettextCatalog.GetString("Original Revision")); originalComboBox.Active = 0; originalComboBox.Sensitive = false; diffComboBox = new ComboBox(revisionStore); diffComboBox.Changed += DiffComboBox_Changed; diffComboBox.PackStart(revRenderer, false); diffComboBox.AddAttribute(revRenderer, "text", 1); diffComboBox.PackStart(timeRenderer, false); diffComboBox.AddAttribute(timeRenderer, "text", 2); diffComboBox.PackStart(authorRenderer, true); diffComboBox.AddAttribute(authorRenderer, "text", 3); diffComboBox.Accessible.SetTitle(GettextCatalog.GetString("Compared Revision")); diffComboBox.Active = 0; diffComboBox.Sensitive = false; this.headerWidgets = new [] { diffComboBox, originalComboBox }; } }
protected override void CreateComponents() { var options = GetTextEditorOptions(); this.editors = new [] { new MonoTextEditor(new TextDocument(), options), new MonoTextEditor(new TextDocument(), options), }; if (!viewOnly) { revisionStore = new ListStore(typeof(Revision), typeof(string), typeof(string), typeof(string)); revisionStore.AppendValues(GettextCatalog.GetString("Loading…"), "", ""); originalComboBox = new ComboBox(revisionStore); originalComboBox.Changed += OriginalComboBox_Changed; var revRenderer = new CellRendererText(); revRenderer.WidthChars = 62; originalComboBox.PackStart(revRenderer, false); originalComboBox.AddAttribute(revRenderer, "text", 1); var timeRenderer = new CellRendererText(); timeRenderer.WidthChars = 21; originalComboBox.PackStart(timeRenderer, false); originalComboBox.AddAttribute(timeRenderer, "text", 2); var authorRenderer = new CellRendererText(); originalComboBox.PackStart(authorRenderer, true); originalComboBox.AddAttribute(authorRenderer, "text", 3); // originalComboBox.AccessibilityTextFormat = GettextCatalog.GetString ("Select original revision, current: {0}"); originalComboBox.Active = 0; originalComboBox.Sensitive = false; diffComboBox = new ComboBox(revisionStore); diffComboBox.Changed += DiffComboBox_Changed; diffComboBox.PackStart(revRenderer, false); diffComboBox.AddAttribute(revRenderer, "text", 1); diffComboBox.PackStart(timeRenderer, false); diffComboBox.AddAttribute(timeRenderer, "text", 2); diffComboBox.PackStart(authorRenderer, true); diffComboBox.AddAttribute(authorRenderer, "text", 3); // diffComboBox.AccessibilityTextFormat = GettextCatalog.GetString ("Select diff revision, current: {0}"); diffComboBox.Active = 0; diffComboBox.Sensitive = false; this.headerWidgets = new [] { diffComboBox, originalComboBox }; } }
public Tuple <string, Widget> CreateExposureCompensation() { var dropdown = new ComboBox(); dropdown.Changed += (sender, e) => { var value = this.GetDropdownValue(dropdown); MMALCameraConfig.ExposureCompensation = int.Parse(value); ConfigForm.ReloadConfig = true; }; var expModel = new ListStore(typeof(int), typeof(string)); dropdown.Model = expModel; for (int i = -10; i <= 10; i++) { expModel.AppendValues(i, i.ToString()); } // Set the default value for this combo box dropdown.Active = 10; CellRendererText text = new CellRendererText(); dropdown.PackStart(text, false); dropdown.AddAttribute(text, "text", 0); return(new Tuple <string, Widget>("Exp Compensation", dropdown)); }
public override Gtk.Widget GetEditWidget() { namestore = new ListStore(typeof(string)); ComboBox combo = new ComboBox(namestore); CellRenderer rdr = new CellRendererText(); combo.PackStart(rdr, true); combo.AddAttribute(rdr, "text", 0); Array values = System.Enum.GetValues(parentRow.PropertyDescriptor.PropertyType); foreach (object s in values) { string str = parentRow.PropertyDescriptor.Converter.ConvertToString(s); TreeIter t = namestore.AppendValues(str); if (str == parentRow.PropertyDescriptor.Converter.ConvertToString(parentRow.PropertyValue)) { combo.SetActiveIter(t); } } combo.Changed += new EventHandler(combo_Changed); combo.Destroyed += new EventHandler(combo_Destroyed); return(combo); }
/// <summary> /// Initializes a new instance of the <see cref="InitialWaterView" /> class. /// </summary> public InitialWaterView(ViewBase owner) : base(owner) { Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.InitialWaterView.glade"); hpaned1 = (HPaned)builder.GetObject("hpaned1"); spinbutton1 = (SpinButton)builder.GetObject("spinbutton1"); entry1 = (Entry)builder.GetObject("entry1"); entry2 = (Entry)builder.GetObject("entry2"); frame1 = (Frame)builder.GetObject("frame1"); frame2 = (Frame)builder.GetObject("frame2"); radiobutton1 = (RadioButton)builder.GetObject("radiobutton1"); radiobutton2 = (RadioButton)builder.GetObject("radiobutton2"); combobox1 = (ComboBox)builder.GetObject("combobox1"); mainWidget = hpaned1; combobox1.PackStart(comboRender, false); combobox1.AddAttribute(comboRender, "text", 0); combobox1.Model = comboModel; frameRadio1 = new RadioButton(frame1.Label); frameRadio1.Active = true; frame1.LabelWidget = frameRadio1; frameRadio2 = new RadioButton(frameRadio1, frame2.Label); frameRadio2.Active = false; frame2.LabelWidget = frameRadio2; graphView1 = new GraphView(this); hpaned1.Pack2(graphView1.MainWidget, true, true); entry1.Changed += OnTextBox1TextChanged; entry2.Changed += OnTextBox2TextChanged; radiobutton1.Toggled += OnRadioButton1CheckedChanged; spinbutton1.Changed += OnNumericUpDown1ValueChanged; combobox1.Changed += OnComboBox1SelectedValueChanged; frameRadio1.Toggled += FrameRadio_Toggled; mainWidget.Destroyed += _mainWidget_Destroyed; }
public ComboBoxDialog() { Title = "Gtk Combo Box Dialog"; WidthRequest = 500; HeightRequest = 400; var vbox = new VBox(); this.VBox.PackStart(vbox); comboBox = new ComboBox(); vbox.PackStart(comboBox, false, false, 0); listStore = new ListStore(typeof(string), typeof(ComboBoxItem)); comboBox.Model = listStore; var cell = new CellRendererText(); comboBox.PackStart(cell, true); comboBox.AddAttribute(cell, "text", 0); AddItems(); Child.ShowAll(); Show(); }
/* old * static public TreeView NewMC(VBox pg,string name){ * var mmc = new TreeView(); * var tbox = new HBox(); * var tvc = new TreeViewColumn(); * var NameCell = new CellRendererText(); * tvc.PackStart(NameCell, true); * tvc.AddAttribute(NameCell, "text", 0); * mmc.AppendColumn(tvc); * tvc.Title = name; * var tp = new Label("mc"); tp.SetSizeRequest(200, 25); // FYI: mc = Multiple Choice * var nm = new Label(name); nm.SetSizeRequest(400, 25); * mmc.SetSizeRequest(400, 25); * tbox.Add(tp); * tbox.Add(nm); * tbox.Add(mmc); * * pg.Add(tbox); * MyDataBase.fields[name] = "mc"; * MyDataBase.defaults[name] = ""; * mmc.HeadersVisible = false; * mmc.FixedHeightMode = true; * mmc.HeightRequest = 30; * return mmc; * } */ static public ComboBox NewMC(VBox pg, string name) { var mmc = new ComboBox(); var tbox = new HBox(); //var NameCell = new CellRendererText(); //mmc.AddAttribute(NameCell, "text", 0); CellRendererText text = new CellRendererText(); mmc.PackStart(text, false); mmc.AddAttribute(text, "text", 0); var tp = new Label("mc"); tp.SetSizeRequest(200, 25); tp.SetAlignment(0, 0); // FYI: mc = Multiple Choice var nm = new Label(name.Replace("_", "__")); nm.SetSizeRequest(400, 25); nm.SetAlignment(0, 0); #if RottenBackGround tp.ModifyFg(StateType.Normal, new Gdk.Color(125, 18, 0)); nm.ModifyFg(StateType.Normal, new Gdk.Color(18, 125, 0)); #else tp.ModifyFg(StateType.Normal, new Gdk.Color(255, 180, 0)); nm.ModifyFg(StateType.Normal, new Gdk.Color(180, 255, 0)); #endif mmc.SetSizeRequest(400, 25); tbox.Add(tp); tbox.Add(nm); tbox.Add(mmc); pg.Add(tbox); MyDataBase.fields[name] = "mc"; MyDataBase.defaults[name] = ""; mmc.HeightRequest = 30; MainClass.mc[name] = mmc; objlink[mmc] = name; mmc.Changed += OnCombo; return(mmc); }
void inicializa_componentes() { svr = new ClaseServidor(); svr.Pto = "7070"; svr.NuevaConexion += Nueva_Conexion; svr.DatosRecibidos += Datos_Recibidos; svr.ConexionTerminada += Conexion_Terminada; con_buffer = tb_mostrar.Buffer; tb_mostrar.Editable = false; tb_mostrar.CursorVisible = false; cb_clientes.Clear(); cell1 = new CellRendererText(); cb_clientes.PackStart(cell1, false); cb_clientes.AddAttribute(cell1, "text", 0); cb_clientes.Model = lista_cte; lista_cte.AppendValues("Enviar a todos", "enviar a todos"); cb_seleccion.Clear(); cell2 = new CellRendererText(); cb_seleccion.PackStart(cell2, false); cb_seleccion.AddAttribute(cell2, "text", 0); cb_seleccion.Model = lista_des; lista_des.AppendValues("Desconectar a todos", "enviar a todos"); this.DeleteEvent += OnDeleteEvent; this.bt_conexion.Clicked += Bt_conexion_Clicked; this.bt_enviar.Clicked += Bt_enviar_Clicked; this.bt_historial.Clicked += Bt_historial_Clicked; this.bt_cerrar.Clicked += Bt_cerrar_Clicked; this.bt_desconectar.Clicked += Bt_desconectar_Clicked; }
public Tuple <string, Widget> CreateShutterSpeed() { var dropdown = new ComboBox(); dropdown.Changed += (sender, e) => { var value = this.GetDropdownValue(dropdown); MMALCameraConfig.ShutterSpeed = int.Parse(value); ConfigForm.ReloadConfig = true; }; // Shutter speed ComboBox var isoModel = new ListStore(typeof(string), typeof(string)); dropdown.Model = isoModel; isoModel.AppendValues("Auto", "0"); isoModel.AppendValues("1s", "1000000"); isoModel.AppendValues("2s", "2000000"); isoModel.AppendValues("3s", "3000000"); isoModel.AppendValues("4s", "4000000"); isoModel.AppendValues("5s", "5000000"); isoModel.AppendValues("6s", "6000000"); dropdown.Active = 0; CellRendererText text = new CellRendererText(); dropdown.PackStart(text, false); dropdown.AddAttribute(text, "text", 0); return(new Tuple <string, Widget>("Shutter speed", dropdown)); }
public Tuple <string, Widget> CreateSaturation() { var dropdown = new ComboBox(); dropdown.Changed += (sender, e) => { var value = this.GetDropdownValue(dropdown); MMALCameraConfig.Saturation = int.Parse(value); ConfigForm.ReloadConfig = true; }; // Brightness ComboBox var brightnessModel = new ListStore(typeof(int), typeof(string)); dropdown.Model = brightnessModel; for (int i = 0; i <= 10; i++) { brightnessModel.AppendValues(i * 10, (i * 10).ToString()); } dropdown.Active = 5; CellRendererText text = new CellRendererText(); dropdown.PackStart(text, false); dropdown.AddAttribute(text, "text", 0); return(new Tuple <string, Widget>("Saturation", dropdown)); }
/// <summary> /// Construtor /// </summary> public LegendView(ViewBase owner) : base(owner) { Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.LegendView.glade"); hbox1 = (HBox)builder.GetObject("hbox1"); combobox1 = (ComboBox)builder.GetObject("combobox1"); listview = (Gtk.TreeView)builder.GetObject("listview"); mainWidget = hbox1; combobox1.Model = comboModel; combobox1.PackStart(comboRender, false); combobox1.AddAttribute(comboRender, "text", 0); combobox1.Changed += OnPositionComboChanged; combobox1.Focused += OnTitleTextBoxEnter; listview.Model = listModel; TreeViewColumn column = new TreeViewColumn(); column.Title = "Series name"; column.PackStart(listToggle, false); listRender.Editable = false; column.PackStart(listRender, true); column.SetAttributes(listToggle, "active", 0); column.SetAttributes(listRender, "text", 1); listview.AppendColumn(column); listToggle.Activatable = true; listToggle.Toggled += OnItemChecked; mainWidget.Destroyed += _mainWidget_Destroyed; }
public Tuple <string, Widget> CreateExposureMode() { var dropdown = new ComboBox(); dropdown.Changed += (sender, e) => { var value = this.GetDropdownValue(dropdown); MMALCameraConfig.ExposureMode = (MMAL_PARAM_EXPOSUREMODE_T)Enum.Parse(typeof(MMAL_PARAM_EXPOSUREMODE_T), value); ConfigForm.ReloadConfig = true; }; var expModeModel = new ListStore(typeof(string), typeof(string)); dropdown.Model = expModeModel; var enums = Enum.GetValues(typeof(MMAL_PARAM_EXPOSUREMODE_T)).Cast <MMAL_PARAM_EXPOSUREMODE_T>().ToList(); for (var i = 0; i < enums.Count; i++) { var split = enums[i].ToString().Split('_'); expModeModel.AppendValues(split.Last(), enums[i].ToString()); } dropdown.Active = 1; CellRendererText text = new CellRendererText(); dropdown.PackStart(text, false); dropdown.AddAttribute(text, "text", 0); return(new Tuple <string, Widget>("Exposure Mode", dropdown)); }
public Tuple <string, Widget> CreateRotation() { var dropdown = new ComboBox(); dropdown.Changed += (sender, e) => { var value = this.GetDropdownValue(dropdown); MMALCameraConfig.Rotation = int.Parse(value); ConfigForm.ReloadConfig = true; }; var rotModel = new ListStore(typeof(int), typeof(string)); dropdown.Model = rotModel; rotModel.AppendValues(0, "0"); rotModel.AppendValues(90, "90"); rotModel.AppendValues(180, "180"); rotModel.AppendValues(270, "270"); // Set the default value for this combo box dropdown.Active = 0; CellRendererText text = new CellRendererText(); dropdown.PackStart(text, false); dropdown.AddAttribute(text, "text", 0); return(new Tuple <string, Widget>("Rotation", dropdown)); }
private static void init(ComboBox comboBox) { CellRendererText cellRendererText = new CellRendererText(); comboBox.PackStart(cellRendererText, false); comboBox.AddAttribute(cellRendererText, "text", 1); ListStore listStore = new ListStore(typeof(string), typeof(string)); comboBox.Model = listStore; }
public PropertyGrid(IServiceProvider parentServices) { this.serviceProvider = parentServices; grid = new MonoDevelop.DesignerSupport.PropertyGrid.PropertyGrid(); this.PackEnd(grid, true, true, 0); components = new ListStore(typeof(string), typeof(IComponent)); combo = new ComboBox(components); CellRenderer rdr = new CellRendererText(); combo.PackStart(rdr, true); combo.AddAttribute(rdr, "text", 0); this.PackStart(combo, false, false, 3); //for selecting nothing, i.e. deselect all components.AppendValues(new object[] { "", null }); combo.Changed += new EventHandler(combo_Changed); InitialiseServices(); }
public static void Fill(ComboBox comboBox, string selectSql, object id) { CellRendererText CellRendererText = new CellRendererText(); comboBox.PackStart(CellRendererText, false); comboBox.AddAttribute(CellRendererText, "text", 1); IDbCommand dbCommand = App.Instance.Connection.CreateCommand(); dbCommand.CommandText = selectSql; IDataReader dataReader = dbCommand.ExecuteReader(); ListStore listStore = new ListStore(typeof(string), typeof(string)); TreeIter initialTreeIter = listStore.AppendValues("0", ComboNullLabel); while (dataReader.Read()) { TreeIter treeIter = listStore.AppendValues(dataReader[0].ToString(), dataReader[1].ToString()); if (id.Equals(dataReader[0])) { initialTreeIter = treeIter; } } comboBox.SetActiveIter(initialTreeIter); }
/// <summary> /// Construtor /// </summary> public LegendView(ViewBase owner) : base(owner) { Glade.XML gxml = new Glade.XML("ApsimNG.Resources.Glade.LegendView.glade", "hbox1"); gxml.Autoconnect(this); _mainWidget = hbox1; combobox1.Model = comboModel; combobox1.PackStart(comboRender, false); combobox1.AddAttribute(comboRender, "text", 0); combobox1.Changed += OnPositionComboChanged; combobox1.Focused += OnTitleTextBoxEnter; listview.Model = listModel; TreeViewColumn column = new TreeViewColumn(); column.Title = "Series name"; column.PackStart(listToggle, false); listRender.Editable = false; column.PackStart(listRender, true); column.SetAttributes(listToggle, "active", 0); column.SetAttributes(listRender, "text", 1); listview.AppendColumn(column); listToggle.Activatable = true; listToggle.Toggled += OnItemChecked; _mainWidget.Destroyed += _mainWidget_Destroyed; }
public DropdownWidget(string label) { this.Build(); HBox box = new HBox(false, 10); _store = new ListStore(typeof(string)); _values = new List <string>(); CellRendererText cell = new CellRendererText(); _dropdown = new ComboBox(); _dropdown.PackStart(cell, false); _dropdown.AddAttribute(cell, "text", 0); _dropdown.Model = _store; if (!string.IsNullOrEmpty(label)) { _label = new Label(label); box.PackStart(_label, false, false, 0); } box.PackStart(_dropdown, false, false, 0); Add(box); }
/// <summary> /// Configuration at construction time /// </summary> private void SetupCombo() { mainWidget = combobox1; combobox1.PackStart(comboRender, false); combobox1.AddAttribute(comboRender, "text", 0); combobox1.Changed += OnSelectionChanged; mainWidget.Destroyed += _mainWidget_Destroyed; }
/// <summary>Constructor</summary> public DropDownView(ViewBase owner) : base(owner) { combobox1 = new ComboBox(comboModel); _mainWidget = combobox1; combobox1.PackStart(comboRender, false); combobox1.AddAttribute(comboRender, "text", 0); combobox1.Changed += OnSelectionChanged; }
/// <summary>Constructor</summary> public ColourDropDownView(ViewBase owner) : base(owner) { combobox1 = new ComboBox(comboModel); _mainWidget = combobox1; combobox1.PackStart(comboRender, true); combobox1.AddAttribute(comboRender, "text", 0); combobox1.SetCellDataFunc(comboRender, OnDrawColourCombo); combobox1.Changed += OnChanged; }
Widget IOptionsPanel.CreatePanelWidget() { HBox hbox = new HBox(false, 6); Label label = new Label(); string displayName = polSet != null?GettextCatalog.GetString("_Policy") : PolicyTitleWithMnemonic; label.MarkupWithMnemonic = "<b>" + displayName + ":</b>"; hbox.PackStart(label, false, false, 0); store = new ListStore(typeof(string), typeof(PolicySet)); policyCombo = new ComboBox(store); CellRenderer renderer = new CellRendererText(); policyCombo.PackStart(renderer, true); policyCombo.AddAttribute(renderer, "text", 0); label.MnemonicWidget = policyCombo; policyCombo.RowSeparatorFunc = (TreeModel model, TreeIter iter) => ((string)model.GetValue(iter, 0)) == "--"; hbox.PackStart(policyCombo, false, false, 0); VBox vbox = new VBox(false, 6); vbox.PackStart(hbox, false, false, 0); vbox.ShowAll(); FillPolicies(); policyCombo.Active = 0; Widget child = CreatePanelWidget(); //HACK: work around bug 469427 - broken themes match on widget names if (child.Name.IndexOf("Panel") > 0) { child.Name = child.Name.Replace("Panel", "_"); } vbox.PackEnd(child, true, true, 0); LoadFrom(GetCurrentValue()); loading = false; if (!IsRoot && !policyContainer.DirectHas <T> ()) { //in this case "parent" is always first in the list policyCombo.Active = 0; } else { UpdateSelectedNamedPolicy(); } policyCombo.Changed += HandlePolicyComboChanged; return(vbox); }
public TaskListPad() { Id = "MonoDevelop.Ide.Gui.Pads.TaskListPad"; VBox vbox = new VBox(); vbox.Accessible.SetShouldIgnore(true); switcherComboList = new ListStore(typeof(string), typeof(ITaskListView), typeof(string)); try { ExtensionNodeList viewCodons = AddinManager.GetExtensionNodes("/MonoDevelop/Ide/TaskList/View", typeof(TaskListViewCodon)); foreach (TaskListViewCodon codon in viewCodons) { switcherComboList.AppendValues(codon.Label, codon.View, codon.Class); } } catch (Exception e) // no codons loaded { LoggingService.LogError("Loading of Tasks Views failed: {0}", e.ToString()); } switcherCombo = new ComboBox(switcherComboList); switcherCombo.SetCommonAccessibilityAttributes("TaskPad.Switcher", GettextCatalog.GetString("Type Selector"), GettextCatalog.GetString("Select which type of tasks to display")); CellRenderer cr = new CellRendererText(); switcherCombo.PackStart(cr, true); switcherCombo.AddAttribute(cr, "text", 0); sw = new MonoDevelop.Components.CompactScrolledWindow(); sw.ShadowType = ShadowType.None; vbox.Add(sw); control = vbox; control.ShowAll(); // Load from preferences which one was used last time string className = (string)PropertyService.Get("Monodevelop.TaskList.ActiveView", ""); int pos = 0, i = 0; foreach (object[] row in switcherComboList) { if ((string)row[2] == className) { pos = i; break; } i++; } switcherCombo.Active = pos; }
/// <summary>Initializes a new instance of the <see cref="SummaryView"/> class.</summary> public SummaryView(ViewBase owner) : base(owner) { Glade.XML gxml = new Glade.XML("ApsimNG.Resources.Glade.SummaryView.glade", "vbox1"); gxml.Autoconnect(this); _mainWidget = vbox1; combobox1.PackStart(comboRender, false); combobox1.AddAttribute(comboRender, "text", 0); combobox1.Model = comboModel; htmlview = new HTMLView(this); layout1.Add(htmlview.MainWidget); }
public (string, Widget) CreateMultiColumnComboBox() { // create a store for our combo var store = new ListStore(typeof(string), typeof(string), typeof(bool)); // lets append some stock icons, passing the icon names, and a simple text column store.AppendValues("dialog-warning", "Warning", true); store.AppendValues("process-stop", "Stop", false); store.AppendValues("document-new", "New", true); store.AppendValues("edit-clear", "Clear", true); // create cells var imageCell = new CellRendererPixbuf(); var textCell = new CellRendererText(); // create the combo and pass the values in var combo = new ComboBox(store); combo.PackStart(imageCell, true); combo.PackStart(textCell, true); // add combo attributes to show in columns combo.AddAttribute(imageCell, "icon-name", 0); combo.AddAttribute(textCell, "text", 1); // lets use the store bool values to control sensitive rows // Process-stop (store index one) should be disabled in this sample // For a ComboBox item to be disabled, all cell renderers for the item need to have // their sensitivity disabled combo.AddAttribute(imageCell, "sensitive", 2); combo.AddAttribute(textCell, "sensitive", 2); // listen to index changed on combo combo.Changed += (sender, e) => ApplicationOutput.WriteLine(sender, $"Index changed to:{((ComboBox)sender).Active}"); // lets preselect the first option combo.Active = 0; return("Combo with Icons and Text:", combo); }
public PhonePage(Builder builder) : base(builder.GetObject("_rootPhonePageBox").Handle) { builder.Autoconnect(this); var listStore = new ListStore(typeof(string), typeof(string)); foreach (var country in Country.Countries) { listStore.AppendValues(country.Name, "+" + country.PhoneCode); } _comboBox.Model = listStore; _comboBox.Changed += CountryComboBoxChanged; var countryNameRenderer = new CellRendererText(); _comboBox.PackStart(countryNameRenderer, true); _comboBox.AddAttribute(countryNameRenderer, "text", 0); var countryCodeRenderer = new CellRendererText(); _comboBox.PackStart(countryCodeRenderer, false); _comboBox.AddAttribute(countryCodeRenderer, "text", 1); _okButton.Clicked += OkButtonClickedAsync; _codeEntry = new DigitsEntry(); _codeEntry.WidthRequest = 10; _codeEntry.MaxLength = 4; _codeEntry.MarginEnd = 5; _codeEntry.WidthChars = 4; _codeEntry.Changed += CodeEntryChanged; _hbox.PackStart(_codeEntry, false, false, 0); _phoneEntry = new DigitsEntry(); _phoneEntry.PlaceholderText = "--- --- -- --"; _phoneEntry.MaxLength = 10; _phoneEntry.MaxWidthChars = 10; _hbox.PackStart(_phoneEntry, true, true, 0); ShowAll(); }
protected override ComboBox CreateComboBox() { var box = new ComboBox(); cell_renderer = new CellRendererText(); box.PackStart(cell_renderer, false); box.AddAttribute(cell_renderer, "text", 0); box.SetCellDataFunc(cell_renderer, new CellLayoutDataFunc(RenderFont)); return(box); }
/// <summary>Initializes a new instance of the <see cref="SummaryView"/> class.</summary> public SummaryView(ViewBase owner) : base(owner) { Builder builder = new Builder("ApsimNG.Resources.Glade.SummaryView.glade"); vbox1 = (VBox)builder.GetObject("vbox1"); combobox1 = (ComboBox)builder.GetObject("combobox1"); _mainWidget = vbox1; combobox1.PackStart(comboRender, false); combobox1.AddAttribute(comboRender, "text", 0); combobox1.Model = comboModel; combobox1.Changed += comboBox1_TextChanged; htmlview = new HTMLView(this); vbox1.PackEnd(htmlview.MainWidget, true, true, 0); }
// Initialize Cell Renderers. This is neeeded for updating elements in the ComboBoxes. public void InitializeCellRenderers() { _donor_blood_antigen.PackStart(comboBoxRenderers[0], false); _donor_blood_antigen.AddAttribute(comboBoxRenderers[0], "text", 0); _donor_blood_rh.PackStart(comboBoxRenderers[1], false); _donor_blood_rh.AddAttribute(comboBoxRenderers[1], "text", 0); _recipient_blood_antigen.PackStart(comboBoxRenderers[2], false); _recipient_blood_antigen.AddAttribute(comboBoxRenderers[2], "text", 0); _recipient_blood_rh.PackStart(comboBoxRenderers[3], false); _recipient_blood_rh.AddAttribute(comboBoxRenderers[3], "text", 0); _donor_blood_antigen.Model = donorAntigens; _donor_blood_rh.Model = donorRHs; _recipient_blood_antigen.Model = recipientAntigens; _recipient_blood_rh.Model = recipientRHs; }