]>
Commit | Line | Data |
---|---|---|
8cd79b7a VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/msw/private/textmeasure.h | |
3 | // Purpose: wxMSW-specific declaration of wxTextMeasure class | |
4 | // Author: Manuel Martin | |
5 | // Created: 2012-10-05 | |
6 | // Copyright: (c) 1997-2012 wxWidgets team | |
7 | // Licence: wxWindows licence | |
8 | /////////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef _WX_MSW_PRIVATE_TEXTMEASURE_H_ | |
11 | #define _WX_MSW_PRIVATE_TEXTMEASURE_H_ | |
12 | ||
13 | #include "wx/msw/wrapwin.h" | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // wxTextMeasure for MSW. | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | class wxTextMeasure : public wxTextMeasureBase | |
20 | { | |
21 | public: | |
c94c3a77 | 22 | wxEXPLICIT wxTextMeasure(const wxDC *dc, const wxFont *font = NULL) |
8cd79b7a VZ |
23 | : wxTextMeasureBase(dc, font) |
24 | { | |
25 | Init(); | |
26 | } | |
c94c3a77 VZ |
27 | |
28 | wxEXPLICIT wxTextMeasure(const wxWindow *win, const wxFont *font = NULL) | |
8cd79b7a VZ |
29 | : wxTextMeasureBase(win, font) |
30 | { | |
31 | Init(); | |
32 | } | |
33 | ||
34 | protected: | |
35 | void Init(); | |
36 | ||
37 | virtual void BeginMeasuring(); | |
38 | virtual void EndMeasuring(); | |
39 | ||
40 | virtual void DoGetTextExtent(const wxString& string, | |
41 | wxCoord *width, | |
42 | wxCoord *height, | |
43 | wxCoord *descent = NULL, | |
44 | wxCoord *externalLeading = NULL); | |
45 | ||
46 | virtual bool DoGetPartialTextExtents(const wxString& text, | |
47 | wxArrayInt& widths, | |
48 | double scaleX); | |
49 | ||
50 | ||
51 | ||
52 | // We use either the HDC of the provided wxDC or an HDC created for our | |
53 | // window. | |
54 | HDC m_hdc; | |
55 | ||
56 | // If we change the font in BeginMeasuring(), we restore it to the old one | |
57 | // in EndMeasuring(). | |
58 | HFONT m_hfontOld; | |
59 | ||
60 | wxDECLARE_NO_COPY_CLASS(wxTextMeasure); | |
61 | }; | |
62 | ||
63 | #endif // _WX_MSW_PRIVATE_TEXTMEASURE_H_ |