1 #ifndef HRK_COMPONENT_H
2 #define HRK_COMPONENT_H
26 virtual void set_position(
const PointF& position)
31 virtual PointF position(
void)
const
36 virtual void set_input_enabled(
bool enable)
38 input_enabled_ = enable;
41 virtual bool input_enabled(
void)
const
43 return input_enabled_;
46 virtual void set_alpha(
double alpha) = 0;
47 virtual void set_color_strength(
double ratio) = 0;
49 virtual void update(
void)
53 virtual void draw(
void) = 0;
55 virtual SizeF size(
void)
const = 0;
57 virtual double width(
void)
const
59 return size().width();
62 virtual double height(
void)
const
64 return size().height();
67 virtual RectF rect(
void)
const
69 return RectF(position(), size());
72 virtual double set_align(
double value,
const unsigned char align)
74 double next_value = value;
76 if (align & (Align::Left | Align::Center | Align::Right)) {
78 if (align & Align::Center) {
79 next_value = value - size().width() / 2;
81 }
else if (align & Align::Right) {
82 next_value = value - size().width();
84 set_position(
PointF(next_value, position().y()));
88 if (align & Align::Middle) {
89 next_value = value - size().height() / 2;
91 }
else if (align & Align::Bottom) {
92 next_value = value - size().height();
94 set_position(
PointF(position().x(), next_value));
位置
Definition: PointF.h:12
Definition: Component.h:15
幅と高さ
Definition: SizeF.h:12
矩形
Definition: RectF.h:16