Fixed dialog units <-> pixels conversion.

The computation is now identical to Windows native one. To achieve this,
MSDN-recommended GetTextExtent() call is used instead of GetCharWidth().
wxMulDivInt32() is used instead of integer arithmetics to achieve
correct rounding.

Use toplevel parent's font instead of window's own. This makes more
sense, as dialog units are defined for TLWs, not individual subcontrols.

Also fixed wxMSW's wxButton::GetDefaultSize() to compute dialog units
correctly.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63251 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2010-01-24 11:51:09 +00:00
parent 8cb03510a1
commit 5c3c137277
4 changed files with 98 additions and 14 deletions

View File

@@ -1736,6 +1736,8 @@ private:
// explicitly disabled with SetAutoLayout(false)
void InternalOnSize(wxSizeEvent& event);
// base for dialog unit conversion, i.e. average character size
wxSize GetDlgUnitBase() const;
// the stack of windows which have captured the mouse
static struct WXDLLIMPEXP_FWD_CORE wxWindowNext *ms_winCaptureNext;