mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 05:55:13 +00:00
Implement this functionality by adding global cursor tracking. It's currently only possible for one GWidget per GWindow to track the cursor.
29 lines
735 B
C++
29 lines
735 B
C++
#pragma once
|
|
|
|
#include "GWidget.h"
|
|
#include <AK/AKString.h>
|
|
#include <AK/Function.h>
|
|
|
|
class GButton final : public GWidget {
|
|
public:
|
|
explicit GButton(GWidget* parent);
|
|
virtual ~GButton() override;
|
|
|
|
String caption() const { return m_caption; }
|
|
void set_caption(String&&);
|
|
|
|
Function<void(GButton&)> on_click;
|
|
|
|
private:
|
|
virtual void paint_event(GPaintEvent&) override;
|
|
virtual void mousedown_event(GMouseEvent&) override;
|
|
virtual void mouseup_event(GMouseEvent&) override;
|
|
virtual void mousemove_event(GMouseEvent&) override;
|
|
|
|
virtual const char* class_name() const override { return "GButton"; }
|
|
|
|
String m_caption;
|
|
bool m_being_pressed { false };
|
|
bool m_tracking_cursor { false };
|
|
};
|
|
|