Skip to content

Commit

Permalink
Stop using <atlcrack.h> in infolist_window.h
Browse files Browse the repository at this point in the history
  • Loading branch information
yukawa committed Jan 25, 2024
1 parent 034b610 commit 60d309c
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 17 deletions.
26 changes: 21 additions & 5 deletions src/renderer/win32/indicator_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <atltypes.h>
#include <atlwin.h>
#include <atlapp.h>
#include <atlcrack.h>
#include <atlmisc.h>
// clang-format on

Expand Down Expand Up @@ -112,10 +111,10 @@ class IndicatorWindow::WindowImpl
WindowImpl(const WindowImpl &) = delete;
WindowImpl &operator=(const WindowImpl &) = delete;

BEGIN_MSG_MAP_EX(WindowImpl)
MSG_WM_CREATE(OnCreate)
MSG_WM_TIMER(OnTimer)
MSG_WM_SETTINGCHANGE(OnSettingChange)
BEGIN_MSG_MAP(WindowImpl)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_TIMER, OnTimer)
MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange)
END_MSG_MAP()

void OnUpdate(const commands::RendererCommand &command,
Expand Down Expand Up @@ -306,6 +305,23 @@ class IndicatorWindow::WindowImpl
}
}

inline LRESULT OnCreate(UINT msg_id, WPARAM wparam, LPARAM lparam,
BOOL &handled) {
return static_cast<LRESULT>(
OnCreate(reinterpret_cast<LPCREATESTRUCT>(lparam)));
}
inline LRESULT OnTimer(UINT msg_id, WPARAM wparam, LPARAM lparam,
BOOL &handled) {
OnTimer(static_cast<UINT_PTR>(wparam));
return 0;
}
inline LRESULT OnSettingChange(UINT msg_id, WPARAM wparam, LPARAM lparam,
BOOL &handled) {
OnSettingChange(static_cast<UINT>(wparam),
reinterpret_cast<LPCTSTR>(lparam));
return 0;
}

CBitmapHandle current_image_;
CPoint top_left_;
BYTE alpha_;
Expand Down
65 changes: 53 additions & 12 deletions src/renderer/win32/infolist_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <atltypes.h>
#include <atlwin.h>
#include <atlapp.h>
#include <atlcrack.h>
#include <atlmisc.h>
#include <atlgdi.h>
// clang-format on
Expand Down Expand Up @@ -67,22 +66,22 @@ class InfolistWindow : public ATL::CWindowImpl<InfolistWindow, ATL::CWindow,
public:
DECLARE_WND_CLASS_EX(kInfolistWindowClassName, CS_SAVEBITS | CS_DROPSHADOW,
COLOR_WINDOW);

BEGIN_MSG_MAP_EX(InfolistWindow)
MSG_WM_DESTROY(OnDestroy)
MSG_WM_DPICHANGED(OnDpiChanged)
MSG_WM_ERASEBKGND(OnEraseBkgnd)
MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo)
MSG_WM_SETTINGCHANGE(OnSettingChange)
MSG_WM_PAINT(OnPaint)
MSG_WM_PRINTCLIENT(OnPrintClient)
MSG_WM_TIMER(OnTimer)
BEGIN_MSG_MAP(InfolistWindow)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
MESSAGE_HANDLER(WM_DPICHANGED, OnDpiChanged)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo)
MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
MESSAGE_HANDLER(WM_PRINTCLIENT, OnPrintClient)
MESSAGE_HANDLER(WM_TIMER, OnTimer)
END_MSG_MAP()

InfolistWindow();
InfolistWindow(const InfolistWindow &) = delete;
InfolistWindow &operator=(const InfolistWindow &) = delete;
~InfolistWindow();

void OnDestroy();
void OnDpiChanged(UINT dpiX, UINT dpiY, RECT *rect);
BOOL OnEraseBkgnd(WTL::CDCHandle dc);
Expand All @@ -91,7 +90,6 @@ class InfolistWindow : public ATL::CWindowImpl<InfolistWindow, ATL::CWindow,
void OnPrintClient(WTL::CDCHandle dc, UINT uFlags);
void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
void OnTimer(UINT_PTR nIDEvent);

void UpdateLayout(const commands::Candidates &candidates);
void SetSendCommandInterface(
client::SendCommandInterface *send_command_interface);
Expand All @@ -103,6 +101,49 @@ class InfolistWindow : public ATL::CWindowImpl<InfolistWindow, ATL::CWindow,
void DelayHide(UINT mseconds);

private:
inline LRESULT OnDestroy(UINT msg_id, WPARAM wparam, LPARAM lparam,
BOOL &handled) {
OnDestroy();
return 0;
}
inline LRESULT OnDpiChanged(UINT msg_id, WPARAM wparam, LPARAM lparam,
BOOL &handled) {
OnDpiChanged(static_cast<UINT>(LOWORD(wparam)),
static_cast<UINT>(HIWORD(wparam)),
reinterpret_cast<RECT *>(lparam));
return 0;
}
inline LRESULT OnEraseBkgnd(UINT msg_id, WPARAM wparam, LPARAM lparam,
BOOL &handled) {
return static_cast<LRESULT>(OnEraseBkgnd(reinterpret_cast<HDC>(wparam)));
}
inline LRESULT OnGetMinMaxInfo(UINT msg_id, WPARAM wparam, LPARAM lparam,
BOOL &handled) {
OnGetMinMaxInfo(reinterpret_cast<MINMAXINFO *>(lparam));
return 0;
}
inline LRESULT OnSettingChange(UINT msg_id, WPARAM wparam, LPARAM lparam,
BOOL &handled) {
OnSettingChange(static_cast<UINT>(wparam),
reinterpret_cast<LPCTSTR>(lparam));
return 0;
}
inline LRESULT OnPaint(UINT msg_id, WPARAM wparam, LPARAM lparam,
BOOL &handled) {
OnPaint(reinterpret_cast<HDC>(wparam));
return 0;
}
inline LRESULT OnPrintClient(UINT msg_id, WPARAM wparam, LPARAM lparam,
BOOL &handled) {
OnPrintClient(reinterpret_cast<HDC>(wparam), static_cast<UINT>(lparam));
return 0;
}
inline LRESULT OnTimer(UINT msg_id, WPARAM wparam, LPARAM lparam,
BOOL &handled) {
OnTimer(static_cast<UINT_PTR>(wparam));
return 0;
}

Size DoPaint(WTL::CDCHandle dc);
Size DoPaintRow(WTL::CDCHandle dc, int row, int ypos);

Expand Down

0 comments on commit 60d309c

Please sign in to comment.