Пример #1
0
        #pragma warning restore 0169
        #pragma warning restore 0649

        public ViewTaskDialog(Window parent, bool isTaskInit)
        {
            Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ViewTaskDialog.glade");

            Glade.XML glade = new Glade.XML(stream, "ViewTaskDialog", null);
            stream.Close();
            glade.Autoconnect(this);
            thisDialog                = ((Dialog)(glade.GetWidget("ViewTaskDialog")));
            thisDialog.Modal          = true;
            thisDialog.TransientFor   = parent;
            thisDialog.WindowPosition = WindowPosition.CenterAlways;

            cbActor.Entry.IsEditable = false;
            cbActor.Changed         += new EventHandler(OnCbActorChanged);
            calStartTime.Date        = DateTime.Now.Date;
            calEndTime.Date          = DateTime.Now.Date;
            cbState.Entry.IsEditable = false;
            cbState.Changed         += new EventHandler(OnCbStateChanged);
            spbPriority.SetRange(0, 10000);
            spbPriority.SetIncrements(1, 10);

            IsInitTask = isTaskInit;
            tvDescription.KeyReleaseEvent += HandleKeyReleaseEvent;
            tvComment.KeyReleaseEvent     += CommentKeyReleaseEvent;
        }
Пример #2
0
        // Relative: [<|>] [num] [minutes|hours] ago
        // TODO: Absolute: [>|>=|=|<|<=] [date/time]
        public FileSizeQueryValueEntry() : base()
        {
            spin_button = new SpinButton(0.0, 1.0, 1.0)
            {
                Digits     = 1,
                WidthChars = 4
            };
            spin_button.SetRange(0.0, double.MaxValue);
            Add(spin_button);

            combo = ComboBox.NewText();
            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;
        }
Пример #3
0
        void HandleCollectionChanged(IBrowsableCollection collection)
        {
            bool multiple = collection.Count > 1;

            tray_frame.Visible = multiple;
            //forward_button.Visible = multiple;
            //back_button.Visible = multiple;
            count_label.Visible  = multiple;
            photo_spin.Visible   = multiple;
            action_frame.Visible = multiple;
            photo_spin.SetRange(1.0, (double)collection.Count);
        }
Пример #4
0
        private void SetMinValues()
        {
            int vin  = SpinIn.ValueAsInt;
            int vmin = SpinMin.ValueAsInt;

            int min = vin / 2 + 1;

            SpinMin.SetRange(min, vin);

            if (vmin < min)
            {
                vmin = min;
            }
            else if (vmin > vin)
            {
                vmin = vin;
            }

            SpinMin.Value = vmin;
        }
