fix wxMac-QD - blank focusesed text; minor reformat
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36610 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2640,16 +2640,16 @@ wxGridCellAttr *wxGridCellAttrProvider::GetAttr(int row, int col,
|
|||||||
wxGridCellAttr *attr = (wxGridCellAttr *)NULL;
|
wxGridCellAttr *attr = (wxGridCellAttr *)NULL;
|
||||||
if ( m_data )
|
if ( m_data )
|
||||||
{
|
{
|
||||||
switch(kind)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case (wxGridCellAttr::Any):
|
case (wxGridCellAttr::Any):
|
||||||
//Get cached merge attributes.
|
// Get cached merge attributes.
|
||||||
// Currenlty not used as no cache implemented as not mutiable
|
// Currently not used as no cache implemented as not mutable
|
||||||
// attr = m_data->m_mergeAttr.GetAttr(row, col);
|
// attr = m_data->m_mergeAttr.GetAttr(row, col);
|
||||||
if (!attr)
|
if (!attr)
|
||||||
{
|
{
|
||||||
//Basically implement old version.
|
// Basically implement old version.
|
||||||
//Also check merge cache, so we don't have to re-merge every time..
|
// Also check merge cache, so we don't have to re-merge every time..
|
||||||
wxGridCellAttr *attrcell = m_data->m_cellAttrs.GetAttr(row, col);
|
wxGridCellAttr *attrcell = m_data->m_cellAttrs.GetAttr(row, col);
|
||||||
wxGridCellAttr *attrrow = m_data->m_rowAttrs.GetAttr(row);
|
wxGridCellAttr *attrrow = m_data->m_rowAttrs.GetAttr(row);
|
||||||
wxGridCellAttr *attrcol = m_data->m_colAttrs.GetAttr(col);
|
wxGridCellAttr *attrcol = m_data->m_colAttrs.GetAttr(col);
|
||||||
@@ -2660,7 +2660,7 @@ wxGridCellAttr *wxGridCellAttrProvider::GetAttr(int row, int col,
|
|||||||
attr = new wxGridCellAttr;
|
attr = new wxGridCellAttr;
|
||||||
attr->SetKind(wxGridCellAttr::Merged);
|
attr->SetKind(wxGridCellAttr::Merged);
|
||||||
|
|
||||||
//Order important..
|
// Order is important..
|
||||||
if (attrcell)
|
if (attrcell)
|
||||||
{
|
{
|
||||||
attr->MergeWith(attrcell);
|
attr->MergeWith(attrcell);
|
||||||
@@ -2676,7 +2676,8 @@ wxGridCellAttr *wxGridCellAttrProvider::GetAttr(int row, int col,
|
|||||||
attr->MergeWith(attrrow);
|
attr->MergeWith(attrrow);
|
||||||
attrrow->DecRef();
|
attrrow->DecRef();
|
||||||
}
|
}
|
||||||
//store merge attr if cache implemented
|
|
||||||
|
// store merge attr if cache implemented
|
||||||
//attr->IncRef();
|
//attr->IncRef();
|
||||||
//m_data->m_mergeAttr.SetAttr(attr, row, col);
|
//m_data->m_mergeAttr.SetAttr(attr, row, col);
|
||||||
}
|
}
|
||||||
@@ -2687,7 +2688,7 @@ wxGridCellAttr *wxGridCellAttrProvider::GetAttr(int row, int col,
|
|||||||
attr = attrrow;
|
attr = attrrow;
|
||||||
if (attrcol)
|
if (attrcol)
|
||||||
{
|
{
|
||||||
if(attr)
|
if (attr)
|
||||||
attr->DecRef();
|
attr->DecRef();
|
||||||
attr = attrcol;
|
attr = attrcol;
|
||||||
}
|
}
|
||||||
@@ -4928,7 +4929,7 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
|
|||||||
|
|
||||||
if ( event.LeftIsDown() )
|
if ( event.LeftIsDown() )
|
||||||
{
|
{
|
||||||
switch( m_cursorMode )
|
switch ( m_cursorMode )
|
||||||
{
|
{
|
||||||
case WXGRID_CURSOR_RESIZE_ROW:
|
case WXGRID_CURSOR_RESIZE_ROW:
|
||||||
{
|
{
|
||||||
@@ -5153,7 +5154,7 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
|
|||||||
|
|
||||||
if ( event.LeftIsDown() )
|
if ( event.LeftIsDown() )
|
||||||
{
|
{
|
||||||
switch( m_cursorMode )
|
switch ( m_cursorMode )
|
||||||
{
|
{
|
||||||
case WXGRID_CURSOR_RESIZE_COL:
|
case WXGRID_CURSOR_RESIZE_COL:
|
||||||
{
|
{
|
||||||
@@ -5484,7 +5485,7 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
|
|||||||
{
|
{
|
||||||
//wxLogDebug("pos(%d, %d) coords(%d, %d)", pos.x, pos.y, coords.GetRow(), coords.GetCol());
|
//wxLogDebug("pos(%d, %d) coords(%d, %d)", pos.x, pos.y, coords.GetRow(), coords.GetCol());
|
||||||
|
|
||||||
// Don't start doing anything until the mouse has been drug at
|
// Don't start doing anything until the mouse has been dragged at
|
||||||
// least 3 pixels in any direction...
|
// least 3 pixels in any direction...
|
||||||
if (! m_isDragging)
|
if (! m_isDragging)
|
||||||
{
|
{
|
||||||
@@ -7053,9 +7054,15 @@ void wxGrid::DrawCell( wxDC& dc, const wxGridCellCoords& coords )
|
|||||||
// Note: However, only if it is really _shown_, i.e. not hidden!
|
// Note: However, only if it is really _shown_, i.e. not hidden!
|
||||||
if ( isCurrent && IsCellEditControlShown() )
|
if ( isCurrent && IsCellEditControlShown() )
|
||||||
{
|
{
|
||||||
|
// OSAF NB: this "#if..." is temporary and fixes a problem where the
|
||||||
|
// edit control is erased by this code after being rendered.
|
||||||
|
// On wxMac (QD build only), the cell editor is a wxTextCntl and is rendered
|
||||||
|
// implicitly, causing this out-of order render.
|
||||||
|
#if !defined(__WXMAC__) || wxMAC_USE_CORE_GRAPHICS
|
||||||
wxGridCellEditor *editor = attr->GetEditor(this, row, col);
|
wxGridCellEditor *editor = attr->GetEditor(this, row, col);
|
||||||
editor->PaintBackground(rect, attr);
|
editor->PaintBackground(rect, attr);
|
||||||
editor->DecRef();
|
editor->DecRef();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -7495,7 +7502,7 @@ void wxGrid::DrawTextRectangle( wxDC& dc,
|
|||||||
else
|
else
|
||||||
GetTextBoxSize( dc, lines, &textHeight, &textWidth );
|
GetTextBoxSize( dc, lines, &textHeight, &textWidth );
|
||||||
|
|
||||||
switch( vertAlign )
|
switch ( vertAlign )
|
||||||
{
|
{
|
||||||
case wxALIGN_BOTTOM:
|
case wxALIGN_BOTTOM:
|
||||||
if ( textOrientation == wxHORIZONTAL )
|
if ( textOrientation == wxHORIZONTAL )
|
||||||
@@ -7525,7 +7532,7 @@ void wxGrid::DrawTextRectangle( wxDC& dc,
|
|||||||
{
|
{
|
||||||
dc.GetTextExtent(lines[l], &lineWidth, &lineHeight);
|
dc.GetTextExtent(lines[l], &lineWidth, &lineHeight);
|
||||||
|
|
||||||
switch( horizAlign )
|
switch ( horizAlign )
|
||||||
{
|
{
|
||||||
case wxALIGN_RIGHT:
|
case wxALIGN_RIGHT:
|
||||||
if ( textOrientation == wxHORIZONTAL )
|
if ( textOrientation == wxHORIZONTAL )
|
||||||
@@ -8253,11 +8260,11 @@ bool wxGrid::MoveCursorUp( bool expandSelection )
|
|||||||
}
|
}
|
||||||
else if ( m_currentCellCoords.GetRow() > 0 )
|
else if ( m_currentCellCoords.GetRow() > 0 )
|
||||||
{
|
{
|
||||||
|
int row = m_currentCellCoords.GetRow() - 1;
|
||||||
|
int col = m_currentCellCoords.GetCol();
|
||||||
ClearSelection();
|
ClearSelection();
|
||||||
MakeCellVisible( m_currentCellCoords.GetRow() - 1,
|
MakeCellVisible( row, col );
|
||||||
m_currentCellCoords.GetCol() );
|
SetCurrentCell( row, col );
|
||||||
SetCurrentCell( m_currentCellCoords.GetRow() - 1,
|
|
||||||
m_currentCellCoords.GetCol() );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
@@ -8288,11 +8295,11 @@ bool wxGrid::MoveCursorDown( bool expandSelection )
|
|||||||
}
|
}
|
||||||
else if ( m_currentCellCoords.GetRow() < m_numRows - 1 )
|
else if ( m_currentCellCoords.GetRow() < m_numRows - 1 )
|
||||||
{
|
{
|
||||||
|
int row = m_currentCellCoords.GetRow() + 1;
|
||||||
|
int col = m_currentCellCoords.GetCol();
|
||||||
ClearSelection();
|
ClearSelection();
|
||||||
MakeCellVisible( m_currentCellCoords.GetRow() + 1,
|
MakeCellVisible( row, col );
|
||||||
m_currentCellCoords.GetCol() );
|
SetCurrentCell( row, col );
|
||||||
SetCurrentCell( m_currentCellCoords.GetRow() + 1,
|
|
||||||
m_currentCellCoords.GetCol() );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
@@ -8322,11 +8329,11 @@ bool wxGrid::MoveCursorLeft( bool expandSelection )
|
|||||||
}
|
}
|
||||||
else if ( m_currentCellCoords.GetCol() > 0 )
|
else if ( m_currentCellCoords.GetCol() > 0 )
|
||||||
{
|
{
|
||||||
|
int row = m_currentCellCoords.GetRow();
|
||||||
|
int col = m_currentCellCoords.GetCol() - 1;
|
||||||
ClearSelection();
|
ClearSelection();
|
||||||
MakeCellVisible( m_currentCellCoords.GetRow(),
|
MakeCellVisible( row, col );
|
||||||
m_currentCellCoords.GetCol() - 1 );
|
SetCurrentCell( row, col );
|
||||||
SetCurrentCell( m_currentCellCoords.GetRow(),
|
|
||||||
m_currentCellCoords.GetCol() - 1 );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
@@ -8356,11 +8363,11 @@ bool wxGrid::MoveCursorRight( bool expandSelection )
|
|||||||
}
|
}
|
||||||
else if ( m_currentCellCoords.GetCol() < m_numCols - 1 )
|
else if ( m_currentCellCoords.GetCol() < m_numCols - 1 )
|
||||||
{
|
{
|
||||||
|
int row = m_currentCellCoords.GetRow();
|
||||||
|
int col = m_currentCellCoords.GetCol() + 1;
|
||||||
ClearSelection();
|
ClearSelection();
|
||||||
MakeCellVisible( m_currentCellCoords.GetRow(),
|
MakeCellVisible( row, col );
|
||||||
m_currentCellCoords.GetCol() + 1 );
|
SetCurrentCell( row, col );
|
||||||
SetCurrentCell( m_currentCellCoords.GetRow(),
|
|
||||||
m_currentCellCoords.GetCol() + 1 );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
@@ -9624,7 +9631,6 @@ wxGrid::GetDefaultRendererForType(const wxString& typeName) const
|
|||||||
return m_typeRegistry->GetRenderer(index);
|
return m_typeRegistry->GetRenderer(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// row/col size
|
// row/col size
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -9722,7 +9728,7 @@ void wxGrid::SetColSize( int col, int width )
|
|||||||
//
|
//
|
||||||
// This test then fixes sf.net bug #645734
|
// This test then fixes sf.net bug #645734
|
||||||
|
|
||||||
if ( width < GetColMinimalAcceptableWidth())
|
if ( width < GetColMinimalAcceptableWidth() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( m_colWidths.IsEmpty() )
|
if ( m_colWidths.IsEmpty() )
|
||||||
@@ -9742,6 +9748,7 @@ void wxGrid::SetColSize( int col, int width )
|
|||||||
GetTextBoxSize(dc, lines, &w, &h);
|
GetTextBoxSize(dc, lines, &w, &h);
|
||||||
width = w + 6;
|
width = w + 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w = wxMax( 0, width );
|
int w = wxMax( 0, width );
|
||||||
int diff = w - m_colWidths[col];
|
int diff = w - m_colWidths[col];
|
||||||
m_colWidths[col] = w;
|
m_colWidths[col] = w;
|
||||||
@@ -9751,6 +9758,7 @@ void wxGrid::SetColSize( int col, int width )
|
|||||||
{
|
{
|
||||||
m_colRights[i] += diff;
|
m_colRights[i] += diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !GetBatchCount() )
|
if ( !GetBatchCount() )
|
||||||
CalcDimensions();
|
CalcDimensions();
|
||||||
}
|
}
|
||||||
@@ -9777,6 +9785,7 @@ int wxGrid::GetColMinimalWidth(int col) const
|
|||||||
{
|
{
|
||||||
wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)col;
|
wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)col;
|
||||||
wxLongToLongHashMap::const_iterator it = m_colMinWidths.find(key);
|
wxLongToLongHashMap::const_iterator it = m_colMinWidths.find(key);
|
||||||
|
|
||||||
return it != m_colMinWidths.end() ? (int)it->second : m_minAcceptableColWidth;
|
return it != m_colMinWidths.end() ? (int)it->second : m_minAcceptableColWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9784,24 +9793,23 @@ int wxGrid::GetRowMinimalHeight(int row) const
|
|||||||
{
|
{
|
||||||
wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)row;
|
wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)row;
|
||||||
wxLongToLongHashMap::const_iterator it = m_rowMinHeights.find(key);
|
wxLongToLongHashMap::const_iterator it = m_rowMinHeights.find(key);
|
||||||
|
|
||||||
return it != m_rowMinHeights.end() ? (int)it->second : m_minAcceptableRowHeight;
|
return it != m_rowMinHeights.end() ? (int)it->second : m_minAcceptableRowHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGrid::SetColMinimalAcceptableWidth( int width )
|
void wxGrid::SetColMinimalAcceptableWidth( int width )
|
||||||
{
|
{
|
||||||
// We do allow a width of 0 since this gives us
|
// We do allow a width of 0 since this gives us
|
||||||
// an easy way to temporarily hidding columns.
|
// an easy way to temporarily hiding columns.
|
||||||
if ( width < 0 )
|
if ( width >= 0 )
|
||||||
return;
|
|
||||||
m_minAcceptableColWidth = width;
|
m_minAcceptableColWidth = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGrid::SetRowMinimalAcceptableHeight( int height )
|
void wxGrid::SetRowMinimalAcceptableHeight( int height )
|
||||||
{
|
{
|
||||||
// We do allow a height of 0 since this gives us
|
// We do allow a height of 0 since this gives us
|
||||||
// an easy way to temporarily hidding rows.
|
// an easy way to temporarily hiding rows.
|
||||||
if ( height < 0 )
|
if ( height >= 0 )
|
||||||
return;
|
|
||||||
m_minAcceptableRowHeight = height;
|
m_minAcceptableRowHeight = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9823,11 +9831,11 @@ void wxGrid::AutoSizeColOrRow( int colOrRow, bool setAsMin, bool column )
|
|||||||
{
|
{
|
||||||
wxClientDC dc(m_gridWin);
|
wxClientDC dc(m_gridWin);
|
||||||
|
|
||||||
//Cancel editting of cell
|
// cancel editing of cell
|
||||||
HideCellEditControl();
|
HideCellEditControl();
|
||||||
SaveEditControlValue();
|
SaveEditControlValue();
|
||||||
|
|
||||||
// init both of them to avoid compiler warnings, even if weo nly need one
|
// init both of them to avoid compiler warnings, even if we only need one
|
||||||
int row = -1,
|
int row = -1,
|
||||||
col = -1;
|
col = -1;
|
||||||
if ( column )
|
if ( column )
|
||||||
@@ -9889,19 +9897,15 @@ void wxGrid::AutoSizeColOrRow( int colOrRow, bool setAsMin, bool column )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( column )
|
if ( column )
|
||||||
{
|
|
||||||
// leave some space around text
|
// leave some space around text
|
||||||
extentMax += 10;
|
extentMax += 10;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
extentMax += 6;
|
extentMax += 6;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( column )
|
if ( column )
|
||||||
{
|
{
|
||||||
SetColSize(col, extentMax);
|
SetColSize( col, extentMax );
|
||||||
if ( !GetBatchCount() )
|
if ( !GetBatchCount() )
|
||||||
{
|
{
|
||||||
int cw, ch, dummy;
|
int cw, ch, dummy;
|
||||||
@@ -9971,9 +9975,7 @@ int wxGrid::SetOrCalcRowSizes(bool calcOnly, bool setAsMin)
|
|||||||
for ( int row = 0; row < m_numRows; row++ )
|
for ( int row = 0; row < m_numRows; row++ )
|
||||||
{
|
{
|
||||||
if ( !calcOnly )
|
if ( !calcOnly )
|
||||||
{
|
|
||||||
AutoSizeRow(row, setAsMin);
|
AutoSizeRow(row, setAsMin);
|
||||||
}
|
|
||||||
|
|
||||||
height += GetRowHeight(row);
|
height += GetRowHeight(row);
|
||||||
}
|
}
|
||||||
@@ -10139,10 +10141,12 @@ wxSize wxGrid::DoGetBestSize() const
|
|||||||
height = maxheight;
|
height = maxheight;
|
||||||
|
|
||||||
wxSize best(width, height);
|
wxSize best(width, height);
|
||||||
|
|
||||||
// NOTE: This size should be cached, but first we need to add calls to
|
// NOTE: This size should be cached, but first we need to add calls to
|
||||||
// InvalidateBestSize everywhere that could change the results of this
|
// InvalidateBestSize everywhere that could change the results of this
|
||||||
// calculation.
|
// calculation.
|
||||||
// CacheBestSize(size);
|
// CacheBestSize(size);
|
||||||
|
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10189,9 +10193,9 @@ void wxGrid::SetCellValue( int row, int col, const wxString& s )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
// ----------------------------------------------------------------------------
|
||||||
// ------ Block, row and col selection
|
// block, row and col selection
|
||||||
//
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxGrid::SelectRow( int row, bool addToSelected )
|
void wxGrid::SelectRow( int row, bool addToSelected )
|
||||||
{
|
{
|
||||||
@@ -10231,9 +10235,9 @@ void wxGrid::SelectAll()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// ----------------------------------------------------------------------------
|
||||||
// ------ Cell, row and col deselection
|
// cell, row and col deselection
|
||||||
//
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxGrid::DeselectRow( int row )
|
void wxGrid::DeselectRow( int row )
|
||||||
{
|
{
|
||||||
@@ -10379,7 +10383,7 @@ wxRect wxGrid::BlockToDeviceRect( const wxGridCellCoords &topLeft,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rect = wxRect(0,0,0,0);
|
rect = wxRect(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
cellRect = CellToRect( bottomRight );
|
cellRect = CellToRect( bottomRight );
|
||||||
@@ -10423,7 +10427,6 @@ wxRect wxGrid::BlockToDeviceRect( const wxGridCellCoords &topLeft,
|
|||||||
bottomRow = i;
|
bottomRow = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for ( j = topRow; j <= bottomRow; j++ )
|
for ( j = topRow; j <= bottomRow; j++ )
|
||||||
{
|
{
|
||||||
for ( i = leftCol; i <= rightCol; i++ )
|
for ( i = leftCol; i <= rightCol; i++ )
|
||||||
@@ -10467,9 +10470,9 @@ wxRect wxGrid::BlockToDeviceRect( const wxGridCellCoords &topLeft,
|
|||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// ----------------------------------------------------------------------------
|
||||||
// ------ Grid event classes
|
// grid event classes
|
||||||
//
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS( wxGridEvent, wxNotifyEvent )
|
IMPLEMENT_DYNAMIC_CLASS( wxGridEvent, wxNotifyEvent )
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user