mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 18:55:08 +00:00
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <SharedGraphics/Rect.h>
|
|
#include <AK/Retainable.h>
|
|
#include <AK/Retained.h>
|
|
#include <AK/Weakable.h>
|
|
|
|
class GPainter;
|
|
class VBForm;
|
|
|
|
enum class Direction { None, Left, UpLeft, Up, UpRight, Right, DownRight, Down, DownLeft };
|
|
template<typename Callback>
|
|
inline void for_each_direction(Callback callback)
|
|
{
|
|
callback(Direction::Left);
|
|
callback(Direction::UpLeft);
|
|
callback(Direction::Up);
|
|
callback(Direction::UpRight);
|
|
callback(Direction::Right);
|
|
callback(Direction::DownRight);
|
|
callback(Direction::Down);
|
|
callback(Direction::DownLeft);
|
|
}
|
|
|
|
class VBWidget : public Retainable<VBWidget>, public Weakable<VBWidget> {
|
|
public:
|
|
static Retained<VBWidget> create(VBForm& form) { return adopt(*new VBWidget(form)); }
|
|
virtual ~VBWidget();
|
|
|
|
bool is_selected() const;
|
|
|
|
Rect rect() const { return m_rect; }
|
|
void set_rect(const Rect& rect) { m_rect = rect; }
|
|
|
|
Rect grabber_rect(Direction) const;
|
|
Direction grabber_at(const Point&) const;
|
|
|
|
void paint(GPainter&);
|
|
|
|
private:
|
|
VBWidget(VBForm&);
|
|
|
|
VBForm& m_form;
|
|
Rect m_rect;
|
|
};
|