mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
25 lines
484 B
C++
25 lines
484 B
C++
#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 onPaint(PaintEvent&) override;
|
|
virtual void onMouseDown(MouseEvent&) override;
|
|
|
|
unsigned itemHeight() const;
|
|
|
|
unsigned m_scrollOffset { 0 };
|
|
int m_selectedIndex { -1 };
|
|
|
|
Vector<String> m_items;
|
|
};
|
|
|