mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:27:45 +00:00
Try out a signal-like system like this:
auto* b = new Button; b->onClick = [] (Button&) { printf("The button was clicked!\n"); };
This commit is contained in:
parent
a3fb19fe9c
commit
7a0a7abc52
4 changed files with 10 additions and 0 deletions
|
@ -11,6 +11,8 @@ public:
|
|||
String caption() const { return m_caption; }
|
||||
void setCaption(String&&);
|
||||
|
||||
std::function<void(Button&)> onClick;
|
||||
|
||||
private:
|
||||
virtual void paintEvent(PaintEvent&) override;
|
||||
virtual void mouseDownEvent(MouseEvent&) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue