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