]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/private/textmeasure.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / gtk / private / textmeasure.h
CommitLineData
8cd79b7a
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/gtk/private/textmeasure.h
3// Purpose: wxGTK-specific declaration of wxTextMeasure class
4// Author: Manuel Martin
c70155b8 5// Created: 2012-10-05
8cd79b7a
VZ
6// Copyright: (c) 1997-2012 wxWidgets team
7// Licence: wxWindows licence
8///////////////////////////////////////////////////////////////////////////////
9
10#ifndef _WX_GTK_PRIVATE_TEXTMEASURE_H_
11#define _WX_GTK_PRIVATE_TEXTMEASURE_H_
12
13// ----------------------------------------------------------------------------
14// wxTextMeasure
15// ----------------------------------------------------------------------------
16
17class WXDLLIMPEXP_FWD_CORE wxWindowDCImpl;
18
19class wxTextMeasure : public wxTextMeasureBase
20{
21public:
c94c3a77 22 wxEXPLICIT wxTextMeasure(const wxDC *dc, const wxFont *font = NULL)
8cd79b7a
VZ
23 : wxTextMeasureBase(dc, font)
24 {
25 Init();
26 }
27
c94c3a77 28 wxEXPLICIT wxTextMeasure(const wxWindow *win, const wxFont *font = NULL)
8cd79b7a
VZ
29 : wxTextMeasureBase(win, font)
30 {
31 Init();
32 }
33
34protected:
35 // Common part of both ctors.
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
8cd79b7a
VZ
51 // This class is only used for DC text measuring with GTK+ 2 as GTK+ 3 uses
52 // Cairo and not Pango for this. However it's still used even with GTK+ 3
53 // for window text measuring, so the context and the layout are still
54 // needed.
55#ifndef __WXGTK3__
56 wxWindowDCImpl *m_wdc;
57#endif // GTK+ < 3
58 PangoContext *m_context;
59 PangoLayout *m_layout;
60
61 wxDECLARE_NO_COPY_CLASS(wxTextMeasure);
62};
63
64#endif // _WX_GTK_PRIVATE_TEXTMEASURE_H_