void PopulateCategoryOptionMenu(Tag t) { int history = 0; int i = 0; categories = new List <Tag> (); var root = db.Tags.RootCategory; categories.Add(root); PopulateCategories(categories, root); category_option_menu.Clear(); var cell2 = new CellRendererPixbuf(); category_option_menu.PackStart(cell2, false); category_option_menu.AddAttribute(cell2, "pixbuf", 0); var cell = new CellRendererText(); category_option_menu.PackStart(cell, true); category_option_menu.AddAttribute(cell, "text", 1); var store = new ListStore(new[] { typeof(Gdk.Pixbuf), typeof(string) }); category_option_menu.Model = store; foreach (Category category in categories) { if (t.Category == category) { history = i; } i++; string categoryName = category.Name; Gdk.Pixbuf categoryImage = category.Icon; store.AppendValues(new object[] { categoryImage, categoryName }); } category_option_menu.Sensitive = true; category_option_menu.Active = history; //category_option_menu.SetHistory ((uint)history); //category_option_menu.Active = (uint)history; }
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); }
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 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 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 (); }
void llenacombo_contrato() { combo_tipocontrato.Clear(); CellRendererText cell = new CellRendererText(); combo_tipocontrato.PackStart(cell, true); combo_tipocontrato.AddAttribute(cell, "text", 0); ListStore store = new ListStore(typeof(string)); combo_tipocontrato.Model = store; store.AppendValues((string)""); store.AppendValues((string)"DETERMINADO (1 MES)"); store.AppendValues((string)"DETERMINADO (2 MESES)"); store.AppendValues((string)"DETERMINADO (3 MESES)"); store.AppendValues((string)"INDETERMINADO"); store.AppendValues((string)"HONORARIOS (ASIMILABLES)"); store.AppendValues((string)"PRACTICAS"); TreeIter iter; if (store.GetIterFirst(out iter)) { combo_tipocontrato.SetActiveIter(iter); } combo_tipocontrato.Changed += new EventHandler(onComboBoxChanged_tipocontrato); }
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 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 (); }
void llena_horas_notas() { combobox_hora_nota.Clear(); CellRendererText cell2 = new CellRendererText(); combobox_hora_nota.PackStart(cell2, true); combobox_hora_nota.AddAttribute(cell2, "text", 0); ListStore store2 = new ListStore(typeof(string), typeof(int)); combobox_hora_nota.Model = store2; for (int i = 1; i < (int)classpublic.horario_24_horas + 1; i++) { store2.AppendValues((string)i.ToString("00").Trim()); } combobox_hora_nota.Changed += new EventHandler(onComboBoxChanged_hora_minutos_cita); combobox_minutos_nota.Clear(); CellRendererText cell3 = new CellRendererText(); combobox_minutos_nota.PackStart(cell3, true); combobox_minutos_nota.AddAttribute(cell3, "text", 0); ListStore store3 = new ListStore(typeof(string), typeof(int)); combobox_minutos_nota.Model = store3; for (int i = (int)0; i < 60; i = i + (int)classpublic.intervalo_minutos) { store3.AppendValues((string)i.ToString("00").Trim()); } combobox_minutos_nota.Changed += new EventHandler(onComboBoxChanged_hora_minutos_cita); combobox_hora_somato.Clear(); CellRendererText cell4 = new CellRendererText(); combobox_hora_somato.PackStart(cell4, true); combobox_hora_somato.AddAttribute(cell4, "text", 0); ListStore store4 = new ListStore(typeof(string), typeof(int)); combobox_hora_somato.Model = store4; for (int i = 1; i < (int)classpublic.horario_24_horas + 1; i++) { store4.AppendValues((string)i.ToString("00").Trim()); } combobox_hora_somato.Changed += new EventHandler(onComboBoxChanged_hora_minutos_cita); combobox_minutos_somato.Clear(); CellRendererText cell5 = new CellRendererText(); combobox_minutos_somato.PackStart(cell5, true); combobox_minutos_somato.AddAttribute(cell5, "text", 0); ListStore store5 = new ListStore(typeof(string), typeof(int)); combobox_minutos_somato.Model = store5; for (int i = (int)0; i < 60; i = i + (int)classpublic.intervalo_minutos) { store5.AppendValues((string)i.ToString("00").Trim()); } combobox_minutos_somato.Changed += new EventHandler(onComboBoxChanged_hora_minutos_cita); }
public void ShowWindow() { Application.Init(); gxml = new Glade.XML("contactviewer.glade", "MainWindow"); gxml.Autoconnect(this); ActionEntry[] entries = new ActionEntry [] { new ActionEntry("FileMenuAction", null, "_File", null, null, null), new ActionEntry("OpenAction", Gtk.Stock.Open, "_Open", "<control>O", Catalog.GetString("Open..."), new EventHandler(OnOpenDatabase)), new ActionEntry("QuitAction", Gtk.Stock.Quit, "_Quit", "<control>Q", Catalog.GetString("Quit"), new EventHandler(OnQuit)), new ActionEntry("HelpMenuAction", null, "_Help", null, null, null), new ActionEntry("AboutAction", Gnome.Stock.About, "_About", null, Catalog.GetString("About"), new EventHandler(OnAbout)) }; ActionGroup grp = new ActionGroup("MainGroup"); grp.Add(entries); ui_manager = new UIManager(); ui_manager.InsertActionGroup(grp, 0); ui_manager.AddUiFromResource("menu.xml"); MenubarHolder.Add(ui_manager.GetWidget("/MainMenu")); // Fix the TreeView that will contain all contacts contact_store = new ListStore(typeof(string), typeof(string)); ContactList.Model = contact_store; ContactList.RulesHint = true; ContactList.AppendColumn(Catalog.GetString("Contacts"), new CellRendererText(), "text", 1); ContactList.ButtonReleaseEvent += OnContactSelected; // This ListStore will let the user choose what to see in the contact list contact_show_type_store = new ListStore(typeof(string), typeof(string)); contact_show_type_store.AppendValues("DisplayName", Catalog.GetString("Display name")); contact_show_type_store.AppendValues("PrimaryEmail", Catalog.GetString("Primary E-mail")); contact_show_type_store.AppendValues("SecondEmail", Catalog.GetString("Secondary E-mail")); contact_show_type_store.AppendValues("NickName", Catalog.GetString("Nickname")); CellRendererText cell = new CellRendererText(); ListIdentifier.PackStart(cell, false); ListIdentifier.AddAttribute(cell, "text", 1); ListIdentifier.Model = contact_show_type_store; ListIdentifier.Active = 0; ListIdentifier.Changed += OnContactListTypeChanged; MainWindow.Icon = Beagle.Images.GetPixbuf("contact-icon.png"); MainWindow.DeleteEvent += OnDeleteEvent; LoadDatabase(); Application.Run(); }
/// <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; }
void FillCombo (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 ComboBoxHelper(ComboBox comboBox, IDbConnection dbConnection, string keyFieldName, string valueFieldName,string tableName,int initialId) { this.comboBox = comboBox; //this.initalId = initialId; CellRendererText cellRenderText1 = new CellRendererText(); comboBox.PackStart(cellRenderText1,false); comboBox.AddAttribute(cellRenderText1,"text",0);//el ultimo parametro el 0 sirve para elegir la columna a visualizar CellRendererText cellRenderText = new CellRendererText(); comboBox.PackStart(cellRenderText,false); comboBox.AddAttribute(cellRenderText,"text",1);//el ultimo parametro el 1 sirve para elegir la columna a visualizar 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(); //Recorre el dataReader para insertar los valores en el comboBox while(dataReader.Read()) { int id =(int) dataReader["id"]; string nombre = (string)dataReader["nombre"]; treeIter = listStore.AppendValues(id,nombre); if (id == initialId) initialTreeIter = treeIter; } dataReader.Close(); comboBox.Model = listStore; comboBox.SetActiveIter(initialTreeIter); comboBox.Changed += delegate { TreeIter treeIter; comboBox.GetActiveIter(out treeIter); int id = (int) listStore.GetValue(treeIter,0); Console.WriteLine("ID = "+ id); }; }
/// <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; _mainWidget.Destroyed += _mainWidget_Destroyed; }
public static void FillSizeCombo(ComboBox combo, string[] sizes) { combo.Clear (); var list = new ListStore (typeof(string)); foreach (var size in sizes) list.AppendValues (size); combo.Model = list; CellRendererText text = new CellRendererText (); combo.PackStart (text, true); combo.AddAttribute (text, "text", 0); }
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; }
//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 BindDesignDialog(string id, ArrayList validClasses, string baseFolder) { XML glade = new XML(null, "gui.glade", "BindDesignDialog", null); glade.Autoconnect(this); labelMessage.Text = GettextCatalog.GetString("The widget design {0} is not currently bound to a class.", id); fileEntry = new FolderEntry(); fileEntryBox.Add(fileEntry); fileEntry.ShowAll(); if (validClasses.Count > 0) { store = new ListStore(typeof(string)); foreach (string cname in validClasses) { store.AppendValues(cname); } comboClasses.Model = store; CellRendererText cr = new CellRendererText(); comboClasses.PackStart(cr, true); comboClasses.AddAttribute(cr, "text", 0); comboClasses.Active = 0; } else { radioSelect.Sensitive = false; radioCreate.Active = true; } fileEntry.Path = baseFolder; // Initialize the class name using the widget name int i = id.IndexOf('.'); if (i != -1) { entryClassName.Text = id.Substring(i + 1); entryNamespace.Text = id.Substring(0, i); } else { entryClassName.Text = id; entryNamespace.Text = lastNamespace; } dialog.Response += new Gtk.ResponseHandler(OnResponse); UpdateStatus(); }
private void SetupExportPlugins() { ListStore model = new ListStore(typeof(string), typeof(ExportPlugin)); foreach(ExportPlugin plugin in pluginManager.Plugins) { model.AppendValues(plugin.Description, plugin); } Gtk.CellRenderer renderer = new Gtk.CellRendererText(); ExportAsCombo.PackStart(renderer, false); ExportAsCombo.AddAttribute(renderer, "text", 0); ExportAsCombo.Model = model; ExportAsCombo.Active = 0; }
void llenado_combobox_tipo_paciente() { // Llenado de combobox combobox_tipo_admision.Clear(); CellRendererText cell2 = new CellRendererText(); combobox_tipo_admision.PackStart(cell2, true); combobox_tipo_admision.AddAttribute(cell2, "text", 0); ListStore store2 = new ListStore(typeof(string), typeof(int)); combobox_tipo_admision.Model = store2; // lleno de la tabla de his_tipo_de_admisiones NpgsqlConnection conexion; conexion = new NpgsqlConnection(connectionString + nombrebd); // Verifica que la base de datos este conectada try{ conexion.Open(); NpgsqlCommand comando; comando = conexion.CreateCommand(); comando.CommandText = "SELECT * FROM osiris_his_tipo_admisiones " + "WHERE cuenta_mayor = 4000 " + "ORDER BY descripcion_admisiones;"; NpgsqlDataReader lector = comando.ExecuteReader(); store2.AppendValues("", 0); while (lector.Read()) { store2.AppendValues((string)lector["descripcion_admisiones"], (int)lector["id_tipo_admisiones"]); } }catch (NpgsqlException ex) { MessageDialog msgBoxError = new MessageDialog(MyWinError, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, "PostgresSQL error: {0}", ex.Message); msgBoxError.Run(); msgBoxError.Destroy(); } conexion.Close(); TreeIter iter2; if (store2.GetIterFirst(out iter2)) { //Console.WriteLine(iter2); combobox_tipo_admision.SetActiveIter(iter2); } combobox_tipo_admision.Changed += new EventHandler(onComboBoxChanged_tipo_admision); }
private void PopulateComboBox(ComboBox combobox, string active, IEnumerable<string> enumerable) { ListStore model = new ListStore (typeof (string)); combobox.Model = model; foreach (string s in enumerable) { TreeIter iter = model.AppendValues (s); if (s == active) combobox.SetActiveIter (iter); } CellRendererText cr = new CellRendererText (); combobox.PackStart (cr, false); combobox.AddAttribute (cr, "text", 0); }
/// <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); } }
void llenado_municipios(string tipo_, string descripcionmunicipio_) { combobox_municipios.Clear(); CellRendererText cell3 = new CellRendererText(); combobox_municipios.PackStart(cell3, true); combobox_municipios.AddAttribute(cell3, "text", 0); ListStore store3 = new ListStore(typeof(string)); combobox_municipios.Model = store3; if (tipo_ == "selecciona") { store3.AppendValues((string)descripcionmunicipio_); } NpgsqlConnection conexion; conexion = new NpgsqlConnection(connectionString + nombrebd); // Verifica que la base de datos este conectada try{ conexion.Open(); NpgsqlCommand comando; comando = conexion.CreateCommand(); comando.CommandText = "SELECT descripcion_municipio FROM osiris_municipios WHERE id_estado = '" + idestado.ToString() + "' " + "ORDER BY descripcion_municipio;"; NpgsqlDataReader lector = comando.ExecuteReader(); while (lector.Read()) { store3.AppendValues((string)lector["descripcion_municipio"]); } }catch (NpgsqlException ex) { MessageDialog msgBoxError = new MessageDialog(MyWinError, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, "PostgresSQL error: {0}", ex.Message); msgBoxError.Run(); msgBoxError.Destroy(); } conexion.Close(); TreeIter iter3; if (store3.GetIterFirst(out iter3)) { combobox_municipios.SetActiveIter(iter3); } combobox_municipios.Changed += new EventHandler(onComboBoxChanged_municipios); }
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 populateComboBox(Database db) { // Set up the comboBox. CellRendererText combocell = new CellRendererText(); comboBox.PackStart(combocell, false); comboBox.AddAttribute(combocell, "text", 0); ListStore combostore = new ListStore(typeof(string)); comboBox.Model = combostore; // Take the names of the tables. for (int i = 0; i < db.Tables.Count; ++i) { Model.Table table = db.Tables[i]; combostore.AppendValues(table.Name); } comboBox.Changed += new EventHandler(OnComboBoxChanged); comboBox.ShowAll(); }
public FeedbackControl(TypFeedback type) : base(3,2,false) { typeFeedback = type; this.RowSpacing = 3; this.ColumnSpacing = 3; Label lblSubject = GetLabel("Subject"); this.Attach(lblSubject,0,1,0,1,AttachOptions.Fill,AttachOptions.Fill,0,0); entrSubject = new Entry(); this.Attach(entrSubject,1,2,0,1,AttachOptions.Fill|AttachOptions.Expand,AttachOptions.Fill,0,0); cbType = new ComboBox(); projectModel = new ListStore(typeof(string), typeof(string)); CellRendererText textRenderer = new CellRendererText(); cbType.PackStart(textRenderer, true); cbType.AddAttribute(textRenderer, "text", 0); cbType.Model= projectModel; projectModel.AppendValues("IDE and Emulator","IDE and Emulator" ); projectModel.AppendValues("Framework and Documentation","Framework and Documentation" ); projectModel.AppendValues("Deployment, Devices and Publishing","Deployment, Devices and Publishing" ); projectModel.AppendValues("Web moscrif.com","Web moscrif.com" ); cbType.Active = 0; Label lblVersion = GetLabel("Product Group"); this.Attach(lblVersion,0,1,1,2,AttachOptions.Fill,AttachOptions.Fill,0,0); this.Attach(cbType,1,2,1,2,AttachOptions.Fill|AttachOptions.Expand,AttachOptions.Fill,0,0); Label lblDescription = GetLabel("Description"); this.Attach(lblDescription,0,1,2,3,AttachOptions.Fill,AttachOptions.Fill,0,0); tvDescription = new TextView(); ScrolledWindow sw = new ScrolledWindow (); sw.ShadowType = ShadowType.Out; sw.Add(tvDescription); this.Attach(sw,1,2,2,3,AttachOptions.Fill|AttachOptions.Expand,AttachOptions.Fill|AttachOptions.Expand,0,0); this.ShowAll(); }
public PropertyGrid(ServiceContainer parentServices) { this.parentServices = parentServices; grid = new AspNetEdit.UI.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 TimePeriodAdderView(Glade.XML gxml) { startTimeEntry = (Gtk.Entry)gxml.GetWidget ("startTimestampEntry"); endTimeEntry = (Gtk.Entry)gxml.GetWidget ("endTimestampEntry"); blockCommentTextview = (Gtk.TextView)gxml.GetWidget ("blockCommentTextview"); addBlockButton = (Gtk.Button)gxml.GetWidget ("addBlockButton"); cancelBlockButton = (Gtk.Button)gxml.GetWidget ("cancelBlockButton"); startBlockButton = (Gtk.Button)gxml.GetWidget ("startBlockButton"); taskCombobox = (Gtk.ComboBox)gxml.GetWidget ("taskCombobox"); Gtk.CellRendererText colCell = new Gtk.CellRendererText (); taskCombobox.PackStart (colCell, false); taskTree = new Gtk.TreeStore (typeof(string)); taskCombobox.AddAttribute (colCell, "text", 0); taskCombobox.Model = taskTree; notDefiningBlockSensitivity (); }
public DataDatabaseView(string fileName) { hbox = new HBox(); sqlLiteDal = new SqlLiteDal(fileName); lblTable = new Label(MainClass.Languages.Translate("tables")); hbox.PackStart(lblTable,false,false,10); cbTable = new ComboBox(); cbTable.Changed += new EventHandler(OnComboProjectChanged); CellRendererText textRenderer = new CellRendererText(); cbTable.PackStart(textRenderer, true); cbTable.AddAttribute(textRenderer, "text", 0); cbTable.Model = tablesComboModel; cbTable.WidthRequest = 200; hbox.PackStart(cbTable,false,false,2); hbox.PackEnd(new Label(""),true,true,2); this.PackStart(hbox,false,false,5); ScrolledWindow sw = new ScrolledWindow (); sw.ShadowType = ShadowType.EtchedIn; sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic); treeView = new TreeView (tableModel); treeView.RulesHint = true; //treeView.SearchColumn = (int) Column.Description; sw.Add (treeView); this.PackStart(sw,true,true,5); this.ShowAll(); GetTables(); }
public void BindCombobox(ComboBox cb, string [] values) { cb.Clear (); var store = new ListStore (typeof(string)); cb.Model = store; foreach (var input in values) { store.AppendValues (input); } var text = new CellRendererText {Style = Pango.Style.Oblique}; cb.PackStart(text,true); cb.AddAttribute (text, "text", 0); }
public override Widget CreatePanelWidget () { HBox hbox = new HBox (false, 6); Label label = new Label (); label.MarkupWithMnemonic = GettextCatalog.GetString ("_Policy:"); 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 (); notebook = new Notebook (); // Get the panels for all mime types List<string> types = new List<string> (); types.AddRange (DesktopService.GetMimeTypeInheritanceChain (mimeType)); panelData.SectionLoaded = true; panels = panelData.Panels; foreach (IMimeTypePolicyOptionsPanel panel in panelData.Panels) { panel.SetParentSection (this); Widget child = panel.CreateMimePanelWidget (); Label tlabel = new Label (panel.Label); label.Show (); child.Show (); Alignment align = new Alignment (0.5f, 0.5f, 1f, 1f); align.BorderWidth = 6; align.Add (child); align.Show (); notebook.AppendPage (align, tlabel); panel.LoadCurrentPolicy (); } notebook.Show (); vbox.PackEnd (notebook, true, true, 0); FillPolicies (); policyCombo.Active = 0; loading = false; if (!isRoot && panelData.UseParentPolicy) { //in this case "parent" is always first in the list policyCombo.Active = 0; notebook.Sensitive = false; } else { UpdateSelectedNamedPolicy (); } policyCombo.Changed += HandlePolicyComboChanged; return vbox; }
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> /// Constructor /// </summary> /// <param name="service"> /// The <see cref="StreamrecorderService"/> that is being configured /// </param> /// <param name="previous_output_folder"> /// A <see cref="System.String"/> containing the previously configured output directory /// </param> /// <param name="previous_encoder"> /// A <see cref="System.String"/> containing the previously configured encoder /// </param> /// <param name="is_importing_enabled"> /// A <see cref="System.Boolean"/> indicating whether file scanning was previously enabled /// </param> /// <param name="is_splitting_enabled"> /// A <see cref="System.Boolean"/> indicating whether file splitting was previously enabled /// </param> public StreamrecorderConfigDialog(StreamrecorderService service, string previous_output_folder, string previous_encoder, bool is_importing_enabled, bool is_splitting_enabled) { streamrecorder_service = service; encoderbox.IdColumn = 0; preferences_image.Yalign = 0f; preferences_image.IconName = "gtk-preferences"; preferences_image.IconSize = (int)IconSize.Dialog; preferences_image.Show(); header_label.Text = String.Format(AddinManager.CurrentLocalizer.GetString("{0}Streamrecorder configuration\n{1}"), "<span weight=\"bold\" size=\"larger\">", "</span>"); header_label.UseMarkup = true; header_label.Wrap = true; header_label.Yalign = 0f; header_label.Xalign = 0f; description_label.Text = AddinManager.CurrentLocalizer.GetString("Please select output folder for ripped files and if ripped\n" + "files should be imported to media library.\n"); description_label.Yalign = 0f; description_label.Xalign = 0f; choose_folder_label.Text = AddinManager.CurrentLocalizer.GetString("Output folder:"); choose_encoder_label.Text = AddinManager.CurrentLocalizer.GetString("Encoder:"); output_folder.Text = previous_output_folder; choose_output_folder_button.Label = AddinManager.CurrentLocalizer.GetString("_Browse"); choose_output_folder_button.Image = new Image("gtk-directory", IconSize.Button); choose_output_folder_button.ShowAll(); cancel_button.Label = AddinManager.CurrentLocalizer.GetString("_Cancel"); cancel_button.Image = new Image("gtk-cancel", IconSize.Button); save_button.Label = AddinManager.CurrentLocalizer.GetString("_Save"); save_button.Image = new Image("gtk-save", IconSize.Button); enable_import_ripped_songs.Label = AddinManager.CurrentLocalizer.GetString("Import files to media library"); enable_import_ripped_songs.Active = StreamrecorderService.IsImportingEnabledEntry.Get().Equals("True") ? true : false; enable_automatic_splitting.Label = AddinManager.CurrentLocalizer.GetString("Enable automatic files splitting by Metadata"); enable_automatic_splitting.Active = StreamrecorderService.IsFileSplittingEnabledEntry.Get().Equals("True") ? true : false; encoderbox.Clear(); CellRendererText cell = new CellRendererText(); encoderbox.PackStart(cell, false); encoderbox.AddAttribute(cell, "text", 0); ListStore store = new ListStore(typeof(string)); encoderbox.Model = store; int row = -1; int chosen_row = -1; foreach (string encoder in streamrecorder_service.GetEncoders()) { row++; store.AppendValues(encoder); if (encoder.Equals(previous_encoder)) { chosen_row = row; Hyena.Log.DebugFormat("[StreamrecorderConfigDialog] found active encoder in row {1}: {0}", encoder, chosen_row); } } if (chosen_row > -1) { Gtk.TreeIter iter; encoderbox.Model.IterNthChild(out iter, chosen_row); encoderbox.SetActiveIter(iter); } else { Gtk.TreeIter iter; encoderbox.Model.GetIterFirst(out iter); encoderbox.SetActiveIter(iter); } HBox main_container = new HBox(); VBox action_container = new VBox(); main_container.Spacing = 12; main_container.BorderWidth = 6; action_container.PackStart(header_label, true, true, 0); action_container.PackStart(description_label, true, true, 0); VBox choosing_labels = new VBox(); choosing_labels.PackStart(choose_folder_label, true, true, 5); choosing_labels.PackStart(choose_encoder_label, true, true, 5); HBox folder_choosing = new HBox(); folder_choosing.PackStart(output_folder, true, true, 5); folder_choosing.PackStart(choose_output_folder_button, true, true, 0); VBox box_choosing = new VBox(); box_choosing.PackStart(folder_choosing, true, true, 0); box_choosing.PackStart(encoderbox, true, true, 5); HBox all_choosing = new HBox(); all_choosing.PackStart(choosing_labels, true, true, 0); all_choosing.PackStart(box_choosing, true, true, 0); action_container.PackStart(all_choosing, true, true, 5); action_container.PackStart(enable_automatic_splitting, true, true, 5); action_container.PackStart(enable_import_ripped_songs, true, true, 5); main_container.PackStart(preferences_image, true, true, 5); main_container.PackEnd(action_container, true, true, 5); this.ContentArea.PackStart(main_container, true, true, 5); AddActionWidget(cancel_button, 0); AddActionWidget(save_button, 0); choose_output_folder_button.Clicked += new EventHandler(OnChooseOutputFolderButtonClicked); cancel_button.Clicked += new EventHandler(OnCancelButtonClicked); save_button.Clicked += new EventHandler(OnSaveButtonClicked); Title = "Streamrecorder configuration"; IconName = "gtk-preferences"; Resizable = false; BorderWidth = 6; // HasSeparator = false; this.ContentArea.Spacing = 12; ShowAll(); }
private void GenerateContent(ref Gtk.Table tableSystem, string label, int xPos, Condition cd,bool isResolution) { ListStore lstorePlatform = new ListStore(typeof(int),typeof(int),typeof(string)); int selectRule = 0; if (conditionRules_Old.Count > 0) { ConditionRule cr = conditionRules_Old.Find(x => x.ConditionId == cd.Id); if (cr != null) selectRule = cr.RuleId; } Label lblPlatform = new Label(label); lblPlatform.Name = "lbl_" + label; lblPlatform.Xalign = 1; lblPlatform.Yalign = 0.5F; ComboBox cboxPlatform = new ComboBox(); cboxPlatform.Name = "cd_" + label; CellRendererText textRenderer = new CellRendererText(); cboxPlatform.PackStart(textRenderer, true); cboxPlatform.AddAttribute(textRenderer, "text", 2); cboxPlatform.WidthRequest = 200; cboxPlatform.Model = lstorePlatform; cboxPlatform.Changed += delegate(object sender, EventArgs e) { if (sender == null) return; ComboBox combo = sender as ComboBox; TreeIter iter; if (combo.GetActiveIter(out iter)) { int ruleId = (int)combo.Model.GetValue(iter, 0); int condId = (int)combo.Model.GetValue(iter, 1); if (ruleId != 0){ ConditionRule cr = conditionRules.Find(x => x.ConditionId == condId);//cd.Id); if (cr != null) cr.RuleId = ruleId; else conditionRules.Add(new ConditionRule(condId,ruleId)); } else { ConditionRule cr = conditionRules.Find(x => x.ConditionId == condId);//cd.Id); if (cr != null){ conditionRules.Remove(cr); } } } }; tableSystem.Attach(lblPlatform, 0, 1, (uint)(xPos - 1), (uint)xPos, AttachOptions.Shrink, AttachOptions.Shrink, 2, 2); tableSystem.Attach(cboxPlatform, 1, 2, (uint)(xPos - 1), (uint)xPos, AttachOptions.Shrink, AttachOptions.Shrink, 2, 2); TreeIter selectIter = lstorePlatform.AppendValues(0, cd.Id, "Unset"); foreach (Rule rl in cd.Rules){ if(!isResolution){ if (rl.Id == selectRule) selectIter = lstorePlatform.AppendValues(rl.Id, cd.Id, rl.Name); else lstorePlatform.AppendValues(rl.Id, cd.Id, rl.Name); } else { string name = String.Format("{0} ({1}x{2})",rl.Name,rl.Width,rl.Height); if (rl.Id == selectRule) selectIter = lstorePlatform.AppendValues(rl.Id, cd.Id, name); else lstorePlatform.AppendValues(rl.Id, cd.Id, name); } } cboxPlatform.SetActiveIter(selectIter); }
public FilterWidgetRow(FileSearchFilter filter) : base(0, 0, 1, 1) { TreeIter iter; CellRendererText textCell; ListStore store; this.filter = filter; matchTypeStore = new ListStore(typeof(string), typeof(FileSearchFilterComparison)); textCell = new CellRendererText(); matchTypeComboBox = new ComboBox(); matchTypeComboBox.Model = matchTypeStore; matchTypeComboBox.PackStart(textCell, true); matchTypeComboBox.AddAttribute(textCell, "text", 0); matchTypeComboBox.RowSeparatorFunc = ComboSeparatorFunc; matchTypeComboBox.Changed += MatchTypeChanged; textCell = new CellRendererText(); store = new ListStore(typeof(string), typeof(FilterEntryMode), typeof(FileSearchFilterField)); filterTextEntry = new FilterEntry(filter); filterTextEntry.Changed += FilterTextChanged; fieldComboBox = new ComboBox(); fieldComboBox.PackStart(textCell, true); fieldComboBox.AddAttribute(textCell, "text", 0); fieldComboBox.SetCellDataFunc(textCell, FieldComboDataFunc); store.AppendValues("File Name", FilterEntryMode.String, FileSearchFilterField.FileName); store.AppendValues("Size", FilterEntryMode.Size, FileSearchFilterField.Size); store.AppendValues("-"); store.AppendValues("(Audio)", null); store.AppendValues("Artist", FilterEntryMode.String, FileSearchFilterField.Artist); store.AppendValues("Album", FilterEntryMode.String, FileSearchFilterField.Album); store.AppendValues("Bitrate", FilterEntryMode.Speed, FileSearchFilterField.Bitrate); store.AppendValues("-"); store.AppendValues("(Video)", null); store.AppendValues("Resolution", FilterEntryMode.Dimentions, FileSearchFilterField.Resolution); store.AppendValues("-"); store.AppendValues("(Images)", null); store.AppendValues("Dimentions", FilterEntryMode.Dimentions, FileSearchFilterField.Dimentions); fieldComboBox.Model = store; fieldComboBox.RowSeparatorFunc = ComboSeparatorFunc; fieldComboBox.Changed += FieldChanged; /* if (fieldComboBox.Model.GetIterFirst(out iter)) { fieldComboBox.SetActiveIter(iter); } */ addButton = new Button(); addButton.Relief = ReliefStyle.None; addButton.Image = new Image(Gui.LoadIcon(16, "list-add")); addButton.Clicked += AddButtonClicked; removeButton = new Button(); removeButton.Relief = ReliefStyle.None; removeButton.Image = new Image(Gui.LoadIcon(16, "list-remove")); removeButton.Clicked += RemoveButtonClicked; box = new HBox(); box.PackStart(fieldComboBox, false, false, 0); box.PackStart(matchTypeComboBox, false, false, 3); box.PackStart(filterTextEntry, true, true, 0); box.PackStart(removeButton, false, false, 0); box.PackStart(addButton, false, false, 0); this.TopPadding = 3; this.BottomPadding = 3; this.Add(box); fieldComboBox.Model.GetIterFirst(out iter); do { FileSearchFilterField field = (FileSearchFilterField)fieldComboBox.Model.GetValue(iter, 2); if (field == filter.Field) { fieldComboBox.SetActiveIter(iter); break; } } while (fieldComboBox.Model.IterNext(ref iter)); matchTypeComboBox.Model.GetIterFirst(out iter); do { FileSearchFilterComparison comp = (FileSearchFilterComparison)matchTypeComboBox.Model.GetValue(iter, 1); if (comp == filter.Comparison) { matchTypeComboBox.SetActiveIter(iter); break; } } while (matchTypeComboBox.Model.IterNext(ref iter)); filterTextEntry.Text = filter.Text; }
// creates the media engine window public EnginesWindow(FuseApp fuse) : base(fuse.Window, "Media Engines") { this.fuse = fuse; // main widgets VBox backbone = new VBox (false, 2); backbone.BorderWidth = 10; Table details = new Table (5, 4, false); details.ColumnSpacing = 5; combo = new ComboBox (store); Button cancel = new Button (Stock.Cancel); Button save = new Button (Stock.Save); HBox button_box = new HBox (false, 2); // basic setup button_box.PackEnd (save); button_box.PackEnd (cancel); CellRendererText renderer = new CellRendererText (); combo.PackStart (renderer, true); combo.AddAttribute (renderer, "text", 1); // header labels Label instruction = new Label ("Select a media engine from the list below:"); Label title_header = new Label (); Label version_header = new Label (); Label description_header = new Label (); Label author_header = new Label (); Label website_header = new Label (); // add header content and styles title_header.Markup = "<small><b>Title:</b></small>"; version_header.Markup = "<small><b>Version:</b></small>"; description_header.Markup = "<small><b>Description:</b></small>"; author_header.Markup = "<small><b>Author:</b></small>"; website_header.Markup = "<small><b>Website:</b></small>"; // change label alignment title_header.Xalign = 0; version_header.Xalign = 0; description_header.Xalign = 0; author_header.Xalign = 0; website_header.Xalign = 0; title.Xalign = 0; version.Xalign = 0; description.Xalign = 0; author.Xalign = 0; website.Xalign = 0; // attach the labels to the details table details.Attach (title_header, 0, 1, 0, 1); details.Attach (version_header, 0, 1, 1, 2); details.Attach (author_header, 0, 1, 2, 3); details.Attach (website_header, 0, 1, 3, 4); details.Attach (description_header, 0, 1, 4, 5); details.Attach (title, 1, 2, 0, 1); details.Attach (version, 1, 2, 1, 2); details.Attach (author, 1, 2, 2, 3); details.Attach (website, 1, 2, 3, 4); details.Attach (description, 1, 2, 4, 5); // widget events combo.Changed += combo_changed; save.Clicked += save_clicked; cancel.Clicked += cancel_clicked; // add main widgets to the backbone backbone.PackStart (instruction, false, false, 5); backbone.PackStart (combo, false, false, 0); backbone.PackStart (details, false, false, 5); backbone.PackStart (button_box, false, false, 0); this.Resizable = false; this.SkipTaskbarHint = true; this.SkipPagerHint = true; this.Add (backbone); loadEngineList (); TreeIter first_iter; bool not_empty = combo.Model.GetIterFirst (out first_iter); combo.Sensitive = not_empty; if (not_empty) combo.SetActiveIter (first_iter); // select the previously selected engine store.Foreach (delegate (TreeModel model, TreePath path, TreeIter iter) { MediaEngine engine = (MediaEngine) model.GetValue (iter, 0); if (engine.Path == fuse.ChosenEngine) { combo.SetActiveIter (iter); return true; } return false; }); }
public MainToolbar () { WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget (button); AddSpace (8); configurationCombo = new Gtk.ComboBox (); configurationCombo.Model = configurationStore; var ctx = new Gtk.CellRendererText (); configurationCombo.PackStart (ctx, true); configurationCombo.AddAttribute (ctx, "text", 0); configurationCombosBox = new HBox (false, 8); var configurationComboVBox = new VBox (); configurationComboVBox.PackStart (configurationCombo, true, false, 0); configurationCombosBox.PackStart (configurationComboVBox, false, false, 0); // bold attributes for running runtime targets / (emulators) boldAttributes.Insert (new Pango.AttrWeight (Pango.Weight.Bold)); runtimeCombo = new Gtk.ComboBox (); runtimeCombo.Model = runtimeStore; ctx = new Gtk.CellRendererText (); if (Platform.IsWindows) ctx.Ellipsize = Pango.EllipsizeMode.Middle; runtimeCombo.PackStart (ctx, true); runtimeCombo.SetCellDataFunc (ctx, RuntimeRenderCell); runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator; var runtimeComboVBox = new VBox (); runtimeComboVBox.PackStart (runtimeCombo, true, false, 0); configurationCombosBox.PackStart (runtimeComboVBox, false, false, 0); AddWidget (configurationCombosBox); buttonBarBox = new Alignment (0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = (uint) 7; buttonBarBox.Add (buttonBar); buttonBarBox.NoShowAll = true; AddWidget (buttonBarBox); AddSpace (24); statusArea = new StatusArea (); statusArea.ShowMessage (BrandingService.ApplicationName); var statusAreaAlign = new Alignment (0, 0, 1, 1); statusAreaAlign.Add (statusArea); contentBox.PackStart (statusAreaAlign, true, true, 0); AddSpace (24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) return; int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max (center - 300, args.Allocation.Left); int right = Math.Min (left + 600, args.Allocation.Right); uint left_padding = (uint) (left - args.Allocation.Left); uint right_padding = (uint) (args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) statusAreaAlign.SetPadding (0, 0, (uint) left_padding, (uint) right_padding); }; matchEntry = new SearchEntry (); matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += (o, e) => { if (SearchEntryLostFocus != null) SearchEntryLostFocus (o, e); }; matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.WidthRequest = 240; if (!Platform.IsMac && !Platform.IsWindows) matchEntry.Entry.ModifyFont (Pango.FontDescription.FromString ("Sans 9")); // TODO: VV: "Segoe UI 9" matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += HandleSearchEntryActivated; matchEntry.Entry.KeyPressEvent += HandleSearchEntryKeyPressed; SizeAllocated += (o, e) => { if (SearchEntryResized != null) SearchEntryResized (o, e); }; contentBox.PackStart (matchEntry, false, false, 0); var align = new Gtk.Alignment (0, 0, 1f, 1f); align.Show (); align.TopPadding = (uint) 5; align.LeftPadding = (uint) 9; align.RightPadding = (uint) 18; align.BottomPadding = (uint) 10; align.Add (contentBox); Add (align); SetDefaultSizes (-1, 21); configurationCombo.Changed += (o, e) => { if (ConfigurationChanged != null) ConfigurationChanged (o, e); }; runtimeCombo.Changed += (o, e) => { var ea = new HandledEventArgs (); if (RuntimeChanged != null) RuntimeChanged (o, ea); TreeIter it; if (runtimeCombo.GetActiveIter (out it)) { if (ea.Handled) { runtimeCombo.SetActiveIter (lastSelection); return; } lastSelection = it; } }; button.Clicked += HandleStartButtonClicked; IdeApp.CommandService.ActiveWidgetChanged += (sender, e) => { lastCommandTarget = new WeakReference (e.OldActiveWidget); }; this.ShowAll (); this.statusArea.statusIconBox.HideAll (); }
public override Widget CreatePanelWidget () { HBox hbox = new HBox (false, 6); Label label = new Label (); label.MarkupWithMnemonic = GettextCatalog.GetString ("_Policy:"); 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 (); // Warning message to be shown when the user modifies the default policy warningMessage = new HBox (); warningMessage.Spacing = 6; Image img = new Image (Gtk.Stock.DialogWarning, IconSize.LargeToolbar); warningMessage.PackStart (img, false, false, 0); Label wl = new Label (GettextCatalog.GetString ("Changes done in this section will only be applied to new projects. " + "Settings for existing projects can be modified in the project (or solution) options dialog.")); wl.Xalign = 0; wl.Wrap = true; wl.WidthRequest = 450; warningMessage.PackStart (wl, true, true, 0); warningMessage.ShowAll (); warningMessage.Visible = false; vbox.PackEnd (warningMessage, false, false, 0); notebook = new Notebook (); // Get the panels for all mime types List<string> types = new List<string> (); types.AddRange (DesktopService.GetMimeTypeInheritanceChain (mimeType)); panelData.SectionLoaded = true; panels = panelData.Panels; foreach (IMimeTypePolicyOptionsPanel panel in panelData.Panels) { panel.SetParentSection (this); Widget child = panel.CreateMimePanelWidget (); Label tlabel = new Label (panel.Label); label.Show (); child.Show (); Alignment align = new Alignment (0.5f, 0.5f, 1f, 1f); align.BorderWidth = 6; align.Add (child); align.Show (); notebook.AppendPage (align, tlabel); panel.LoadCurrentPolicy (); } notebook.SwitchPage += delegate(object o, SwitchPageArgs args) { if (notebook.Page >= 0 && notebook.Page < this.panels.Count) this.panels[notebook.Page].PanelSelected (); }; notebook.Show (); vbox.PackEnd (notebook, true, true, 0); FillPolicies (); policyCombo.Active = 0; loading = false; if (!isRoot && panelData.UseParentPolicy) { //in this case "parent" is always first in the list policyCombo.Active = 0; notebook.Sensitive = false; } else { UpdateSelectedNamedPolicy (); } policyCombo.Changed += HandlePolicyComboChanged; return vbox; }
public requisicion_materiales_compras(string LoginEmp_, string NomEmpleado_, string AppEmpleado_, string ApmEmpleado_, string _nombrebd_) { LoginEmpleado = LoginEmp_; NomEmpleado = NomEmpleado_; AppEmpleado = AppEmpleado_; ApmEmpleado = ApmEmpleado_; nombrebd = _nombrebd_; Glade.XML gxml = new Glade.XML(null, "almacen_costos_compras.glade", "requisicion_materiales", null); gxml.Autoconnect(this); ////// Muestra ventana de Glade requisicion_materiales.Show(); // Creacion de una Nueva Requisicion entry_requisicion.KeyPressEvent += onKeyPressEvent_enter_requisicion; checkbutton_nueva_requisicion.Clicked += new EventHandler(on_checkbutton_nueva_requisicion_clicked); // Asignando valores de Fechas this.entry_fecha_solicitud.Text = (string)DateTime.Now.ToString("yyyy-MM-dd"); this.entry_fecha_requerida.Text = (string)DateTime.Now.ToString("yyyy-MM-dd"); // Llenado de combobox1 combobox_tipo_admision.Clear(); CellRendererText cell1 = new CellRendererText(); combobox_tipo_admision.PackStart(cell1, true); combobox_tipo_admision.AddAttribute(cell1, "text", 0); combobox_tipo_admision2.Clear(); CellRendererText cell2 = new CellRendererText(); combobox_tipo_admision2.PackStart(cell2, true); combobox_tipo_admision2.AddAttribute(cell2, "text", 0); ListStore store2 = new ListStore(typeof(string), typeof(int)); combobox_tipo_admision.Model = store2; combobox_tipo_admision2.Model = store2; // lleno de la tabla de his_tipo_de_admisiones NpgsqlConnection conexion; conexion = new NpgsqlConnection(connectionString + nombrebd); // Verifica que la base de datos este conectada try{ conexion.Open(); NpgsqlCommand comando; comando = conexion.CreateCommand(); comando.CommandText = "SELECT * FROM hscmty_his_tipo_admisiones " + //"WHERE cuenta_mayor = 4000 "+ " ORDER BY descripcion_admisiones;"; NpgsqlDataReader lector = comando.ExecuteReader(); while (lector.Read()) { store2.AppendValues((string)lector["descripcion_admisiones"], (int)lector["id_tipo_admisiones"]); } }catch (NpgsqlException ex) { MessageDialog msgBoxError = new MessageDialog(MyWinError, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, "PostgresSQL error: {0}", ex.Message); msgBoxError.Run(); msgBoxError.Destroy(); } conexion.Close(); TreeIter iter2; if (store2.GetIterFirst(out iter2)) { //Console.WriteLine(iter2); combobox_tipo_admision.SetActiveIter(iter2); } combobox_tipo_admision.Changed += new EventHandler(onComboBoxChanged_tipo_admision); combobox_tipo_admision2.Changed += new EventHandler(onComboBoxChanged_tipo_admision2); // Sale de la ventana button_salir.Clicked += new EventHandler(on_cierraventanas_clicked); // Activacion de boton de busqueda button_busca_producto.Clicked += new EventHandler(on_button_busca_producto_clicked); // Desactivando Entrys y Combobox this.entry_fecha_solicitud.Sensitive = false; this.entry_fecha_requerida.Sensitive = false; this.combobox_tipo_admision.Sensitive = false; this.combobox_tipo_admision2.Sensitive = false; this.entry_observaciones.Sensitive = false; this.button_guardar_requisicion.Sensitive = false; statusbar_almacen_requi.Pop(0); statusbar_almacen_requi.Push(1, "login: "******" |Usuario: " + NomEmpleado + " " + AppEmpleado + " " + ApmEmpleado); statusbar_almacen_requi.HasResizeGrip = false; // Creacion del treeview crea_treeview_requisicion(); }
public TaskListPad () { VBox vbox = new VBox (); 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 Task List Views failed: {0}", e.ToString ()); } switcherCombo = new ComboBox (switcherComboList); 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; }
void AddMultiOptionCombo (SortedDictionary<string, List<TargetFramework>> options) { var alignment = new Alignment (0.0f, 0.5f, 1.0f, 1.0f) { LeftPadding = 18 }; var model = new ListStore (new Type[] { typeof (string), typeof (object) }); var renderer = new CellRendererText (); var combo = new ComboBox (model); var check = new CheckButton (); List<TargetFramework> targets; var hbox = new HBox (); int current = 0; int active = -1; string label; foreach (var kvp in options) { label = kvp.Key; if (current + 1 < options.Count) label += " or later"; targets = kvp.Value; if (active == -1) { foreach (var target in targets) { if (target.Id.Equals (project.TargetFramework.Id)) { active = current; break; } } } model.AppendValues (label, targets); current++; } combo.PackStart (renderer, true); combo.AddAttribute (renderer, "text", 0); check.Show (); combo.Show (); if (active != -1) { combo.Active = active; check.Active = true; } else { check.Active = false; combo.Active = 0; } combo.Changed += (sender, e) => { if (check.Active) TargetFrameworkChanged (check, combo); }; check.Toggled += (sender, e) => { TargetFrameworkChanged (check, combo); }; comboboxes.Add (check, combo); hbox.PackStart (check, false, false, 0); hbox.PackStart (combo, false, true, 0); hbox.Show (); alignment.Add (hbox); alignment.Show (); vbox1.PackStart (alignment, false, false, 0); }
public StructureDatabaseView(string fileName) { this.filename = fileName; hbox = new HBox(); sqlLiteDal = new SqlLiteDal(fileName); lblTable = new Label( MainClass.Languages.Translate("tables")); hbox.PackStart(lblTable, false, false, 10); cbTable = new ComboBox(); cbTable.Changed += new EventHandler(OnComboProjectChanged); CellRendererText textRenderer = new CellRendererText(); cbTable.PackStart(textRenderer, true); cbTable.AddAttribute(textRenderer, "text", 0); cbTable.Model = tablesComboModel; cbTable.WidthRequest = 200; hbox.PackStart(cbTable, false, false, 2); hbox.PackEnd(new Label(""), true, true, 2); HButtonBox hbbAction = new HButtonBox(); hbbAction.LayoutStyle = Gtk.ButtonBoxStyle.Start; hbbAction.Spacing =6; Button btnAddTable = new Button(MainClass.Languages.Translate("add_table")); btnAddTable.Clicked+= delegate(object sender, EventArgs e) { SqlLiteAddTable addtable = new SqlLiteAddTable( filename ); int result = addtable.Run(); if (result == (int)ResponseType.Ok) { GetTables(); } addtable.Destroy(); }; Button btnDeleteTable = new Button(MainClass.Languages.Translate("delete_table")); btnDeleteTable.Clicked+= delegate(object sender, EventArgs e) { if(!CheckSelectTable()) return; MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo,MainClass.Languages.Translate("permanently_delete_table", curentTable), "", Gtk.MessageType.Question); int result = md.ShowDialog(); if (result != (int)Gtk.ResponseType.Yes) return; DropTable(); GetTables(); }; Button btnEditTable = new Button(MainClass.Languages.Translate("edit_table")); btnEditTable.Clicked+= delegate(object sender, EventArgs e) { if(!CheckSelectTable()) return; SqlLiteEditTable editTable = new SqlLiteEditTable(filename,curentTable); int result = editTable.Run(); if (result == (int)ResponseType.Ok) { GetTables(); } editTable.Destroy(); }; hbbAction.Add(btnAddTable); hbbAction.Add(btnDeleteTable); hbbAction.Add(btnEditTable); hbox.PackEnd(hbbAction, false, false, 10); this.PackStart(hbox, false, false, 5); ScrolledWindow sw = new ScrolledWindow(); sw.ShadowType = ShadowType.EtchedIn; sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); treeView = new TreeView(tableModel); GenerateColumns(); treeView.RulesHint = true; //treeView.SearchColumn = (int) Column.Description; sw.Add(treeView); this.PackStart(sw, true, true, 5); ScrolledWindow sw2 = new ScrolledWindow (); sw2.ShadowType = ShadowType.EtchedIn; sw2.SetPolicy (PolicyType.Automatic, PolicyType.Automatic); sw2.HeightRequest = 50; textControl = new TextView(); textControl.Editable = false; textControl.HeightRequest = 50; sw2.Add (textControl); this.PackEnd(sw2, false, false, 5); this.ShowAll(); GetTables(); //cbTable.Active = 0; }
private void GenerateComboBox(ref Table table, string name, string label, string selectVal,int xPos,List<SettingValue> list,bool isAndroidSupportDevice) { xPos = xPos+3; Label lblApp = new Label(label); lblApp.Xalign = 1; lblApp.Yalign = 0.5F; lblApp.WidthRequest = 115; if(table.Name != "table1") lblApp.WidthRequest = 114; CellRendererText textRenderer = new CellRendererText(); ComboBox cbe = new ComboBox();//(val); ListStore cbModel = new ListStore(typeof(string), typeof(string)); cbe.PackStart(textRenderer, true); cbe.AddAttribute(textRenderer, "text", 0); cbe.Name = name; cbe.Model= cbModel; cbe.Active = 0; TreeIter ti = new TreeIter(); foreach(SettingValue ds in list){// MainClass.Settings.InstallLocations){ if(ds.Value == selectVal){ ti = cbModel.AppendValues(ds.Display,ds.Value); cbe.SetActiveIter(ti); } else cbModel.AppendValues(ds.Display,ds.Value); } if(cbe.Active <0) cbe.Active =0; if(isAndroidSupportDevice){ cbe.Changed+= delegate(object sender, EventArgs e) { if(cbe.Active !=0){ if(!MainClass.LicencesSystem.CheckFunction("androidsupporteddevices",parentWindow)){ cbe.Active =0; return; } } }; } table.Attach(lblApp,0,1,(uint)(xPos-1),(uint)xPos,AttachOptions.Fill,AttachOptions.Shrink,0,0); table.Attach(cbe,1,2,(uint)(xPos-1),(uint)xPos,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Expand,0,0); }
public MainToolbar () { executionTargetsChanged = DispatchService.GuiDispatch (new EventHandler (HandleExecutionTargetsChanged)); IdeApp.Workspace.ActiveConfigurationChanged += (sender, e) => UpdateCombos (); IdeApp.Workspace.ConfigurationsChanged += (sender, e) => UpdateCombos (); IdeApp.Workspace.SolutionLoaded += (sender, e) => UpdateCombos (); IdeApp.Workspace.SolutionUnloaded += (sender, e) => UpdateCombos (); IdeApp.ProjectOperations.CurrentSelectedSolutionChanged += HandleCurrentSelectedSolutionChanged; WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget (button); AddSpace (8); configurationCombo = new Gtk.ComboBox (); configurationCombo.Model = configurationStore; var ctx = new Gtk.CellRendererText (); configurationCombo.PackStart (ctx, true); configurationCombo.AddAttribute (ctx, "text", 0); configurationCombosBox = new HBox (false, 8); var configurationComboVBox = new VBox (); configurationComboVBox.PackStart (configurationCombo, true, false, 0); configurationCombosBox.PackStart (configurationComboVBox, false, false, 0); runtimeCombo = new Gtk.ComboBox (); runtimeCombo.Model = runtimeStore; ctx = new Gtk.CellRendererText (); runtimeCombo.PackStart (ctx, true); runtimeCombo.SetCellDataFunc (ctx, RuntimeRenderCell); runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator; var runtimeComboVBox = new VBox (); runtimeComboVBox.PackStart (runtimeCombo, true, false, 0); configurationCombosBox.PackStart (runtimeComboVBox, false, false, 0); AddWidget (configurationCombosBox); buttonBarBox = new Alignment (0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = (uint) 7; buttonBarBox.Add (buttonBar); buttonBarBox.NoShowAll = true; AddWidget (buttonBarBox); AddSpace (24); statusArea = new StatusArea (); statusArea.ShowMessage (BrandingService.ApplicationName); var statusAreaAlign = new Alignment (0, 0, 1, 1); statusAreaAlign.Add (statusArea); contentBox.PackStart (statusAreaAlign, true, true, 0); AddSpace (24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) return; int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max (center - 300, args.Allocation.Left); int right = Math.Min (left + 600, args.Allocation.Right); uint left_padding = (uint) (left - args.Allocation.Left); uint right_padding = (uint) (args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) statusAreaAlign.SetPadding (0, 0, (uint) left_padding, (uint) right_padding); }; matchEntry = new SearchEntry (); var searchFiles = this.matchEntry.AddMenuItem (GettextCatalog.GetString ("Search Files")); searchFiles.Activated += delegate { SetSearchCategory ("files"); }; var searchTypes = this.matchEntry.AddMenuItem (GettextCatalog.GetString ("Search Types")); searchTypes.Activated += delegate { SetSearchCategory ("type"); }; var searchMembers = this.matchEntry.AddMenuItem (GettextCatalog.GetString ("Search Members")); searchMembers.Activated += delegate { SetSearchCategory ("member"); }; matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += delegate { matchEntry.Entry.Text = ""; }; var cmd = IdeApp.CommandService.GetCommand (Commands.NavigateTo); cmd.KeyBindingChanged += delegate { UpdateSearchEntryLabel (); }; UpdateSearchEntryLabel (); matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.Entry.ModifyBase (StateType.Normal, Style.White); matchEntry.WidthRequest = 240; matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += (sender, e) => { var pattern = SearchPopupSearchPattern.ParsePattern (matchEntry.Entry.Text); if (pattern.Pattern == null && pattern.LineNumber > 0) { popup.Destroy (); var doc = IdeApp.Workbench.ActiveDocument; if (doc != null && doc != null) { doc.Select (); doc.Editor.Caret.Location = new Mono.TextEditor.DocumentLocation (pattern.LineNumber, pattern.Column > 0 ? pattern.Column : 1); doc.Editor.CenterToCaret (); doc.Editor.Parent.StartCaretPulseAnimation (); } return; } if (popup != null) popup.OpenFile (); }; matchEntry.Entry.KeyPressEvent += (o, args) => { if (args.Event.Key == Gdk.Key.Escape) { var doc = IdeApp.Workbench.ActiveDocument; if (doc != null) { if (popup != null) popup.Destroy (); doc.Select (); } return; } if (popup != null) { args.RetVal = popup.ProcessKey (args.Event.Key, args.Event.State); } }; IdeApp.Workbench.RootWindow.WidgetEvent += delegate(object o, WidgetEventArgs args) { if (args.Event is Gdk.EventConfigure) PositionPopup (); }; BuildToolbar (); IdeApp.CommandService.RegisterCommandBar (buttonBar); AddinManager.ExtensionChanged += delegate(object sender, ExtensionEventArgs args) { if (args.PathChanged (ToolbarExtensionPath)) BuildToolbar (); }; contentBox.PackStart (matchEntry, false, false, 0); var align = new Gtk.Alignment (0, 0, 1f, 1f); align.Show (); align.TopPadding = (uint) 5; align.LeftPadding = (uint) 9; align.RightPadding = (uint) 18; align.BottomPadding = (uint) 10; align.Add (contentBox); Add (align); SetDefaultSizes (-1, 21); UpdateCombos (); button.Clicked += HandleStartButtonClicked; IdeApp.CommandService.RegisterCommandBar (this); IdeApp.CommandService.ActiveWidgetChanged += (sender, e) => { lastCommandTarget = e.OldActiveWidget; }; this.ShowAll (); this.statusArea.statusIconBox.HideAll (); }
private void GenerateComboBoxSigning(ref Table table, string name, string label, string selectVal,int xPos,List<SettingValue> list) { xPos = xPos+3; Label lblApp = new Label(label); lblApp.Xalign = 1; lblApp.Yalign = 0.5F; lblApp.WidthRequest = 115; if(table.Name != "table1") lblApp.WidthRequest = 114; CellRendererText textRenderer = new CellRendererText(); ComboBox cbe = new ComboBox();//(val); ListStore cbModel = new ListStore(typeof(string), typeof(string)); cbe.PackStart(textRenderer, true); cbe.AddAttribute(textRenderer, "text", 0); cbe.Name = name; cbe.Model= cbModel; cbe.Active = 0; if(MainClass.Platform.IsMac){ TreeIter ti = new TreeIter(); foreach(SettingValue ds in list){// MainClass.Settings.InstallLocations){ if(ds.Value == selectVal){ ti = cbModel.AppendValues(ds.Display,ds.Value); cbe.SetActiveIter(ti); } else cbModel.AppendValues(ds.Display,ds.Value); } if(cbe.Active <0) cbe.Active =0; } else { cbe.Sensitive = false; if(!String.IsNullOrEmpty(selectVal)){ cbModel.AppendValues(selectVal,selectVal); cbe.Active =0; } else { Pango.FontDescription customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont); customFont.Weight = Pango.Weight.Bold; cbe.ModifyFont(customFont); cbModel.AppendValues("Please, don´t forget set the provisioning",""); cbe.Active =0; } } table.Attach(lblApp,0,1,(uint)(xPos-1),(uint)xPos,AttachOptions.Fill,AttachOptions.Shrink,0,0); table.Attach(cbe,1,2,(uint)(xPos-1),(uint)xPos,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Expand,0,0); }