Esempio n. 1
0
        static ComboBox Create_ComboBox(string [] strings)
        {
            /*Menu menu = new Menu ();
             *
             * MenuItem menu_item = null;
             *
             * foreach (string str in strings) {
             *      menu_item = new MenuItem (str);
             *      menu_item.Show ();
             *      menu.Append (menu_item);
             * }
             *
             * OptionMenu option_menu = new OptionMenu ();
             * option_menu.Menu = menu;
             *
             * return option_menu;*/
            ComboBoxText combo_box = new ComboBoxText();

            foreach (string str in strings)
            {
                combo_box.AppendText(str);
            }

            return(combo_box);
        }
Esempio n. 2
0
        public ToolBarComboBox(int width, int activeIndex, bool allowEntry, params string[] contents)
        {
            if (allowEntry)
            {
                ComboBox = ComboBoxText.NewWithEntry();
            }
            else
            {
                ComboBox = new ComboBoxText();
            }


            foreach (string entry in contents)
            {
                ComboBox.AppendText(entry);
            }

            ComboBox.AddEvents((int)Gdk.EventMask.ButtonPressMask);
            ComboBox.WidthRequest = width;

            if (activeIndex >= 0)
            {
                ComboBox.Active = activeIndex;
            }

            ComboBox.Show();

            Add(ComboBox);
            Show();
        }
Esempio n. 3
0
        private HBox BuildMatchHeader()
        {
            HBox header = new HBox();

            header.Show();

            terms_enabled_checkbox = new CheckButton(Catalog.GetString("_Match"));
            terms_enabled_checkbox.Show();
            terms_enabled_checkbox.Active   = true;
            terms_enabled_checkbox.Toggled += OnMatchCheckBoxToggled;
            header.PackStart(terms_enabled_checkbox, false, false, 0);

            terms_logic_combo = new ComboBoxText();
            terms_logic_combo.AppendText(Catalog.GetString("all"));
            terms_logic_combo.AppendText(Catalog.GetString("any"));
            terms_logic_combo.Show();
            terms_logic_combo.Active = 0;
            header.PackStart(terms_logic_combo, false, false, 0);

            terms_label = new Label(Catalog.GetString("of the following:"));
            terms_label.Show();
            terms_label.Xalign = 0.0f;
            header.PackStart(terms_label, true, true, 0);

            header.Spacing = 5;

            return(header);
        }
