Ejemplo n.º 1
0
        public RangeEntry(string rangeLabel, RangeOrderClosure orderClosure, string orderTooltip)
        {
            AutoOrderButton auto_order_button;

            PackStart(from_entry = new SpinButton(0, 999, 1), true, true, 0);
            PackStart(new Label(rangeLabel), false, false, 6);
            PackStart(to_entry = new SpinButton(0, 999, 1), true, true, 0);
            if (orderClosure != null)
            {
                PackStart(auto_order_button = new AutoOrderButton(), false, false, 1);
                auto_order_button.Clicked  += delegate { orderClosure(this); };
                if (orderTooltip != null)
                {
                    TooltipSetter.Set(TooltipSetter.CreateHost(), auto_order_button, orderTooltip);
                }
            }

            ShowAll();

            from_entry.WidthChars = 2;
            to_entry.WidthChars   = 2;

            from_entry.ValueChanged += OnChanged;
            to_entry.ValueChanged   += OnChanged;
        }
Ejemplo n.º 2
0
 private void CreateComponents()
 {
     panel1              = new Table(2, 1, false);
     panel3Content       = new Table(2, 1, false);
     panel3              = new Frame(GetLocalizedText("Image Boxes"));
     panel6              = new Table(1, 4, false);
     label1              = new Label(GetLocalizedText("Rows"));
     _imageBoxRows       = new SpinButton(0, 100, 1);
     label2              = new Label(GetLocalizedText("Cols"));
     _imageBoxCols       = new SpinButton(0, 100, 1);
     panel4              = new Table(1, 3, false);
     panel9              = new Table(0, 0, false);
     _btnApplyImageBoxes = new Button(GetLocalizedText("Apply"));
     panel7              = new Table(0, 0, false);
     panel2Content       = new Table(2, 1, false);
     panel2              = new Frame(GetLocalizedText("Tiles"));
     panel8              = new Table(1, 4, false);
     label3              = new Label(GetLocalizedText("Rows"));
     _tileRows           = new SpinButton(0, 100, 1);
     label4              = new Label(GetLocalizedText("Cols"));
     _tileCols           = new SpinButton(0, 100, 1);
     panel5              = new Table(1, 3, false);
     panel11             = new Table(0, 0, false);
     _btnApplyTiles      = new Button(GetLocalizedText("Apply"));
     panel10             = new Table(0, 0, false);
 }
Ejemplo n.º 3
0
        public override Gtk.Widget GetEditWidget()
        {
            Gtk.SpinButton spin;

            if (parentRow.PropertyDescriptor.PropertyType == typeof(Int16))
            {
                spin = new SpinButton(Int16.MinValue, Int16.MaxValue, 1);
            }
            else if (parentRow.PropertyDescriptor.PropertyType == typeof(Int32))
            {
                spin = new SpinButton(Int32.MinValue, Int32.MaxValue, 1);
            }
            else if (parentRow.PropertyDescriptor.PropertyType == typeof(Int64))
            {
                spin = new SpinButton(Int64.MinValue, Int64.MaxValue, 1);
            }
            else              //TODO: process floats etc nicely
            {
                spin = new SpinButton(Int64.MinValue, Int64.MaxValue, 1);
            }

            spin.HasFrame      = false;
            spin.Value         = Convert.ToDouble(parentRow.PropertyValue);
            spin.ValueChanged += new EventHandler(spin_ValueChanged);

            return(spin);
        }
Ejemplo n.º 4
0
    /// <summary>
    /// Constructs the sprite drawing area, along with the various
    /// rules needed.
    /// </summary>
    public Viewer()
    {
        // Create the drop-down list
        HBox box = new HBox();

        fps          = new SpinButton(1, 100, 1);
        fps.Value    = DesiredFps;
        fps.Changed += OnFpsChanged;
        showUpdate   = new CheckButton();
        box.PackStart(new Label("FPS"), false, false, 0);
        box.PackStart(fps, false, false, 2);
        box.PackStart(new Label("Show Update"), false, false, 5);
        box.PackStart(showUpdate, false, false, 2);
        box.PackStart(new Label(), true, true, 0);
        PackStart(box, false, false, 2);

        // Create the drawing area and pack it
        area                 = new DrawingArea();
        area.Realized       += OnRealized;
        area.ExposeEvent    += OnExposed;
        area.ConfigureEvent += OnConfigure;
        PackStart(area, true, true, 2);

        // Create the viewport
        Sprites  = new SpriteList();
        viewport = new SpriteViewport(Sprites);

        // Start up a little animation loop
        Timeout.Add(1000 / DesiredFps, OnTick);
    }
