ladybird/Widgets/ListBox.h

25 lines
490 B
C
Raw Normal View History

2018-10-13 01:20:44 +03:00
#pragma once
#include "Widget.h"
class ListBox final : public Widget {
public:
explicit ListBox(Widget* parent);
virtual ~ListBox() override;
void addItem(String&&);
int selectedIndex() const { return m_selectedIndex; }
private:
virtual void paintEvent(PaintEvent&) override;
virtual void mouseDownEvent(MouseEvent&) override;
2018-10-13 01:20:44 +03:00
unsigned itemHeight() const;
unsigned m_scrollOffset { 0 };
int m_selectedIndex { -1 };
Vector<String> m_items;
};