In PersistLocation get the new location of the dialog directly from the dialog rather than from the event as the data in the event is wrong

Originally committed to SVN as r6411.
This commit is contained in:
Thomas Goyne 2012-02-01 00:48:07 +00:00
parent 04cc422391
commit 7bd0691bd7
2 changed files with 5 additions and 3 deletions

View File

@ -35,6 +35,7 @@ PersistLocation::PersistLocation(wxDialog *dialog, std::string options_prefix)
: x_opt(OPT_SET(options_prefix + "/Last/X"))
, y_opt(OPT_SET(options_prefix + "/Last/Y"))
, maximize_opt(OPT_SET(options_prefix + "/Maximized"))
, dialog(dialog)
{
dialog->Bind(wxEVT_MOVE, &PersistLocation::OnMove, this);
dialog->Bind(wxEVT_ICONIZE, &PersistLocation::OnMinimize, this);
@ -78,8 +79,8 @@ PersistLocation::PersistLocation(wxDialog *dialog, std::string options_prefix)
}
}
void PersistLocation::OnMove(wxMoveEvent &evt) {
wxPoint pos = evt.GetPosition();
void PersistLocation::OnMove(wxMoveEvent &) {
wxPoint pos = dialog->GetPosition();
x_opt->SetInt(pos.x);
y_opt->SetInt(pos.y);
}

View File

@ -40,8 +40,9 @@ class PersistLocation {
agi::OptionValue *x_opt;
agi::OptionValue *y_opt;
agi::OptionValue *maximize_opt;
class wxDialog *dialog;
void OnMove(wxMoveEvent &evt);
void OnMove(wxMoveEvent &);
void OnMinimize(wxIconizeEvent &evt);
public: