Added msw_buttons_rescale() - Function for a scaling Dialog's buttons under MSW

This commit is contained in:
YuSanka 2019-04-25 15:06:44 +02:00
parent 3f978f6afe
commit 708037158e
17 changed files with 149 additions and 43 deletions

View file

@ -19,6 +19,7 @@
#include "MsgDialog.hpp"
#include "I18N.hpp"
#include "../Utils/PrintHost.hpp"
#include "wxExtensions.hpp"
namespace fs = boost::filesystem;
@ -136,8 +137,6 @@ PrintHostQueueDialog::PrintHostQueueDialog(wxWindow *parent)
, on_error_evt(this, EVT_PRINTHOST_ERROR, &PrintHostQueueDialog::on_error, this)
, on_cancel_evt(this, EVT_PRINTHOST_CANCEL, &PrintHostQueueDialog::on_cancel, this)
{
enum { HEIGHT = 60, WIDTH = 30, SPACING = 5 };
const auto em = GetTextExtent("m").x;
SetSize(wxSize(HEIGHT * em, WIDTH * em));
@ -202,6 +201,18 @@ void PrintHostQueueDialog::append_job(const PrintHostJob &job)
job_list->AppendItem(fields, static_cast<wxUIntPtr>(ST_NEW));
}
void PrintHostQueueDialog::on_dpi_changed(const wxRect &suggested_rect)
{
const int& em = em_unit();
msw_buttons_rescale(this, em, { wxID_DELETE, wxID_CANCEL, btn_error->GetId() });
SetMinSize(wxSize(HEIGHT * em, WIDTH * em));
Fit();
Refresh();
}
PrintHostQueueDialog::JobState PrintHostQueueDialog::get_state(int idx)
{
wxCHECK_MSG(idx >= 0 && idx < job_list->GetItemCount(), ST_ERROR, "Out of bounds access to job list");