forked from NaiJi/project-kyoku
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "widget.h"
|
|
#include "core/corefactory.h"
|
|
#include "core/rectangle.h"
|
|
#include "core/vector.h"
|
|
#include "core/text.h"
|
|
|
|
#include <functional>
|
|
|
|
class Window : public Widget
|
|
{
|
|
public:
|
|
explicit Window(const std::shared_ptr<kku::CoreFactory>& factory, const std::string& title);
|
|
|
|
virtual void input(const kku::SystemEvent& event) override;
|
|
virtual void update(const kku::microsec& dt) override;
|
|
virtual void display() const override;
|
|
virtual void move(const kku::Vector2<float>& delta) override;
|
|
virtual bool isUnderMouse(const kku::Point& position) const override final;
|
|
|
|
virtual void setRect(const kku::Area<float>& rect) override;
|
|
virtual kku::Area<float> getRect() const override;
|
|
|
|
virtual void setPosition(const kku::Point& position) override;
|
|
virtual kku::Point getPosition() const override;
|
|
|
|
void addBarButton(const std::string& text, std::function<void(void)> callback);
|
|
|
|
protected:
|
|
std::shared_ptr<kku::Rectangle> _bar;
|
|
std::shared_ptr<kku::Rectangle> _window_content;
|
|
std::shared_ptr<kku::Text> _bar_title;
|
|
|
|
const std::shared_ptr<kku::CoreFactory> _core_factory;
|
|
|
|
private:
|
|
bool _is_dragging;
|
|
kku::Point _previous_click_position;
|
|
};
|
|
|