public WidgetSlider(int x, int y, [CallerFilePath]
                        string filePath = null, [CallerLineNumber]
                        int lineNumber  = -1) : base(x, y, filePath, lineNumber)
    {
        // Size of the slider itself
        Width  = 177;
        Height = 27;

        var leftButton = new WidgetButton();

        leftButton.SetStyle(Globals.WidgetButtonStyles.GetStyle("slider-left"));
        leftButton.SetClickHandler(() => { SetValue(GetValue() - 1); });
        leftButton.SetRepeat(true);
        leftButton.Width  = 27;
        leftButton.Height = 27;

        var rightButton = new WidgetButton();

        rightButton.SetStyle(Globals.WidgetButtonStyles.GetStyle("slider-right"));
        rightButton.SetClickHandler(() => { SetValue(GetValue() + 1); });
        rightButton.SetRepeat(true);
        rightButton.Width  = 27;
        rightButton.Height = 27;
        rightButton.X      = Width - rightButton.Width;

        var track = new WidgetButton();

        track.SetStyle(Globals.WidgetButtonStyles.GetStyle("slider-track"));
        track.SetClickHandler((x, y) =>
        {
            if (x < _handleButton.X)
            {
                SetValue(GetValue() - Quantum);
            }
            else if (x >= _handleButton.X + _handleButton.Width)
            {
                SetValue(GetValue() + Quantum);
            }
        });
        track.SetRepeat(true);

        var handle = new WidgetSliderHandle(this);

        handle.Y = 2;

        _leftButton   = leftButton;
        _rightButton  = rightButton;
        _track        = track;
        _handleButton = handle;

        Add(track);
        Add(leftButton);
        Add(rightButton);
        Add(handle);
    }
    public WidgetScrollBar() : base(0, 0)
    {
        var upButton = new WidgetButton();

        upButton.SetParent(this);
        upButton.SetStyle(Globals.WidgetButtonStyles.GetStyle("scrollbar-up"));
        upButton.SetClickHandler(() => { SetValue(GetValue() - 1); });
        upButton.SetRepeat(true);

        var downButton = new WidgetButton();

        downButton.SetParent(this);
        downButton.SetStyle(Globals.WidgetButtonStyles.GetStyle("scrollbar-down"));
        downButton.SetClickHandler(() => { SetValue(GetValue() + 1); });
        downButton.SetRepeat(true);

        var track = new WidgetButton();

        track.SetParent(this);
        track.SetStyle(Globals.WidgetButtonStyles.GetStyle("scrollbar-track"));
        track.SetClickHandler((x, y) =>
        {
            // The y value is in relation to the track, we need to add it's own Y value,
            // and compare against the current position of the handle
            y += mTrack.Y;
            if (y < mHandleButton.Y)
            {
                SetValue(GetValue() - 5);
            }
            else if (y >= mHandleButton.Y + mHandleButton.Height)
            {
                SetValue(GetValue() + 5);
            }
        });
        track.SetRepeat(true);

        var handle = new WidgetScrollBarHandle(this);

        handle.SetParent(this);
        handle.Height = 100;

        Width = Math.Max(upButton.Width, downButton.Width);

        mUpButton     = upButton;
        mDownButton   = downButton;
        mTrack        = track;
        mHandleButton = handle;

        Add(track);
        Add(upButton);
        Add(downButton);
        Add(handle);
    }
    public CampingUi()
    {
        _translations = Tig.FS.ReadMesFile("mes/utility_bar.mes");

        var doc = WidgetDoc.Load("ui/camping_ui.json");

        // Begin top level window
        // Created @ 0x1012f29f
        _mainWindow = doc.GetRootContainer();
        // _mainWindow.OnBeforeRender += 0x1012e4d0;
        // Swallow mouse events (to prevent click through)
        _mainWindow.SetMouseMsgHandler(msg => true);
        _mainWindow.SetKeyStateChangeHandler(OnKeyStateChange);
        _mainWindow.ZIndex          = 100000;
        _mainWindow.Visible         = false;
        _mainWindow.OnBeforeRender += UpdateCheckboxes;

        var titleLabel = new WidgetText(WindowTitle, "camping-button-text");

        titleLabel.X         = 31;
        titleLabel.Y         = 11;
        titleLabel.FixedSize = new Size(230, 12);
        _mainWindow.AddContent(titleLabel);

        // Labels for the hours/days to rest

        _daysToRestLabelText = new WidgetText(DaysLabel, "camping-torest-labels");
        _mainWindow.AddContent(_daysToRestLabelText);
        _hoursToRestLabelText = new WidgetText(HoursLabel, "camping-torest-labels");
        _mainWindow.AddContent(_hoursToRestLabelText);
        _daysToRestText = new WidgetText("0", "camping-torest");
        _mainWindow.AddContent(_daysToRestText);
        _hoursToRestText = new WidgetText("0", "camping-torest");
        _mainWindow.AddContent(_hoursToRestText);

        _restButton = doc.GetButton("restButton");
        _restButton.SetClickHandler(OnRestClicked);

        _cancelButton      = doc.GetButton("cancelButton");
        _cancelButton.Text = ButtonLabelCancel;
        _cancelButton.SetClickHandler(Hide);

        _incrementDaysButton = doc.GetButton("incDaysButton");
        _incrementDaysButton.SetRepeat(true);
        _incrementDaysButton.SetClickHandler(OnIncrementDays);

        _decrementDaysButton = doc.GetButton("decDaysButton");
        _decrementDaysButton.SetRepeat(true);
        _decrementDaysButton.SetClickHandler(OnDecrementDays);

        _incrementHoursButton = doc.GetButton("incHoursButton");
        _incrementHoursButton.SetRepeat(true);
        _incrementHoursButton.SetClickHandler(OnIncrementHours);

        _decrementHoursButton = doc.GetButton("decHoursButton");
        _decrementHoursButton.SetRepeat(true);
        _decrementHoursButton.SetClickHandler(OnDecrementHours);

        _restUntilHealedCheckbox = new CampingCheckbox(new Rectangle(86, 96, 113, 15), UntilHealedLabel,
                                                       "camping-checkbox-labels");
        _restUntilHealedCheckbox.OnCheckedChange += value => CampingSetTimeUntilHealed();
        _mainWindow.Add(_restUntilHealedCheckbox);

        _restUntilNightCheckbox = new CampingCheckbox(new Rectangle(86, 117, 113, 15), UntilEveningLabel,
                                                      "camping-checkbox-labels");
        _restUntilNightCheckbox.OnCheckedChange += value => UiCampingSetTimeToUntilNighttime();
        _mainWindow.Add(_restUntilNightCheckbox);

        _restUntilDayCheckbox = new CampingCheckbox(new Rectangle(86, 138, 113, 15), UntilMorningLabel,
                                                    "camping-checkbox-labels");
        _restUntilDayCheckbox.OnCheckedChange += value => UiCampingSetTimeToUntilDaytime();
        _mainWindow.Add(_restUntilDayCheckbox);

        // Begin top level window
        // Created @ 0x1019b2c8
        // var @ [TempleDllLocation(0x11e72ad8)]
        var sticky_ui_main_window1 = new WidgetContainer(new Rectangle(0, 0, 0, 0));

        // sticky_ui_main_window1.OnHandleMessage += 0x101f5850;
        // sticky_ui_main_window1.OnBeforeRender += 0x1019a9a0;
        sticky_ui_main_window1.ZIndex  = 0;
        sticky_ui_main_window1.Name    = "sticky_ui_main_window";
        sticky_ui_main_window1.Visible = false;
        // Created @ 0x1019b39a
        // var @ [TempleDllLocation(0x11e7277c)]
        var radialmenuslideracceptbutton1 = new WidgetButton(new Rectangle(328, 370, 112, 22));

        // radialmenuslideracceptbutton1.OnHandleMessage += 0x1019af30;
        // radialmenuslideracceptbutton1.OnBeforeRender += 0x1019ac10;
        radialmenuslideracceptbutton1.Name = "radial menu slider accept button";
        sticky_ui_main_window1.Add(radialmenuslideracceptbutton1);
        // Created @ 0x1019b4a1
        // var @ [TempleDllLocation(0x11e72ad4)]
        var radialmenusliderdeclinebutton1 = new WidgetButton(new Rectangle(452, 370, 112, 22));

        // radialmenusliderdeclinebutton1.OnHandleMessage += 0x1019af30;
        // radialmenusliderdeclinebutton1.OnBeforeRender += 0x1019ac10;
        radialmenusliderdeclinebutton1.Name = "radial menu slider decline button";
        sticky_ui_main_window1.Add(radialmenusliderdeclinebutton1);
        // Created @ 0x1019b5a9
        // var @ [TempleDllLocation(0x11e72b9c)]
        var radialmenuslidercheckboxbutton1 = new WidgetButton(new Rectangle(335, 354, 40, 11));

        // radialmenuslidercheckboxbutton1.OnHandleMessage += 0x1019b1d0;
        // radialmenuslidercheckboxbutton1.OnBeforeRender += 0x1019afa0;
        radialmenuslidercheckboxbutton1.Name = "radial menu slider checkbox button";
        sticky_ui_main_window1.Add(radialmenuslidercheckboxbutton1);
    }