Ejemplo n.º 5
0
        private void SubscribeHSV(SpinButton spinButton, Slider slider)
        {
            spinButton.Tag = false;
            slider.Tag     = false;

            spinButton.ValueChangedByUser += (s, a) =>
            {
                if (spinButton.Value == null)
                {
                    return;
                }

                try
                {
                    spinButton.Tag = true;

                    var hsv = new ColorHSV
                    {
                        H = (int)_sliderH.Value,
                        S = (int)_sliderS.Value,
                        V = (int)_sliderV.Value
                    };
                    SetHSV(hsv);

                    _suppressHSV = true;
                    var rgb = hsv.ToRGB();
                    Color = new Color(rgb.R, rgb.G, rgb.B, Color.A);
                }
                finally
                {
                    spinButton.Tag = false;
                    _suppressHSV   = false;
                }
            };

            slider.ValueChangedByUser += (s, a) =>
            {
                try
                {
                    slider.Tag = true;

                    var hsv = new ColorHSV
                    {
                        H = (int)_sliderH.Value,
                        S = (int)_sliderS.Value,
                        V = (int)_sliderV.Value
                    };
                    SetHSV(hsv);

                    _suppressHSV = true;
                    var rgb = hsv.ToRGB();
                    Color = new Color(rgb.R, rgb.G, rgb.B, Color.A);
                }
                finally
                {
                    slider.Tag   = false;
                    _suppressHSV = false;
                }
            };
        }
        private void BuildWidget()
        {
            sleepHour = new SpinButton(0, 23, 1);
            sleepMin  = new SpinButton(0, 59, 1);

            sleepHour.WidthChars = 2;
            sleepMin.WidthChars  = 2;

            int remainder = 0;

            sleepHour.Value = Math.DivRem(service.SleepTimerDuration, 60, out remainder);
            sleepMin.Value  = remainder;

            sleepHour.ValueChanged += OnSleepValueChanged;
            sleepMin.ValueChanged  += OnSleepValueChanged;

            Label prefix    = new Label(AddinManager.CurrentLocalizer.GetString("Sleep Timer :"));
            Label separator = new Label(":");

            HBox topbox = new HBox(false, 10);

            topbox.PackStart(prefix, true, true, 2);
            topbox.PackStart(sleepHour, true, true, 2);
            topbox.PackStart(separator, true, true, 2);
            topbox.PackStart(sleepMin, true, true, 2);

            AddStockButton(Stock.Cancel, ResponseType.Cancel);
            start_button = AddButton(AddinManager.CurrentLocalizer.GetString("Start Timer"), ResponseType.Ok, true);

            VBox.PackStart(topbox, true, true, 2);

            Update();
        }
Ejemplo n.º 7
0
 public CheckBoxItem(Label label, Size size, CheckButton check, SpinButton spin)
 {
     Label = label;
     Size  = size;
     Check = check;
     Spin  = spin;
 }
Ejemplo n.º 8
0
        private void InitializeComponent()
        {
            var box = new VBox();

            _cbAutoStart = new CheckButton("Auto-start?");
            box.PackStart(_cbAutoStart, false, false, 0);

            _cbUseTime = new CheckButton("Work only at specified times");
            box.PackStart(_cbUseTime, false, false, 0);

            _timeGridWidget = new TimeGridWidget();
            box.PackStart(_timeGridWidget, true, true, 0);

            _numMaxRate        = new SpinButton(1, Double.MaxValue, 0.25);
            _numMaxRate.Digits = 3;
            var tbl = new Table(2, 2, true);

            tbl.Attach(new Label("Max download rate (KB/s):"), 0, 1, 0, 1);
            tbl.Attach(_numMaxRate, 1, 2, 0, 1);

            _numMaxJobs        = new SpinButton(1, Double.MaxValue, 1);
            _numMaxJobs.Digits = 1;
            tbl.Attach(new Label("Max simultaneous jobs:"), 0, 1, 1, 2);
            tbl.Attach(_numMaxJobs, 1, 2, 1, 2);
            box.PackStart(tbl, false, false, 0);

            PackStart(box, false, false, 0);
            ShowAll();

            _cbUseTime.Toggled += (s, ea) => UpdateUI();
        }
Ejemplo n.º 9
0
        private void BuildWidget()
        {
            sleepHour = new SpinButton(0, 23, 1);
            sleepMin  = new SpinButton(0, 59, 1);

            sleepHour.Value = (int)plugin.GetSleepTimer() / 60;
            sleepMin.Value  = plugin.GetSleepTimer() - (sleepHour.Value * 60);

            sleepHour.WidthChars = 2;
            sleepMin.WidthChars  = 2;

            Label prefix    = new Label(Catalog.GetString("Sleep Timer :"));
            Label separator = new Label(":");
            Label comment   = new Label(Catalog.GetString("<i>(set to 0:00 to disable)</i>"));

            comment.UseMarkup = true;

            Button OK = new Button(Gtk.Stock.Ok);

            OK.Clicked += new EventHandler(OnSleepTimerOK);

            HBox topbox = new HBox(false, 10);

            topbox.PackStart(prefix);
            topbox.PackStart(sleepHour);
            topbox.PackStart(separator);
            topbox.PackStart(sleepMin);

            this.AddActionWidget(OK, 0);

            this.VBox.PackStart(topbox);
            this.VBox.PackStart(comment);
        }
