Modules/Taskboard/public/TaskStateChip.hpp
Шурупов Илья Викторович e779309553 Taskboard: one session chip for cards and the task header
The task header showed its session as a muted text label while cards used a pulsing chip, so
the same state looked different in the docked panel, the full view and on cards. TaskStateChip
moves to its own file with showSession(), and the header uses it. The chip now sits on the
right of the badge row, before status, colour and actions.
2026-10-25 22:27:50 +03:00

36 lines
916 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(ui::Painter& 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;
};
}