]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/private/window.h
3084665206057673aaf176c78ae8726dccec351c
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/private/window.h
3 // Purpose: misc wxWindow helpers
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2010 Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_PRIVATE_WINDOW_H_
12 #define _WX_PRIVATE_WINDOW_H_
14 #include "wx/gdicmn.h"
19 // Windows' computes dialog units using average character width over upper-
20 // and lower-case ASCII alphabet and not using the average character width
21 // metadata stored in the font; see
22 // http://support.microsoft.com/default.aspx/kb/145994 for detailed discussion.
24 // This helper function computes font dimensions in the same way. It works with
25 // either wxDC or wxWindow argument.
27 inline wxSize
GetAverageASCIILetterSize(const T
& of_what
)
29 const wxStringCharType
*TEXT_TO_MEASURE
=
30 wxS("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
32 wxSize s
= of_what
.GetTextExtent(TEXT_TO_MEASURE
);
33 s
.x
= (s
.x
/ 26 + 1) / 2;
37 } // namespace wxPrivate
39 #endif // _WX_PRIVATE_WINDOW_H_