aboutsummaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/layout.h4
-rw-r--r--c/wcharptr.cpp61
2 files changed, 33 insertions, 32 deletions
diff --git a/c/layout.h b/c/layout.h
index cbdcac7..3d9cc3b 100644
--- a/c/layout.h
+++ b/c/layout.h
@@ -26,10 +26,10 @@ protected:
virtual bool InDragArea(int x, int y);
/* Perform drag, resizing relevant windows. */
virtual void Drag(int x, int y);
- /* Called after drag, when mouse button is released. */
- virtual void Done();
/* Reset dragger to automatic position. */
virtual void Reset();
+ /* Called after drag, when mouse button is released. */
+ virtual void Done();
private:
bool m_bActive = false;
long m_time = 0;
diff --git a/c/wcharptr.cpp b/c/wcharptr.cpp
index 25ddae1..d1332d5 100644
--- a/c/wcharptr.cpp
+++ b/c/wcharptr.cpp
@@ -4,8 +4,39 @@
#include "wcharptr.h"
#include "win.h"
+WcharPtr WcharPtr::FromNarrow(const char* const src, const int cp)
+{
+ int cbMultiByte = strlen(src)+1;
+ int cchWideChar = MultiByteToWideChar(cp, 0, src, cbMultiByte, nullptr, 0);
+ wchar_t* dst = new wchar_t[cchWideChar];
+ if (!MultiByteToWideChar(cp, 0, src, cbMultiByte, dst, cchWideChar)) {
+ delete dst;
+ throw Win32Error();
+ }
+ return dst;
+}
+
+WcharPtr WcharPtr::Copy(const wchar_t* const src)
+{
+ const int cb = wcslen(src)+1;
+ wchar_t* dst = new wchar_t[cb];
+ memcpy(dst, src, cb*sizeof(wchar_t));
+ return dst;
+}
+
+
WcharPtr::WcharPtr() noexcept {}
+WcharPtr::~WcharPtr() noexcept
+{
+ delete m_p;
+}
+
+WcharPtr::operator wchar_t*() noexcept
+{
+ return m_p;
+}
+
WcharPtr::WcharPtr(wchar_t* const s) noexcept : m_p(s) {}
WcharPtr& WcharPtr::operator=(wchar_t* const s) noexcept
@@ -26,39 +57,9 @@ WcharPtr& WcharPtr::operator=(WcharPtr&& other) noexcept
return *this;
}
-WcharPtr::operator wchar_t*() noexcept
-{
- return m_p;
-}
-
wchar_t* WcharPtr::Release() noexcept
{
wchar_t* p2 = m_p;
m_p = nullptr;
return p2;
}
-
-WcharPtr::~WcharPtr() noexcept
-{
- delete m_p;
-}
-
-WcharPtr WcharPtr::FromNarrow(const char* const src, const int cp)
-{
- int cbMultiByte = strlen(src)+1;
- int cchWideChar = MultiByteToWideChar(cp, 0, src, cbMultiByte, nullptr, 0);
- wchar_t* dst = new wchar_t[cchWideChar];
- if (!MultiByteToWideChar(cp, 0, src, cbMultiByte, dst, cchWideChar)) {
- delete dst;
- throw Win32Error();
- }
- return dst;
-}
-
-WcharPtr WcharPtr::Copy(const wchar_t* const src)
-{
- const int cb = wcslen(src)+1;
- wchar_t* dst = new wchar_t[cb];
- memcpy(dst, src, cb*sizeof(wchar_t));
- return dst;
-}