forked from IQ.Lvbs/IQ.Pilot
IQ.Pilot Release Commit @ 0b96bd5
This commit is contained in:
35
iqpilot/tools/cabana/ui/chart/tiplabel.h
Normal file
35
iqpilot/tools/cabana/ui/chart/tiplabel.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
|
||||
|
||||
struct TipLine {
|
||||
bool has_marker = false;
|
||||
ImU32 marker = 0;
|
||||
std::string name;
|
||||
std::string bold;
|
||||
std::string rest;
|
||||
};
|
||||
|
||||
class TipLabel {
|
||||
public:
|
||||
void showText(const ImVec2 &pt, const std::vector<TipLine> &text, const ImRect &rect);
|
||||
void hide() { visible_ = false; }
|
||||
bool isVisible() const { return visible_; }
|
||||
void draw();
|
||||
|
||||
private:
|
||||
|
||||
ImVec2 layoutLines(ImDrawList *p, const ImVec2 &origin, ImU32 fg) const;
|
||||
ImVec2 sizeHint() const;
|
||||
|
||||
static constexpr float MARGIN = 2.0f;
|
||||
std::vector<TipLine> text_;
|
||||
ImVec2 pos_;
|
||||
ImVec2 size_;
|
||||
bool visible_ = false;
|
||||
};
|
||||
Reference in New Issue
Block a user