示例#1
0
    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);
        }
    }
示例#2
0
 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];
 }
示例#3
0
        public void FillContactList()
        {
            TreeIter iter;
            int      count = 0;

            if (!ListIdentifier.GetActiveIter(out iter))
            {
                return;
            }

            contact_store.Clear();

            // Add contacts to treeview
            foreach (string id in database)
            {
                Hashtable tbl = database.Compile(id, database.EnumNamespace);

                if (tbl ["table"] != null && tbl ["table"] as string == "BF")
                {
                    contact_store.AppendValues(tbl ["id"], tbl [contact_show_type_store.GetValue(iter, 0)]);
                    count++;
                }
            }

            SetStatusMessage(String.Format(Catalog.GetPluralString("Added {0} contact", "Added {0} contacts", count), count));
        }
示例#4
0
 public static object GetId(ComboBox comboBox)
 {
     TreeIter treeIter;
     comboBox.GetActiveIter (out treeIter);
     IList row = (IList)comboBox.Model.GetValue (treeIter, 0);
     return row [0];
 }
示例#5
0
        void onComboBoxChanged_hora_minutos_cita(object sender, EventArgs args)
        {
            //Gtk.ComboBox hora_minutos_cita = (Gtk.ComboBox) sender;
            Gtk.ComboBox hora_minutos = sender as Gtk.ComboBox;
            if (sender == null)
            {
                return;
            }
            TreeIter iter;

            if (hora_minutos.GetActiveIter(out iter))
            {
                if (hora_minutos.Name.ToString() == "combobox_hora_nota")
                {
                    hora_nota = (string)hora_minutos.Model.GetValue(iter, 0);
                }
                if (hora_minutos.Name.ToString() == "combobox_minutos_nota")
                {
                    minutos_nota = (string)hora_minutos.Model.GetValue(iter, 0);
                }
                if (hora_minutos.Name.ToString() == "combobox_hora_somato")
                {
                    hora_somatometria = (string)hora_minutos.Model.GetValue(iter, 0);
                }
                if (hora_minutos.Name.ToString() == "combobox_minutos_somato")
                {
                    minutos_somatometria = (string)hora_minutos.Model.GetValue(iter, 0);
                }
            }
        }
示例#6
0
        void OnOK(object sender, EventArgs args)
        {
            GameSession.Types types = GameSession.Types.None;

            if (checkbox_logic.Active)
            {
                types |= GameSession.Types.LogicPuzzles;
            }

            if (checkbox_calculation.Active)
            {
                types |= GameSession.Types.Calculation;
            }

            if (checkbox_verbal.Active)
            {
                types |= GameSession.Types.VerbalAnalogies;
            }


            TreeIter iter;

            layout_combo.GetActiveIter(out iter);
            int sides = (int)layout_combo.Model.GetValue(iter, COLUMN_VALUE);

            GeneratePdf(types,
                        (int)games_spinbutton.Value,
                        sides,
                        Difficulty,
                        colorblindcheckbutton.Active,
                        file.Filename);
        }
        public static string GetActiveString(ComboBox box)
        {
            TreeIter iter;
            if(!box.GetActiveIter(out iter))
                return null;

            return (string)box.Model.GetValue(iter, 0);
        }
        void HandleOffsetComboChanged(object o, EventArgs e)
        {
            TreeIter iter;

            if (offset_combo.GetActiveIter(out iter))
            {
                datetime.Offset = (int)offset_combo.Model.GetValue(iter, 1);
            }
        }
示例#9
0
		public static string GetActiveText(ComboBox cbox) 
		{
			if (cbox.Active < 0)
				return "";

			TreeIter iter;
			cbox.GetActiveIter (out iter);
			string cvalue = ((ListStore) cbox.Model).GetValue (iter, 0).ToString();
			return cvalue;
		}
示例#10
0
        public string GetPeerSelected()
        {
            TreeIter iter;

            if (comboPeers.GetActiveIter(out iter))
            {
                return((string)comboPeers.Model.GetValue(iter, 0));
            }
            return(null);
        }
        private void HandleTimeComboChanged(object o, EventArgs e)
        {
            TreeIter iter;

            if (time_combo.GetActiveIter(out iter))
            {
                datetime.Hour   = (int)time_store.GetValue(iter, 1);
                datetime.Minute = (int)time_store.GetValue(iter, 2);
            }
        }
示例#12
0
        // ============================================
        // PUBLIC Methods
        // ============================================
        /// Get Selected Peer and Return his name, or null if no one is selected.
        public string GetPeerSelected()
        {
            // Bad Method, ReDo this:
            //  - Return UserInfo
            TreeIter iter;

            if (comboPeers.GetActiveIter(out iter))
            {
                return((string)comboPeers.Model.GetValue(iter, 0));
            }
            return(null);
        }
示例#13
0
    string getSelectedLanguage()
    {
        TreeIter    iter;
        CultureInfo info;

        combo_language.GetActiveIter(out iter);
        info = (CultureInfo)langsStore.GetValue(iter, 1);
        if (info == null)
        {
            return("");
        }
        else
        {
            return(info.Name);
        }
    }
示例#14
0
        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);
            };
        }
示例#15
0
        private void OnOK(object sender, EventArgs args)
        {
            Preferences.Set <int>  (Preferences.MemQuestionTimeKey, (int)prefspinbutton.Value);
            Preferences.Set <bool> (Preferences.MemQuestionWarnKey, prefcheckbutton.Active);
            Preferences.Set <int>  (Preferences.DifficultyKey, (int)Difficulty);
            Preferences.Set <int>  (Preferences.MaxStoredGamesKey, (int)maxstoredspinbutton.Value);
            Preferences.Set <int>  (Preferences.MinPlayedGamesKey, (int)minplayedspinbutton.Value);
            Preferences.Set <bool> (Preferences.ColorBlindKey, colorblindcheckbutton.Active);
            Preferences.Set <bool> (Preferences.EnglishKey, english_checkbutton.Active);

            TreeIter iter;

            themes_combobox.GetActiveIter(out iter);
            Theme theme = (Theme)themes_combobox.Model.GetValue(iter, COLUMN_VALUE);

            NewThemeSet = String.Compare(theme.Name, Preferences.Get <string> (Preferences.ThemeKey), true) != 0;
            Preferences.Set <string> (Preferences.ThemeKey, theme.Name);

            Preferences.Save();
        }
示例#16
0
        private void RunTestButton_Click(object sender, System.EventArgs e)
        {
            TreeIter iter;
            bool     activeIter;
            string   str;

            activeIter = TestSelectComboBox.GetActiveIter(out iter);
            if (activeIter)
            {
                str = (string)TestSelectComboBox.Model.GetValue(iter, 0);
                if (str.Equals("Axis Test"))
                {
                    displayForm = new AxisTestsForm();
                    displayForm.ShowAll();
                }
                if (str.Equals("PlotSurface2D"))
                {
                    displayForm = new PlotSurface2DDemo();
                    displayForm.ShowAll();
                }
            }
        }
示例#17
0
        //private string lastType = null;

        private void ChangeType(object o, EventArgs args)
        {
            Gtk.ComboBox combo    = (Gtk.ComboBox)o;
            string       hit_type = null;

            Gtk.TreeIter iter;

            if (combo.GetActiveIter(out iter))
            {
                hit_type = (string)filter_data.GetValue(iter, 1);
            }

            if (this.hit_type == hit_type)
            {
                return;
            }

            this.hit_type = hit_type;

            root.SetSource(this.hit_type);
            root.HitCollection.PageFirst();
            UpdatePage();
        }
		string GetActiveVar (ComboBox combo)
		{
			Gtk.TreeIter iter;
			if (!combo.GetActiveIter (out iter))
				return string.Empty;
				
			string var = (string) combo.Model.GetValue (iter, 0);
			if (String.Compare (var, "(None)") == 0)
				return String.Empty;
			else
				return var.Trim ();
		}
示例#19
0
		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 ();
		}
		List<TargetFramework> GetTargetFrameworks (ComboBox combo)
		{
			TreeIter iter;

			if (!combo.GetActiveIter (out iter))
				return new List<TargetFramework> ();

			return (List<TargetFramework>) combo.Model.GetValue (iter, 1);
		}
示例#21
0
        public ProjectPropertyWidget(Project project)
        {
            this.project = project;

            Table mainTable = new Table(2,1,false);
            Table propertyTable = new Table(5,2,false);

            Label lblFN = new Label(System.IO.Path.GetFileName(project.ProjectName));
            lblFN.UseUnderline = false;
            lblFN.Selectable = true;
            lblFN.Xalign = 0;

            /*prjDir.LabelProp = this.project.RelativeAppFilePath;
            prjFullPath.LabelProp  = this.project.AbsolutProjectDir;*/

            Entry entr = new Entry(this.project.RelativeAppFilePath);
            entr.ModifyBg(StateType.Normal,this.Style.Background(StateType.Normal));
            entr.IsEditable = false;

            Entry entrFullPath = new Entry(this.project.AbsolutProjectDir);
            entrFullPath.IsEditable = false;

            Entry entrFacebookApi = new Entry(this.project.FacebookAppID);
            entrFacebookApi.Changed+= delegate(object sender, EventArgs e)
            {
                this.project.FacebookAppID = entrFacebookApi.Text;
            };

            Entry entrTitle = new Entry(this.project.AppFile.Title);
            entrTitle.Changed+= delegate(object sender, EventArgs e)
            {
                try{
                    this.project.AppFile.Title = entrTitle.Text;
                } catch (Exception ex){
                    Moscrif.IDE.Tool.Logger.Error(ex.Message);
                }
            };

            ComboBox 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;
            cbType.Changed+= delegate(object sender, EventArgs e) {
                TreeIter tiSelect = new TreeIter();
                cbType.GetActiveIter(out tiSelect);
                string text = cbType.Model.GetValue(tiSelect,1).ToString();
                project.ApplicationType =text;
            };

            AddControl(ref propertyTable,0,lblFN,"Project ");
            AddControl(ref propertyTable,1,entr,"Project App ");
            AddControl(ref propertyTable,2,entrFullPath,"Project Path ");
            AddControl(ref propertyTable,3,entrTitle,"Title ");
            AddControl(ref propertyTable,4,cbType,"Type ");
            AddControl(ref propertyTable,5,entrFacebookApi,"Facebook ID ");

            mainTable.Attach(propertyTable,0,1,0,1,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Fill,0,0);

            /*int rowCount = project.ConditoinsDefine.Count;
            Table conditionsTable = new Table((uint)(rowCount + 3),(uint)2,false);

            GenerateContent(ref conditionsTable, MainClass.Settings.Platform.Name, 1, MainClass.Settings.Platform,false);//tableSystem
            GenerateContent(ref conditionsTable, MainClass.Settings.Resolution.Name, 2,MainClass.Settings.Resolution,true); //project.Resolution);//tableSystem
            int i = 3;
            foreach (Condition cd in project.ConditoinsDefine) {
                GenerateContent(ref conditionsTable, cd.Name, i, cd,false);
                i++;
            }
            mainTable.Attach(conditionsTable,0,1,1,2,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Fill,0,0);
            */
            this.PackStart(mainTable,true,true,0);
            this.ShowAll();
        }
示例#22
0
        void OnDialogResponse(object o, Gtk.ResponseArgs args)
        {
            lock (LockObj) {
                if (args.ResponseId == ResponseType.Ok && dataBook != null && dataBook.NPages > 0)
                {
                    DataView dv = ((DataViewDisplay)dataBook.CurrentPageWidget).View;

                    IExportBuilder builder = null;
                    TreeIter       iter;
                    ExportAsCombo.GetActiveIter(out iter);
                    ExportPlugin plugin = (ExportPlugin)ExportAsCombo.Model.GetValue(iter, 1);


                    Util.Range range;

                    try {
                        range = GetCurrentRange(dv);
                    }
                    catch (FormatException ex) {
                        ErrorAlert ea = new ErrorAlert(Catalog.GetString("Error in custom range"), ex.Message, mainWindow);
                        ea.Run();
                        ea.Destroy();
                        return;
                    }

                    Util.Range bufferRange;
                    if (dv.Buffer.Size == 0)
                    {
                        bufferRange = new Util.Range();
                    }
                    else
                    {
                        bufferRange = new Util.Range(0, dv.Buffer.Size - 1);
                    }

                    if (!bufferRange.Contains(range.Start) || !bufferRange.Contains(range.End))
                    {
                        ErrorAlert ea = new ErrorAlert(Catalog.GetString("Error in range"), Catalog.GetString("Range is out of file's limits"), mainWindow);
                        ea.Run();
                        ea.Destroy();
                        return;
                    }

                    Stream stream = null;
                    try {
                        stream  = new FileStream(ExportFileEntry.Text, FileMode.Create, FileAccess.Write);
                        builder = plugin.CreateBuilder(stream);

                        InterpretedPatternExporter exporter = new InterpretedPatternExporter(builder);
                        exporter.Pattern = ExportPatternComboEntry.Entry.Text;

                        cancelClicked = false;
                        BeginExport(exporter, dv.Buffer, range.Start, range.End);
                    }
                    catch (Exception ex) {
                        if (stream != null)
                        {
                            stream.Close();
                        }

                        ErrorAlert ea = new ErrorAlert(Catalog.GetString("Error saving to file"), ex.Message, mainWindow);
                        ea.Run();
                        ea.Destroy();
                        return;
                    }
                }
                else if (args.ResponseId == ResponseType.Close)
                {
                    this.Hide();
                }
            }
        }