Ejemplo n.º 10
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;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InitialWaterView" /> class.
        /// </summary>
        public InitialWaterView(ViewBase owner) : base(owner)
        {
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.InitialWaterView.glade");

            hpaned1      = (HPaned)builder.GetObject("hpaned1");
            spinbutton1  = (SpinButton)builder.GetObject("spinbutton1");
            entry1       = (Entry)builder.GetObject("entry1");
            entry2       = (Entry)builder.GetObject("entry2");
            frame1       = (Frame)builder.GetObject("frame1");
            frame2       = (Frame)builder.GetObject("frame2");
            radiobutton1 = (RadioButton)builder.GetObject("radiobutton1");
            radiobutton2 = (RadioButton)builder.GetObject("radiobutton2");
            combobox1    = (ComboBox)builder.GetObject("combobox1");
            mainWidget   = hpaned1;
            combobox1.PackStart(comboRender, false);
            combobox1.AddAttribute(comboRender, "text", 0);
            combobox1.Model    = comboModel;
            frameRadio1        = new RadioButton(frame1.Label);
            frameRadio1.Active = true;
            frame1.LabelWidget = frameRadio1;
            frameRadio2        = new RadioButton(frameRadio1, frame2.Label);
            frameRadio2.Active = false;
            frame2.LabelWidget = frameRadio2;
            graphView1         = new GraphView(this);
            hpaned1.Pack2(graphView1.MainWidget, true, true);
            entry1.Changed       += OnTextBox1TextChanged;
            entry2.Changed       += OnTextBox2TextChanged;
            radiobutton1.Toggled += OnRadioButton1CheckedChanged;
            spinbutton1.Changed  += OnNumericUpDown1ValueChanged;
            combobox1.Changed    += OnComboBox1SelectedValueChanged;
            frameRadio1.Toggled  += FrameRadio_Toggled;
            mainWidget.Destroyed += _mainWidget_Destroyed;
        }
Ejemplo n.º 12
0
    /// <summary>
    /// Constructs the sprite drawing area, along with the various
    /// rules needed.
    /// </summary>
    public Viewer()
    {
        // Create the drop-down list
        HBox box = new HBox();
        fps = new SpinButton(1, 100, 1);
        fps.Value = DesiredFps;
        fps.Changed += OnFpsChanged;
        showUpdate = new CheckButton();
        box.PackStart(new Label("FPS"), false, false, 0);
        box.PackStart(fps, false, false, 2);
        box.PackStart(new Label("Show Update"), false, false, 5);
        box.PackStart(showUpdate, false, false, 2);
        box.PackStart(new Label(), true, true, 0);
        PackStart(box, false, false, 2);

        // Create the drawing area and pack it
        area = new DrawingArea();
        area.Realized += OnRealized;
        area.ExposeEvent += OnExposed;
        area.ConfigureEvent += OnConfigure;
        PackStart(area, true, true, 2);

        // Create the viewport
        Sprites = new SpriteList();
        viewport = new SpriteViewport(Sprites);

        // Start up a little animation loop
        Timeout.Add(1000 / DesiredFps, OnTick);
    }
Ejemplo n.º 13
0
        /* Public methods */

        public void GetEditableWidgets(out SpinButton startSpinButton, out SpinButton endSpinButton,
                                       out SpinButton durationSpinButton, out TextView textEdit, out TextView translationEdit)
        {
            spinButtons.GetWidgets(out startSpinButton, out endSpinButton, out durationSpinButton);
            textEdit        = this.textEdit.TextView;
            translationEdit = this.translationEdit.TextView;
        }
Ejemplo n.º 14
0
    protected void OnRoomSpinButtonValueChanged(object sender, EventArgs e)
    {
        if (Project == null)
        {
            return;
        }
        SpinButton button = sender as SpinButton;

        // If in a dungeon, "correct" the room value by looking for the "expected" version of the
        // room (sidescrolling rooms have duplicates, only one is the "correct" version).
        if (ActiveMap is Dungeon)
        {
            Room room = Project.GetIndexedDataType <Room>(button.ValueAsInt);
            if (room.ExpectedIndex != button.ValueAsInt)
            {
                button.Value = room.ExpectedIndex;
                return; // Callback will get invoked again
            }
        }

        Room r = Project.GetIndexedDataType <Room>(button.ValueAsInt);

        if (r != ActiveRoom)
        {
            SetRoom(r, ActiveSeason);
            UpdateMinimapFromRoom(false);
        }
    }
