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