mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
eb610b309e
I found myself having to cast to GWidget* all the time when writing some generic debugging code that just wanted to dump widget info.
27 lines
645 B
C++
27 lines
645 B
C++
#pragma once
|
|
|
|
#include "GWidget.h"
|
|
|
|
class GListBox final : public GWidget {
|
|
public:
|
|
explicit GListBox(GWidget* parent);
|
|
virtual ~GListBox() override;
|
|
|
|
void add_item(String&&);
|
|
int selected_index() const { return m_selected_index; }
|
|
|
|
virtual const char* class_name() const override { return "GListBox"; }
|
|
|
|
private:
|
|
virtual void paint_event(GPaintEvent&) override;
|
|
virtual void mousedown_event(GMouseEvent&) override;
|
|
virtual bool accepts_focus() const override { return true; }
|
|
|
|
Rect item_rect(int index) const;
|
|
|
|
int m_scroll_offset { 0 };
|
|
int m_selected_index { -1 };
|
|
|
|
Vector<String> m_items;
|
|
};
|
|
|