Ejemplo n.º 15
0
        public SpinButtonEntryDialog(string title, Window parent, string label, int min, int max, int current)
            : base(title, parent, DialogFlags.Modal, Stock.Cancel, ResponseType.Cancel, Stock.Ok, ResponseType.Ok)
        {
            BorderWidth  = 6;
            VBox.Spacing = 3;
            HBox hbox = new HBox();

            hbox.Spacing = 6;

            Label lbl = new Label(label);

            lbl.Xalign = 0;
            hbox.PackStart(lbl);

            spinButton       = new SpinButton(min, max, 1);
            spinButton.Value = current;
            hbox.PackStart(spinButton);

            hbox.ShowAll();
            VBox.Add(hbox);

            AlternativeButtonOrder      = new int[] { (int)ResponseType.Ok, (int)ResponseType.Cancel };
            DefaultResponse             = ResponseType.Ok;
            spinButton.ActivatesDefault = true;
        }
Ejemplo n.º 16
0
        public NumericEditor(object @object, PropertyInfo info) : base(@object, info)
        {
            RangeAttribute range = Util.GetAttribute <RangeAttribute>(info, false);

            double min, max;

            if (range == null)
            {
                FieldInfo field = info.PropertyType.GetField("MinValue",
                                                             BindingFlags.Public |
                                                             BindingFlags.Static);

                if (field == null)
                {
                    min = double.MinValue;
                }
                else
                {
                    min = Convert.ToDouble(field.GetValue(null));
                }

                field = info.PropertyType.GetField("MaxValue",
                                                   BindingFlags.Public |
                                                   BindingFlags.Static);

                if (field == null)
                {
                    max = double.MaxValue;
                }
                else
                {
                    max = Convert.ToDouble(field.GetValue(null));
                }
            }
            else
            {
                min = range.Minimum;
                max = range.Maximum;
            }

            this.mSpin = new SpinButton(min, max, 1);

            if (info.PropertyType == typeof(float) ||
                info.PropertyType == typeof(double))
            {
                this.mSpin.Digits = 5;
            }
            else
            {
                this.mSpin.Digits = 0;
            }

            this.Revert();

            this.mSpin.Changed      += this.OnSpinChanged;
            this.mSpin.ValueChanged += this.OnSpinChanged;

            this.mSpin.Show();
            this.Add(this.mSpin);
        }
        //TODO use Util.SetSpinButtonAdjustment
        private void SetFramesMode(SpinButton spinButton, bool allowNegatives)
        {
            Util.SetSpinButtonTimingMode(spinButton, TimingMode.Frames);

            spinButton.Adjustment.StepIncrement = Base.Config.TimingsFramesStep;
            spinButton.Adjustment.Upper         = maxFrames;
            spinButton.Adjustment.Lower         = (allowNegatives ? -maxFrames : 0);
        }
        public IntegerQueryValueEntry() : base()
        {
            spin_button               = new SpinButton(0.0, 1.0, 1.0);
            spin_button.Digits        = 0;
            spin_button.WidthChars    = 4;
            spin_button.ValueChanged += HandleValueChanged;

            Add(spin_button);
        }
Ejemplo n.º 19
0
 private DateInputWindow(string title, string message_year, string message_month) : base(title, message_year, 2000, 2100)
 {
     label2          = new Label(message_month);
     spinButtonMonth = new SpinButton(1, 12, 1);
     vBox.Remove(hButtonBox);
     vBox.Add(label2);
     vBox.Add(spinButtonMonth);
     vBox.Add(hButtonBox);
 }
Ejemplo n.º 20
0
        private void BindToWidget()
        {
            foreach (var p in GetObjectProperties(m_objectType))
            {
                var hbox = new HBox();

                var label = new Label(p.Name);
                hbox.Add(label);
                var    value = p.GetValue(ObjectInstance, null);
                Widget input = null;

                if (p.PropertyType == typeof(int))
                {
                    var spinButton = new SpinButton(0, int.MaxValue, 1);
                    spinButton.Value = Convert.ToDouble(value);
                    input            = spinButton;
                }

                if (p.PropertyType == typeof(bool))
                {
                    var toggle = new ToggleButton();
                    toggle.Active = Convert.ToBoolean(value);
                    input         = toggle;
                }
                else if (p.PropertyType == typeof(float) || p.PropertyType == typeof(double))
                {
                    var horizontalScale = new HScale(0, 1, 0.05);

                    if (ObjectInstance != null)
                    {
                        horizontalScale.Value = Convert.ToDouble(value);
                    }

                    input = horizontalScale;
                }
                else if (p.PropertyType == typeof(TimeSpan))
                {
                    var secondsHBox = new HBox();
                    var seconds     = new SpinButton(0, int.MaxValue, 1);
                    seconds.Value = ((TimeSpan)value).TotalSeconds;
                    secondsHBox.Add(seconds);

                    var secondsLabel = new Label("seconds");
                    secondsHBox.Add(secondsLabel);

                    input = secondsHBox;
                }

                if (input != null)
                {
                    m_widgetMap.Add(p, input);
                    hbox.Add(input);
                }

                VBox.Add(hbox);
            }
        }
