summaryrefslogtreecommitdiff
path: root/wx+/popup_dlg.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2016-07-25 20:46:59 +0200
committerDaniel Wilhelm <daniel@wili.li>2016-07-25 20:46:59 +0200
commit37dab163d3ee934a56f7d4ef2423c973f20cd27a (patch)
tree050c0b1c35de989fa397faa34f7ed2a1df543e51 /wx+/popup_dlg.cpp
parent8.2 (diff)
downloadFreeFileSync-37dab163d3ee934a56f7d4ef2423c973f20cd27a.tar.gz
FreeFileSync-37dab163d3ee934a56f7d4ef2423c973f20cd27a.tar.bz2
FreeFileSync-37dab163d3ee934a56f7d4ef2423c973f20cd27a.zip
8.3
Diffstat (limited to 'wx+/popup_dlg.cpp')
-rw-r--r--wx+/popup_dlg.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/wx+/popup_dlg.cpp b/wx+/popup_dlg.cpp
index 188ad76d..4cf5b7b4 100644
--- a/wx+/popup_dlg.cpp
+++ b/wx+/popup_dlg.cpp
@@ -6,6 +6,7 @@
#include "popup_dlg.h"
#include <wx/app.h>
+#include <wx/display.h>
#include <wx+/std_button_layout.h>
#include <wx+/font_size.h>
#include <wx+/image_resources.h>
@@ -104,6 +105,8 @@ public:
m_bitmapMsgType->SetBitmap(getResourceImage(L"msg_error"));
break;
}
+ if (cfg.icon.IsOk())
+ m_bitmapMsgType->SetBitmap(cfg.icon);
if (titleTmp.empty())
SetTitle(wxTheApp->GetAppDisplayName());
@@ -115,14 +118,19 @@ public:
SetTitle(wxTheApp->GetAppDisplayName() + L" - " + titleTmp);
}
- const wxSize maxSize(500, 380);
+ int maxWidth = 500;
+ int maxHeight = 400; //try to determine better value based on actual display resolution:
+
+ int disPos = wxDisplay::GetFromWindow(parent); //window must be visible
+ if (disPos != wxNOT_FOUND)
+ maxHeight = wxDisplay(disPos).GetClientArea().GetHeight() * 2 / 3;
assert(!cfg.textMain.empty() || !cfg.textDetail.empty());
if (!cfg.textMain.empty())
{
setMainInstructionFont(*m_staticTextMain);
m_staticTextMain->SetLabel(cfg.textMain);
- m_staticTextMain->Wrap(maxSize.GetWidth()); //call *after* SetLabel()
+ m_staticTextMain->Wrap(maxWidth); //call *after* SetLabel()
}
else
m_staticTextMain->Hide();
@@ -130,7 +138,7 @@ public:
if (!cfg.textDetail.empty())
{
const wxString& text = L"\n" + cfg.textDetail + L"\n"; //add empty top/bottom lines *instead* of using border space!
- setBestInitialSize(*m_textCtrlTextDetail, text, maxSize);
+ setBestInitialSize(*m_textCtrlTextDetail, text, wxSize(maxWidth, maxHeight));
m_textCtrlTextDetail->ChangeValue(text);
}
else
@@ -205,6 +213,7 @@ public:
setStandardButtonLayout(*bSizerStdButtons, StdButtons().setAffirmative(m_buttonAffirmative));
setAsStandard(*m_buttonAffirmative);
GetSizer()->SetSizeHints(this); //~=Fit() + SetMinSize()
+ Center(); //needs to be re-applied after a dialog size change!
}
};
@@ -223,6 +232,7 @@ public:
setStandardButtonLayout(*bSizerStdButtons, StdButtons().setAffirmative(m_buttonAffirmative).setCancel(m_buttonCancel));
setAsStandard(*m_buttonAffirmative);
GetSizer()->SetSizeHints(this); //~=Fit() + SetMinSize()
+ Center(); //needs to be re-applied after a dialog size change!
}
};
}
@@ -248,6 +258,7 @@ public:
setStandardButtonLayout(*bSizerStdButtons, StdButtons().setAffirmative(m_buttonAffirmative).setNegative(m_buttonNegative).setCancel(m_buttonCancel));
setAsStandard(*m_buttonAffirmative);
GetSizer()->SetSizeHints(this); //~=Fit() + SetMinSize()
+ Center(); //needs to be re-applied after a dialog size change!
}
private:
bgstack15