[Commits] (davids) colheader - fixed problem with generic text
render
commits at osafoundation.org
commits at osafoundation.org
Wed Apr 13 21:15:15 PDT 2005
Commit by: davids
Modified files:
internal/wxPython-2.5/include/wx/generic/colheader.h 1.30 1.31
internal/wxPython-2.5/src/generic/colheader.cpp 1.65 1.66
Log message:
colheader - fixed problem with generic text render
r=TBD
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/include/wx/generic/colheader.h.diff?r1=text&tr1=1.30&r2=text&tr2=1.31
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/generic/colheader.cpp.diff?r1=text&tr1=1.65&r2=text&tr2=1.66
Index: internal/wxPython-2.5/include/wx/generic/colheader.h
diff -u internal/wxPython-2.5/include/wx/generic/colheader.h:1.30 internal/wxPython-2.5/include/wx/generic/colheader.h:1.31
--- internal/wxPython-2.5/include/wx/generic/colheader.h:1.30 Tue Apr 12 16:33:45 2005
+++ internal/wxPython-2.5/include/wx/generic/colheader.h Wed Apr 13 21:15:13 2005
@@ -91,7 +91,7 @@
wxClientDC *dc,
const wxRect *boundsR,
bool bUseUnicode,
- bool bVisibleSelection ) const;
+ bool bVisibleSelection );
#if defined(__WXMAC__)
long MacDrawItem(
@@ -99,7 +99,7 @@
wxClientDC *dc,
const wxRect *boundsR,
bool bUseUnicode,
- bool bVisibleSelection ) const;
+ bool bVisibleSelection );
#endif
public:
Index: internal/wxPython-2.5/src/generic/colheader.cpp
diff -u internal/wxPython-2.5/src/generic/colheader.cpp:1.65 internal/wxPython-2.5/src/generic/colheader.cpp:1.66
--- internal/wxPython-2.5/src/generic/colheader.cpp:1.65 Tue Apr 12 16:33:45 2005
+++ internal/wxPython-2.5/src/generic/colheader.cpp Wed Apr 13 21:15:14 2005
@@ -1330,7 +1330,7 @@
dc.SetClippingRegion( boundsR.x, boundsR.y, boundsR.width, boundsR.height );
#if defined(__WXMAC__)
- // Mac case - selection indicator is drawn as needed
+ // MacOS case - selection indicator is drawn as needed
resultV |= m_ItemList[i]->MacDrawItem( this, &dc, &boundsR, m_BUseUnicode, m_BVisibleSelection );
#else
@@ -1641,7 +1641,8 @@
, m_BSortAscending( FALSE )
, m_BFixedWidth( FALSE )
{
- m_LabelTextExtent.x = m_LabelTextExtent.y = (-1);
+ m_LabelTextExtent.x =
+ m_LabelTextExtent.y = (-1);
}
wxColumnHeaderItem::wxColumnHeaderItem(
@@ -1657,7 +1658,8 @@
, m_BSortAscending( FALSE )
, m_BFixedWidth( FALSE )
{
- m_LabelTextExtent.x = m_LabelTextExtent.y = (-1);
+ m_LabelTextExtent.x =
+ m_LabelTextExtent.y = (-1);
SetItemData( info );
}
@@ -1765,6 +1767,8 @@
void wxColumnHeaderItem::SetLabelText(
const wxString &textBuffer )
{
+ m_LabelTextExtent.x =
+ m_LabelTextExtent.y = (-1);
m_LabelTextRef = textBuffer;
}
@@ -1892,7 +1896,7 @@
wxClientDC *dc,
const wxRect *boundsR,
bool bUseUnicode,
- bool bVisibleSelection ) const
+ bool bVisibleSelection )
{
ThemeButtonDrawInfo drawInfo;
Rect qdBoundsR;
@@ -2006,10 +2010,9 @@
wxClientDC *dc,
const wxRect *boundsR,
bool bUseUnicode,
- bool bVisibleSelection ) const
+ bool bVisibleSelection )
{
wxRect localBoundsR, subItemBoundsR;
-wxSize labelTextSize;
long originX, insetX;
bool bSelected, bHasIcon;
@@ -2039,14 +2042,24 @@
{
case wxCOLUMNHEADER_JUST_Right:
case wxCOLUMNHEADER_JUST_Center:
- // NB: consider caching these values
- dc->GetTextExtent( m_LabelTextRef.c_str(), &(labelTextSize.x), &(labelTextSize.y) );
- if (m_ExtentX > labelTextSize.x)
+ if ((m_LabelTextExtent.x < 0) || (m_LabelTextExtent.y < 0))
+ {
+ wxCoord targetWidth, targetHeight;
+
+ dc->GetTextExtent(
+ m_LabelTextRef,
+ &targetWidth, &targetHeight,
+ NULL, NULL, NULL );
+
+ m_LabelTextExtent.x = targetWidth;
+ m_LabelTextExtent.y = targetHeight;
+ }
+ if (m_ExtentX > m_LabelTextExtent.x)
{
if (m_TextJust == wxCOLUMNHEADER_JUST_Center)
- originX += (m_ExtentX - labelTextSize.x) / 2;
+ originX += (m_ExtentX - m_LabelTextExtent.x) / 2;
else
- originX += m_ExtentX - (labelTextSize.x + insetX);
+ originX += m_ExtentX - (m_LabelTextExtent.x + insetX);
}
break;
More information about the Commits
mailing list