X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/439b3bf1f5c9a92218d84d6b8bfacb4d07a50829..520e470fdd0daef09c77938db642e4583933c90d:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 28fd6ab1d1..4aebe4007e 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -9,6 +9,17 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#include "wx/frame.h" #include "wx/defs.h" #include "wx/window.h" @@ -53,3 +64,27 @@ void wxWindow::UpdateWindowUI() } } } + +// Dialog units translations. Implemented in wincmn.cpp. +wxPoint wxWindow::ConvertPixelsToDialog(const wxPoint& pt) +{ + int charWidth = GetCharWidth(); + int charHeight = GetCharHeight(); + wxPoint pt2; + pt2.x = (int) ((pt.x * 4) / charWidth) ; + pt2.y = (int) ((pt.y * 8) / charHeight) ; + + return pt2; +} + +wxPoint wxWindow::ConvertDialogToPixels(const wxPoint& pt) +{ + int charWidth = GetCharWidth(); + int charHeight = GetCharHeight(); + wxPoint pt2; + pt2.x = (int) ((pt.x * charWidth) / 4) ; + pt2.y = (int) ((pt.y * charHeight) / 8) ; + + return pt2; +} +