public static bool SetActiveText (ComboBox cbox, string text) { // returns true if found, false if not found string tvalue; TreeIter iter; ListStore store = (ListStore) cbox.Model; store.IterChildren (out iter); tvalue = store.GetValue (iter, 0).ToString(); if (tvalue.Equals (text)) { cbox.SetActiveIter (iter); return true; } else { bool found = store.IterNext (ref iter); while (found == true) { tvalue = store.GetValue (iter, 0).ToString(); if (tvalue.Equals (text)) { cbox.SetActiveIter (iter); return true; } else found = store.IterNext (ref iter); } } return false; // not found }
public ErrorMatrixPanel(uint rows, uint cols) : base(4, 2, false) { divisorSpinButton = new SpinButton(1, 10000, 1); sourceOffsetXSpinButton = new SpinButton(1, cols, 1); customDivisorCheckButton = new CheckButton("Use a custom divisor?"); customDivisorCheckButton.Toggled += delegate { divisorSpinButton.Sensitive = customDivisorCheckButton.Active; }; matrixPanel = new MatrixPanel(rows, cols); matrixPanel.MatrixResized += delegate { sourceOffsetXSpinButton.Adjustment.Upper = matrixPanel.Columns; }; presets = new List<ErrorMatrix>(ErrorMatrix.Samples.listMatrices()); var presetsNames = from preset in presets select preset.Name; presetComboBox = new ComboBox(presetsNames.ToArray()); presetComboBox.Changed += delegate { int active = presetComboBox.Active; if (active >= 0) { Matrix = presets[active]; } }; ColumnSpacing = 2; RowSpacing = 2; BorderWidth = 2; Attach(new Label("Preset:") { Xalign = 0.0f }, 0, 1, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); Attach(presetComboBox, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); Attach(matrixPanel, 0, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 0, 0); Attach(new Label("Source offset X:") { Xalign = 0.0f }, 0, 1, 2, 3, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); Attach(sourceOffsetXSpinButton, 1, 2, 2, 3, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); Attach(customDivisorCheckButton, 0, 2, 3, 4, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); Attach(new Label("Divisor:") { Xalign = 0.0f }, 0, 1, 4, 5, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); Attach(divisorSpinButton, 1, 2, 4, 5, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); }
public ApplicationWidget(Project project,Gtk.Window parent) { parentWindow =parent; this.Build(); this.project = project; cbType = new ComboBox(); ListStore projectModel = new ListStore(typeof(string), typeof(string)); CellRendererText textRenderer = new CellRendererText(); cbType.PackStart(textRenderer, true); cbType.AddAttribute(textRenderer, "text", 0); cbType.Model= projectModel; TreeIter ti = new TreeIter(); foreach(SettingValue ds in MainClass.Settings.ApplicationType){// MainClass.Settings.InstallLocations){ if(ds.Value == this.project.ApplicationType){ ti = projectModel.AppendValues(ds.Display,ds.Value); cbType.SetActiveIter(ti); } else projectModel.AppendValues(ds.Display,ds.Value); } if(cbType.Active <0) cbType.Active =0; tblGlobal.Attach(cbType, 1, 2, 0,1, AttachOptions.Fill|AttachOptions.Expand, AttachOptions.Fill|AttachOptions.Expand, 0, 0); afc = new ApplicationFileControl(project.AppFile,ApplicationFileControl.Mode.EditNoSaveButton,parentWindow); vbox2.PackEnd(afc, true, true, 0); }
/// <summary> Called when our field changes on any instance of same type as our Object. </summary> private void OnFieldChanged(object Object, FieldOrProperty field, object oldValue) { if (this.Object == Object) { if (field.Type == typeof(string) || field.Type == typeof(float) || field.Type == typeof(int)) { Gtk.Entry entry = (Gtk.Entry)widgetTable[fieldTable.IndexOf(field)]; object val = field.GetValue(Object); if (val != null) { entry.Text = val.ToString(); } } else if (field.Type == typeof(bool)) { Gtk.CheckButton checkButton = (Gtk.CheckButton)widgetTable[fieldTable.IndexOf(field)]; checkButton.Active = (bool)field.GetValue(Object); } else if (field.Type.IsEnum) { Gtk.ComboBox comboBox = (Gtk.ComboBox)widgetTable[fieldTable.IndexOf(field)]; // FIXME: This will break if: // 1) the first enum isn't 0 and/or // 2) the vaules are not sequential (0, 1, 3, 4 wouldn't work) object val = field.GetValue(Object); if (val != null) { comboBox.Active = (int)val; } } } }
public static void ComboAccrualYearsFill(ComboBox combo, params string[] firstItems) { try { logger.Info ("Запрос лет для начислений..."); TreeIter iter; string sql = "SELECT DISTINCT year FROM accrual ORDER BY year DESC"; MySqlCommand cmd = new MySqlCommand (sql, QSMain.connectionDB); MySqlDataReader rdr = cmd.ExecuteReader (); ((ListStore)combo.Model).Clear (); foreach(var item in firstItems) { combo.AppendText (item); } combo.AppendText (Convert.ToString (DateTime.Now.AddYears (1).Year)); combo.AppendText (Convert.ToString (DateTime.Now.Year)); while (rdr.Read ()) { if (rdr.GetUInt32 ("year") == DateTime.Now.Year || rdr.GetUInt32 ("year") == DateTime.Now.AddYears (1).Year) continue; combo.AppendText (rdr ["year"].ToString ()); } rdr.Close (); ((ListStore)combo.Model).SetSortColumnId (0, SortType.Descending); ListStoreWorks.SearchListStore ((ListStore)combo.Model, Convert.ToString (DateTime.Now.Year), out iter); combo.SetActiveIter (iter); logger.Info ("Ok"); } catch (Exception ex) { logger.Warn (ex, "Ошибка получения списка лет!"); } }
public EnumEditor(object @object, PropertyInfo info) : base(@object, info) { Type type = info.PropertyType; foreach (FieldInfo fi in type.GetFields()) { if (!fi.IsStatic || fi.FieldType != type) continue; string name = fi.Name; DisplayNameAttribute dispname = Util.GetAttribute<DisplayNameAttribute>(fi, false); if (dispname != null) name = dispname.DisplayName; object value = fi.GetValue(null); this.mStore.AppendValues(new EnumValue(value, name)); } this.mCombo = new ComboBox(this.mStore); CellRendererText renderer = new CellRendererText(); this.mCombo.PackStart(renderer, true); this.mCombo.SetCellDataFunc(renderer, ComboFunc); this.mCombo.Show(); this.Add(this.mCombo); this.mCombo.Changed += this.OnComboChanged; this.Revert(); }
public MainWindow_Widget() : base("You know I'm no good") { SetDefaultSize(800, 600); BorderWidth = 8; SetPosition(WindowPosition.Center); // Title Title = "Widget Test"; // Label DeleteEvent += delegate { Application.Quit(); }; Fixed fix = new Fixed(); ComboBox combo = new ComboBox(distros); combo.Changed += OnChanged; lyrics = new Label(text); fix.Put(combo, 50, 30); fix.Put(lyrics, 50, 150); Add(fix); ShowAll(); }
void GroupsChanged () { if (combo != null) { combo.Changed -= combo_Changed; Remove (combo); } combo = Gtk.ComboBox.NewText (); combo.Changed += combo_Changed; #if GTK_SHARP_2_6 combo.RowSeparatorFunc = RowSeparatorFunc; #endif combo.Show (); PackStart (combo, true, true, 0); values = new ArrayList (); int i = 0; foreach (string name in manager.GroupNames) { values.Add (name); combo.AppendText (name); if (name == group) combo.Active = i; i++; } #if GTK_SHARP_2_6 combo.AppendText (""); #endif combo.AppendText (Catalog.GetString ("Rename Group...")); combo.AppendText (Catalog.GetString ("New Group...")); }
public TasksPanelWidget () { Build (); comboPriority = ComboBox.NewText (); foreach (TaskPriority priority in Enum.GetValues (typeof (TaskPriority))) comboPriority.AppendText (Enum.GetName (typeof (TaskPriority), priority)); comboPriority.Changed += new EventHandler (Validate); comboPriority.Show (); vboxPriority.PackEnd (comboPriority, false, false, 0); tokensStore = new ListStore (typeof (string), typeof (int)); tokensTreeView.AppendColumn (String.Empty, new CellRendererText (), "text", 0); tokensTreeView.Selection.Changed += new EventHandler (OnTokenSelectionChanged); tokensTreeView.Model = tokensStore; OnTokenSelectionChanged (null, null); buttonAdd.Clicked += new EventHandler (AddToken); buttonChange.Clicked += new EventHandler (ChangeToken); buttonRemove.Clicked += new EventHandler (RemoveToken); entryToken.Changed += new EventHandler (Validate); Styles.Changed += HandleUserInterfaceSkinChanged; }
public ComboBoxHelper(IDbConnection dbConnection,ComboBox comboBox,string nombre, string id,int elementoInicial,string tabla) { this.comboBox=comboBox; IDbCommand dbCommand= dbConnection.CreateCommand(); dbCommand.CommandText = string.Format(selectFormat,id,nombre,tabla); IDataReader dbDataReader= dbCommand.ExecuteReader(); // CellRendererText cell1=new CellRendererText(); // comboBox.PackStart(cell1,false); // comboBox.AddAttribute(cell1,"text",0); CellRendererText cell2=new CellRendererText(); comboBox.PackStart(cell2,false); comboBox.AddAttribute(cell2,"text",1);//añadimos columnas liststore=new ListStore(typeof(int),typeof(string)); TreeIter initialIter= liststore.AppendValues(0,"<sin asignar>");//si el elemento inicial no existe se selecciona esta opcion while(dbDataReader.Read()){ int id2=(int)dbDataReader[id]; string nombre2=dbDataReader[nombre].ToString(); TreeIter iter=liststore.AppendValues(id2,nombre2); if(elementoInicial==id2) initialIter=iter; } dbDataReader.Close(); comboBox.Model=liststore; comboBox.SetActiveIter(initialIter); }
public ComboBoxHelper( ComboBox comboBox, IDbConnection dbConnection, string keyFieldName, string valueFieldName, string tableName, int id) { this.comboBox = comboBox; CellRendererText cellRendererText = new CellRendererText(); comboBox.PackStart (cellRendererText, true); comboBox.AddAttribute (cellRendererText, "text", 1); listStore = new ListStore(typeof(int), typeof(string)); TreeIter initialTreeIter = listStore.AppendValues(0, "<sin asignar>"); IDbCommand dbCommand = dbConnection.CreateCommand (); dbCommand.CommandText = string.Format(selectFormat, keyFieldName, valueFieldName, tableName); IDataReader dataReader = dbCommand.ExecuteReader (); while (dataReader.Read ()) { int key = (int)dataReader[keyFieldName]; string value = (string)dataReader[valueFieldName]; TreeIter treeIter = listStore.AppendValues (key, value); if (key == id) initialTreeIter = treeIter; } dataReader.Close (); comboBox.Model = listStore; comboBox.SetActiveIter (initialTreeIter); }
public ToolBarComboBox(int width, int activeIndex, bool allowEntry, params string[] contents) { if (allowEntry) ComboBox = new ComboBoxEntry (contents); else { Model = new ListStore (typeof(string), typeof (object)); if (contents != null) { foreach (string entry in contents) { Model.AppendValues (entry, null); } } ComboBox = new ComboBox (); ComboBox.Model = Model; CellRendererText = new CellRendererText(); ComboBox.PackStart(CellRendererText, false); ComboBox.AddAttribute(CellRendererText,"text",0); } ComboBox.AddEvents ((int)Gdk.EventMask.ButtonPressMask); ComboBox.WidthRequest = width; if (activeIndex >= 0) ComboBox.Active = activeIndex; ComboBox.Show (); Add (ComboBox); Show (); }
public void onComboBoxChanged(object o, EventArgs args) { Gtk.ComboBox combo = o as Gtk.ComboBox; if (o == null) { return; } Gtk.TreeIter iter; if (combo.GetActiveIter(out iter)) { if (combo.Name == "startAtBox") { userSelectedStartLocation = (string)combo.Model.GetValue(iter, 0); startSelected = true; Console.WriteLine("*** Start Location selected: " + userSelectedStartLocation); } else if (combo.Name == "destinationBox") { userSelectedDestinationLocation = (string)combo.Model.GetValue(iter, 0); destinationSelected = true; Console.WriteLine("*** Destination Location selected: " + userSelectedDestinationLocation); } // update Go button visibility setGoButtonVisible(startSelected && destinationSelected); } }
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 (); }
public static void Fill(ComboBox comboBox, QueryResult queryResult) { CellRendererText cellRenderText = new CellRendererText (); comboBox.PackStart (cellRenderText, false); comboBox.SetCellDataFunc(cellRenderText, delegate(CellLayout Cell_layout, CellRenderer CellView, TreeModel tree_model, TreeIter iter) { IList row = (IList)tree_model.GetValue(iter, 0); cellRenderText.Text = row[1].ToString(); //Vamos a ver el uso de los parámetros para acceder a SQL }); ListStore listStore = new ListStore (typeof(IList)); //TODO localización de "Sin Asignar". IList first = new object[] { null, "<sin asignar>" }; TreeIter treeIterFirst = listStore.AppendValues (first); //TreeIter treeIterFirst = ListStore.AppendValues(first); foreach (IList row in queryResult.Rows) listStore.AppendValues (row); comboBox.Model = listStore; //Por defecto vale -1 (para el indice de categoría) comboBox.Active = 0; comboBox.SetActiveIter(treeIterFirst); }
public void Initialize (EditSession session) { this.session = session; //if standard values are supported by the converter, then //we list them in a combo if (session.Property.Converter.GetStandardValuesSupported (session)) { store = new ListStore (typeof(string), typeof(object)); //if converter doesn't allow nonstandard values, or can't convert from strings, don't have an entry if (session.Property.Converter.GetStandardValuesExclusive (session) || !session.Property.Converter.CanConvertFrom (session, typeof(string))) { combo = new ComboBox (store); var crt = new CellRendererText (); combo.PackStart (crt, true); combo.AddAttribute (crt, "text", 0); } else { combo = new ComboBoxEntry (store, 0); entry = ((ComboBoxEntry)combo).Entry; entry.HeightRequest = combo.SizeRequest ().Height; } PackStart (combo, true, true, 0); combo.Changed += TextChanged; //fill the list foreach (object stdValue in session.Property.Converter.GetStandardValues (session)) { store.AppendValues (session.Property.Converter.ConvertToString (session, stdValue), ObjectBox.Box (stdValue)); } //a value of "--" gets rendered as a --, if typeconverter marked with UsesDashesForSeparator object[] atts = session.Property.Converter.GetType () .GetCustomAttributes (typeof (StandardValuesSeparatorAttribute), true); if (atts.Length > 0) { string separator = ((StandardValuesSeparatorAttribute)atts[0]).Separator; combo.RowSeparatorFunc = (model, iter) => separator == ((string)model.GetValue (iter, 0)); } } // no standard values, so just use an entry else { entry = new Entry (); PackStart (entry, true, true, 0); } //if we have an entry, fix it up a little if (entry != null) { entry.HasFrame = false; entry.Changed += TextChanged; entry.FocusOutEvent += FirePendingChangeEvent; } if (entry != null && ShouldShowDialogButton ()) { var button = new Button ("..."); PackStart (button, false, false, 0); button.Clicked += ButtonClicked; } Spacing = 3; ShowAll (); }
public void creaVentanaArticulo() { App.Instance.Tabla=new Table(4,2,false); separaFilas(App.Instance.Tabla,10); App.Instance.vb.PackStart(App.Instance.Tabla,false,false,0); Label cat=new Label("Introduce el nombre del nuevo articulo: "); text= new Entry(); ComboBox cb=new ComboBox(); Label cat2=new Label("Selecciona la categoria: "); combot= new ComboBoxHelper(dbConnection,cb,"nombre","id",0,"categoria"); App.Instance.Tabla.Attach(cat,0,1,0,1); App.Instance.Tabla.Attach(text,1,2,0,1); App.Instance.Tabla.Attach(cat2,0,1,1,2); App.Instance.Tabla.Attach(cb,1,2,1,2); Label pre=new Label("Introduce el precio del nuevo articulo: "); precio=new Entry(); App.Instance.Tabla.Attach(pre,0,1,2,3); App.Instance.Tabla.Attach(precio,1,2,2,3); Button button=new Button("Añadir"); button.Clicked +=delegate{ añadirArticulo(dbConnection); if(!enBlanco) App.Instance.Wind.Destroy(); }; App.Instance.Tabla.Attach(button,1,2,3,4); App.Instance.Wind.ShowAll(); }
public static object GetId(ComboBox comboBox) { TreeIter treeIter; comboBox.GetActiveIter (out treeIter); IList row = (IList)comboBox.Model.GetValue (treeIter, 0); return row [0]; }
public ComboBoxHelper(ComboBox comboBox, object id, string selectSql) { CellRendererText cellRendererText = new CellRendererText (); comboBox.PackStart (cellRendererText, false); comboBox.SetCellDataFunc (cellRendererText, new CellLayoutDataFunc (delegate(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) { cellRendererText.Text = ((object[])tree_model.GetValue(iter, 0))[1].ToString(); })); ListStore listStore = new ListStore (typeof(object)); object[] initial = new object[] { null, "<sin asignar>" }; TreeIter initialTreeIter = listStore.AppendValues ((object)initial); IDbCommand dbCommand = App.Instance.DbConnection.CreateCommand (); dbCommand.CommandText = selectSql; IDataReader dataReader = dbCommand.ExecuteReader (); while (dataReader.Read()) { object currentId = dataReader [0]; object currentName = dataReader [1]; object[] values = new object[] { currentId, currentName }; TreeIter treeIter = listStore.AppendValues ((object)values); if (currentId.Equals (id)) initialTreeIter = treeIter; } dataReader.Close (); comboBox.Model = listStore; comboBox.SetActiveIter (initialTreeIter); }
public static void ComboPlaceNoFill(ComboBox combo, int Type_id) { //Заполняем комбобокс Номерами мест try { logger.Info ("Запрос номеров мест..."); int count = 0; string sql = "SELECT place_no FROM places " + "WHERE type_id = @type_id"; MySqlCommand cmd = new MySqlCommand (sql, QSMain.connectionDB); cmd.Parameters.AddWithValue ("@type_id", Type_id); MySqlDataReader rdr = cmd.ExecuteReader (); while (rdr.Read ()) { combo.AppendText (rdr ["place_no"].ToString ()); count++; } rdr.Close (); if (count == 1) combo.Active = 0; logger.Info ("Ok"); } catch (Exception ex) { logger.Error (ex, "Ошибка получения номеров мест!"); } }
public static object GetId(ComboBox comboBox) { TreeIter treeIter; comboBox.GetActiveIter (out treeIter); IList row = (IList)comboBox.Model.GetValue (treeIter, 0); //ILIST 0 por que es el unico elemento aunque dentro vallan las columnas return row [0]; }
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; }
private void BuildMediaTypeCombo () { var store = media_type_store = new TreeStore (typeof (IA.MediaType), typeof (string)); var combo = media_type_combo = new ComboBox (); combo.Model = store; all_iter = store.AppendValues (null, Catalog.GetString ("All")); mediatypes = new Dictionary<IA.FieldValue, TreeIter> (); foreach (var mediatype in IA.MediaType.Options.OrderBy (t => t.Name)) { if (mediatype.Id != "software") { var iter = store.AppendValues (mediatype, mediatype.Name); mediatypes.Add (mediatype, iter); if (mediatype.Children != null) { foreach (var child in mediatype.Children.OrderBy (t => t.Name)) { var child_iter = store.AppendValues (iter, child, child.Name); mediatypes.Add (child, child_iter); // FIXME should remember the last selected one in a schema or per-source in the db if (child.Id == "etree") combo.SetActiveIter (child_iter); } } } } var cell = new CellRendererText (); combo.PackStart (cell, true); combo.AddAttribute (cell, "text", 1); PackStart (new Label (Catalog.GetString ("Collection:")), false, false, 0); PackStart (combo, false, false, 0); }
public void creaVentanaArticulo() { titulo="Añadir articulo"; ventana(titulo); Label cat=new Label("Introduce el nombre del nuevo articulo: "); text= new Entry(); ComboBox cb=new ComboBox(); Label cat2=new Label("Selecciona la categoria: "); combot= new ComboBoxHelper(App.Instance.DbConnection,cb,"nombre","id",0,"categoria"); tabla.Attach(cat,0,1,0,1); tabla.Attach(text,1,2,0,1); tabla.Attach(cat2,0,1,1,2); tabla.Attach(cb,1,2,1,2); Label pre=new Label("Introduce el precio del nuevo articulo: "); precio=new Entry(); tabla.Attach(pre,0,1,2,3); tabla.Attach(precio,1,2,2,3); Button button=new Button("Añadir"); button.Clicked +=delegate{ añadirArticulo(App.Instance.DbConnection); if(!enBlanco){ window.Destroy(); refresh(); } }; tabla.Attach(button,1,2,3,4); window.Add(vbox); window.ShowAll(); }
private void BuildInterface () { field_chooser = ComboBox.NewText (); field_chooser.Changed += HandleFieldChanged; op_chooser = ComboBox.NewText (); op_chooser.RowSeparatorFunc = IsRowSeparator; op_chooser.Changed += HandleOperatorChanged; value_box = new HBox (); remove_button = new Button (new Image ("gtk-remove", IconSize.Button)); remove_button.Relief = ReliefStyle.None; remove_button.Clicked += OnButtonRemoveClicked; add_button = new Button (new Image ("gtk-add", IconSize.Button)); add_button.Relief = ReliefStyle.None; add_button.Clicked += OnButtonAddClicked; button_box = new HBox (); button_box.PackStart (remove_button, false, false, 0); button_box.PackStart (add_button, false, false, 0); foreach (QueryField field in sorted_fields) { field_chooser.AppendText (field.Label); } Show (); field_chooser.Active = 0; }
public static string GetActiveString(ComboBox box) { TreeIter iter; if(!box.GetActiveIter(out iter)) return null; return (string)box.Model.GetValue(iter, 0); }
public SearchCriteria(HBox aHbox, Gtk.Entry attr, ComboBox op, Gtk.Entry val, ComboBox bc) { hbox = aHbox; attrEntry = attr; critCombo = op; valEntry = val; boolCombo = bc; }
private SubtitleType fixedSubtitleType = SubtitleType.Unknown; //A subtitle type that must be selected public SubtitleFormatComboBox (ComboBox comboBox, SubtitleType fixedSubtitleType, string[] additionalActions) { this.comboBox = comboBox; this.fixedSubtitleType = fixedSubtitleType; this.additionalActions = additionalActions; InitComboBoxModel(); SetComboBox(); ConnectHandlers(); }
public NewlineTypeComboBox (ComboBox comboBox, NewlineType newlineTypeToSelect, string[] additionalActions) { this.comboBox = comboBox; this.newlineTypeToSelect = newlineTypeToSelect; this.additionalActions = additionalActions; InitComboBoxModel(); FillComboBox(); ConnectHandlers(); }
private SplitDialog(Gtk.Window parent) : base(parent) { this.Title = Catalog.GetString("Split Files"); this.SetSizeRequest (550,330); this.FileEntry.Changed += new EventHandler (OnEntryChanged); Formats = CreateFormatsComboBox(); LayoutComponents(); }
public WidgetBuilderOptionPanelWidget (Project project) : base (false, 6) { this.project = project as DotNetProject; Gtk.HBox box = new Gtk.HBox (false, 3); Gtk.Label lbl = new Gtk.Label (GettextCatalog.GetString ("Target Gtk# version:")); box.PackStart (lbl, false, false, 0); comboVersions = ComboBox.NewText (); ReferenceManager refmgr = new ReferenceManager (project as DotNetProject); foreach (string v in refmgr.SupportedGtkVersions) comboVersions.AppendText (v); comboVersions.Active = refmgr.SupportedGtkVersions.IndexOf (refmgr.GtkPackageVersion); refmgr.Dispose (); box.PackStart (comboVersions, false, false, 0); box.ShowAll (); PackStart (box, false, false, 0); HSeparator sep = new HSeparator (); sep.Show (); PackStart (sep, false, false, 0); if (!GtkDesignInfo.HasDesignedObjects (project)) return; GtkDesignInfo designInfo = GtkDesignInfo.FromProject (project); checkGettext = new CheckButton (GettextCatalog.GetString ("Enable gettext support")); checkGettext.Active = designInfo.GenerateGettext; checkGettext.Show (); PackStart (checkGettext, false, false, 0); box = new Gtk.HBox (false, 3); box.PackStart (new Label (GettextCatalog.GetString ("Gettext class:")), false, false, 0); entryGettext = new Gtk.Entry (); entryGettext.Text = designInfo.GettextClass; entryGettext.Sensitive = checkGettext.Active; box.PackStart (entryGettext, false, false, 0); box.ShowAll (); PackStart (box, false, false, 0); sep= new HSeparator (); sep.Show (); PackStart (sep, false, false, 0); box = new Gtk.HBox (false, 3); box.PackStart (new Label (GettextCatalog.GetString ("Stetic folder name :")), false, false, 0); entryFolderName = new Gtk.Entry (); entryFolderName.Text = designInfo.SteticFolderName; entryFolderName.Sensitive = false; box.PackStart (entryFolderName, false, false, 0); box.ShowAll (); PackStart (box, false, false, 0); checkHideFiles = new CheckButton (GettextCatalog.GetString ("Hide designer files")); checkHideFiles.Active = designInfo.HideGtkxFiles; checkHideFiles.Show (); PackStart (checkHideFiles, false, false, 0); }
/// <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; _mainWidget.Destroyed += _mainWidget_Destroyed; }
public FileSelectorDialog(string title, Gtk.FileChooserAction action) : base(title, action) { LocalOnly = true; // Add the text encoding selector Table table = new Table(2, 2, false); table.RowSpacing = 6; table.ColumnSpacing = 6; encodingLabel = new Label(GettextCatalog.GetString("_Character Coding:")); encodingLabel.Xalign = 0; table.Attach(encodingLabel, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0); encodingMenu = new Gtk.OptionMenu(); FillEncodings(); encodingMenu.SetHistory(0); table.Attach(encodingMenu, 1, 2, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); encodingMenu.Changed += EncodingChanged; // Add the viewer selector viewerLabel = new Label(GettextCatalog.GetString("Open With:")); viewerLabel.Xalign = 0; table.Attach(viewerLabel, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0); Gtk.HBox box = new HBox(false, 6); viewerSelector = Gtk.ComboBox.NewText(); box.PackStart(viewerSelector, true, true, 0); closeWorkspaceCheck = new CheckButton(GettextCatalog.GetString("Close current workspace")); closeWorkspaceCheck.Active = true; box.PackStart(closeWorkspaceCheck, false, false, 0); table.Attach(box, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); FillViewers(); viewerSelector.Changed += OnViewerChanged; table.ShowAll(); this.ExtraWidget = table; // Give back the height that the extra widgets take int w, h; GetSize(out w, out h); Resize(w, h + table.SizeRequest().Height); if (action == Gtk.FileChooserAction.SelectFolder) { ShowEncodingSelector = false; } if (action != Gtk.FileChooserAction.Open) { closeWorkspaceCheck.Visible = ShowViewerSelector = false; } }
private void createComboAges2() { combo_ages2 = ComboBox.NewText(); string [] ages2 = Util.StringToStringArray(Constants.Any); UtilGtk.ComboUpdate(combo_ages2, ages2, ""); combo_ages2.Active = UtilGtk.ComboMakeActive(ages2, Catalog.GetString(Constants.Any)); combo_ages2.Changed += new EventHandler(on_combo_ages2_changed); UtilGtk.ComboPackShowAndSensitive(hbox_combo_ages2, combo_ages2); combo_ages2.Sensitive = false; spin_ages2.Sensitive = false; }
protected void createComboEventType(Event myEvent) { combo_eventType = ComboBox.NewText(); string [] myTypes = findTypes(myEvent); UtilGtk.ComboUpdate(combo_eventType, myTypes, ""); combo_eventType.Active = UtilGtk.ComboMakeActive(myTypes, myEvent.Type); hbox_combo_eventType.PackStart(combo_eventType, true, true, 0); hbox_combo_eventType.ShowAll(); createSignal(); }
public WidgetBuilderOptionPanelWidget(Project project) : base(false, 6) { this.project = project as DotNetProject; Gtk.HBox box = new Gtk.HBox(false, 3); Gtk.Label lbl = new Gtk.Label(GettextCatalog.GetString("Target Gtk# version:")); box.PackStart(lbl, false, false, 0); comboVersions = ComboBox.NewText(); ReferenceManager refmgr = new ReferenceManager(project as DotNetProject); foreach (string v in refmgr.SupportedGtkVersions) { comboVersions.AppendText(v); } comboVersions.Active = refmgr.SupportedGtkVersions.IndexOf(refmgr.GtkPackageVersion); refmgr.Dispose(); box.PackStart(comboVersions, false, false, 0); box.ShowAll(); PackStart(box, false, false, 0); HSeparator sep = new HSeparator(); sep.Show(); PackStart(sep, false, false, 0); if (!GtkDesignInfo.HasDesignedObjects(project)) { return; } GtkDesignInfo designInfo = GtkDesignInfo.FromProject(project); checkGettext = new CheckButton(GettextCatalog.GetString("Enable gettext support")); checkGettext.Active = designInfo.GenerateGettext; checkGettext.Show(); PackStart(checkGettext, false, false, 0); box = new Gtk.HBox(false, 3); box.PackStart(new Label(GettextCatalog.GetString("Gettext class:")), false, false, 0); entryGettext = new Gtk.Entry(); entryGettext.Text = designInfo.GettextClass; entryGettext.Sensitive = checkGettext.Active; box.PackStart(entryGettext, false, false, 0); box.ShowAll(); PackStart(box, false, false, 0); checkGettext.Clicked += delegate { box.Sensitive = checkGettext.Active; if (checkGettext.Active) { entryGettext.Text = "Mono.Unix.Catalog"; } }; }
private void createComboEncoderMainVariable() { combo_encoder_main_variable = ComboBox.NewText(); comboEncoderMainVariableFill(); hbox_combo_encoder_main_variable.PackStart(combo_encoder_main_variable, false, false, 0); hbox_combo_encoder_main_variable.ShowAll(); combo_encoder_main_variable.Sensitive = true; combo_encoder_main_variable.Changed += new EventHandler(on_combo_encoder_main_variable_changed); }
private void createComboEncoderAutomaticVariable() { combo_encoder_variable_automatic = ComboBox.NewText(); string [] values = { Constants.MeanSpeed, Constants.MaxSpeed, Constants.MeanForce, Constants.MaxForce, Constants.MeanPower, Constants.PeakPower }; UtilGtk.ComboUpdate(combo_encoder_variable_automatic, values, ""); combo_encoder_variable_automatic.Active = UtilGtk.ComboMakeActive(combo_encoder_variable_automatic, "Mean power"); hbox_combo_encoder_variable_automatic.PackStart(combo_encoder_variable_automatic, false, false, 0); hbox_combo_encoder_variable_automatic.ShowAll(); combo_encoder_variable_automatic.Sensitive = true; }
public static void ClearCombo(Gtk.ComboBox combo) { // clear combo combo.Model = new ListStore(typeof(string)); combo.Active = -1; if (combo is ComboBoxEntry) { (combo as ComboBoxEntry).Entry.Text = String.Empty; } }
protected void ClearCombo(Gtk.ComboBox cb) { cb.Clear(); CellRendererText cell = new CellRendererText(); cb.PackStart(cell, false); cb.AddAttribute(cell, "text", 0); ListStore store = new ListStore(typeof(string)); cb.Model = store; }
public void SetComboValues(string [] values, string current) { combo = ComboBox.NewText(); UtilGtk.ComboUpdate(combo, values, ""); hbox_combo.PackStart(combo, true, true, 0); hbox_combo.ShowAll(); combo.Sensitive = true; combo.Active = UtilGtk.ComboMakeActive(values, current); }
private void createComboEvaluators() { combo_evaluators = ComboBox.NewText(); //first value (any) should be translated evaluators[0] = Constants.AnyID.ToString() + ":" + Catalog.GetString(Constants.Any); UtilGtk.ComboUpdate(combo_evaluators, evaluators, ""); combo_evaluators.Active = UtilGtk.ComboMakeActive(combo_evaluators, Catalog.GetString(Constants.Any)); combo_evaluators.Changed += new EventHandler(on_combo_other_changed); UtilGtk.ComboPackShowAndSensitive(hbox_combo_evaluators, combo_evaluators); }
// ============================================ // PUBLIC Constructors // ============================================ public TopBar() : base(false, 2) { // Initialize Search Logo this.imageLogo = StockIcons.GetImage("Search"); this.imageLogo.Xalign = 0.1f; this.imageLogo.Yalign = 0.1f; this.imageLogo.Xpad = 2; this.PackStart(this.imageLogo, false, false, 2); // Initialize Top VBox this.table = new Gtk.Table(3, 2, false); this.table.ColumnSpacing = 6; this.table.RowSpacing = 2; this.PackStart(this.table, true, true, 2); Gtk.Label label; // Initialize Search Label label = new Gtk.Label("<b>Search:</b>"); label.UseMarkup = true; label.Xalign = 1.0f; this.table.Attach(label, 0, 1, 0, 1); // Initialize Entry Search this.entrySearch = new Gtk.Entry(); this.table.Attach(this.entrySearch, 1, 2, 0, 1); // Initialize Search By label = new Gtk.Label("<b>By:</b>"); label.UseMarkup = true; label.Xalign = 1.0f; this.table.Attach(label, 0, 1, 1, 2); // Initialize Combo Search Type this.comboSearchType = ComboBox.NewText(); AddSearchType(); this.comboSearchType.Active = 0; this.table.Attach(this.comboSearchType, 1, 2, 1, 2); // Initialize Search By label = new Gtk.Label("<b>User:</b>"); label.UseMarkup = true; label.Xalign = 1.0f; table.Attach(label, 0, 1, 2, 3); // Initialize Combo Search Type this.comboSearchUser = ComboBox.NewText(); AddSearchUsers(); this.comboSearchUser.Active = 0; this.table.Attach(this.comboSearchUser, 1, 2, 2, 3); this.ShowAll(); }
//utility method to clear a gtk combobox private void clearComboBox() { Gtk.ComboBox cb = this.loadComboBox; cb.Clear(); CellRendererText cell = new CellRendererText(); cb.PackStart(cell, false); cb.AddAttribute(cell, "text", 0); ListStore store = new ListStore(typeof(string)); cb.Model = store; }
public override CellEditable StartEditing(Gdk.Event ev, Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, CellRendererState flags) { this.path = path; Gtk.ComboBox combo = Gtk.ComboBox.NewText(); foreach (string s in values) { combo.AppendText(s); } combo.Active = Array.IndexOf(values, Text); combo.Changed += new EventHandler(SelectionChanged); return(new TreeViewCellContainer(combo)); }
// HERZUM SPRINT 5.5: TLAB-242 private void setActiveComboBoxValue(Gtk.ComboBox cb, string s) { Gtk.TreeIter iter; cb.Model.GetIterFirst(out iter); do { GLib.Value thisRow = new GLib.Value(); cb.Model.GetValue(iter, 0, ref thisRow); if ((thisRow.Val as string).Equals(s)) { cb.SetActiveIter(iter); break; } } while (cb.Model.IterNext(ref iter)); }
/// <summary> /// Regenera un dropdown segun una lista pasada /// </summary> /// <param name="cb">ComboBox.</param> /// <param name="valores">Lista.</param> private void RepopulateComboBox(Gtk.ComboBox cb, List <string> valores) { cb.Clear(); CellRendererText cell = new CellRendererText(); cb.PackStart(cell, false); cb.AddAttribute(cell, "text", 0); ListStore store = new ListStore(typeof(string)); cb.Model = store; foreach (string str in valores) { cb.AppendText(str); } }
private void FillTestComboBox(Gtk.ComboBox cb) { cb.Clear(); CellRendererText cell = new CellRendererText(); cb.PackStart(cell, false); cb.AddAttribute(cell, "text", 0); ListStore store = new ListStore(typeof(string)); cb.Model = store; store.AppendValues("BitBlt"); store.AppendValues("Ellipse"); store.AppendValues("Polygon"); store.AppendValues("LineTo"); store.AppendValues("PolylineTo"); }
private void createComboCountries() { combo_countries = ComboBox.NewText(); countries = new String[1]; //record countries with id:english name:translatedName countries [0] = Constants.CountryUndefinedID + ":" + Constants.CountryUndefined + ":" + Catalog.GetString(Constants.CountryUndefined); string [] myCountries = new String[1]; myCountries [0] = Catalog.GetString(Constants.CountryUndefined); UtilGtk.ComboUpdate(combo_countries, myCountries, ""); combo_countries.Active = UtilGtk.ComboMakeActive(myCountries, Catalog.GetString(Constants.CountryUndefined)); combo_countries.Changed += new EventHandler(on_combo_other_changed); UtilGtk.ComboPackShowAndSensitive(hbox_combo_countries, combo_countries); }
public TalkWithDialog() : base("dialog", new XML(null, "TalkWithDialog.glade", "dialog", null)) { this.comboPeers = ComboBox.NewText(); this.vboxMain.PackStart(this.comboPeers, false, false, 2); // Add Peers if (P2PManager.KnownPeers != null) { foreach (UserInfo userInfo in P2PManager.KnownPeers.Keys) { this.comboPeers.AppendText(userInfo.Name); } } this.image.Pixbuf = StockIcons.GetPixbuf("TalkBubble"); this.dialog.ShowAll(); }
// ============================================ // PUBLIC Constructors // ============================================ /// Create New "Remove Peer" Dialog public RemovePeer() : base("dialog", "RemovePeerDialog.glade") { this.comboPeers = ComboBox.NewText(); this.vboxMain.PackStart(this.comboPeers, false, false, 2); // Add Peers if (P2PManager.KnownPeers != null) { foreach (UserInfo userInfo in P2PManager.KnownPeers.Keys) { this.comboPeers.AppendText(userInfo.Name); } } this.comboPeers.ShowAll(); // Initialize Dialog Image this.image.Pixbuf = StockIcons.GetPixbuf("Network", 96); }
public CopyOffsetPreferencesWidget() { // Use a hbox inside an vbox to avoid expanding vertically. Gtk.HBox hbox = new Gtk.HBox(); Gtk.Label label = new Gtk.Label(Catalog.GetString("Number base:")); numberBaseCombo = Gtk.ComboBox.NewText(); numberBaseCombo.AppendText("2"); numberBaseCombo.AppendText("8"); numberBaseCombo.AppendText("10"); numberBaseCombo.AppendText("16"); hbox.PackStart(label, false, false, 6); hbox.PackStart(numberBaseCombo, false, false, 6); this.PackStart(hbox, true, false, 6); this.ShowAll(); }
private void createComboLevels() { combo_levels = ComboBox.NewText(); levels = Constants.Levels; //first value has to be any (but is ok to put the id value of the LevelUndefinedID) levels[0] = Constants.LevelUndefinedID.ToString() + ":" + Catalog.GetString(Constants.Any); UtilGtk.ComboUpdate(combo_levels, levels, ""); combo_levels.Active = UtilGtk.ComboMakeActive(levels, Constants.LevelUndefinedID.ToString() + ":" + Catalog.GetString(Constants.Any)); hbox_combo_levels.PackStart(combo_levels, true, true, 0); hbox_combo_levels.ShowAll(); combo_levels.Sensitive = false; //level is shown when sport is not "undefined" and not "none" combo_levels.Changed += new EventHandler(on_combo_other_changed); UtilGtk.ComboPackShowAndSensitive(hbox_combo_levels, combo_levels); }
public void CreateComboCheckBoxes() { if (hbox_combo_all_none_selected.Children.Length > 0) { hbox_combo_all_none_selected.Remove(combo_all_none_selected); } combo_all_none_selected = ComboBox.NewText(); UtilGtk.ComboUpdate(combo_all_none_selected, comboCheckBoxesOptions, ""); //combo_all_none_selected.DisableActivate (); combo_all_none_selected.Changed += new EventHandler(on_combo_all_none_selected_changed); hbox_combo_all_none_selected.PackStart(combo_all_none_selected, true, true, 0); hbox_combo_all_none_selected.ShowAll(); combo_all_none_selected.Sensitive = true; combo_all_none_selected.Active = UtilGtk.ComboMakeActive(comboCheckBoxesOptions, Catalog.GetString("Selected")); }
protected override void OnBuildToolBar(Toolbar tb) { base.OnBuildToolBar(tb); if (fill_sep == null) { fill_sep = new Gtk.SeparatorToolItem(); } tb.AppendItem(fill_sep); if (fill_label == null) { fill_label = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Fill Style"))); } tb.AppendItem(fill_label); if (fill_button == null) { fill_button = new ToolBarDropDownButton(); fill_button.AddItem(Catalog.GetString("Outline Shape"), "ShapeTool.Outline.png", 0); fill_button.AddItem(Catalog.GetString("Fill Shape"), "ShapeTool.Fill.png", 1); fill_button.AddItem(Catalog.GetString("Fill and Outline Shape"), "ShapeTool.OutlineFill.png", 2); } tb.AppendItem(fill_button); Gtk.ComboBox dpbBox = dashPBox.SetupToolbar(tb); if (dpbBox != null) { dpbBox.Changed += (o, e) => { dashPattern = dpbBox.ActiveText; }; } }
private void createComboCamera(string [] devices, int current) { combo_camera = ComboBox.NewText(); if (devices.Length == 0) { devices = Util.StringToStringArray(Constants.CameraNotFound); current = 0; } UtilGtk.ComboUpdate(combo_camera, devices, ""); hbox_combo_camera.PackStart(combo_camera, true, true, 0); hbox_combo_camera.ShowAll(); if (current >= devices.Length) { current = 0; } combo_camera.Active = UtilGtk.ComboMakeActive(devices, devices[current]); }
/// Create New Remove Peer Dialog public RemovePeer() { XML xml = new XML(null, "RemovePeerDialog.glade", "dialog", null); xml.Autoconnect(this); this.comboPeers = ComboBox.NewText(); this.vboxMain.PackStart(this.comboPeers, false, false, 2); // Add Peers if (P2PManager.KnownPeers != null) { foreach (UserInfo userInfo in P2PManager.KnownPeers.Keys) { this.comboPeers.AppendText(userInfo.Name); } } this.image.Pixbuf = StockIcons.GetPixbuf("Network"); this.dialog.ShowAll(); }
private void OnComboBoxChanged(object o, EventArgs args) { try { Gtk.ComboBox comboBox = (Gtk.ComboBox)o; FieldOrProperty field = fieldTable[widgetTable.IndexOf(comboBox)]; // Parse the string back to enum. Enum oldValue = (Enum)field.GetValue(Object); Enum newValue = (Enum)Enum.Parse(field.Type, comboBox.ActiveText); if (!oldValue.Equals(newValue)) //no change => no Undo action { PropertyChangeCommand command = new PropertyChangeCommand( "Changed value of " + field.Name, field, Object, newValue); command.Do(); UndoManager.AddCommand(command); } } catch (Exception e) { ErrorDialog.Exception(e); } }
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); }
private void createComboContinents() { combo_continents = ComboBox.NewText(); continents = Constants.Continents; //first value has to be any continents[0] = Constants.Any + ":" + Catalog.GetString(Constants.Any); //create continentsTranslated, only with translated stuff continentsTranslated = new String[Constants.Continents.Length]; int i = 0; foreach (string continent in continents) { continentsTranslated[i++] = Util.FetchName(continent); } UtilGtk.ComboUpdate(combo_continents, continentsTranslated, ""); combo_continents.Active = UtilGtk.ComboMakeActive(continentsTranslated, Catalog.GetString(Constants.Any)); combo_continents.Changed += new EventHandler(on_combo_continents_changed); UtilGtk.ComboPackShowAndSensitive(hbox_combo_continents, combo_continents); }