Ejemplo n.º 21
0
        private SpinButton CreateNumericUpDown(int value, int min, int max)
        {
            var upDown = new SpinButton(min, max, 1);

            upDown.Value         = value;
            upDown.ValueChanged += UpDown_ValueChanged1;

            return(upDown);
        }
Ejemplo n.º 22
0
 //Purpose: To remove the Question_Box that currently has the
 //Spin instructions
 //Requires:Nothing
 //Returns:Nothing
 private void Begin_Spin_Round_Click(object sender, EventArgs e)
 {
     Question_Box.Hide();
     SpinButton.Show();
     Begin_Spin_Round.Hide();
     Boarder_Box.Show();
     Quit_Button.Show();
     checkSpin(); //checks to see who goes first
 }
Ejemplo n.º 23
0
        /// <summary>Initializes a new instance of the <see cref="TabbedMetDataView"/> class.</summary>
        public TabbedMetDataView(ViewBase owner) : base(owner)
        {
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.TabbedMetDataView.glade");

            labelFileName                  = (Label)builder.GetObject("labelFileName");
            vbox1                          = (VBox)builder.GetObject("vbox1");
            notebook1                      = (Notebook)builder.GetObject("notebook1");
            textview1                      = (TextView)builder.GetObject("textview1");
            alignSummary                   = (Alignment)builder.GetObject("alignSummary");
            alignData                      = (Alignment)builder.GetObject("alignData");
            alignRainChart                 = (Alignment)builder.GetObject("alignRainChart");
            alignRainMonthly               = (Alignment)builder.GetObject("alignRainMonthly");
            alignTemp                      = (Alignment)builder.GetObject("alignTemp");
            alignRadn                      = (Alignment)builder.GetObject("alignRadn");
            vboxRainChart                  = (VBox)builder.GetObject("vboxRainChart");
            vboxRainMonthly                = (VBox)builder.GetObject("vboxRainMonthly");
            vboxTemp                       = (VBox)builder.GetObject("vboxTemp");
            vboxRadn                       = (VBox)builder.GetObject("vboxRadn");
            hboxOptions                    = (HBox)builder.GetObject("hboxOptions");
            spinStartYear                  = (SpinButton)builder.GetObject("spinStartYear");
            spinNYears                     = (SpinButton)builder.GetObject("spinNYears");
            button1                        = (Button)builder.GetObject("button1");
            vpaned1                        = (VPaned)builder.GetObject("vpaned1");
            hbox2                          = (HBox)builder.GetObject("hbox2");
            alignment10                    = (Alignment)builder.GetObject("alignment10");
            constantsFileSelector          = (Button)builder.GetObject("button2");
            constantsFileSelector.Clicked += OnChooseConstantsFile;
            constantsFileSelectorContainer = (Container)builder.GetObject("hbox3");
            labelConstantsFileName         = (Label)builder.GetObject("labelFileName1");
            mainWidget                     = vbox1;
            graphViewSummary               = new GraphView(this);
            alignSummary.Add(graphViewSummary.MainWidget);
            graphViewRainfall = new GraphView(this);
            vboxRainChart.PackEnd(graphViewRainfall.MainWidget);
            graphViewMonthlyRainfall = new GraphView(this);
            vboxRainMonthly.PackEnd(graphViewMonthlyRainfall.MainWidget);
            graphViewTemperature = new GraphView(this);
            vboxTemp.PackEnd(graphViewTemperature.MainWidget);
            graphViewRadiation = new GraphView(this);
            vboxRadn.PackEnd(graphViewRadiation.MainWidget);
            gridViewData          = new GridView(this);
            gridViewData.ReadOnly = true;
            alignData.Add(gridViewData.MainWidget);
            button1.Clicked            += OnButton1Click;
            spinStartYear.ValueChanged += OnGraphStartYearValueChanged;
            spinNYears.ValueChanged    += OnGraphShowYearsValueChanged;
            notebook1.SwitchPage       += TabControl1_SelectedIndexChanged;
            GraphStartYearMaxValue      = 2100;
            GraphStartYearMinValue      = 1900;
            GraphStartYearValue         = 2000;
            GraphShowYearsValue         = 1;
            worksheetCombo              = new DropDownView(this);
            alignment10.Add(worksheetCombo.MainWidget);
            worksheetCombo.Visible  = true;
            worksheetCombo.Changed += WorksheetCombo_Changed;
            mainWidget.Destroyed   += _mainWidget_Destroyed;
        }