Пример #5
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;
        }
        private void BuildInterface()
        {
            Gui.Initialize(this);
            Icon           = new Pixbuf(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, !ApplicationHelper.IsUnix ? @"Content\img\todo.png": @"Content/img/todo.png"));
            Name           = "DatePicker";
            Title          = "Set date";
            WindowPosition = WindowPosition.Mouse;

            KeepAbove = true;
            Modal     = true;
            Resizable = false;

            _containerVBox = new VBox
            {
                Name      = "containerVBox",
                HasWindow = false
            };

            Calendar = new Calendar();

            _timeBox = new HBox
            {
                Name      = "timeBox",
                HasWindow = false
            };

            _hoursBox = new VBox
            {
                Name      = "hoursBox",
                HasWindow = false
            };

            _hoursLabel = new Label
            {
                Name = "hoursLabel",
                Text = "Hours"
            };

            HoursSpin = new SpinButton(0f, 1f, 1f)
            {
                Name = "hoursSpin"
            };
            HoursSpin.SetRange(0, 23);

            _minutesBox = new VBox
            {
                Name      = "minutesBox",
                HasWindow = false
            };

            _minutesLabel = new Label
            {
                Name = "minutesLabel",
                Text = "Minutes"
            };

            MinutesSpin = new SpinButton(0f, 1f, 1f)
            {
                Name = "minutesSpin"
            };
            MinutesSpin.SetRange(0, 59);

            _secondsBox = new VBox
            {
                Name      = "secondsBox",
                HasWindow = false
            };

            _secondsLabel = new Label
            {
                Name = "secondsLabel",
                Text = "Seconds"
            };

            SecondsSpin = new SpinButton(0f, 1f, 1f)
            {
                Name = "secondsSpin"
            };
            SecondsSpin.SetRange(0, 59);

            _buttonBox = new HBox
            {
                Name      = "buttonBox",
                HasWindow = false
            };

            AcceptButton = new Button
            {
                Name  = "acceptButton",
                Label = "OK"
            };

            _cancelButton = new Button
            {
                Name  = "cancelButton",
                Label = "Cancel"
            };

            _containerVBox.Add(Calendar);

            var calendarChild = (Box.BoxChild)_containerVBox[Calendar];

            calendarChild.Padding = 5;
            calendarChild.Expand  = true;

            _containerVBox.Add(_timeBox);

            var timeChild = (Box.BoxChild)_containerVBox[_timeBox];

            timeChild.Padding = 5;
            timeChild.Expand  = true;

            _timeBox.Add(_hoursBox);
            var hoursBoxChild = (Box.BoxChild)_timeBox[_hoursBox];

            hoursBoxChild.Padding = 5;
            hoursBoxChild.Expand  = true;

            _hoursBox.Add(_hoursLabel);

            var hoursLabelChild = (Box.BoxChild)_hoursBox[_hoursLabel];

            hoursLabelChild.Padding = 5;
            hoursLabelChild.Expand  = true;

            _hoursBox.Add(HoursSpin);

            var hoursSpinChild = (Box.BoxChild)_hoursBox[HoursSpin];

            hoursSpinChild.Padding = 5;
            hoursSpinChild.Expand  = true;

            _timeBox.Add(_minutesBox);
            var minutesBoxChild = (Box.BoxChild)_timeBox[_minutesBox];

            minutesBoxChild.Padding = 5;
            minutesBoxChild.Expand  = true;

            _minutesBox.Add(_minutesLabel);

            var minutesLabelChild = (Box.BoxChild)_minutesBox[_minutesLabel];

            minutesLabelChild.Padding = 5;
            minutesLabelChild.Expand  = true;

            _minutesBox.Add(MinutesSpin);

            var minutesSpinChild = (Box.BoxChild)_minutesBox[MinutesSpin];

            minutesSpinChild.Padding = 5;
            minutesSpinChild.Expand  = true;

            _timeBox.Add(_secondsBox);
            var secondsBoxChild = (Box.BoxChild)_timeBox[_secondsBox];

            secondsBoxChild.Padding = 5;
            secondsBoxChild.Expand  = true;

            _secondsBox.Add(_secondsLabel);

            var secondsLabelChild = (Box.BoxChild)_secondsBox[_secondsLabel];

            secondsLabelChild.Padding = 5;
            secondsLabelChild.Expand  = true;

            _secondsBox.Add(SecondsSpin);

            var secondsSpinChild = (Box.BoxChild)_secondsBox[SecondsSpin];

            secondsSpinChild.Padding = 5;
            secondsSpinChild.Expand  = true;

            _containerVBox.Add(_buttonBox);

            var boxchild = (Box.BoxChild)_containerVBox[_buttonBox];

            boxchild.Padding = 5;
            boxchild.Expand  = true;

            _buttonBox.Add(AcceptButton);

            var acceptChild = (Box.BoxChild)_buttonBox[AcceptButton];

            acceptChild.Padding = 5;

            _buttonBox.Add(_cancelButton);

            var cancelChild = (Box.BoxChild)_buttonBox[_cancelButton];

            cancelChild.Padding = 5;

            Add(_containerVBox);

            ShowAll();

            _cancelButton.Clicked += CancelButton_Clicked;

            DeleteEvent += OnDeleteEvent;
        }
