Files
Aerofoil/PortabilityLayer/PLScrollBarWidget.h

50 lines
1.3 KiB
C
Raw Normal View History

2020-01-05 02:33:03 -05:00
#pragma once
#include "PascalStr.h"
#include "PLWidgets.h"
2020-03-10 01:35:42 -04:00
struct Rect;
2020-01-05 02:33:03 -05:00
namespace PortabilityLayer
{
class ScrollBarWidget final : public WidgetSpec<ScrollBarWidget>
{
public:
explicit ScrollBarWidget(const WidgetBasicState &state);
bool Init(const WidgetBasicState &state) override;
2020-03-10 01:35:42 -04:00
void OnEnabledChanged() override;
WidgetHandleState_t ProcessEvent(const TimeTaggedVOSEvent &evt) override;
void DrawControl(DrawSurface *surface) override;
2020-03-14 04:29:47 -04:00
void SetState(int16_t state) override;
2020-03-10 01:35:42 -04:00
void OnStateChanged() override;
2020-03-14 04:29:47 -04:00
int16_t Capture(const Point &pos, WidgetUpdateCallback_t callback) override;
2020-03-10 01:35:42 -04:00
int ResolvePart(const Point &point) const override;
private:
bool IsHorizontal() const;
bool Isvertical() const;
void DrawControlHorizontal(DrawSurface *surface);
void DrawControlVertical(DrawSurface *surface);
void RefreshGrip();
static void DrawBeveledBox(DrawSurface *surface, const Rect &rect);
2020-03-14 04:29:47 -04:00
int16_t CaptureScrollSegment(const Point &pos, int part, WidgetUpdateCallback_t callback);
int16_t CaptureIndicator(const Point &pos, WidgetUpdateCallback_t callback);
void IterateScrollSegment(int part, WidgetUpdateCallback_t callback);
2020-03-10 01:35:42 -04:00
int32_t m_min;
int32_t m_max;
int32_t m_gripSize;
int32_t m_gripPos;
int32_t m_laneCapacity;
2020-01-05 02:33:03 -05:00
};
}