]> git.saurik.com Git - wxWidgets.git/blob - include/wx/private/window.h
Revert "Make wxMSW stack walking methods work with Unicode identifiers."
[wxWidgets.git] / include / wx / private / window.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/private/window.h
3 // Purpose: misc wxWindow helpers
4 // Author: Vaclav Slavik
5 // Created: 2010-01-21
6 // Copyright: (c) 2010 Vaclav Slavik
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_PRIVATE_WINDOW_H_
11 #define _WX_PRIVATE_WINDOW_H_
12
13 #include "wx/gdicmn.h"
14
15 namespace wxPrivate
16 {
17
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.
22 //
23 // This helper function computes font dimensions in the same way. It works with
24 // either wxDC or wxWindow argument.
25 template<typename T>
26 inline wxSize GetAverageASCIILetterSize(const T& of_what)
27 {
28 const wxStringCharType *TEXT_TO_MEASURE =
29 wxS("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
30
31 wxSize s = of_what.GetTextExtent(TEXT_TO_MEASURE);
32 s.x = (s.x / 26 + 1) / 2;
33 return s;
34 }
35
36 } // namespace wxPrivate
37
38 #endif // _WX_PRIVATE_WINDOW_H_