Finish the error window implementation
This commit is contained in:
parent
a9ac98cd3d
commit
ec292f0178
7 changed files with 292 additions and 16 deletions
|
|
@ -1,21 +1,52 @@
|
|||
#pragma once
|
||||
|
||||
#include <zwidget/core/widget.h>
|
||||
#include <zwidget/core/span_layout.h>
|
||||
|
||||
class TextEdit;
|
||||
class LogViewer;
|
||||
class PushButton;
|
||||
|
||||
class ErrorWindow : public Widget
|
||||
{
|
||||
public:
|
||||
static void ExecModal(const std::string& text);
|
||||
static bool ExecModal(const std::string& text, const std::string& log);
|
||||
|
||||
ErrorWindow();
|
||||
|
||||
bool Restart = false;
|
||||
|
||||
protected:
|
||||
void OnClose() override;
|
||||
void OnGeometryChanged() override;
|
||||
|
||||
private:
|
||||
ErrorWindow();
|
||||
void SetText(const std::string& text, const std::string& log);
|
||||
|
||||
void SetText(const std::string& text);
|
||||
void OnClipboardButtonClicked();
|
||||
void OnRestartButtonClicked();
|
||||
|
||||
TextEdit* LogView = nullptr;
|
||||
LogViewer* LogView = nullptr;
|
||||
PushButton* ClipboardButton = nullptr;
|
||||
PushButton* RestartButton = nullptr;
|
||||
|
||||
std::string clipboardtext;
|
||||
};
|
||||
|
||||
class LogViewer : public Widget
|
||||
{
|
||||
public:
|
||||
LogViewer(Widget* parent);
|
||||
|
||||
void SetText(const std::string& text, const std::string& log);
|
||||
|
||||
protected:
|
||||
void OnPaintFrame(Canvas* canvas) override;
|
||||
void OnPaint(Canvas* canvas) override;
|
||||
|
||||
private:
|
||||
SpanLayout CreateLineLayout(const std::string& text);
|
||||
|
||||
std::shared_ptr<Font> largefont = Font::Create("Poppins", 16.0);
|
||||
std::shared_ptr<Font> font = Font::Create("Poppins", 12.0);
|
||||
std::vector<SpanLayout> lines;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue