really fixed GetRenderer() and GetEditor() methods, they were both broken in some strange and twisted (and different) ways
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13185 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -63,12 +63,16 @@ Unix ports:
|
|||||||
2.3.3
|
2.3.3
|
||||||
-----
|
-----
|
||||||
|
|
||||||
All:
|
wxBase:
|
||||||
|
|
||||||
- fixes to the command line parsing error and usage messages
|
- fixes to the command line parsing error and usage messages
|
||||||
- modified wxFileName::CreateTempFileName() to open the file atomically
|
- modified wxFileName::CreateTempFileName() to open the file atomically
|
||||||
(if possible) and, especially, not to leak the file descriptors under Unix
|
(if possible) and, especially, not to leak the file descriptors under Unix
|
||||||
|
|
||||||
|
All (GUI):
|
||||||
|
|
||||||
|
- fixed using custom renderers in wxGrid which was broken in 2.3.2
|
||||||
|
|
||||||
wxMSW:
|
wxMSW:
|
||||||
|
|
||||||
- huge (40*) speed up in wxMask::Create() (=> much faster toolbar creation)
|
- huge (40*) speed up in wxMask::Create() (=> much faster toolbar creation)
|
||||||
|
@@ -2018,58 +2018,95 @@ void wxGridCellAttr::GetAlignment(int *hAlign, int *vAlign) const
|
|||||||
|
|
||||||
wxGridCellRenderer* wxGridCellAttr::GetRenderer(wxGrid* grid, int row, int col) const
|
wxGridCellRenderer* wxGridCellAttr::GetRenderer(wxGrid* grid, int row, int col) const
|
||||||
{
|
{
|
||||||
wxGridCellRenderer* renderer = NULL;
|
wxGridCellRenderer *renderer;
|
||||||
|
|
||||||
if ( m_defGridAttr == this || grid == NULL )
|
if ( m_renderer && this != m_defGridAttr )
|
||||||
{
|
{
|
||||||
renderer = m_renderer; // use local attribute
|
// use the cells renderer if it has one
|
||||||
if ( renderer )
|
renderer = m_renderer;
|
||||||
renderer->IncRef();
|
renderer->IncRef();
|
||||||
|
}
|
||||||
|
else // no non default cell renderer
|
||||||
|
{
|
||||||
|
// get default renderer for the data type
|
||||||
|
if ( grid )
|
||||||
|
{
|
||||||
|
// GetDefaultRendererForCell() will do IncRef() for us
|
||||||
|
renderer = grid->GetDefaultRendererForCell(row, col);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
renderer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !renderer )
|
||||||
|
{
|
||||||
|
if ( this != m_defGridAttr )
|
||||||
|
{
|
||||||
|
// if we still don't have one then use the grid default
|
||||||
|
// (no need for IncRef() here neither)
|
||||||
|
renderer = m_defGridAttr->GetRenderer(NULL, 0, 0);
|
||||||
|
}
|
||||||
|
else // default grid attr
|
||||||
|
{
|
||||||
|
// use m_renderer which we had decided not to use initially
|
||||||
|
renderer = m_renderer;
|
||||||
|
if ( renderer )
|
||||||
|
renderer->IncRef();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !renderer && grid ) // get renderer for the data type
|
// we're supposed to always find something
|
||||||
{
|
wxASSERT_MSG(renderer, wxT("Missing default cell renderer"));
|
||||||
// GetDefaultRendererForCell() will do IncRef() for us
|
|
||||||
renderer = grid->GetDefaultRendererForCell(row, col);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !renderer )
|
|
||||||
{
|
|
||||||
// if we still don't have one then use the grid default
|
|
||||||
// (no need for IncRef() here neither)
|
|
||||||
renderer = m_defGridAttr->GetRenderer(NULL,0,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !renderer)
|
|
||||||
{
|
|
||||||
wxFAIL_MSG(wxT("Missing default cell attribute"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// same as above, except for s/renderer/editor/g
|
||||||
wxGridCellEditor* wxGridCellAttr::GetEditor(wxGrid* grid, int row, int col) const
|
wxGridCellEditor* wxGridCellAttr::GetEditor(wxGrid* grid, int row, int col) const
|
||||||
{
|
{
|
||||||
wxGridCellEditor* editor = NULL;
|
wxGridCellEditor *editor;
|
||||||
|
|
||||||
if ( m_defGridAttr != this || grid == NULL )
|
if ( m_editor && this != m_defGridAttr )
|
||||||
{
|
{
|
||||||
editor = m_editor; // use local attribute
|
// use the cells editor if it has one
|
||||||
if ( editor )
|
editor = m_editor;
|
||||||
editor->IncRef();
|
editor->IncRef();
|
||||||
|
}
|
||||||
|
else // no non default cell editor
|
||||||
|
{
|
||||||
|
// get default editor for the data type
|
||||||
|
if ( grid )
|
||||||
|
{
|
||||||
|
// GetDefaultEditorForCell() will do IncRef() for us
|
||||||
|
editor = grid->GetDefaultEditorForCell(row, col);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
editor = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !editor )
|
||||||
|
{
|
||||||
|
if ( this != m_defGridAttr )
|
||||||
|
{
|
||||||
|
// if we still don't have one then use the grid default
|
||||||
|
// (no need for IncRef() here neither)
|
||||||
|
editor = m_defGridAttr->GetEditor(NULL, 0, 0);
|
||||||
|
}
|
||||||
|
else // default grid attr
|
||||||
|
{
|
||||||
|
// use m_editor which we had decided not to use initially
|
||||||
|
editor = m_editor;
|
||||||
|
if ( editor )
|
||||||
|
editor->IncRef();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !editor && grid ) // get renderer for the data type
|
// we're supposed to always find something
|
||||||
editor = grid->GetDefaultEditorForCell(row, col);
|
wxASSERT_MSG(editor, wxT("Missing default cell editor"));
|
||||||
|
|
||||||
if ( !editor )
|
|
||||||
// if we still don't have one then use the grid default
|
|
||||||
editor = m_defGridAttr->GetEditor(NULL,0,0);
|
|
||||||
|
|
||||||
if ( !editor )
|
|
||||||
{
|
|
||||||
wxFAIL_MSG(wxT("Missing default cell attribute"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user