mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 11:37:45 +00:00
LibGUI: Adjust BreadcrumbButtons width on resize
This commit relayouts the BreadcrumbButtons on resize to a shrunken state if they don't fit. It also caps the button width to 100px to avoid overflowing the widget.
This commit is contained in:
parent
8649996201
commit
71f345bbb8
2 changed files with 37 additions and 2 deletions
|
@ -19,6 +19,7 @@ public:
|
|||
void clear_segments();
|
||||
void append_segment(String text, Gfx::Bitmap const* icon = nullptr, String data = {}, String tooltip = {});
|
||||
void remove_end_segments(size_t segment_index);
|
||||
void relayout();
|
||||
|
||||
size_t segment_count() const { return m_segments.size(); }
|
||||
String segment_data(size_t index) const { return m_segments[index].data; }
|
||||
|
@ -35,10 +36,14 @@ public:
|
|||
private:
|
||||
Breadcrumbbar();
|
||||
|
||||
virtual void resize_event(ResizeEvent&) override;
|
||||
|
||||
struct Segment {
|
||||
RefPtr<const Gfx::Bitmap> icon;
|
||||
String text;
|
||||
String data;
|
||||
int width { 0 };
|
||||
int shrunken_width { 0 };
|
||||
WeakPtr<GUI::Button> button;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue