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
This commit is contained in:
Robin Dunn
2004-09-03 19:30:19 +00:00
parent 9a8a6d250f
commit 71e60f703c
4 changed files with 30 additions and 16 deletions

View File

@@ -1310,6 +1310,13 @@ public:
void SetRowAttr(int row, wxGridCellAttr *attr); void SetRowAttr(int row, wxGridCellAttr *attr);
void SetColAttr(int col, 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 // shortcuts for setting the column parameters
// set the format for the data in the column: default is string // 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? // do we have some place to store attributes in?
bool CanHaveAttributes(); 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 // cell attribute cache (currently we only cache 1, may be will do
// more/better later) // more/better later)
struct CachedAttr struct CachedAttr

View File

@@ -9097,9 +9097,10 @@ wxGridCellAttr *wxGrid::GetCellAttr(int row, int col) const
wxGridCellAttr *wxGrid::GetOrCreateCellAttr(int row, int col) const wxGridCellAttr *wxGrid::GetOrCreateCellAttr(int row, int col) const
{ {
wxGridCellAttr *attr = (wxGridCellAttr *)NULL; wxGridCellAttr *attr = (wxGridCellAttr *)NULL;
bool canHave = ((wxGrid*)this)->CanHaveAttributes();
wxCHECK_MSG( m_table, attr, wxCHECK_MSG( canHave, attr, _T("Cell attributes not allowed"));
_T("we may only be called if CanHaveAttributes() returned true and then m_table should be !NULL") ); wxCHECK_MSG( m_table, attr, _T("must have a table") );
attr = m_table->GetAttr(row, col, wxGridCellAttr::Cell); attr = m_table->GetAttr(row, col, wxGridCellAttr::Cell);
if ( !attr ) if ( !attr )

View File

@@ -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 wxMac fix for not sending a native click to a control if it is not
enabled (does an enable itself) 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 Added support to XRC and XRCed for the 3-state checkbox flags and also
for wx.ToggleButton. Updated the generic window styles supported by for wx.ToggleButton. Updated the generic window styles supported by
XRCed. XRCed.
It is now possible to create "stock" buttons. Basically this means 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 that you only have to provide one of the stock IDs (and either an
label) when creating the button and wxWidgets will choose the stock empty label or a label that matches the stock label) when creating the
label to go with it automatically. Additionally on the platforms that button and wxWidgets will choose the stock label to go with it
have a native concept of a stock button (currently only GTK2) then the automatically. Additionally on the platforms that have a native
native stock button will be used. For example, the following will concept of a stock button (currently only GTK2) then the native stock
result in a button with "Cancel" as the label and an accelerator on button will be used. For example, the following will result in a
the "C", and if on wxGTK2 there will be an image of a red X:: 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) b = wx.Button(parent, wx.ID_CANCEL)
Added wx.lib.ticker.Ticker class from Chris Mellon. 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.

View File

@@ -1820,6 +1820,13 @@ public:
void SetRowAttr(int row, wxGridCellAttr *attr); void SetRowAttr(int row, wxGridCellAttr *attr);
void SetColAttr(int col, 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 // shortcuts for setting the column parameters
// set the format for the data in the column: default is string // set the format for the data in the column: default is string