public DemoComponents()
        {
            // Create the general frame
            uint row = 1;
            var table = new LabelWidgetTable(5, 2);
            table.BorderWidth = 5;

            // Just a text entry
            var nameEntry = new Entry("Bob");
            table.AttachExpanded(row++, "Name", nameEntry);

            // An unexpanded enumeration combo box
            var ecb = new EnumComboBox(typeof (ButtonsType));
            ecb.ActiveEnum = ButtonsType.YesNo;
            table.Attach(row++, "EnumComboBox", ecb);

            // An unexpanded described
            testEnumCombo = new EnumComboBox(typeof (ExampleEnumeration));
            testEnumCombo.Changed += OnTestEnumChanged;
            table.Attach(row++, "ExampleEnumeration", testEnumCombo);

            // Add the string entry
            var sle = new StringListEntry();
            sle.Values = new[]
            {
                "Line 1", "Line 2", "Line 3",
            };
            sle.CompletionStore.AppendValues("List 4");
            sle.CompletionStore.AppendValues("List 5");
            sle.CompletionStore.AppendValues("List 6");
            sle.CompletionStore.AppendValues("List 7");
            table.AttachExpanded(row++, "StringListEntry", sle);

            // Return it
            PackStart(table, false, false, 0);
            PackStart(new Label(""), true, true, 0);
        }
Example #2
0
        /// <summary>
        /// Constructs the dialog box.
        /// </summary>
        public ConfigDialog()
        {
            // Set up our controls
            Title = Locale.Translate("Configuration Dialog");
            AddButton("Close", ResponseType.Close);
            //Response += new ResponseHandler (on_dialog_response);

            // Add the dialog table
            LabelWidgetTable table = new LabelWidgetTable(2, 2);
            uint row = 0;
            VBox.Add(table);

            // Put in a list of themes
            int i = 0;
            themes = ComboBox.NewText();

            foreach (Theme theme in Theme.GetThemes())
            {
                themes.AppendText(theme.ThemeName);

                if (theme.ThemeName == Game.Config.ThemeName)
                {
                    themes.Active = 0;
                }

                i++;
            }

            themes.Changed += OnChanged;

            // Languages
            languages = ComboBox.NewText();
            languages.AppendText("en-US");
            languages.Active = 0;
            languages.Changed += OnChanged;

            // Selection type
            selectionType = new EnumComboBox(typeof(SelectionType));
            selectionType.ActiveEnum = Game.Config.SelectionType;
            selectionType.Changed += OnChanged;

            // Board size
            boardSize = new SpinButton(3f, 27f, 1f);
            boardSize.Value = Game.Config.BoardSize;
            boardSize.Changed += OnChanged;

            // Frames per second
            fps = new SpinButton(1f, 60f, 1f);
            fps.Value = Game.Config.FramesPerSecond;
            fps.Changed += OnChanged;

            // Start with theme configuration
            table.AttachExpanded(row++, "Theme", themes);
            table.AttachExpanded(row++, "Board Size", boardSize);
            table.AttachExpanded(row++, "Selection Type", selectionType);
            table.AttachExpanded(row++, "Language", languages);
            table.AttachExpanded(row++, "FPS", fps);

            // Finish up
            ShowAll();
        }