[Commits] (davids) colheader - converted GTK code to pure generic
implementation
commits at osafoundation.org
commits at osafoundation.org
Tue Apr 5 11:35:09 PDT 2005
Commit by: davids
Modified files:
internal/wxPython-2.5/include/wx/generic/colheader.h 1.20 1.21
internal/wxPython-2.5/src/generic/colheader.cpp 1.47 1.48
Log message:
colheader - converted GTK code to pure generic implementation
r=RBD
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/include/wx/generic/colheader.h.diff?r1=text&tr1=1.20&r2=text&tr2=1.21
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/generic/colheader.cpp.diff?r1=text&tr1=1.47&r2=text&tr2=1.48
Index: internal/wxPython-2.5/include/wx/generic/colheader.h
diff -u internal/wxPython-2.5/include/wx/generic/colheader.h:1.20 internal/wxPython-2.5/include/wx/generic/colheader.h:1.21
--- internal/wxPython-2.5/include/wx/generic/colheader.h:1.20 Sun Apr 3 00:49:21 2005
+++ internal/wxPython-2.5/include/wx/generic/colheader.h Tue Apr 5 11:35:07 2005
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////
// Name: generic/colheader.h
-// Purpose: generic definitions for a native-appearance column header
+// Purpose: data definitions for a 2-platform (Mac,MSW) + generic native-appearance column header
// Author: David Surovell
// Modified by:
// Created: 01.01.2005
@@ -49,13 +49,6 @@
wxColumnHeaderItem();
virtual ~wxColumnHeaderItem();
- long DrawItem(
- wxWindow *parentW,
- wxClientDC *dc,
- const wxRect *boundsR,
- bool bUseUnicode,
- bool bVisibleSelection ) const;
-
long HitTest(
const wxPoint &locationPt ) const;
@@ -92,6 +85,22 @@
wxColumnHeaderFlagAttr flagEnum,
bool bFlagValue );
+ long GenericDrawItem(
+ wxWindow *parentW,
+ wxClientDC *dc,
+ const wxRect *boundsR,
+ bool bUseUnicode,
+ bool bVisibleSelection ) const;
+
+#if defined(__WXMAC__)
+ long MacDrawItem(
+ wxWindow *parentW,
+ wxClientDC *dc,
+ const wxRect *boundsR,
+ bool bUseUnicode,
+ bool bVisibleSelection ) const;
+#endif
+
public:
#if defined(__WXMSW__)
static void MSWRenderSelection(
@@ -99,22 +108,20 @@
const wxRect *boundsR );
#endif
-#if defined(__WXGTK__)
- static void GTKGetSortArrowBounds(
- const wxRect *itemBoundsR,
- wxRect *targetBoundsR );
- static void GTKDrawSortArrow(
- wxClientDC *dc,
- const wxRect *boundsR,
- bool bSortAscending );
-#endif
-
#if defined(__WXMAC__)
static void MacDrawThemeBackgroundNoArrows(
const void *boundsR,
bool bSelected );
#endif
+ static void GenericGetSortArrowBounds(
+ const wxRect *itemBoundsR,
+ wxRect *targetBoundsR );
+ static void GenericDrawSortArrow(
+ wxClientDC *dc,
+ const wxRect *boundsR,
+ bool bSortAscending );
+
static bool HasValidBitmapRef(
const wxBitmap *bitmapRef );
static void GetBitmapItemBounds(
Index: internal/wxPython-2.5/src/generic/colheader.cpp
diff -u internal/wxPython-2.5/src/generic/colheader.cpp:1.47 internal/wxPython-2.5/src/generic/colheader.cpp:1.48
--- internal/wxPython-2.5/src/generic/colheader.cpp:1.47 Mon Apr 4 15:13:59 2005
+++ internal/wxPython-2.5/src/generic/colheader.cpp Tue Apr 5 11:35:08 2005
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////
// Name: generic/colheader.cpp
-// Purpose: 3-platform (Mac,MSW,GTK) implementation of a native-appearance column header
+// Purpose: 2-platform (Mac,MSW) + generic implementation of a native-appearance column header
// Author: David Surovell
// Modified by:
// Created: 01.01.2005
@@ -1274,11 +1274,17 @@
#else
wxClientDC dc( this );
- // NB: this case being used for both Mac and GTK
- // no DC needed for Mac rendering (except for bitmaps)
+ // NB: this case being used for both Mac and Generic
for (long i=0; i<m_ItemCount; i++)
if (GetItemBounds( i, &boundsR ))
- resultV |= m_ItemList[i]->DrawItem( this, &dc, &boundsR, m_BUseUnicode, m_BVisibleSelection );
+ {
+#if defined(__WXMAC__)
+ // no DC needed for Mac rendering (except for bitmaps)
+ resultV |= m_ItemList[i]->MacDrawItem( this, &dc, &boundsR, m_BUseUnicode, m_BVisibleSelection );
+#else
+ resultV |= m_ItemList[i]->GenericDrawItem( this, &dc, &boundsR, m_BUseUnicode, m_BVisibleSelection );
+#endif
+ }
#endif
return resultV;
@@ -1812,28 +1818,14 @@
return resultV;
}
-long wxColumnHeaderItem::DrawItem(
+#if defined(__WXMAC__)
+long wxColumnHeaderItem::MacDrawItem(
wxWindow *parentW,
wxClientDC *dc,
const wxRect *boundsR,
bool bUseUnicode,
bool bVisibleSelection ) const
{
-// if ((boundsR == NULL) || boundsR->IsEmpty())
- if (boundsR == NULL)
- return (-1L);
-
-#if defined(__WXMSW__)
- wxUnusedVar( parentW );
- wxUnusedVar( dc );
- wxUnusedVar( bUseUnicode );
- wxUnusedVar( bVisibleSelection );
-
- // NB: implementation not needed
- // - parent renders all items as a single control
- return 0;
-
-#elif defined(__WXMAC__)
ThemeButtonDrawInfo drawInfo;
RgnHandle savedClipRgn;
Rect qdBoundsR;
@@ -1841,6 +1833,10 @@
bool bSelected, bHasIcon;
OSStatus errStatus;
+// if ((boundsR == NULL) || boundsR->IsEmpty())
+ if (boundsR == NULL)
+ return (-1L);
+
errStatus = noErr;
qdBoundsR.left = boundsR->x;
@@ -1939,13 +1935,25 @@
DisposeRgn( savedClipRgn );
return (long)errStatus;
+}
+#endif
-#else
+long wxColumnHeaderItem::GenericDrawItem(
+ wxWindow *parentW,
+ wxClientDC *dc,
+ const wxRect *boundsR,
+ bool bUseUnicode,
+ bool bVisibleSelection ) const
+{
wxRect localBoundsR, subItemBoundsR;
wxPoint labelTextSize;
long originX, insetX;
bool bSelected, bHasIcon;
+// if ((boundsR == NULL) || boundsR->IsEmpty())
+ if (boundsR == NULL)
+ return (-1L);
+
if ((parentW == NULL) || (dc == NULL))
return (-1L);
@@ -1954,7 +1962,7 @@
bHasIcon = ((dc != NULL) && HasValidBitmapRef( m_BitmapRef ));
// draw column header background:
- // leverage native (GTK) wxRenderer
+ // leverage native (GTK?) wxRenderer
localBoundsR = *boundsR;
localBoundsR.y = 0;
wxRendererNative::Get().DrawHeaderButton( parentW, *dc, localBoundsR );
@@ -1992,13 +2000,9 @@
// NB: what if icon avail? mut. ex.?
if (bSelected && m_BSortEnabled)
{
-#if defined(__WXGTK__)
// NB: should the first arg be the original "boundsR" arg ??
- GTKGetSortArrowBounds( &localBoundsR, &subItemBoundsR );
- GTKDrawSortArrow( dc, &subItemBoundsR, m_BSortAscending );
-#else
- // FIXME: what about non-(Mac,MSW,GTK) platforms?
-#endif
+ GenericGetSortArrowBounds( &localBoundsR, &subItemBoundsR );
+ GenericDrawSortArrow( dc, &subItemBoundsR, m_BSortAscending );
}
// render the bitmap, should one be present
@@ -2010,7 +2014,6 @@
}
return 0;
-#endif
}
// ================
@@ -2097,9 +2100,8 @@
}
#endif
-#if defined(__WXGTK__)
// static
-void wxColumnHeaderItem::GTKGetSortArrowBounds(
+void wxColumnHeaderItem::GenericGetSortArrowBounds(
const wxRect *itemBoundsR,
wxRect *targetBoundsR )
{
@@ -2129,7 +2131,7 @@
}
// static
-void wxColumnHeaderItem::GTKDrawSortArrow(
+void wxColumnHeaderItem::GenericDrawSortArrow(
wxClientDC *dc,
const wxRect *boundsR,
bool bSortAscending )
@@ -2160,7 +2162,6 @@
dc->DrawPolygon( 3, triPt, boundsR->x, boundsR->y );
}
-#endif
// static
void wxColumnHeaderItem::GetBitmapItemBounds(
@@ -2227,7 +2228,7 @@
, { wxCOLUMNHEADER_JUST_Center, teJustCenter }
, { wxCOLUMNHEADER_JUST_Right, teJustRight }
#else
- // FIXME: GTK - wild guess - irrelevant
+ // FIXME: generic - wild guess - irrelevant
{ wxCOLUMNHEADER_JUST_Left, 0 }
, { wxCOLUMNHEADER_JUST_Center, 1 }
, { wxCOLUMNHEADER_JUST_Right, 2 }
More information about the Commits
mailing list