Small refactoring
parent
560f29fc8c
commit
4ffa8fcdf9
|
@ -45,15 +45,21 @@ void ColourPopup::create(int dialogID)
|
|||
display();
|
||||
}
|
||||
|
||||
void ColourPopup::createForDpi(int dialogID)
|
||||
void ColourPopup::doDialog(POINT p)
|
||||
{
|
||||
if (!isCreated())
|
||||
{
|
||||
const DPI_AWARENESS_CONTEXT dpiContextSystem = NppDarkMode::isWindows10() ? DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED : DPI_AWARENESS_CONTEXT_SYSTEM_AWARE;
|
||||
const auto dpiContext = DPIManagerV2::setThreadDpiAwarenessContext(dpiContextSystem);
|
||||
create(dialogID);
|
||||
|
||||
create(IDD_COLOUR_POPUP);
|
||||
|
||||
if (dpiContext != NULL)
|
||||
{
|
||||
DPIManagerV2::setThreadDpiAwarenessContext(dpiContext);
|
||||
}
|
||||
}
|
||||
::SetWindowPos(_hSelf, HWND_TOP, p.x, p.y, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||
}
|
||||
|
||||
intptr_t CALLBACK ColourPopup::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
|
|
@ -37,14 +37,7 @@ public :
|
|||
}
|
||||
|
||||
void create(int dialogID);
|
||||
void createForDpi(int dialogID);
|
||||
|
||||
void doDialog(POINT p)
|
||||
{
|
||||
if (!isCreated())
|
||||
createForDpi(IDD_COLOUR_POPUP);
|
||||
::SetWindowPos(_hSelf, HWND_TOP, p.x, p.y, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||
}
|
||||
void doDialog(POINT p);
|
||||
|
||||
virtual void destroy()
|
||||
{
|
||||
|
|
|
@ -263,16 +263,6 @@ void StaticDialog::create(int dialogID, bool isRTL, bool msgDestParent)
|
|||
::SendMessage(msgDestParent ? _hParent : (::GetParent(_hParent)), NPPM_MODELESSDIALOG, MODELESSDIALOGADD, reinterpret_cast<WPARAM>(_hSelf));
|
||||
}
|
||||
|
||||
void StaticDialog::createForDpi(int dialogID, bool isRTL, bool msgDestParent, DPI_AWARENESS_CONTEXT dpiAContext)
|
||||
{
|
||||
const auto dpiContext = setThreadDpiAwarenessContext(dpiAContext);
|
||||
create(dialogID, isRTL, msgDestParent);
|
||||
if (dpiContext != NULL)
|
||||
{
|
||||
setThreadDpiAwarenessContext(dpiContext);
|
||||
}
|
||||
}
|
||||
|
||||
intptr_t CALLBACK StaticDialog::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
|
|
|
@ -44,7 +44,6 @@ public :
|
|||
virtual ~StaticDialog();
|
||||
|
||||
virtual void create(int dialogID, bool isRTL = false, bool msgDestParent = true);
|
||||
virtual void createForDpi(int dialogID, bool isRTL = false, bool msgDestParent = true, DPI_AWARENESS_CONTEXT dpiAContext = DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
|
||||
|
||||
virtual bool isCreated() const {
|
||||
return (_hSelf != nullptr);
|
||||
|
|
Loading…
Reference in New Issue