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