ladybird/Libraries/LibGUI/GToolBar.h
Andreas Kling 7faf878e0a GToolBar: Make add_action() take a GAction& instead of NonnullRefPtr&&.
There's very little reason to take NonnullRefPtr&& in arguments really.
You can avoid ref-count churn in the cases where ownership is transferred
from the caller to the callee, but that's a pretty unusual situation and
not worth optimizing for at this stage.
2019-07-11 15:57:29 +02:00

35 lines
743 B
C++

#pragma once
#include <LibGUI/GWidget.h>
class GAction;
class GToolBar : public GWidget {
public:
explicit GToolBar(GWidget* parent);
virtual ~GToolBar() override;
void add_action(GAction&);
void add_separator();
bool has_frame() const { return m_has_frame; }
void set_has_frame(bool has_frame) { m_has_frame = has_frame; }
virtual const char* class_name() const override { return "GToolBar"; }
private:
virtual void paint_event(GPaintEvent&) override;
struct Item {
enum Type {
Invalid,
Separator,
Action
};
Type type { Invalid };
RefPtr<GAction> action;
};
Vector<OwnPtr<Item>> m_items;
bool m_has_frame { true };
};