Ejemplo n.º 24
0
 public ToolBarSpinButton(int width, double min, double max, double step)
 {
     SpinButton = new SpinButton(min, max, 1);
     SpinButton.AddEvents((int)Gdk.EventMask.ButtonPressMask);
     SpinButton.WidthRequest = width;
     SpinButton.Show();
     Add(SpinButton);
     Show();
 }
Ejemplo n.º 25
0
        public TaskGenAritWindow(TextViewList textviews)
            : base("TaskGen Arithmetics Window")
        {
            this.textviews = textviews;

            Table table = new Table(5, 2, true);

            Label labelMinimum   = new Label("Minimum:");
            Label labelMaximum   = new Label("Maximum:");
            Label labelVariables = new Label("Number of variables: ");
            Label labelNoT       = new Label("Number of tasks:");

            SpinButton spinbuttonMinimum       = new SpinButton(1, 100, 1);
            SpinButton spinbuttonMaximum       = new SpinButton(1, 100, 1);
            SpinButton spinbuttonVariables     = new SpinButton(2, 5, 1);
            SpinButton spinbuttonNumberOfTasks = new SpinButton(1, 5, 1);

            spinbuttonMaximum.Value = 20;

            Button buttonOk     = new Button("Ok");
            Button buttonCancel = new Button("Cancel");

            //Sets the table
            table.Attach(labelMinimum, 0, 1, 0, 1);
            table.Attach(spinbuttonMinimum, 1, 2, 0, 1);
            table.Attach(labelMaximum, 0, 1, 1, 2);
            table.Attach(spinbuttonMaximum, 1, 2, 1, 2);
            table.Attach(labelVariables, 0, 1, 2, 3);
            table.Attach(spinbuttonVariables, 1, 2, 2, 3);
            table.Attach(labelNoT, 0, 1, 3, 4);
            table.Attach(spinbuttonNumberOfTasks, 1, 2, 3, 4);
            table.Attach(buttonCancel, 0, 1, 4, 5);
            table.Attach(buttonOk, 1, 2, 4, 5);

            buttonCancel.Clicked += (sender, e) =>
            {
                this.Destroy();
            };

            // Generates a number of tasks based on the users input
            buttonOk.Clicked += (sender, e) =>
            {
                for (int generatedTaskes = 0; generatedTaskes < spinbuttonNumberOfTasks.Value; generatedTaskes++)
                {
                    TaskGenLib.Task t = TaskGenLib.TaskGen.MakeCalcTask((int)spinbuttonMinimum.Value, (int)spinbuttonMaximum.Value, (int)spinbuttonVariables.Value);
                    textviews.InsertTaskGenTextView(t.TaskDescription);

                    textviews.InsertResult("", t.Solution);
                }

                this.Destroy();
            };

            Add(table);
            ShowAll();
        }
Ejemplo n.º 26
0
        private SpinButton CreateNumericUpDown(int value, int min, int max, string tooltip = null)
        {
            var upDown = new SpinButton(min, max, 1);

            upDown.Value         = value;
            upDown.TooltipText   = tooltip;
            upDown.ValueChanged += UpDown_ValueChanged1;

            return(upDown);
        }
Ejemplo n.º 27
0
    protected void OnAreaSpinButtonValueChanged(object sender, EventArgs e)
    {
        if (Project == null)
        {
            return;
        }
        SpinButton button = sender as SpinButton;

        SetArea(Project.GetIndexedDataType <Area>(button.ValueAsInt));
    }
