From 713ef99e2f054f40a880a16254f58b757fbd9ee4 Mon Sep 17 00:00:00 2001 From: Geoffray Levasseur Date: Wed, 28 Oct 2026 18:07:38 +0100 Subject: [PATCH] missing implementation in cevowidgets --- widget/include/Cevo/CevoDrawDlg.h | 4 ++++ widget/include/Cevo/CevoScreenTools.h | 1 + widget/src/CevoDrawDlg.cpp | 16 ++++++++++++++++ widget/src/CevoScreenTools.cpp | 9 +++++++++ 4 files changed, 30 insertions(+) diff --git a/widget/include/Cevo/CevoDrawDlg.h b/widget/include/Cevo/CevoDrawDlg.h index c8cc91c..d1af5f3 100644 --- a/widget/include/Cevo/CevoDrawDlg.h +++ b/widget/include/Cevo/CevoDrawDlg.h @@ -45,6 +45,10 @@ public: virtual void smartInvalidate(); void centerToScreen(); void centerToScreen(int w, int h); + // Assigns HGrSystem's bitmap/mask + the button font to every direct + // child ButtonBase (ButtonA/ButtonB) - call once the dialog's buttons + // exist (e.g. after ui->setupUi()). + void initButtons(); protected: int titleHeight = 0; // area (from the top) that can be used to drag the window diff --git a/widget/include/Cevo/CevoScreenTools.h b/widget/include/Cevo/CevoScreenTools.h index 8e2dfce..3861a45 100644 --- a/widget/include/Cevo/CevoScreenTools.h +++ b/widget/include/Cevo/CevoScreenTools.h @@ -96,6 +96,7 @@ void sprite(Dpi::Canvas &canvas, int xDst, int yDst, const GraphicSetItem &item) void frame(Dpi::Canvas &canvas, int x0, int y0, int x1, int y1, QColor cl0, QColor cl1); void rframe(Dpi::Canvas &canvas, int x0, int y0, int x1, int y1, QColor cl0, QColor cl1); void btnFrame(Dpi::Canvas &canvas, const QRect &rect, const Texture &texture); +void editFrame(Dpi::Canvas &canvas, const QRect &rect, const Texture &texture); // Unimplemented in the original ScreenTools.pas too (body is commented out there). void corner(Dpi::Canvas &canvas, int x, int y, int kind, const Texture &texture); diff --git a/widget/src/CevoDrawDlg.cpp b/widget/src/CevoDrawDlg.cpp index 7a15c6f..41a0f9a 100644 --- a/widget/src/CevoDrawDlg.cpp +++ b/widget/src/CevoDrawDlg.cpp @@ -28,6 +28,8 @@ #include "Cevo/CevoDrawDlg.h" #include "Cevo/CevoArea.h" +#include "Cevo/CevoButtonA.h" +#include "Cevo/CevoButtonB.h" #include "Cevo/CevoButtonBase.h" #include "Cevo/CevoScreenTools.h" #include "Cevo/CevoTexture.h" @@ -108,6 +110,20 @@ void DrawDlg::centerToScreen(int w, int h) monitor.top() + (monitor.height() - h) / 2, w, h); } +void DrawDlg::initButtons() +{ + const auto children = findChildren(QString(), Qt::FindDirectChildrenOnly); + for (ButtonBase *button : children) { + if (HGrSystem) + button->setGraphic(&HGrSystem->data); + if (auto *buttonA = qobject_cast(button)) + buttonA->setFont(UniFont[static_cast(FontType::Button)]); + if (auto *buttonB = qobject_cast(button)) + if (HGrSystem) + buttonB->setMask(&HGrSystem->mask); + } +} + // ---- BaseMessgDlg ---- BaseMessgDlg::BaseMessgDlg(QWidget *parent) : DrawDlg(parent) diff --git a/widget/src/CevoScreenTools.cpp b/widget/src/CevoScreenTools.cpp index f1aa944..925c945 100644 --- a/widget/src/CevoScreenTools.cpp +++ b/widget/src/CevoScreenTools.cpp @@ -134,6 +134,15 @@ void btnFrame(Dpi::Canvas &canvas, const QRect &rect, const Texture &texture) texture.colorBevelShade, texture.colorBevelLight); } +void editFrame(Dpi::Canvas &canvas, const QRect &rect, const Texture &texture) +{ + frame(canvas, rect.left() - 1, rect.top() - 1, rect.right(), rect.bottom(), Qt::black, Qt::black); + frame(canvas, rect.left() - 2, rect.top() - 2, rect.right() + 1, rect.bottom() + 1, Qt::black, Qt::black); + frame(canvas, rect.left() - 3, rect.top() - 3, rect.right() + 2, rect.bottom() + 1, Qt::black, Qt::black); + rframe(canvas, rect.left() - 4, rect.top() - 4, rect.right() + 3, rect.bottom() + 2, texture.colorBevelShade, + texture.colorBevelLight); +} + void corner(Dpi::Canvas &, int, int, int, const Texture &) { // Unimplemented in the original ScreenTools.pas too (body is commented out there).