From 8e94953b2d9f7d946445759fe31d169879b680c8 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 14 May 2018 13:42:24 +1000 Subject: Backport: Modernize Platform.h (1) - noexcept, const, standard methods. Changes made to FontParameters, Font, Window, ListBoxEvent, ListBox, Menu, DynamicLibrary, and Platform. Backport of changeset 6938:a42c7cc3254b. --- gtk/PlatGTK.cxx | 16 ++++++++-------- gtk/ScintillaGTK.cxx | 3 +-- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'gtk') diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index f9ee02bfc..6c0432198 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -105,7 +105,7 @@ static GtkWidget *PWidget(WindowID wid) { return static_cast(wid); } -Font::Font() : fid(0) {} +Font::Font() noexcept : fid(0) {} Font::~Font() {} @@ -961,7 +961,7 @@ void Window::Destroy() { } } -PRectangle Window::GetPosition() { +PRectangle Window::GetPosition() const { // Before any size allocated pretend its 1000 wide so not scrolled PRectangle rc(0, 0, 1000, 1000); if (wid) { @@ -1005,15 +1005,15 @@ GdkRectangle MonitorRectangleForWidget(GtkWidget *wid) { } -void Window::SetPositionRelative(PRectangle rc, Window relativeTo) { +void Window::SetPositionRelative(PRectangle rc, const Window *relativeTo) { int ox = 0; int oy = 0; - GdkWindow *wndRelativeTo = WindowFromWidget(PWidget(relativeTo.wid)); + GdkWindow *wndRelativeTo = WindowFromWidget(PWidget(relativeTo->wid)); gdk_window_get_origin(wndRelativeTo, &ox, &oy); ox += rc.left; oy += rc.top; - GdkRectangle rcMonitor = MonitorRectangleForWidget(PWidget(relativeTo.wid)); + GdkRectangle rcMonitor = MonitorRectangleForWidget(PWidget(relativeTo->wid)); /* do some corrections to fit into screen */ int sizex = rc.right - rc.left; @@ -1032,7 +1032,7 @@ void Window::SetPositionRelative(PRectangle rc, Window relativeTo) { gtk_window_resize(GTK_WINDOW(wid), sizex, sizey); } -PRectangle Window::GetClientPosition() { +PRectangle Window::GetClientPosition() const { // On GTK+, the client position is the window position return GetPosition(); } @@ -1143,7 +1143,7 @@ static void list_image_free(gpointer, gpointer value, gpointer) { g_free(list_image); } -ListBox::ListBox() { +ListBox::ListBox() noexcept { } ListBox::~ListBox() { @@ -1866,7 +1866,7 @@ void ListBoxX::SetList(const char *listText, char separator, char typesep) { } } -Menu::Menu() : mid(0) {} +Menu::Menu() noexcept : mid(0) {} void Menu::CreatePopUp() { Destroy(); diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 704d7163b..6a115994b 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -979,8 +979,7 @@ void ScintillaGTK::FullPaint() { } PRectangle ScintillaGTK::GetClientRectangle() const { - Window win = wMain; - PRectangle rc = win.GetClientPosition(); + PRectangle rc = wMain.GetClientPosition(); if (verticalScrollBarVisible) rc.right -= verticalScrollBarWidth; if (horizontalScrollBarVisible && !Wrapping()) -- cgit v1.2.3