Пример #7
0
        public override Widget CreateConfigWidget()
        {
            var container = new VBox();



            var fileHBox = new HBox();

            container.Add(fileHBox);


            // Sudoku index.
            var indexHBox = new HBox();

            fileHBox.Add(indexHBox);
            var indexLabel = new Label {
                Text = "Sudoku index"
            };

            indexHBox.Add(indexLabel);

            var indexButton = new SpinButton(1, _sudokuList.Count, 1)
            {
                Value = 1
            };

            indexButton.ValueChanged += delegate
            {
                _sudokuIndex = (int)indexButton.Value - 1;

                OnReconfigured();
            };
            indexHBox.Add(indexButton);

            // File support

            var selectImageButton = new Button {
                Label = "Load sudoku(s) file"
            };

            selectImageButton.Clicked += delegate
            {
                Gtk.FileChooserDialog filechooser =
                    new Gtk.FileChooserDialog(
                        "Select the sudoku to use",
                        Context.GtkWindow,
                        FileChooserAction.Open,
                        "Cancel",
                        ResponseType.Cancel,
                        "Open",
                        ResponseType.Accept);

                if (filechooser.Run() == (int)ResponseType.Accept)
                {
                    _sudokuList = SudokuBoard.ParseFile(filechooser.Filename);
                    indexButton.SetRange(1, _sudokuList.Count);
                }

                filechooser.Destroy();

                OnReconfigured();
            };
            fileHBox.Add(selectImageButton);
            var helpImageButton = new Button {
                Label = "?"
            };

            helpImageButton.Clicked += delegate
            {
                var msg = new MessageDialog(
                    Context.GtkWindow,
                    DialogFlags.Modal,
                    MessageType.Info,
                    ButtonsType.Ok,
                    "Accepted formats represent Sudokus on one or several lines," +
                    "\n with characters '.', '-', or 'X' for empty cells and digits otherwise." +
                    "\n Lines starting with other characters are ignored such as '#' for comments on the common sdk format.");
                msg.Run();

                msg.Destroy();
            };
            fileHBox.Add(helpImageButton);



            // Genetics selector.

            var geneticsHBox = new HBox();

            geneticsHBox.Spacing += 2;

            var geneticsLabel = new Label {
                Text = "Genetics"
            };

            geneticsHBox.Add(geneticsLabel);

            var chromosomeTypes = new string[] {
                nameof(SudokuChromosomeType.RowsPermutations)
                , nameof(SudokuChromosomeType.Cells)
                , nameof(SudokuChromosomeType.RandomRowsPermutations)
                , nameof(SudokuChromosomeType.RowsWithoutMask)
                , nameof(SudokuChromosomeType.CellsWithoutMask)
            };

            _nbPermsHBox = new HBox
            {
                Visible = _ChromosomeType == nameof(SudokuChromosomeType.RandomRowsPermutations)
            };


            var nbPermsLabel = new Label {
                Text = "Nb Permutations"
            };

            _nbPermsHBox.Add(nbPermsLabel);

            var nbPermsButton = new SpinButton(1, 1000, 1);

            _nbPermsHBox.Add(nbPermsButton);
            nbPermsButton.Value         = _nbPermutations;
            nbPermsButton.ValueChanged += delegate
            {
                _nbPermutations = (int)nbPermsButton.Value;

                OnReconfigured();
            };

            var nbSudokusLabel = new Label {
                Text = "Nb Sudokus"
            };

            _nbPermsHBox.Add(nbSudokusLabel);

            var nbSudokusButton = new SpinButton(1, 1000, 1);

            _nbPermsHBox.Add(nbSudokusButton);
            nbSudokusButton.Value         = _nbSudokus;
            nbSudokusButton.ValueChanged += delegate
            {
                _nbSudokus = (int)nbSudokusButton.Value;

                OnReconfigured();
            };



            var selectorCombo = new ComboBox(chromosomeTypes)
            {
                Active = 0
            };

            selectorCombo.Changed += delegate
            {
                _ChromosomeType      = selectorCombo.ActiveText;
                _nbPermsHBox.Visible = _ChromosomeType == nameof(SudokuChromosomeType.RandomRowsPermutations);
                OnReconfigured();
            };
            geneticsHBox.Add(selectorCombo);
            container.Add(geneticsHBox);
            container.Add(_nbPermsHBox);

            //Multi check
            var multiHBox  = new HBox();
            var multiCheck = new CheckButton("Multi-Solutions")
            {
                Active = _multipleChromosome
            };

            _nbChromosomesHBox          = new HBox();
            _nbChromosomesHBox.Spacing += 2;
            _nbChromosomesHBox.Visible  = _multipleChromosome;

            var nbChromosomesLabel = new Label {
                Text = "Nb Chrom."
            };

            _nbChromosomesHBox.Add(nbChromosomesLabel);

            var nbChromosomesButton = new SpinButton(1, 1000, 1);

            _nbChromosomesHBox.Add(nbChromosomesButton);
            nbChromosomesButton.Value         = _nbChromosomes;
            nbChromosomesButton.ValueChanged += delegate
            {
                _nbChromosomes = (int)nbChromosomesButton.Value;

                OnReconfigured();
            };

            multiCheck.Toggled += delegate
            {
                _multipleChromosome        = multiCheck.Active;
                _nbChromosomesHBox.Visible = _multipleChromosome;

                OnReconfigured();
            };

            multiHBox.Add(multiCheck);
            multiHBox.Add(_nbChromosomesHBox);

            container.Add(multiHBox);

            return(container);
        }