Modules/Taskboard/public/TaskStateChip.hpp
agent 0aee9f107f
Some checks failed
Windows / build (pull_request) Has been cancelled
CMake on a single platform / build (pull_request) Has been cancelled
CMake / build (pull_request) Has been cancelled
Taskboard: port onto the refactored Widgets
Paint on tp::Canvas, use the shared Key enum and KeyModifiers, the TextStyle
drawing API and ImageHandle, and open the context menu through Menu::openAt.
The refactor moved storage and CPU placement into each application, so Taskboard
carries the same small AppStorage Sketch2D does.
2026-11-01 13:14:54 +03:00

36 lines
915 B
C++

#pragma once
#include "Task.hpp"
#include "Widget.hpp"
#include <string>
namespace tp::taskboard {
class TaskStateChip : public ui::Widget {
public:
TaskStateChip();
void show(std::string text, const RGBA& color, bool pulsing);
void setDotShown(bool shown);
[[nodiscard]] bool isDotShown() const { return mDotShown; }
[[nodiscard]] const std::string& text() const { return mText; }
[[nodiscard]] const RGBA& color() const { return mColor; }
[[nodiscard]] bool isPulsing() const { return mPulsing; }
void showSession(SessionState state);
protected:
[[nodiscard]] ui::Extent measureContent(ui::Axis axis, halnf crossLength) const override;
void paint(tp::Canvas& painter) override;
void onTick(halnf deltaMs) override;
private:
[[nodiscard]] halnf textStart() const;
std::string mText;
RGBA mColor;
bool mPulsing = false;
bool mDotShown = true;
halnf mClockMs = 0;
};
}