Fix scroll bar SetMin/SetMax not working correctly

This commit is contained in:
elasota
2020-05-02 02:14:52 -04:00
parent 3b7858f96a
commit e546c05ea0
2 changed files with 27 additions and 0 deletions

View File

@@ -213,6 +213,30 @@ namespace PortabilityLayer
DrawControl(m_window->GetDrawSurface()); DrawControl(m_window->GetDrawSurface());
} }
void ScrollBarWidget::SetMin(int32_t v)
{
m_min = v;
if (m_state < m_min)
SetState(m_min);
else
{
RefreshGrip();
DrawControl(m_window->GetDrawSurface());
}
}
void ScrollBarWidget::SetMax(int32_t v)
{
m_max = v;
if (m_state > m_max)
SetState(m_max);
else
{
RefreshGrip();
DrawControl(m_window->GetDrawSurface());
}
}
int16_t ScrollBarWidget::Capture(const Point &pos, WidgetUpdateCallback_t callback) int16_t ScrollBarWidget::Capture(const Point &pos, WidgetUpdateCallback_t callback)
{ {
int part = ResolvePart(pos); int part = ResolvePart(pos);

View File

@@ -21,6 +21,9 @@ namespace PortabilityLayer
void SetState(int16_t state) override; void SetState(int16_t state) override;
void OnStateChanged() override; void OnStateChanged() override;
void SetMin(int32_t v) override;
void SetMax(int32_t v) override;
int16_t Capture(const Point &pos, WidgetUpdateCallback_t callback) override; int16_t Capture(const Point &pos, WidgetUpdateCallback_t callback) override;
int ResolvePart(const Point &point) const override; int ResolvePart(const Point &point) const override;