]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/private/textmeasure.h
Added support for sub-object virtual attributes (temporary attributes for characters...
[wxWidgets.git] / include / wx / gtk / private / textmeasure.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/private/textmeasure.h
3 // Purpose: wxGTK-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_GTK_PRIVATE_TEXTMEASURE_H_
12 #define _WX_GTK_PRIVATE_TEXTMEASURE_H_
13
14 // ----------------------------------------------------------------------------
15 // wxTextMeasure
16 // ----------------------------------------------------------------------------
17
18 class WXDLLIMPEXP_FWD_CORE wxWindowDCImpl;
19
20 class wxTextMeasure : public wxTextMeasureBase
21 {
22 public:
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
35 protected:
36 // Common part of both ctors.
37 void Init();
38
39 virtual void BeginMeasuring();
40 virtual void EndMeasuring();
41
42 virtual void DoGetTextExtent(const wxString& string,
43 wxCoord *width,
44 wxCoord *height,
45 wxCoord *descent = NULL,
46 wxCoord *externalLeading = NULL);
47
48 virtual bool DoGetPartialTextExtents(const wxString& text,
49 wxArrayInt& widths,
50 double scaleX);
51
52 // This class is only used for DC text measuring with GTK+ 2 as GTK+ 3 uses
53 // Cairo and not Pango for this. However it's still used even with GTK+ 3
54 // for window text measuring, so the context and the layout are still
55 // needed.
56 #ifndef __WXGTK3__
57 wxWindowDCImpl *m_wdc;
58 #endif // GTK+ < 3
59 PangoContext *m_context;
60 PangoLayout *m_layout;
61
62 wxDECLARE_NO_COPY_CLASS(wxTextMeasure);
63 };
64
65 #endif // _WX_GTK_PRIVATE_TEXTMEASURE_H_