]> git.saurik.com Git - wxWidgets.git/blob - src/generic/textmeasure.cpp
Improve drawing of the tree item buttons in the generic renderer.
[wxWidgets.git] / src / generic / textmeasure.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/textmeasure.cpp
3 // Purpose:
4 // Author: Vadim Zeitlin
5 // Created: 2012-10-17
6 // Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
9
10 // ============================================================================
11 // declarations
12 // ============================================================================
13
14 // ----------------------------------------------------------------------------
15 // headers
16 // ----------------------------------------------------------------------------
17
18 // for compilers that support precompilation, includes "wx.h".
19 #include "wx/wxprec.h"
20
21 #ifdef __BORLANDC__
22 #pragma hdrstop
23 #endif
24
25 #ifndef WX_PRECOMP
26 #include "wx/window.h"
27 #include "wx/dc.h"
28 #endif //WX_PRECOMP
29
30 #include "wx/private/textmeasure.h"
31
32 #if wxUSE_GENERIC_TEXTMEASURE
33
34 // ============================================================================
35 // wxTextMeasure generic implementation
36 // ============================================================================
37
38 // We assume that the ports not providing platform-specific wxTextMeasure
39 // implementation implement the corresponding functions in their wxDC and
40 // wxWindow classes, so forward back to them instead of using wxTextMeasure
41 // from there, as usual.
42 void wxTextMeasure::DoGetTextExtent(const wxString& string,
43 wxCoord *width,
44 wxCoord *height,
45 wxCoord *descent,
46 wxCoord *externalLeading)
47 {
48 if ( m_dc )
49 {
50 m_dc->GetTextExtent(string, width, height,
51 descent, externalLeading, m_font);
52 }
53 else if ( m_win )
54 {
55 m_win->GetTextExtent(string, width, height,
56 descent, externalLeading, m_font);
57 }
58 //else: we already asserted in the ctor, don't do it any more
59 }
60
61 bool wxTextMeasure::DoGetPartialTextExtents(const wxString& text,
62 wxArrayInt& widths,
63 double scaleX)
64 {
65 return wxTextMeasureBase::DoGetPartialTextExtents(text, widths, scaleX);
66 }
67
68 #endif // wxUSE_GENERIC_TEXTMEASURE