add virtual DoGetTextExtent() to allow calling the overloaded wxWindowBase::GetTextExtent() on wxWindow objects without any ugly casts/scope resolution operators
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60984 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
68d801c8b0
commit
6de7047076
@ -173,7 +173,7 @@ public:
|
||||
// Get character size
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string, int *x, int *y,
|
||||
virtual void DoGetTextExtent(const wxString& string, int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = NULL) const;
|
||||
|
@ -81,12 +81,6 @@ public:
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
virtual void SetDropTarget(wxDropTarget *dropTarget);
|
||||
@ -112,6 +106,11 @@ public:
|
||||
|
||||
protected:
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = NULL) const;
|
||||
virtual void DoClientToScreen(int *x, int *y) const;
|
||||
virtual void DoScreenToClient(int *x, int *y) const;
|
||||
virtual void DoGetPosition(int *x, int *y) const;
|
||||
|
@ -82,12 +82,6 @@ public:
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
int range, bool refresh = true );
|
||||
@ -296,6 +290,11 @@ public:
|
||||
|
||||
protected:
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *font = NULL) const;
|
||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||
virtual void DoScreenToClient( int *x, int *y ) const;
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
|
@ -84,16 +84,6 @@ public:
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
#if wxUSE_MENUS_NATIVE
|
||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
|
||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
int range, bool refresh = true );
|
||||
@ -226,6 +216,16 @@ public:
|
||||
wxInsertChildFunction m_insertCallback;
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = NULL) const;
|
||||
|
||||
#if wxUSE_MENUS_NATIVE
|
||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
|
||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||
virtual void DoScreenToClient( int *x, int *y ) const;
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
|
@ -74,12 +74,6 @@ public:
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
virtual void SetDropTarget(wxDropTarget *dropTarget);
|
||||
@ -110,6 +104,11 @@ protected:
|
||||
int m_eraseBackground;
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *font = NULL) const;
|
||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||
virtual void DoScreenToClient( int *x, int *y ) const;
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
|
@ -71,12 +71,6 @@ public:
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
int range, bool refresh = true );
|
||||
@ -280,6 +274,11 @@ protected:
|
||||
int m_scrollPosY;
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *font = NULL) const;
|
||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||
virtual void DoScreenToClient( int *x, int *y ) const;
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
|
@ -95,12 +95,6 @@ public:
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
int range, bool refresh = true );
|
||||
@ -493,6 +487,11 @@ protected:
|
||||
int m_yThumbSize;
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *font = NULL) const;
|
||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||
virtual void DoScreenToClient( int *x, int *y ) const;
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
|
@ -98,19 +98,6 @@ public:
|
||||
virtual bool SetFont(const wxFont& rFont);
|
||||
virtual int GetCharHeight(void) const;
|
||||
virtual int GetCharWidth(void) const;
|
||||
virtual void GetTextExtent( const wxString& rString
|
||||
,int* pX
|
||||
,int* pY
|
||||
,int* pDescent = NULL
|
||||
,int* pExternalLeading = NULL
|
||||
,const wxFont* pTheFont = (const wxFont *)NULL
|
||||
) const;
|
||||
#if wxUSE_MENUS_NATIVE
|
||||
virtual bool DoPopupMenu( wxMenu* pMenu
|
||||
,int nX
|
||||
,int nY
|
||||
);
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
|
||||
virtual void SetScrollbar( int nOrient
|
||||
,int nPos
|
||||
@ -460,6 +447,19 @@ protected:
|
||||
long m_lDlgCode;
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual void GetTextExtent( const wxString& rString
|
||||
,int* pX
|
||||
,int* pY
|
||||
,int* pDescent = NULL
|
||||
,int* pExternalLeading = NULL
|
||||
,const wxFont* pTheFont = NULL
|
||||
) const;
|
||||
#if wxUSE_MENUS_NATIVE
|
||||
virtual bool DoPopupMenu( wxMenu* pMenu
|
||||
,int nX
|
||||
,int nY
|
||||
);
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
virtual void DoClientToScreen( int* pX
|
||||
,int* pY
|
||||
) const;
|
||||
|
@ -82,20 +82,6 @@ public:
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent( const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = NULL )
|
||||
const;
|
||||
protected:
|
||||
virtual void DoEnable( bool enable );
|
||||
#if wxUSE_MENUS
|
||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||
#endif
|
||||
|
||||
virtual void DoFreeze();
|
||||
virtual void DoThaw();
|
||||
|
||||
public:
|
||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
@ -306,6 +292,20 @@ protected:
|
||||
void MacUpdateControlFont() ;
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = NULL ) const;
|
||||
|
||||
virtual void DoEnable( bool enable );
|
||||
#if wxUSE_MENUS
|
||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||
#endif
|
||||
|
||||
virtual void DoFreeze();
|
||||
virtual void DoThaw();
|
||||
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
virtual wxSize DoGetSizeFromClientSize( const wxSize & size ) const;
|
||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||
|
@ -79,12 +79,6 @@ public:
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
#if wxUSE_MENUS_NATIVE
|
||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||
@ -231,6 +225,11 @@ protected:
|
||||
WXHMENU m_hMenu; // Menu, if any
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *font = NULL) const;
|
||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||
virtual void DoScreenToClient( int *x, int *y ) const;
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
|
@ -1069,12 +1069,14 @@ public:
|
||||
|
||||
// get the width/height/... of the text using current or specified
|
||||
// font
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const = 0;
|
||||
void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *font = NULL) const
|
||||
{
|
||||
DoGetTextExtent(string, x, y, descent, externalLeading, font);
|
||||
}
|
||||
|
||||
wxSize GetTextExtent(const wxString& string) const
|
||||
{
|
||||
@ -1602,6 +1604,13 @@ protected:
|
||||
// overloaded Something()s in terms of DoSomething() which will be the
|
||||
// only one to be virtual.
|
||||
|
||||
// text extent
|
||||
virtual void DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *font = NULL) const = 0;
|
||||
|
||||
// coordinates translation
|
||||
virtual void DoClientToScreen( int *x, int *y ) const = 0;
|
||||
virtual void DoScreenToClient( int *x, int *y ) const = 0;
|
||||
|
@ -71,15 +71,8 @@ public:
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
virtual void ScrollWindow( int dx, int dy,
|
||||
const wxRect* rect = NULL );
|
||||
virtual void ScrollWindow( int dx, int dy, const wxRect* rect = NULL );
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||
@ -165,6 +158,11 @@ protected:
|
||||
bool m_needsInputFocus; // Input focus set in OnIdle
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *font = NULL) const;
|
||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||
virtual void DoScreenToClient( int *x, int *y ) const;
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
|
@ -1713,7 +1713,7 @@ int wxWindow::GetCharWidth() const
|
||||
return 5;
|
||||
}
|
||||
|
||||
void wxWindow::GetTextExtent(const wxString& string, int *outX, int *outY,
|
||||
void wxWindow::DoGetTextExtent(const wxString& string, int *outX, int *outY,
|
||||
int *outDescent, int *outExternalLeading, const wxFont *inFont) const
|
||||
{
|
||||
// FIXME: This obviously ignores the window's font (if any) along with any size
|
||||
|
@ -557,10 +557,11 @@ int wxWindowDFB::GetCharWidth() const
|
||||
return dc.GetCharWidth();
|
||||
}
|
||||
|
||||
void wxWindowDFB::GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent, int *externalLeading,
|
||||
const wxFont *theFont) const
|
||||
void wxWindowDFB::DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent,
|
||||
int *externalLeading,
|
||||
const wxFont *theFont) const
|
||||
{
|
||||
wxWindowDC dc((wxWindow*)this);
|
||||
dc.GetTextExtent(string, x, y, descent, externalLeading, (wxFont*)theFont);
|
||||
|
@ -2922,12 +2922,12 @@ int wxWindowGTK::GetCharWidth() const
|
||||
return (int) PANGO_PIXELS(rect.width);
|
||||
}
|
||||
|
||||
void wxWindowGTK::GetTextExtent( const wxString& string,
|
||||
int *x,
|
||||
int *y,
|
||||
int *descent,
|
||||
int *externalLeading,
|
||||
const wxFont *theFont ) const
|
||||
void wxWindowGTK::DoGetTextExtent( const wxString& string,
|
||||
int *x,
|
||||
int *y,
|
||||
int *descent,
|
||||
int *externalLeading,
|
||||
const wxFont *theFont ) const
|
||||
{
|
||||
wxFont fontToUse = theFont ? *theFont : GetFont();
|
||||
|
||||
|
@ -3240,12 +3240,12 @@ int wxWindowGTK::GetCharWidth() const
|
||||
return gdk_string_width( gfont, "g" );
|
||||
}
|
||||
|
||||
void wxWindowGTK::GetTextExtent( const wxString& string,
|
||||
int *x,
|
||||
int *y,
|
||||
int *descent,
|
||||
int *externalLeading,
|
||||
const wxFont *theFont ) const
|
||||
void wxWindowGTK::DoGetTextExtent(const wxString& string,
|
||||
int *x,
|
||||
int *y,
|
||||
int *descent,
|
||||
int *externalLeading,
|
||||
const wxFont *theFont) const
|
||||
{
|
||||
wxFont fontToUse = theFont ? *theFont : GetFont();
|
||||
|
||||
|
@ -1079,10 +1079,11 @@ int wxWindowMGL::GetCharWidth() const
|
||||
return dc.GetCharWidth();
|
||||
}
|
||||
|
||||
void wxWindowMGL::GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent, int *externalLeading,
|
||||
const wxFont *theFont) const
|
||||
void wxWindowMGL::DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent,
|
||||
int *externalLeading,
|
||||
const wxFont *theFont) const
|
||||
{
|
||||
wxScreenDC dc;
|
||||
if (!theFont)
|
||||
|
@ -1478,10 +1478,11 @@ int wxWindow::GetCharWidth() const
|
||||
return width;
|
||||
}
|
||||
|
||||
void wxWindow::GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent, int *externalLeading,
|
||||
const wxFont *theFont) const
|
||||
void wxWindow::DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent,
|
||||
int *externalLeading,
|
||||
const wxFont *theFont) const
|
||||
{
|
||||
const wxFont *fontToUse = theFont ? theFont : &m_font;
|
||||
|
||||
|
@ -2133,10 +2133,11 @@ int wxWindowMSW::GetCharWidth() const
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxWindowMSW::GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent, int *externalLeading,
|
||||
const wxFont *fontToUse) const
|
||||
void wxWindowMSW::DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent,
|
||||
int *externalLeading,
|
||||
const wxFont *fontToUse) const
|
||||
{
|
||||
wxASSERT_MSG( !fontToUse || fontToUse->Ok(),
|
||||
_T("invalid font in GetTextExtent()") );
|
||||
|
@ -1661,12 +1661,12 @@ int wxWindowOS2::GetCharWidth() const
|
||||
return(vFontMetrics.lAveCharWidth);
|
||||
} // end of wxWindowOS2::GetCharWidth
|
||||
|
||||
void wxWindowOS2::GetTextExtent( const wxString& rString,
|
||||
int* pX,
|
||||
int* pY,
|
||||
int* pDescent,
|
||||
int* pExternalLeading,
|
||||
const wxFont* WXUNUSED(pTheFont) ) const
|
||||
void wxWindowOS2::DoGetTextExtent( const wxString& rString,
|
||||
int* pX,
|
||||
int* pY,
|
||||
int* pDescent,
|
||||
int* pExternalLeading,
|
||||
const wxFont* WXUNUSED(pTheFont) ) const
|
||||
{
|
||||
POINTL avPoint[TXTBOX_COUNT];
|
||||
POINTL vPtMin;
|
||||
@ -1750,7 +1750,7 @@ void wxWindowOS2::GetTextExtent( const wxString& rString,
|
||||
*pExternalLeading = 0;
|
||||
}
|
||||
::WinReleasePS(hPS);
|
||||
} // end of wxWindow::GetTextExtent
|
||||
} // end of wxWindow::DoGetTextExtent
|
||||
|
||||
bool wxWindowOS2::IsMouseInWindow() const
|
||||
{
|
||||
|
@ -1089,8 +1089,11 @@ int wxWindowMac::GetCharWidth() const
|
||||
return width;
|
||||
}
|
||||
|
||||
void wxWindowMac::GetTextExtent(const wxString& str, int *x, int *y,
|
||||
int *descent, int *externalLeading, const wxFont *theFont ) const
|
||||
void wxWindowMac::DoGetTextExtent(const wxString& str,
|
||||
int *x, int *y,
|
||||
int *descent,
|
||||
int *externalLeading,
|
||||
const wxFont *theFont) const
|
||||
{
|
||||
const wxFont *fontToUse = theFont;
|
||||
wxFont tempFont;
|
||||
|
@ -610,10 +610,11 @@ int wxWindowPalm::GetCharWidth() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wxWindowPalm::GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent, int *externalLeading,
|
||||
const wxFont *theFont) const
|
||||
void wxWindowPalm::DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent,
|
||||
int *externalLeading,
|
||||
const wxFont *theFont) const
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1076,10 +1076,11 @@ int wxWindowX11::GetCharWidth() const
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxWindowX11::GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent, int *externalLeading,
|
||||
const wxFont *theFont) const
|
||||
void wxWindowX11::DoGetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent,
|
||||
int *externalLeading,
|
||||
const wxFont *theFont) const
|
||||
{
|
||||
wxFont fontToUse = GetFont();
|
||||
if (theFont) fontToUse = *theFont;
|
||||
|
Loading…
Reference in New Issue
Block a user