From 71e60f703cd81c80970db55164b1415bfbace34f Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 3 Sep 2004 19:30:19 +0000 Subject: [PATCH] Since it is documented, changed GetOrCreateCellAttr from protected to public so it can be used from wxPython. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29018 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/grid.h | 13 +++++++------ src/generic/grid.cpp | 5 +++-- wxPython/docs/CHANGES.txt | 21 +++++++++++++-------- wxPython/src/grid.i | 7 +++++++ 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index 4e1fe217ea..acc6edbbbb 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -1310,6 +1310,13 @@ public: void SetRowAttr(int row, wxGridCellAttr *attr); void SetColAttr(int col, wxGridCellAttr *attr); + // returns the attribute we may modify in place: a new one if this cell + // doesn't have any yet or the existing one if it does + // + // DecRef() must be called on the returned pointer, as usual + wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const; + + // shortcuts for setting the column parameters // set the format for the data in the column: default is string @@ -1794,12 +1801,6 @@ protected: // do we have some place to store attributes in? bool CanHaveAttributes(); - // returns the attribute we may modify in place: a new one if this cell - // doesn't have any yet or the existing one if it does - // - // DecRef() must be called on the returned pointer, as usual - wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const; - // cell attribute cache (currently we only cache 1, may be will do // more/better later) struct CachedAttr diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index b712c67c1d..67c696f3b7 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -9097,9 +9097,10 @@ wxGridCellAttr *wxGrid::GetCellAttr(int row, int col) const wxGridCellAttr *wxGrid::GetOrCreateCellAttr(int row, int col) const { wxGridCellAttr *attr = (wxGridCellAttr *)NULL; + bool canHave = ((wxGrid*)this)->CanHaveAttributes(); - wxCHECK_MSG( m_table, attr, - _T("we may only be called if CanHaveAttributes() returned true and then m_table should be !NULL") ); + wxCHECK_MSG( canHave, attr, _T("Cell attributes not allowed")); + wxCHECK_MSG( m_table, attr, _T("must have a table") ); attr = m_table->GetAttr(row, col, wxGridCellAttr::Cell); if ( !attr ) diff --git a/wxPython/docs/CHANGES.txt b/wxPython/docs/CHANGES.txt index 026d4dffd0..b3b4cfb751 100644 --- a/wxPython/docs/CHANGES.txt +++ b/wxPython/docs/CHANGES.txt @@ -16,26 +16,31 @@ wx.grid.Grid fix allowing DoGetBestSize to be called before CreateGrid wxMac fix for not sending a native click to a control if it is not enabled (does an enable itself) -Added wx.ogl.DrawShape +Added wx.lib.ogl.DrawnShape Added support to XRC and XRCed for the 3-state checkbox flags and also for wx.ToggleButton. Updated the generic window styles supported by XRCed. It is now possible to create "stock" buttons. Basically this means -that you only have to provide one of the stock IDs (and an empty -label) when creating the button and wxWidgets will choose the stock -label to go with it automatically. Additionally on the platforms that -have a native concept of a stock button (currently only GTK2) then the -native stock button will be used. For example, the following will -result in a button with "Cancel" as the label and an accelerator on -the "C", and if on wxGTK2 there will be an image of a red X:: +that you only have to provide one of the stock IDs (and either an +empty label or a label that matches the stock label) when creating the +button and wxWidgets will choose the stock label to go with it +automatically. Additionally on the platforms that have a native +concept of a stock button (currently only GTK2) then the native stock +button will be used. For example, the following will result in a +button with "Cancel" as the label and an accelerator on the "C", and +if run on wxGTK2 then there will also be an image of a red X:: b = wx.Button(parent, wx.ID_CANCEL) Added wx.lib.ticker.Ticker class from Chris Mellon. +Fix some incorrect clipping regions in wxSTC on wxGTK. + +Added wrapper for wx.grid.Grid.GetOrCreateCellAttr. + diff --git a/wxPython/src/grid.i b/wxPython/src/grid.i index c06a703363..90d1855378 100644 --- a/wxPython/src/grid.i +++ b/wxPython/src/grid.i @@ -1820,6 +1820,13 @@ public: void SetRowAttr(int row, wxGridCellAttr *attr); void SetColAttr(int col, wxGridCellAttr *attr); + // returns the attribute we may modify in place: a new one if this cell + // doesn't have any yet or the existing one if it does + // + // DecRef() must be called on the returned pointer, as usual + wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const; + + // shortcuts for setting the column parameters // set the format for the data in the column: default is string -- 2.45.2