Ejemplo n.º 28
0
        private void BuildControl(string textEntry, string textLabel, bool onlyInt, Gtk.Window parent)
        {
            this.onlyInt = onlyInt;

            this.TransientFor = parent;

            HBox hbox = new HBox(false, 8);

            hbox.BorderWidth = 8;
            this.VBox.PackStart(hbox, false, false, 0);

            Image stock = new Image(Stock.DialogQuestion, IconSize.Dialog);

            hbox.PackStart(stock, false, false, 0);

            Table table = new Table(2, 2, false);

            table.RowSpacing    = 4;
            table.ColumnSpacing = 4;
            hbox.PackStart(table, true, true, 0);

            Label label = new Label(textLabel);

            table.Attach(label, 0, 1, 0, 1);

            if (!onlyInt)
            {
                localEntry1      = new Entry();
                localEntry1.Text = textEntry;                //textEntry;
                //localEntry1.Changed += delegate(object sender, EventArgs e) { textEntry = localEntry1.Text; };
                table.Attach(localEntry1, 1, 2, 0, 1);
                label.MnemonicWidget = localEntry1;

                localEntry1.KeyPressEvent += new KeyPressEventHandler(OnKeyPress);

                localEntry1.GrabFocus();
            }
            else
            {
                localSpin         = new SpinButton(1, 10000, 10);
                localSpin.Digits  = 0;
                localSpin.Numeric = true;

                localSpin.KeyPressEvent += new KeyPressEventHandler(OnKeyPress);

                table.Attach(localSpin, 1, 2, 0, 1);
                label.MnemonicWidget = localSpin;
                localSpin.GrabFocus();
            }

            this.AddButton(MainClass.Languages.Translate("cancel"), ResponseType.Cancel);
            this.AddButton(MainClass.Languages.Translate("ok"), ResponseType.Ok);

            this.ShowAll();
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Заполняет CheckBoxPlace таблицу на основе модели
        /// </summary>
        private void ConfigureCheckBoxPlace()
        {
            checkBoxItemList.Clear();
            CheckBoxPlace.Children.ToList().ForEach(e => CheckBoxPlace.Remove(e));
            var rows = (uint)ViewModel.WearSizes.Count;

            CheckBoxPlace.Resize(rows + 1, 4);

            #region пояснения к таблице
            var label1 = new Label {
                LabelProp = "Размер"
            };
            CheckBoxPlace.Attach(label1, 1, 2, 0, 0 + 1, AttachOptions.Expand, AttachOptions.Shrink, 0, 0);

            var label2 = new Label {
                LabelProp = "Добавить?"
            };
            CheckBoxPlace.Attach(label2, 2, 3, 0, 0 + 1, AttachOptions.Expand, AttachOptions.Shrink, 0, 0);

            var label3 = new Label {
                LabelProp = "Количество"
            };
            CheckBoxPlace.Attach(label3, 3, 4, 0, 0 + 1, AttachOptions.Expand, AttachOptions.Shrink, 0, 0);
            #endregion

            var sizes = ViewModel.WearSizes;
            for (uint i = 1; i <= rows; i++)
            {
                var label = new Label {
                    LabelProp = sizes[(int)i - 1].Name
                };
                CheckBoxPlace.Attach(label, 1, 2, i, i + 1, AttachOptions.Expand, AttachOptions.Shrink, 0, 0);

                var check = new CheckButton();
                check.Clicked += CheckButton_Clicked;
                CheckBoxPlace.Attach(check, 2, 3, i, i + 1, AttachOptions.Expand, AttachOptions.Shrink, 0, 0);

                var spin = new SpinButton(0, int.MaxValue, 1);
                spin.Sensitive = false;
                var currentAmount = ViewModel.ExistItems
                                    .Where(x => x.Height == currentGrowth && x.WearSize == sizes[(int)i - 1])
                                    .Select(x => x.Amount)
                                    .FirstOrDefault();
                spin.Value = currentAmount;
                CheckBoxPlace.Attach(spin, 3, 4, i, i + 1, AttachOptions.Expand, AttachOptions.Shrink, 0, 0);

                var checkBoxItem = new CheckBoxItem(label, sizes[(int)i - 1], check, spin);
                checkBoxItemList.Add(checkBoxItem);
            }
            if (HeightRequest > Screen.Height)
            {
                table1.SetScrollAdjustments(new Adjustment(new IntPtr(checkBoxItemList.Count)), null);
            }
            CheckBoxPlace.ShowAll();
        }
Ejemplo n.º 30
0
 private PointInputWindow(string title, int min, int max, int x, int y) : base(title, "X", min, max)
 {
     label2      = new Label("Y");
     spinButton2 = new SpinButton(min, max, 1);
     vBox.Remove(hButtonBox);
     vBox.Add(label2);
     vBox.Add(spinButton2);
     vBox.Add(hButtonBox);
     spinButton.Value  = x;
     spinButton2.Value = y;
 }
Ejemplo n.º 31
0
        protected virtual void OnPopupDelayButtonValueChanged(object sender, System.EventArgs e)
        {
            SpinButton b = sender as SpinButton;

            if (b == null)
            {
                return;
            }

            config.PopupTime = (int)b.Value;
        }
Ejemplo n.º 32
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();

        Catalog.Init("gpdfsplitter", "/usr/share/locale");		//LOCALIZATION

        Title = Catalog.GetString("gPDFsplitter");

        table = new Table(4,5,false);
        table.BorderWidth = 5;
        table.Attach( new Label( Catalog.GetString("1. Select the file:") ), 0, 1, 0, 1 );
        table.Attach( new Label( Catalog.GetString("2. Select a range:") ), 0, 1, 1, 3 );
        table.Attach( new Label( Catalog.GetString("3. Output file name:") ), 0, 1, 3, 4);
        table.Attach( new Label( Catalog.GetString("4. Split:") ), 0, 1, 4, 5 );

        inputBut = new FileChooserButton("Select file", FileChooserAction.Open);
        inputBut.Filter = new FileFilter();
        inputBut.Filter.AddMimeType( "application/pdf" );
        inputBut.FileSet += OnFileSelect;
        table.Attach( inputBut, 1, 4, 0, 1);

        outputBut = new Entry( Catalog.GetString("output.pdf") );
        outputBut.MaxLength = 15;
        outputBut.TooltipText = Catalog.GetString("Directory is home or actual");
        table.Attach( outputBut, 1, 4, 3,4);

        done = new Button("done");
        done.Clicked += OnDone;
        table.Attach( done, 1,4,4,5);

        start = new SpinButton(0,1,1);
        end = new SpinButton(0,1,1);
        table.Attach( start, 2,3, 1,2);
        table.Attach( end, 3,4, 1,2);

        rb1 = new RadioButton( Catalog.GetString("interval") );
        rb2 = new RadioButton( rb1,  Catalog.GetString("chapter") );
        table.Attach( rb1 , 1, 2, 1, 2);
        table.Attach( rb2 , 1, 2, 2, 3);

        table.Attach( new Label( Catalog.GetString("Not implemented yet") ), 2,4,2,3 );

        Add( table );
        ShowAll();
    }
