]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/msw/private/textmeasure.h
Don't create multiple parent-less top level frames in layout sample.
[wxWidgets.git] / include / wx / msw / private / textmeasure.h
... / ...
CommitLineData
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// RCS-ID: $Id:
7// Copyright: (c) 1997-2012 wxWidgets team
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_MSW_PRIVATE_TEXTMEASURE_H_
12#define _WX_MSW_PRIVATE_TEXTMEASURE_H_
13
14#include "wx/msw/wrapwin.h"
15
16// ----------------------------------------------------------------------------
17// wxTextMeasure for MSW.
18// ----------------------------------------------------------------------------
19
20class wxTextMeasure : public wxTextMeasureBase
21{
22public:
23 wxEXPLICIT wxTextMeasure(const wxDC *dc, const wxFont *font = NULL)
24 : wxTextMeasureBase(dc, font)
25 {
26 Init();
27 }
28
29 wxEXPLICIT wxTextMeasure(const wxWindow *win, const wxFont *font = NULL)
30 : wxTextMeasureBase(win, font)
31 {
32 Init();
33 }
34
35protected:
36 void Init();
37
38 virtual void BeginMeasuring();
39 virtual void EndMeasuring();
40
41 virtual void DoGetTextExtent(const wxString& string,
42 wxCoord *width,
43 wxCoord *height,
44 wxCoord *descent = NULL,
45 wxCoord *externalLeading = NULL);
46
47 virtual bool DoGetPartialTextExtents(const wxString& text,
48 wxArrayInt& widths,
49 double scaleX);
50
51
52
53 // We use either the HDC of the provided wxDC or an HDC created for our
54 // window.
55 HDC m_hdc;
56
57 // If we change the font in BeginMeasuring(), we restore it to the old one
58 // in EndMeasuring().
59 HFONT m_hfontOld;
60
61 wxDECLARE_NO_COPY_CLASS(wxTextMeasure);
62};
63
64#endif // _WX_MSW_PRIVATE_TEXTMEASURE_H_