aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2018-05-14 13:42:24 +1000
committerNeil <nyamatongwe@gmail.com>2018-05-14 13:42:24 +1000
commit8e94953b2d9f7d946445759fe31d169879b680c8 (patch)
treea5f38b198b2c82cec50b3bbe8def5907e6358ac2 /win32
parent13c4548805a2a5ef718fc5dfa6f77bb60c6bed2b (diff)
downloadscintilla-mirror-8e94953b2d9f7d946445759fe31d169879b680c8.tar.gz
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.
Diffstat (limited to 'win32')
-rw-r--r--win32/PlatWin.cxx18
-rw-r--r--win32/ScintillaWin.cxx5
2 files changed, 11 insertions, 12 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 58ae06f97..1e3c73114 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -447,8 +447,7 @@ void FontCached::ReleaseId(FontID fid_) {
::LeaveCriticalSection(&crPlatformLock);
}
-Font::Font() {
- fid = 0;
+Font::Font() noexcept : fid(0) {
}
Font::~Font() {
@@ -1805,7 +1804,7 @@ void Window::Destroy() {
wid = nullptr;
}
-PRectangle Window::GetPosition() {
+PRectangle Window::GetPosition() const {
RECT rc;
::GetWindowRect(HwndFromWindowID(wid), &rc);
return PRectangle::FromInts(rc.left, rc.top, rc.right, rc.bottom);
@@ -1837,11 +1836,11 @@ static RECT RectFromMonitor(HMONITOR hMonitor) {
}
-void Window::SetPositionRelative(PRectangle rc, Window relativeTo) {
+void Window::SetPositionRelative(PRectangle rc, const Window *relativeTo) {
const LONG style = ::GetWindowLong(HwndFromWindowID(wid), GWL_STYLE);
if (style & WS_POPUP) {
POINT ptOther = {0, 0};
- ::ClientToScreen(HwndFromWindowID(relativeTo.GetID()), &ptOther);
+ ::ClientToScreen(HwndFromWindowID(relativeTo->GetID()), &ptOther);
rc.Move(static_cast<XYPOSITION>(ptOther.x), static_cast<XYPOSITION>(ptOther.y));
const RECT rcMonitor = RectFromPRectangle(rc);
@@ -1868,7 +1867,7 @@ void Window::SetPositionRelative(PRectangle rc, Window relativeTo) {
SetPosition(rc);
}
-PRectangle Window::GetClientPosition() {
+PRectangle Window::GetClientPosition() const {
RECT rc={0,0,0,0};
if (wid)
::GetClientRect(HwndFromWindowID(wid), &rc);
@@ -2033,7 +2032,7 @@ public:
const TCHAR ListBoxX_ClassName[] = TEXT("ListBoxX");
-ListBox::ListBox() {
+ListBox::ListBox() noexcept {
}
ListBox::~ListBox() {
@@ -2559,8 +2558,7 @@ void ListBoxX::StartResize(WPARAM hitCode) {
}
LRESULT ListBoxX::NcHitTest(WPARAM wParam, LPARAM lParam) const {
- Window win = *this; // Copy HWND to avoid const problems
- const PRectangle rc = win.GetPosition();
+ const PRectangle rc = GetPosition();
LRESULT hit = ::DefWindowProc(GetHWND(), WM_NCHITTEST, wParam, lParam);
// There is an apparent bug in the DefWindowProc hit test code whereby it will
@@ -2894,7 +2892,7 @@ bool ListBoxX_Unregister() {
}
-Menu::Menu() : mid(0) {
+Menu::Menu() noexcept : mid(0) {
}
void Menu::CreatePopUp() {
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 655d99464..541065d31 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -2306,12 +2306,13 @@ void ScintillaWin::Paste() {
void ScintillaWin::CreateCallTipWindow(PRectangle) {
if (!ct.wCallTip.Created()) {
- ct.wCallTip = ::CreateWindow(callClassName, TEXT("ACallTip"),
+ HWND wnd = ::CreateWindow(callClassName, TEXT("ACallTip"),
WS_POPUP, 100, 100, 150, 20,
MainHWND(), 0,
GetWindowInstance(MainHWND()),
this);
- ct.wDraw = ct.wCallTip;
+ ct.wCallTip = wnd;
+ ct.wDraw = wnd;
}
}