From d7a58821f236af8574cbb5ff58b14d1464d05994 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Wed, 28 Nov 2018 21:38:28 -0500 Subject: [PATCH] trying to scroll... --- minigui.d | 28 +++++++++++++++++++++++----- simpledisplay.d | 18 +++++++++--------- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/minigui.d b/minigui.d index a5eed19..2654252 100644 --- a/minigui.d +++ b/minigui.d @@ -546,12 +546,12 @@ version(win32_widgets) {} else version(custom_widgets) { enum windowBackgroundColor = Color(212, 212, 212); // used to be 192 enum activeTabColor = lightAccentColor; - enum activeListXorColor = Color(255, 255, 0); enum hoveringColor = Color(215, 215, 215); enum buttonColor = windowBackgroundColor; enum depressedButtonColor = darkAccentColor; - enum progressBarColor = Color.blue; - enum activeMenuItemColor = Color.blue; + enum activeListXorColor = Color(255, 255, 127); + enum progressBarColor = Color(0, 0, 128); + enum activeMenuItemColor = Color(0, 0, 128); } else static assert(false); // these are used by horizontal rule so not just custom_widgets. for now at least. @@ -1684,9 +1684,11 @@ class ListWidget : ScrollableWidget { super(parent); } - override void paint(ScreenPainter painter) { + override void paintFrameAndBackground(ScreenPainter painter) { draw3dFrame(this, painter, FrameStyle.sunk, Color.white); + } + override void paint(ScreenPainter painter) { auto pos = Point(4, 4); foreach(idx, option; options) { painter.fillColor = Color.white; @@ -3992,7 +3994,20 @@ class MainWindow : Window { class ClientAreaWidget : Widget { this(Widget parent = null) { super(parent); + //sa = new ScrollableWidget(this); } + /* + ScrollableWidget sa; + override void addChild(Widget w, int position) { + if(sa is null) + super.addChild(w, position); + else { + sa.addChild(w, position); + sa.setContentSize(this.minWidth + 1, this.minHeight); + import std.stdio; writeln(sa.contentWidth, "x", sa.contentHeight); + } + } + */ } /** @@ -4024,7 +4039,10 @@ class ToolBar : Widget { tabStop = false; version(win32_widgets) { - createWin32Window(this, "ToolbarWindow32"w, "", TBSTYLE_LIST|TBSTYLE_FLAT|TBSTYLE_TOOLTIPS); + // so i like how the flat thing looks on windows, but not on wine + // and eh, with windows visual styles enabled it looks cool anyway soooo gonna + // leave it commented + createWin32Window(this, "ToolbarWindow32"w, "", TBSTYLE_LIST|/*TBSTYLE_FLAT|*/TBSTYLE_TOOLTIPS); SendMessageW(hwnd, TB_SETEXTENDEDSTYLE, 0, 8/*TBSTYLE_EX_MIXEDBUTTONS*/); diff --git a/simpledisplay.d b/simpledisplay.d index 599a8c7..1b34c56 100644 --- a/simpledisplay.d +++ b/simpledisplay.d @@ -3491,7 +3491,7 @@ class NotificationAreaIcon : CapableOfHandlingNativeEvent { wc.lpfnWndProc = &WndProc; wc.lpszClassName = "arsd_simpledisplay_notification_icon"w.ptr; if(!RegisterClassExW(&wc)) - throw new Exception("RegisterClass ");// ~ to!string(GetLastError())); + throw new WindowsApiException("RegisterClass"); registered = true; } @@ -7877,7 +7877,7 @@ version(Windows) { wc.hIconSm = null; wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; if(!RegisterClassExW(&wc)) - throw new Exception("RegisterClass " ~ to!string(GetLastError())); + throw new WindowsApiException("RegisterClassExW"); knownWinClasses[cnamec] = true; } @@ -7945,10 +7945,10 @@ version(Windows) { auto pixelformat = ChoosePixelFormat(hdc, &pfd); if ((pixelformat = ChoosePixelFormat(hdc, &pfd)) == 0) - throw new Exception("ChoosePixelFormat"); + throw new WindowsApiException("ChoosePixelFormat"); if (SetPixelFormat(hdc, pixelformat, &pfd) == 0) - throw new Exception("SetPixelFormat"); + throw new WindowsApiException("SetPixelFormat"); if (sdpyOpenGLContextVersion && wglCreateContextAttribsARB is null) { // windoze is idiotic: we have to have OpenGL context to get function addresses @@ -7977,7 +7977,7 @@ version(Windows) { ghRC = wglCreateContext(ghDC); } if (ghRC is null) - throw new Exception("wglCreateContextAttribsARB"); + throw new WindowsApiException("wglCreateContextAttribsARB"); } else { // try to do at least something if (sdpyOpenGLContextAllowFallback || sdpyOpenGLContextVersion == 0) { @@ -7985,7 +7985,7 @@ version(Windows) { ghRC = wglCreateContext(ghDC); } if (ghRC is null) - throw new Exception("wglCreateContext"); + throw new WindowsApiException("wglCreateContext"); } } } @@ -8066,7 +8066,7 @@ version(Windows) { rect.right = wind.minWidth + 100; rect.bottom = wind.minHeight + 100; if(!AdjustWindowRect(&rect, GetWindowLong(wind.hwnd, GWL_STYLE), GetMenu(wind.hwnd) !is null)) - throw new Exception("AdjustWindowRect"); + throw new WindowsApiException("AdjustWindowRect"); mmi.ptMinTrackSize.x = rect.right - rect.left; mmi.ptMinTrackSize.y = rect.bottom - rect.top; @@ -8079,7 +8079,7 @@ version(Windows) { rect.right = wind.maxWidth + 100; rect.bottom = wind.maxHeight + 100; if(!AdjustWindowRect(&rect, GetWindowLong(wind.hwnd, GWL_STYLE), GetMenu(wind.hwnd) !is null)) - throw new Exception("AdjustWindowRect"); + throw new WindowsApiException("AdjustWindowRect"); mmi.ptMaxTrackSize.x = rect.right - rect.left; mmi.ptMaxTrackSize.y = rect.bottom - rect.top; @@ -8492,7 +8492,7 @@ version(Windows) { null, 0); if(handle is null) - throw new Exception("create image failed"); + throw new WindowsApiException("create image failed"); }