From 8b9277ebfdb5d6524749e1a38f5cef2486e388e6 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Sun, 25 Aug 2019 16:10:04 -0400 Subject: [PATCH] use built in label class --- minigui.d | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/minigui.d b/minigui.d index 97b4564..f6d4838 100644 --- a/minigui.d +++ b/minigui.d @@ -3179,6 +3179,26 @@ class TabWidgetPage : Widget { this(string title, Widget parent) { this.title = title; super(parent); + + /* + version(win32_widgets) { + static bool classRegistered = false; + if(!classRegistered) { + HINSTANCE hInstance = cast(HINSTANCE) GetModuleHandle(null); + WNDCLASSEX wc; + wc.cbSize = wc.sizeof; + wc.hInstance = hInstance; + wc.lpfnWndProc = &DefWindowProc; + wc.lpszClassName = "arsd_minigui_TabWidgetPage"w.ptr; + if(!RegisterClassExW(&wc)) + throw new Exception("RegisterClass ");// ~ to!string(GetLastError())); + classRegistered = true; + } + + + createWin32Window(this, "arsd_minigui_TabWidgetPage"w, "", 0); + } + */ } override int minHeight() { @@ -5518,15 +5538,16 @@ class TextLabel : Widget { @scriptable void label(string l) { label_ = l; - redraw(); + version(win32_widgets) { + WCharzBuffer bfr = WCharzBuffer(l); + SetWindowTextW(hwnd, bfr.ptr); + } else version(custom_widgets) + redraw(); } /// this(string label, Widget parent = null) { - this.label_ = label; - this.alignment = TextAlignment.Right; - this.tabStop = false; - super(parent); + this(label, TextAlignment.Right, parent); } /// @@ -5535,10 +5556,14 @@ class TextLabel : Widget { this.alignment = alignment; this.tabStop = false; super(parent); + + version(win32_widgets) + createWin32Window(this, "static"w, label, 0, alignment == TextAlignment.Right ? WS_EX_RIGHT : WS_EX_LEFT); } TextAlignment alignment; + version(custom_widgets) override void paint(ScreenPainter painter) { painter.outlineColor = Color.black; painter.drawText(Point(0, 0), this.label, Point(width, height), alignment);