Ejemplo n.º 33
0
    /// <summary>
    /// Constructs the sprite drawing area, along with the various
    /// rules needed.
    /// </summary>
    public DemoSprites()
    {
        // Create the drop-down list
        HBox box = new HBox();
        paneList = ComboBox.NewText();
        paneList.Changed += OnPaneChanged;
        fps = new SpinButton(1, 100, 1);
        fps.Value = DesiredFps;
        fps.Changed += OnFpsChanged;
        showUpdate = new CheckButton();
        box.PackStart(paneList, false, false, 0);
        box.PackStart(new Label("FPS"), false, false, 5);
        box.PackStart(fps, false, false, 2);
        box.PackStart(new Label("Show Update"), false, false, 5);
        box.PackStart(showUpdate, false, false, 2);
        box.PackStart(new Label(), true, true, 0);
        PackStart(box, false, false, 2);

        // Create the drawing area and pack it
        area = new DrawingArea();
        area.Realized += OnRealized;
        area.ExposeEvent += OnExposed;
        area.ConfigureEvent += OnConfigure;
        PackStart(area, true, true, 2);

        // Set up the search paths for the factory. We need to do this
        // before the sprite pane loading because the panes use the
        // factory for their own loading.
        string dataPath = AppDomain.CurrentDomain.BaseDirectory + "/images";
        PixbufFactory.SearchPaths.Add(new DirectoryInfo(dataPath));

        string tilesetPath = System.IO.Path.Combine(dataPath, "tileset.xml");
        FileInfo tilesetFile = new FileInfo(tilesetPath);
        TilesetFactory.Load(tilesetFile);

        // Use reflection to load the demos in random order
        LoadSpritePanes();

        // Start up a little animation loop
        Timeout.Add(1000 / DesiredFps, OnTick);
    }
Ejemplo n.º 34
0
	public SpinControl() {
		Dock = DockStyle.Right;
		BackColor = SystemColors.Control;
		Cursor = Cursors.Default;
		Margin = Padding.Empty;
		Padding = Padding.Empty;
		MinimumSize = new Size(16, 0);
		TabStop = false;
		//---
		UpButton = new SpinButton(this, false);
		DownButton = new SpinButton(this, false);
		ArrowMinimumFontSize = 8f;
		AntiAliasArrows = true;
		ArrowFontSizeFactor = 0.4f;
		ButtonWidthFactor = 2.0f;
		ButtonStyle = SpinButtonStyle.Modern;
		FocusParentOnClick = false; // true;
		Width = TextRenderer.MeasureText(ArrowUpText, ArrowFont).Width;
	}
Ejemplo n.º 35
0
 protected void OnFileSelect(object sender, EventArgs a)
 {
     pdfclown.File file = new pdfclown.File( ((FileChooserButton)sender).Filename );
     start = new SpinButton( 1, file.Document.Pages.Count, 1 );
     end = new SpinButton( 1, file.Document.Pages.Count, 1 );
     table.Attach( start, 2,3, 1,2);
     table.Attach( end, 3,4, 1,2);
     ShowAll();
 }