Esempio n. 4
0
        private void BuildInterface()
        {
            field_chooser          = new ComboBoxText();
            field_chooser.Changed += HandleFieldChanged;

            op_chooser = new ComboBoxText();
            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 void AppendTextCollection(this ComboBoxText comboBox, IEnumerable <string> stringCollection)
 {
     foreach (var str in stringCollection)
     {
         comboBox.AppendText(str);
     }
 }
Esempio n. 6
0
        public OpenRemoteServer() : base(Catalog.GetString("Open remote DAAP server"), null)
        {
            VBox.Spacing = 6;
            VBox.PackStart(new Label()
            {
                Xalign = 0.0f,
                Text   = Catalog.GetString("Enter server IP address and port:")
            }, true, true, 0);

            HBox box = new HBox();

            box.Spacing = 12;
            VBox.PackStart(box, false, false, 0);

            address_entry = ComboBoxText.NewWithEntry();
            address_entry.Entry.Activated += OnEntryActivated;
            address_entry.Entry.WidthChars = 30;
            address_entry.Show();

            port_entry       = new SpinButton(1d, 65535d, 1d);
            port_entry.Value = 3689;
            port_entry.Show();

            box.PackStart(address_entry, true, true, 0);
            box.PackEnd(port_entry, false, false, 0);

            address_entry.HasFocus = true;

            VBox.ShowAll();

            AddStockButton(Stock.Cancel, ResponseType.Cancel);
            AddStockButton(Stock.Add, ResponseType.Ok, true);

            LoadHistory();
        }
        public BinaryOperationNode()
        {
            Label   = "Operation";
            Spacing = 8;

            Width  = 200;
            Height = 200;

            NodePadding = new Border
            {
                Top    = 16,
                Bottom = 16,
                Left   = 16,
                Right  = 16,
            };

            _s1 = new SpinButton(0, double.MaxValue, 0.1);
            _s2 = new SpinButton(0, double.MaxValue, 0.1);

            _op = new ComboBoxText();
            _op.Append("+", "Addition");
            _op.Append("-", "Subtraction");
            _op.Append("*", "Multiplication");
            _op.Append("/", "Division");
            _op.Append("%", "Modulo");
            _op.Append("^", "Power");
        }
Esempio n. 8
0
        private void AttachWidgets(TextView textView)
        {
            // This is really different from the C version, but the
            // C versions seems a little pointless.

            Button button = new Button("Click Me");

            button.Clicked += new EventHandler(EasterEggCB);
            textView.AddChildAtAnchor(button, buttonAnchor);
            button.ShowAll();

            ComboBoxText combo = new ComboBoxText();

            combo.AppendText("Option 1");
            combo.AppendText("Option 2");
            combo.AppendText("Option 3");

            textView.AddChildAtAnchor(combo, menuAnchor);

            HScale scale = new HScale(null);

            scale.SetRange(0, 100);
            scale.SetSizeRequest(70, -1);
            textView.AddChildAtAnchor(scale, scaleAnchor);
            scale.ShowAll();

            Gtk.Image image = Gtk.Image.LoadFromResource("floppybuddy.gif");
            textView.AddChildAtAnchor(image, animationAnchor);
            image.ShowAll();

            Entry entry = new Entry();

            textView.AddChildAtAnchor(entry, entryAnchor);
            entry.ShowAll();
        }
Esempio n. 9
0
        private void CreatePortSelLine()
        {
            Box conn_box = new Box(Orientation.Horizontal, 2);

            _pageContainer.Add(conn_box);

            conn_box.Add(new Label("Serial Port:"));

            _portNameCombo          = new ComboBoxText();
            _portNameCombo.Changed += Portname_Changed;
            conn_box.Add(_portNameCombo);
            PopulateSerialPortCombo();

            conn_box.Add(new Label("Port baudrate:"));

            _baudRateCombo = new ComboBoxText();
            conn_box.Add(_baudRateCombo);
            foreach (var bd_rate in Helpers.SerialRates)
            {
                _baudRateCombo.PrependText(bd_rate);
            }

            Button conn_btn = new Button();

            conn_btn.Label    = "Connect";
            conn_btn.Clicked += BtnConnect_Click;
            conn_box.Add(conn_btn);

            Button disconn_btn = new Button();

            disconn_btn.Label    = "Disconnect";
            disconn_btn.Clicked += BtnDisconnect_Click;
            conn_box.Add(disconn_btn);
        }
Esempio n. 10
0
        public SmartPlaylistQueryValueEntry() : base()
        {
            combo = new ComboBoxText();
            combo.WidthRequest = DefaultWidth;

            int count = 0;
            SmartPlaylistSource playlist;

            foreach (Source child in ServiceManager.SourceManager.DefaultSource.Children)
            {
                playlist = child as SmartPlaylistSource;
                if (playlist != null && playlist.DbId != null)
                {
                    if (Editor.CurrentlyEditing == null || (Editor.CurrentlyEditing != playlist && !playlist.DependsOn(Editor.CurrentlyEditing)))
                    {
                        combo.AppendText(playlist.Name);
                        playlist_id_combo_map [playlist.DbId.Value] = count;
                        combo_playlist_id_map [count++]             = playlist.DbId.Value;
                    }
                }
            }

            Add(combo);
            combo.Active = 0;

            combo.Changed += HandleValueChanged;
        }
Esempio n. 11
0
        public OpenLocationDialog() : base(Catalog.GetString("Open Location"))
        {
            var location_box = new HBox()
            {
                Spacing = 6
            };

            address_entry = ComboBoxText.NewWithEntry();
            address_entry.Entry.Activated += (o, e) => Respond(ResponseType.Ok);

            var browse_button = new Button(Catalog.GetString("Browse..."));

            browse_button.Clicked += OnBrowseClicked;

            location_box.PackStart(address_entry, true, true, 0);
            location_box.PackStart(browse_button, false, false, 0);

            VBox.Spacing = 6;
            VBox.PackStart(new Label()
            {
                Xalign = 0.0f,
                Text   = Catalog.GetString(
                    "Enter the address of the file you would like to open:")
            }, false, false, 0);
            VBox.PackStart(location_box, false, false, 0);
            VBox.ShowAll();

            AddStockButton(Stock.Cancel, ResponseType.Cancel);
            AddStockButton(Stock.Open, ResponseType.Ok, true);

            LoadHistory();

            address_entry.Entry.HasFocus = true;
        }
Esempio n. 12
0
        public NewlineTypeComboBox(NewlineType newlineTypeToSelect, string[] additionalActions)
        {
            this.comboBox            = new ComboBoxText();
            this.newlineTypeToSelect = newlineTypeToSelect;
            this.additionalActions   = additionalActions;

            FillComboBox();
            ConnectHandlers();
        }
        private SubtitleType fixedSubtitleType = SubtitleType.Unknown; //A subtitle type that must be selected

        public SubtitleFormatComboBox(SubtitleType fixedSubtitleType, string[] additionalActions)
        {
            this.comboBox          = new ComboBoxText();
            this.fixedSubtitleType = fixedSubtitleType;
            this.additionalActions = additionalActions;

            this.subtitleTypes = Subtitles.AvailableTypesSorted;
            FillComboBox();
            ConnectHandlers();
        }
Esempio n. 14
0
        private ArrayList configShownEncodings = null;  //Encodings shown in menu from config

        public EncodingComboBox(bool hasAutoDetect, string[] additionalActions, int fixedEncoding)
        {
            this.comboBox          = new ComboBoxText();
            this.additionalActions = additionalActions;
            this.hasAutoDetect     = hasAutoDetect;
            this.fixedEncoding     = fixedEncoding;

            SetActionCount();
            SetComboBox(Base.Config.FileEncodingsShownInMenu);
            ConnectHandlers();
        }
Esempio n. 15
0
        // Convenience function to create a combo box holding a number of strings
        private ComboBox CreateComboBox(string [] strings)
        {
            ComboBoxText combo = new ComboBoxText();

            foreach (string str in strings)
            {
                combo.AppendText(str);
            }

            combo.Active = 0;
            return(combo);
        }
Esempio n. 16
0
        public QueryLimitBox(QueryOrder [] orders, QueryLimit [] limits) : base()
        {
            this.orders = orders;
            this.limits = limits;

            Spacing = 5;

            enabled_checkbox          = new CheckButton(Catalog.GetString("_Limit to"));
            enabled_checkbox.Toggled += OnEnabledToggled;

            // workaround for bgo#727294, we doubt anyway that it's very useful to have a max higher than 2147483647
            const double max = int.MaxValue;

            count_spin         = new SpinButton(0, max, 1);
            count_spin.Numeric = true;
            count_spin.Digits  = 0;
            count_spin.Value   = 25;
            count_spin.SetSizeRequest(60, -1);

            limit_combo = new ComboBoxText();
            foreach (QueryLimit limit in limits)
            {
                limit_combo.AppendText(limit.Label);
            }

            order_combo = new ComboBoxText();
            order_combo.RowSeparatorFunc = IsRowSeparator;
            foreach (QueryOrder order in orders)
            {
                if (order == null)
                {
                    order_combo.AppendText(String.Empty);
                }
                else
                {
                    order_combo.AppendText(order.Label);
                }
            }

            PackStart(enabled_checkbox, false, false, 0);
            PackStart(count_spin, false, false, 0);
            PackStart(limit_combo, false, false, 0);
            PackStart(new Label(Catalog.GetString("selected by")), false, false, 0);
            PackStart(order_combo, false, false, 0);

            enabled_checkbox.Active = false;
            limit_combo.Active      = 0;
            order_combo.Active      = 0;

            OnEnabledToggled(null, null);

            ShowAll();
        }
Esempio n. 17
0
        /* Private members */

        private FileChooserDialog BuildDialog(bool showVideo, string title)
        {
            FileChooserDialog dialog = new FileChooserDialog(title, Base.Ui.Window, FileChooserAction.Open,
                                                             Util.GetStockLabel("gtk-cancel"), ResponseType.Cancel, Util.GetStockLabel("gtk-open"), ResponseType.Ok);

            dialog.DefaultResponse = ResponseType.Ok;

            //Build content area

            Box box = new Box(Orientation.Horizontal, WidgetStyles.BoxSpacingMedium);

            box.BorderWidth = WidgetStyles.BorderWidthMedium;

            if (showVideo)
            {
                videoLabel = new Label(Catalog.GetString("Video to Open:"));
                box.Add(videoLabel);

                videoComboBox         = new ComboBoxText();
                videoComboBox.Hexpand = true;

                CellRendererText videoComboBoxRenderer = (videoComboBox.Cells[0] as CellRendererText);
                videoComboBoxRenderer.WidthChars = 20;
                videoComboBoxRenderer.Ellipsize  = Pango.EllipsizeMode.End;
                videoComboBox.RowSeparatorFunc   = ComboBoxUtil.SeparatorFunc;
                box.Add(videoComboBox);

                autoChooseVideoFile = Base.Config.VideoAutoChooseFile;
            }

            box.Add(new Label(Catalog.GetString("Character Encoding:")));

            encodingComboBox = BuildEncodingComboBox();
            encodingComboBox.Widget.Hexpand = !showVideo;
            box.Add(encodingComboBox.Widget);

            dialog.ContentArea.Add(box);
            dialog.ContentArea.ShowAll();

            //Other stuff

            SetFilters(dialog);
            dialog.SetCurrentFolder(GetStartFolder());

            if (showVideo)
            {
                dialog.CurrentFolderChanged += OnCurrentFolderChanged;
                dialog.SelectionChanged     += OnSelectionChanged;
            }

            return(dialog);
        }
Esempio n. 18
0
        private void BuildSortCombo()
        {
            var combo = sort_combo = new ComboBoxText();

            foreach (var sort in sorts)
            {
                combo.AppendText(sort.Name);
            }
            combo.Active = 0;

            PackStart(new Label(Catalog.GetString("Sort by:")), false, false, 0);
            PackStart(combo, false, false, 0);
        }
Esempio n. 19
0
        public static void Main(string[] args)
        {
            Application.Init();
            MainWindow   win       = new MainWindow();
            Entry        firstnum  = new Entry();
            Entry        secnum    = new Entry();
            Button       calculate = new Button();
            ComboBoxText combotext = new ComboBoxText();
            Label        summary   = new Label();
            Grid         maingrid  = new Grid();

            string[] adds = { "+", "x", "-", "÷" };
            combotext.AppendText(adds[0]);
            combotext.AppendText(adds[1]);
            combotext.AppendText(adds[2]);
            combotext.AppendText(adds[3]);
            calculate.Label = "Calculate!";
            maingrid.Attach(firstnum, 0, 0, 1, 1);
            maingrid.AttachNextTo(combotext, firstnum, PositionType.Bottom, 1, 1);
            maingrid.AttachNextTo(secnum, combotext, PositionType.Bottom, 1, 1);
            maingrid.AttachNextTo(calculate, secnum, PositionType.Bottom, 1, 1);
            maingrid.AttachNextTo(summary, calculate, PositionType.Bottom, 1, 1);
            calculate.Clicked += Calculate_Clicked;
            void Calculate_Clicked(object sender, EventArgs e)
            {
                if (combotext.ActiveText == "+")
                {
                    int sumadd = int.Parse(firstnum.Text) + int.Parse(secnum.Text);
                    summary.Text = sumadd.ToString();
                }
                if (combotext.ActiveText == "x")
                {
                    int summultiply = int.Parse(firstnum.Text) * int.Parse(secnum.Text);
                    summary.Text = summultiply.ToString();
                }
                if (combotext.ActiveText == "-")
                {
                    int sumsubstract = int.Parse(firstnum.Text) - int.Parse(secnum.Text);
                    summary.Text = sumsubstract.ToString();
                }
                if (combotext.ActiveText == "÷")
                {
                    int sumsubstract = int.Parse(firstnum.Text) / int.Parse(secnum.Text);
                    summary.Text = sumsubstract.ToString();
                }
            }

            win.Add(maingrid);
            win.ShowAll();
            Application.Run();
        }
Esempio n. 20
0
        public DataTableControls()
        {
            SerialSpeedCombo = new ComboBoxText();
            foreach (var item in SiKLink.Constants.SiKSerialRates)
            {
                SerialSpeedCombo.Append(item.ToString(), item.ToString());
            }
            AirSpeedEntry   = new Entry();
            EccCheck        = new CheckButton("ECC");
            MavLinkVerCombo = new ComboBoxText();
            foreach (var item in Helpers.MavVersions)
            {
                MavLinkVerCombo.Append(
                    Helpers.MavVersions.IndexOf(item).ToString(),
                    item);
            }

            MinFreqEntry = new Entry();
            MaxFreqEntry = new Entry();
            NumChanEntry = new Entry();
            TxPowerCombo = new ComboBoxText();
            foreach (var item in SiKLink.Constants.AirPower)
            {
                TxPowerCombo.Append(item.ToString(), item.ToString());
            }

            NetIdEntry     = new Entry();
            DutyCycleCombo = new ComboBoxText();
            foreach (var item in Enumerable.Range(1, 100))
            {
                DutyCycleCombo.Append(item.ToString(), item.ToString());
            }
            LbtRssiCombo = new ComboBoxText();
            foreach (var item in Enumerable.Range(0, 255))
            {
                LbtRssiCombo.Append(item.ToString(), item.ToString());
            }
            MaxWndCombo = new ComboBoxText();
            foreach (var item in Enumerable.Range(33, 99))
            {
                MaxWndCombo.Append(item.ToString(), item.ToString());
            }

            RtsCtsCheck               = new CheckButton("RTS/CTS");
            ManchesterCheck           = new CheckButton("Manchester");
            OpportunisticCheck        = new CheckButton("Opp. Send");
            EepromFmtEntry            = new Entry();
            EepromFmtEntry.IsEditable = false;
        }
Esempio n. 21
0
        public (string, Widget) CreateEditableComboBox()
        {
            var combo = ComboBoxText.NewWithEntry();

            combo.AppendText("Example 1");
            combo.AppendText("Example 2");
            combo.AppendText("Example 3");
            combo.AppendText("Example 4");

            // combos with entry have a real entry inside it
            // we can use it by
            combo.Entry.PlaceholderText = "Write something";

            return("Combo with entry:", combo);
        }
Esempio n. 22
0
        ComboBox CreateCombo(EventHandler handler)
        {
            ComboBoxText combo = new ComboBoxText();

            combo.Changed += handler;

            combo.AppendText("<none>");

            foreach (Key key in Keys.All)
            {
                combo.AppendText(key.name);
            }

            combo.Active = 0;

            return(combo);
        }
Esempio n. 23
0
        /// <summary>
        /// <para>Objetivo: Obtener el texto asignado a.</para>
        /// <para>Prueba: </para>
        /// <para>Creacion: Luis Chavarria(OXINET) 20090501 - REQ:XXX.</para>
        /// <para>Modificacion: Luis Chavarria(OXINET) 20090501 - REQ:XXX.</para>
        /// </summary>
        /// <param name="valor"></param>
        public static string ObtenerTexto(ComboBoxText valor)
        {
            string nombre = string.Empty;;

            switch (valor)
            {
            case ComboBoxText.Select:
                nombre = "-- Seleccionar --";
                break;

            case ComboBoxText.Todos:
                nombre = "-- Todos --";
                break;

            case ComboBoxText.Otros:
                nombre = "-- Otros --";
                break;
            }

            return(nombre);
        }
Esempio n. 24
0
        public static Gtk.Window Create()
        {
            window = new Window("GtkComboBox");
            window.SetDefaultSize(200, 100);

            VBox box1 = new VBox(false, 0);

            window.Add(box1);

            VBox box2 = new VBox(false, 10);

            box2.BorderWidth = 10;
            box1.PackStart(box2, true, true, 0);

            ComboBoxText combo = ComboBoxText.NewWithEntry();

            combo.AppendText("Foo");
            combo.AppendText("Bar");
            combo.Changed       += new EventHandler(OnComboActivated);
            combo.Entry.Changed += new EventHandler(OnComboEntryChanged);
            box2.PackStart(combo, true, true, 0);

            HSeparator separator = new HSeparator();

            box1.PackStart(separator, false, false, 0);

            box2             = new VBox(false, 10);
            box2.BorderWidth = 10;
            box1.PackStart(box2, false, false, 0);

            Button button = new Button(Stock.Close);

            button.Clicked   += new EventHandler(OnCloseClicked);
            button.CanDefault = true;

            box2.PackStart(button, true, true, 0);
            button.GrabDefault();
            return(window);
        }
Esempio n. 25
0
        public TimeSpanQueryValueEntry() : base()
        {
            spin_button            = new SpinButton(0.0, 1.0, 1.0);
            spin_button.Digits     = 1;
            spin_button.WidthChars = 4;
            spin_button.SetRange(0.0, Double.MaxValue);
            Add(spin_button);

            combo = new ComboBoxText();
            combo.AppendText(Catalog.GetString("seconds"));
            combo.AppendText(Catalog.GetString("minutes"));
            combo.AppendText(Catalog.GetString("hours"));
            combo.AppendText(Catalog.GetString("days"));
            combo.AppendText(Catalog.GetString("weeks"));
            combo.AppendText(Catalog.GetString("months"));
            combo.AppendText(Catalog.GetString("years"));
            combo.Realized += delegate { combo.Active = set_combo; };
            Add(combo);

            spin_button.ValueChanged += HandleValueChanged;
            combo.Changed            += HandleValueChanged;
        }
Esempio n. 26
0
        //Values: (id, text) pairs
        private ComboBoxText CreateComboBoxText(string propertyName, params string[] values)
        {
            PropertyInfo property = typeof(Headers).GetProperty(propertyName);

            ComboBoxText comboBox = new ComboBoxText();

            for (int i = 0; i < values.Length; i += 2)
            {
                comboBox.Append(values[i], values[i + 1]);
            }

            comboBox.ActiveId = (string)property.GetValue(headers);
            comboBox.Changed += (object sender, EventArgs e) => SetProperty(sender, property, ((ComboBox)sender).ActiveId);
            PropertyChanged  += (object sender, string prop, object newValue) => {
                if ((sender != comboBox) && (prop == propertyName))
                {
                    comboBox.ActiveId = (string)newValue;
                }
            };

            return(comboBox);
        }
Esempio n. 27
0
        // Relative: [<|>] [num] [minutes|hours] ago
        // TODO: Absolute: [>|>=|=|<|<=] [date/time]
        public FileSizeQueryValueEntry() : base()
        {
            spin_button            = new SpinButton(0.0, 1.0, 1.0);
            spin_button.Digits     = 1;
            spin_button.WidthChars = 4;
            spin_button.SetRange(0.0, Double.MaxValue);
            Add(spin_button);

            combo = new ComboBoxText();
            combo.AppendText(Catalog.GetString("bytes"));
            combo.AppendText(Catalog.GetString("KB"));
            combo.AppendText(Catalog.GetString("MB"));
            combo.AppendText(Catalog.GetString("GB"));
            combo.Realized += delegate { if (!combo_set)
                                         {
                                             combo.Active = 2;
                                         }
            };
            Add(combo);

            spin_button.ValueChanged += HandleValueChanged;
            combo.Changed            += HandleValueChanged;
        }
Esempio n. 28
0
        public PlaylistQueryValueEntry() : base()
        {
            combo = new ComboBoxText();
            combo.WidthRequest = DefaultWidth;

            int            count = 0;
            PlaylistSource playlist;

            foreach (Source child in ServiceManager.SourceManager.DefaultSource.Children)
            {
                playlist = child as PlaylistSource;
                if (playlist != null && playlist.DbId != null)
                {
                    combo.AppendText(playlist.Name);
                    playlist_id_combo_map [(int)playlist.DbId] = count;
                    combo_playlist_id_map [count++]            = (int)playlist.DbId;
                }
            }

            Add(combo);
            combo.Active = 0;

            combo.Changed += HandleValueChanged;
        }
Esempio n. 29
0
        private void Build()
        {
            WindowPosition = WindowPosition.CenterOnParent;
            Resizable      = false;

            const int spacing = 6;
            var       hbox1   = new HBox()
            {
                Spacing = spacing
            };

            hbox1.PackStart(new Label(Translations.GetString("Transfer Map")), false, false, 0);
            hbox1.PackStart(new HSeparator(), true, true, 0);
            ContentArea.PackStart(hbox1, false, false, 0);

            var hbox2 = new HBox()
            {
                Spacing = spacing
            };

            comboMap = new ComboBoxText();
            comboMap.AppendText(Translations.GetString("RGB"));
            comboMap.AppendText(Translations.GetString("Luminosity"));
            comboMap.Active = 1;
            hbox2.PackStart(comboMap, false, false, 0);

            labelPoint = new Label("(256, 256)");
            var labelAlign = new Alignment(1, 0.5f, 1, 0);

            labelAlign.Add(labelPoint);
            hbox2.PackEnd(labelAlign, false, false, 0);
            ContentArea.PackStart(hbox2, false, false, 0);

            drawing = new DrawingArea()
            {
                WidthRequest  = 256,
                HeightRequest = 256,
                Events        = (Gdk.EventMask) 795646,
                CanFocus      = true
            };
            ContentArea.PackStart(drawing, false, false, 8);

            var hbox3 = new HBox();

            checkRed = new CheckButton(Translations.GetString("Red  "))
            {
                Active = true
            };
            checkGreen = new CheckButton(Translations.GetString("Green"))
            {
                Active = true
            };
            checkBlue = new CheckButton(Translations.GetString("Blue "))
            {
                Active = true
            };
            hbox3.PackStart(checkRed, false, false, 0);
            hbox3.PackStart(checkGreen, false, false, 0);
            hbox3.PackStart(checkBlue, false, false, 0);

            buttonReset = new Button()
            {
                WidthRequest  = 81,
                HeightRequest = 30,
                Label         = Translations.GetString("Reset")
            };
            hbox3.PackEnd(buttonReset, false, false, 0);
            ContentArea.PackStart(hbox3, false, false, 0);

            labelTip = new Label(Translations.GetString("Tip: Right-click to remove control points."));
            ContentArea.PackStart(labelTip, false, false, 0);

            ContentArea.ShowAll();
            checkRed.Hide();
            checkGreen.Hide();
            checkBlue.Hide();
        }
Esempio n. 30
0
        /// <summary>
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.gbReceive  = new Frame();
            this.txtReceiveScrolledWindow = new ScrolledWindow();
            this.txtReceive = new TextView();
            //this.menuReceive = new ContextMenuStrip(this.components);
            //this.toolStripMenuItem1 = new ToolStripMenuItem();
            //this.mi日志着色 = new ToolStripMenuItem();
            //this.toolStripMenuItem3 = new ToolStripSeparator();
            //this.mi显示应用日志 = new ToolStripMenuItem();
            //this.mi显示编码日志 = new ToolStripMenuItem();
            //this.mi显示发送数据 = new ToolStripMenuItem();
            //this.mi显示接收数据 = new ToolStripMenuItem();
            //this.mi显示统计信息 = new ToolStripMenuItem();
            //this.menuSend = new ContextMenuStrip(this.components);
            //this.mi清空2 = new ToolStripMenuItem();
            this.btnConnect = new Button();
            //this.timer1 = new Timer(this.components);
            //this.fontDialog1 = new FontDialog();
            //this.colorDialog1 = new ColorDialog();
            this.label1                = new Label();
            this.lbAddr                = new Label();
            this.cbMode                = new ComboBox(new string[] {});
            this.cbLocal               = new ComboBox(new string[] { });
            this.cbRemote              = ComboBoxText.NewWithEntry();
            this.pnlSetting            = new HBox();
            this.numPort               = new SpinButton(1, 63353, 1);
            this.label5                = new Label();
            this.gbSend                = new Frame();
            this.boxSend               = new VBox();
            this.boxSendSetting        = new HBox();
            this.numThreads            = new SpinButton(1, 100000, 1);
            this.numSleep              = new SpinButton(1000, 1000000, 1);
            this.txtSendScrolledWindow = new ScrolledWindow();
            this.txtSend               = new TextView();
            this.btnSend               = new Button();
            this.numMutilSend          = new SpinButton(1, 1000000, 1);
            this.label2                = new Label();
            this.label7                = new Label();
            this.label8                = new Label();
            //this.toolTip1 = new ToolTip(this.components);

            //this.menuReceive.SuspendLayout();
            //this.menuSend.SuspendLayout();
            //this.SuspendLayout();
            //
            // gbReceive
            //
            this.gbReceive.Add(this.txtReceiveScrolledWindow);
            this.gbReceive.Margin = 2;
            this.gbReceive.Name   = "gbReceive";
            //this.gbReceive.SetSizeRequest(878, 298);
            // gbReceive.Margin = 10;
            this.gbReceive.Label = "接收区:已接收0字节";
            //this.gbReceive.Halign = Align.Fill;
            //this.gbReceive.Valign = Align.Fill;
            this.gbReceive.ShadowType = ShadowType.Out;
            //
            // txtReceiveScrolledWindow
            //
            this.txtReceiveScrolledWindow.Add(this.txtReceive);
            this.txtReceiveScrolledWindow.CanFocus   = true;
            this.txtReceiveScrolledWindow.ShadowType = ShadowType.In;
            //this.txtReceiveScrolledWindow.Vexpand = true;
            //
            // txtReceive
            //
            // this.txtReceive.ContextMenuStrip = this.menuReceive;
            // this.txtReceive.Dock = DockStyle.Fill;
            // this.txtReceive.HideSelection = false;
            // this.txtReceive.Location = new System.Drawing.Point(4, 25);
            this.txtReceive.Margin = 1;
            this.txtReceive.Name   = "txtReceive";
            // this.txtReceive.Size = new System.Drawing.Size(970, 269);
            this.txtReceive.Editable = false;
            // 滚动方法 https://stackoverflow.com/questions/37824865/gtk-textview-auto-scroll-when-text-is-added-to-text-buffer
            this.txtReceive.SizeAllocated += TxtReceive_SizeAllocated;
            ////
            //// menuReceive
            ////
            //this.menuReceive.ImageScalingSize = new System.Drawing.Size(32, 32);
            //this.menuReceive.Items.AddRange(new ToolStripItem[] {
            //this.toolStripMenuItem1,
            //this.mi日志着色,
            //this.toolStripMenuItem3,
            //this.mi显示应用日志,
            //this.mi显示编码日志,
            //this.mi显示发送数据,
            //this.mi显示接收数据,
            //this.mi显示统计信息});
            //this.menuReceive.Name = "menuSend";
            //this.menuReceive.Size = new System.Drawing.Size(189, 206);
            ////
            //// toolStripMenuItem1
            ////
            //this.toolStripMenuItem1.Name = "toolStripMenuItem1";
            //this.toolStripMenuItem1.Size = new System.Drawing.Size(188, 28);
            //this.toolStripMenuItem1.Text = "清空";
            //this.toolStripMenuItem1.Click += new System.EventHandler(this.mi清空_Click);
            ////
            //// mi日志着色
            ////
            //this.mi日志着色.Name = "mi日志着色";
            //this.mi日志着色.Size = new System.Drawing.Size(188, 28);
            //this.mi日志着色.Text = "日志着色";
            //this.mi日志着色.Click += new System.EventHandler(this.miCheck_Click);
            ////
            //// toolStripMenuItem3
            ////
            //this.toolStripMenuItem3.Name = "toolStripMenuItem3";
            //this.toolStripMenuItem3.Size = new System.Drawing.Size(185, 6);
            ////
            //// mi显示应用日志
            ////
            //this.mi显示应用日志.Name = "mi显示应用日志";
            //this.mi显示应用日志.Size = new System.Drawing.Size(188, 28);
            //this.mi显示应用日志.Text = "显示应用日志";
            //this.mi显示应用日志.Click += new System.EventHandler(this.miCheck_Click);
            ////
            //// mi显示编码日志
            ////
            //this.mi显示编码日志.Name = "mi显示编码日志";
            //this.mi显示编码日志.Size = new System.Drawing.Size(188, 28);
            //this.mi显示编码日志.Text = "显示编码日志";
            //this.mi显示编码日志.Click += new System.EventHandler(this.miCheck_Click);
            ////
            //// mi显示发送数据
            ////
            //this.mi显示发送数据.Name = "mi显示发送数据";
            //this.mi显示发送数据.Size = new System.Drawing.Size(188, 28);
            //this.mi显示发送数据.Text = "显示发送数据";
            //this.mi显示发送数据.Click += new System.EventHandler(this.miCheck_Click);
            ////
            //// mi显示接收数据
            ////
            //this.mi显示接收数据.Name = "mi显示接收数据";
            //this.mi显示接收数据.Size = new System.Drawing.Size(188, 28);
            //this.mi显示接收数据.Text = "显示接收数据";
            //this.mi显示接收数据.Click += new System.EventHandler(this.miCheck_Click);
            ////
            //// mi显示统计信息
            ////
            //this.mi显示统计信息.Name = "mi显示统计信息";
            //this.mi显示统计信息.Size = new System.Drawing.Size(188, 28);
            //this.mi显示统计信息.Text = "显示统计信息";
            //this.mi显示统计信息.Click += new System.EventHandler(this.miCheck_Click);
            ////
            //// menuSend
            ////
            //this.menuSend.ImageScalingSize = new System.Drawing.Size(32, 32);
            //this.menuSend.Items.AddRange(new ToolStripItem[] {
            //this.mi清空2});
            //this.menuSend.Name = "menuSend";
            //this.menuSend.Size = new System.Drawing.Size(117, 32);
            ////
            //// mi清空2
            ////
            //this.mi清空2.Name = "mi清空2";
            //this.mi清空2.Size = new System.Drawing.Size(116, 28);
            //this.mi清空2.Text = "清空";
            //this.mi清空2.Click += new System.EventHandler(this.mi清空2_Click);
            //
            // btnConnect
            //
            // this.btnConnect.Location = new System.Drawing.Point(748, 12);
            this.btnConnect.Margin = 4;
            this.btnConnect.Name   = "btnConnect";
            // this.btnConnect.Size = new System.Drawing.Size(100, 44);
            // this.btnConnect.TabIndex = 3;
            this.btnConnect.Label    = "打开";
            this.btnConnect.Clicked += new System.EventHandler(this.btnConnect_Click);
            ////
            //// timer1
            ////
            //this.timer1.Enabled = true;
            //this.timer1.Interval = 300;
            //this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            //
            // label1
            //
            //this.label1.AutoSize = true;
            this.label1.Xalign       = 0.8F;
            this.label1.Yalign       = 0.5F;
            this.label1.MarginTop    = 4;
            this.label1.MarginBottom = 4;
            this.label1.Name         = "label1";
            //this.label1.WidthRequest = 62;
            //this.label1.HeightRequest = 18;
            this.label1.Text = "模式:";
            //
            // lbAddr
            //
            // this.lbAddr.AutoSize = true;
            // this.lbAddr.Location = new System.Drawing.Point(374, 14);
            this.lbAddr.Xalign       = 0.8F;
            this.lbAddr.Yalign       = 0.5F;
            this.lbAddr.MarginTop    = 4;
            this.lbAddr.MarginBottom = 4;
            this.lbAddr.Name         = "lbAddr";
            //this.lbAddr.WidthRequest = 62;
            //this.lbAddr.HeightRequest = 18;
            this.lbAddr.Text = "远程:";
            //
            // cbMode
            //
            //this.cbMode.DropDownStyle = ComboBoxStyle.DropDownList;
            //this.cbMode.FormattingEnabled = true;
            //this.cbMode.Location = new System.Drawing.Point(72, 11);
            //this.cbMode.Margin = 4;
            this.cbMode.Active = 1;
            this.cbMode.Name   = "cbMode";
            //this.cbMode.SetSizeRequest(1, 1);
            this.cbMode.Changed += new System.EventHandler(this.cbMode_SelectedIndexChanged);
            //
            // cbLocal
            //
            //this.cbLocal.Active = 1;
            this.cbLocal.Name = "cbLocal";
            //this.cbLocal.SetSizeRequest(1, 1);
            //this.cbLocal.Changed += new System.EventHandler(this.cbLocal_SelectedIndexChanged);
            //
            // cbRemote
            //
            //this.cbRemote.Margin = 4;
            this.cbRemote.Name = "cbRemote";
            //this.cbRemote.SetSizeRequest(200, 18);
            // this.cbRemote.Size = new System.Drawing.Size(247, 26);
            this.cbRemote.Sensitive = true;
            //this.cbRemote.
            //
            // pnlSetting
            //
            this.pnlSetting.PackStart(this.label1, false, false, 1);
            this.pnlSetting.PackStart(this.cbMode, false, false, 1);
            this.pnlSetting.PackStart(this.label5, false, false, 1);
            this.pnlSetting.PackStart(this.cbLocal, false, false, 1);
            this.pnlSetting.PackStart(this.lbAddr, false, false, 1);
            this.pnlSetting.PackStart(this.cbRemote, false, false, 1);
            this.pnlSetting.PackStart(this.numPort, false, false, 1);
            this.pnlSetting.PackStart(this.btnConnect, false, false, 1);

            //this.pnlSetting.Add();
            //this.pnlSetting.Position = 5;// .Location = new System.Drawing.Point(14, 12);
            this.pnlSetting.Margin = 2;
            this.pnlSetting.Name   = "pnlSetting";
            // this.pnlSetting.Valign = Align.Fill;
            // this.pnlSetting.Halign = Align.Fill;
            // this.pnlSetting.SetSizeRequest(708, 20);
            // pnlSetting.Orientation = Orientation.Horizontal;
            //this.pnlSetting.Size = new System.Drawing.Size(708, 46);
            //this.pnlSetting.TabIndex = 13;
            //
            // numPort
            //
            // this.numPort.Location = new System.Drawing.Point(270, 10);
            this.numPort.Margin = 4;
            this.numPort.Name   = "numPort";
            this.numPort.Value  = 8080;
            //this.numPort.SetSizeRequest(94, 28);
            //
            // label5
            //
            //this.label5.AutoSize = true;
            //this.label5.Location = new System.Drawing.Point(218, 14);
            this.label5.Xalign       = 0.8F;
            this.label5.Yalign       = 0.5F;
            this.label5.MarginTop    = 4;
            this.label5.MarginBottom = 4;
            this.label5.Name         = "label5";
            //this.label5.SetSizeRequest(62, 18);
            this.label5.Text = "本地:";
            //
            // gbSend
            //
            this.gbSend.Add(this.boxSend);
            // this.gbSend.Controls.Add(this.numThreads);
            // this.gbSend.Controls.Add(this.numSleep);
            // this.gbSend.Controls.Add(this.btnSend);
            // this.gbSend.Controls.Add(this.numMutilSend);
            // this.gbSend.Controls.Add(this.label2);
            // this.gbSend.Controls.Add(this.label7);
            // this.gbSend.Location = new System.Drawing.Point(14, 424);
            this.gbSend.Margin = 1;
            this.gbSend.Name   = "gbSend";
            //this.gbSend.SetSizeRequest(778, 126);
            this.gbSend.Label = "发送区:已发送0字节";
            //
            // boxSend
            //
            this.boxSend.PackStart(this.txtSendScrolledWindow, false, false, 2);
            this.boxSend.PackStart(this.boxSendSetting, false, false, 2);
            // this.boxSend.Orientation = Orientation.Vertical;
            this.boxSend.Margin = 1;
            this.boxSend.Name   = "boxSend";
            //
            // boxSendSetting
            //
            this.boxSendSetting.PackStart(this.label7, false, false, 2);
            this.boxSendSetting.PackStart(this.numMutilSend, false, false, 2);
            this.boxSendSetting.PackStart(this.label8, false, false, 2);
            this.boxSendSetting.PackStart(this.numThreads, false, false, 2);
            this.boxSendSetting.PackStart(this.label2, false, false, 2);
            this.boxSendSetting.PackStart(this.numSleep, false, false, 2);
            this.boxSendSetting.PackStart(this.btnSend, false, false, 2);
            this.boxSendSetting.Margin = 1;
            this.boxSendSetting.Name   = "sendSetting";
            //
            // numThreads
            //
            this.numThreads.Margin = 4;
            this.numThreads.Name   = "numThreads";
            //this.numThreads.SetSizeRequest(78, 28);
            // this.toolTip1.SetToolTip(this.numThreads, "模拟多客户端发送,用于压力测试!");
            //
            // numSleep
            //
            this.numSleep.Margin = 1;
            this.numSleep.Name   = "numSleep";
            //this.numSleep.SetSizeRequest(109, 28);
            //
            // txtSendScrolledWindow
            //
            this.txtSendScrolledWindow.CanFocus   = true;
            this.txtSendScrolledWindow.ShadowType = ShadowType.In;
            this.txtSendScrolledWindow.Vexpand    = true;
            this.txtSendScrolledWindow.Add(this.txtSend);
            //
            // txtSend
            //
            // this.txtSend.ContextMenuStrip = this.menuSend;
            // this.txtSend.Location = new System.Drawing.Point(0, 28);
            this.txtSend.Margin = 4;
            this.txtSend.Name   = "txtSend";
            //this.txtSend.SetSizeRequest(621, 86);
            this.txtSend.WrapMode = WrapMode.Word;
            //this.txtSend.Editable = false;
            //
            // btnSend
            //
            this.btnSend.Margin = 4;
            this.btnSend.Name   = "btnSend";
            //this.btnSend.SetSizeRequest(75, 45);
            this.btnSend.Label    = "发送";
            this.btnSend.Clicked += new System.EventHandler(this.btnSend_Click);
            //
            // numMutilSend
            //
            this.numMutilSend.Margin = 4;
            this.numMutilSend.Name   = "numMutilSend";
            //this.numMutilSend.SetSizeRequest(109, 28);
            //
            // label2
            //
            // this.label2.Location = new System.Drawing.Point(729, 87);
            this.label2.Margin = 4;
            this.label2.Name   = "label2";
            //this.label2.SetSizeRequest(62, 18);
            this.label2.Text = "间隔:";
            //
            // label7
            //
            // this.label7.Location = new System.Drawing.Point(729, 39);
            this.label7.Margin = 4;
            this.label7.Name   = "label7";
            //this.label7.SetSizeRequest(62, 18);
            this.label7.Text = "次数:";
            //
            // label8
            //
            this.label8.Margin = 4;
            this.label8.Name   = "label8";
            //this.label8.SetSizeRequest(62, 18);
            this.label8.Text = "线程:";
            ////
            //// FrmMain
            ////
            //this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
            //this.AutoScaleMode = AutoScaleMode.Font;
            //this.ClientSize = new System.Drawing.Size(1000, 568);
            this.PackStart(this.pnlSetting, false, false, 2);
            this.PackStart(this.gbReceive, true, true, 2);
            this.PackStart(this.gbSend, false, false, 2);
            //this.Margin = new Padding(4);
            //this.Name = "FrmMain";
            //this.StartPosition = FormStartPosition.CenterScreen;
            //this.Text = "Api调试";
            this.Shown += new System.EventHandler(this.FrmMain_Load);
            //this.menuReceive.ResumeLayout(false);
            //this.menuSend.ResumeLayout(false);
            //this.pnlSetting.ResumeLayout(false);
            //this.pnlSetting.PerformLayout();
            //((System.ComponentModel.ISupportInitialize)(this.numPort)).EndInit();
            //((System.ComponentModel.ISupportInitialize)(this.numThreads)).EndInit();
            //((System.ComponentModel.ISupportInitialize)(this.numSleep)).EndInit();
            //((System.ComponentModel.ISupportInitialize)(this.numMutilSend)).EndInit();
            //this.ResumeLayout(false);
            //this.PerformLayout();
            //this.Fill = true;
            //this.Halign = Align.Fill;
            //this.Valign = Align.Fill;
            this.Orientation = Orientation.Vertical;
        }