rect.height -= 1;
}
#else // !GTK
- int extra_x = ( rect.x > 2 )? 2 : 1;
+ int extra_x = ( rect.x > 2 ) ? 2 : 1;
// MB: treat MSW separately here otherwise the caret doesn't show
// when the editor is in the first row.
Text()->SetFocus();
}
-bool wxGridCellTextEditor::EndEdit(int row, int col,
- wxGrid* grid)
+bool wxGridCellTextEditor::EndEdit(int row, int col, wxGrid* grid)
{
wxASSERT_MSG(m_control, wxT("The wxGridCellEditor must be created first!"));
int xUnit = 1, yUnit = 1;
m_grid->GetScrollPixelsPerUnit(&xUnit, &yUnit);
- m_grid->Scroll(colXPos/xUnit-1, m_grid->GetScrollPos(wxVERTICAL));
+ m_grid->Scroll(colXPos / xUnit - 1, m_grid->GetScrollPos(wxVERTICAL));
event.Skip();
break;
}
wxRendererNative::Get().DrawHeaderButton( this, dc, rect, 0 );
#else // !__WXGTK__
- dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW),1, wxSOLID) );
- dc.DrawLine( client_width-1, client_height-1, client_width-1, 0 );
- dc.DrawLine( client_width-1, client_height-1, 0, client_height-1 );
+ dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW), 1, wxSOLID) );
+ dc.DrawLine( client_width - 1, client_height - 1, client_width - 1, 0 );
+ dc.DrawLine( client_width - 1, client_height - 1, 0, client_height - 1 );
dc.DrawLine( 0, 0, client_width, 0 );
dc.DrawLine( 0, 0, 0, client_height );
dc.SetPen( *wxWHITE_PEN );
- dc.DrawLine( 1, 1, client_width-1, 1 );
- dc.DrawLine( 1, 1, 1, client_height-1 );
-#endif // __WXGTK__/!__WXGTK__
+ dc.DrawLine( 1, 1, client_width - 1, 1 );
+ dc.DrawLine( 1, 1, 1, client_height - 1 );
+#endif
}
void wxGridCornerLabelWindow::OnMouseEvent( wxMouseEvent& event )
wxWindowID id,
const wxPoint &pos,
const wxSize &size )
- : wxWindow( parent, id, pos, size, wxWANTS_CHARS | wxBORDER_NONE | wxCLIP_CHILDREN|wxFULL_REPAINT_ON_RESIZE,
- wxT("grid window") )
+ : wxWindow(
+ parent, id, pos, size,
+ wxWANTS_CHARS | wxBORDER_NONE | wxCLIP_CHILDREN | wxFULL_REPAINT_ON_RESIZE,
+ wxT("grid window") )
{
m_owner = parent;
m_rowLabelWin = rowLblWin;
wxPaintDC dc( this );
m_owner->PrepareDC( dc );
wxRegion reg = GetUpdateRegion();
- wxGridCellCoordsArray DirtyCells = m_owner->CalcCellsExposed( reg );
- m_owner->DrawGridCellArea( dc , DirtyCells);
+ wxGridCellCoordsArray dirtyCells = m_owner->CalcCellsExposed( reg );
+ m_owner->DrawGridCellArea( dc, dirtyCells );
#if WXGRID_DRAW_LINES
m_owner->DrawAllGridLines( dc, reg );
#endif
m_owner->DrawGridSpace( dc );
- m_owner->DrawHighlight( dc , DirtyCells );
+ m_owner->DrawHighlight( dc, dirtyCells );
}
void wxGridWindow::ScrollWindow( int dx, int dy, const wxRect *rect )
#define internalYToRow(y) CoordToRowOrCol(y, m_defaultRowHeight, \
m_minAcceptableRowHeight, \
m_rowBottoms, m_numRows, true)
+
/////////////////////////////////////////////////////////////////////
#if wxUSE_EXTENDED_RTTI
wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
wxFLAGS_MEMBER(wxWANTS_CHARS)
wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
- wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
+ wxFLAGS_MEMBER(wxALWAYS_SHOW_SB)
wxFLAGS_MEMBER(wxVSCROLL)
wxFLAGS_MEMBER(wxHSCROLL)
wxCONSTRUCTOR_5( wxGrid , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle )
/*
- TODO : Expose more information of a list's layout etc. via appropriate objects (\81à la NotebookPageInfo)
+ TODO : Expose more information of a list's layout, etc. via appropriate objects (e.g., NotebookPageInfo)
*/
#else
IMPLEMENT_DYNAMIC_CLASS( wxGrid, wxScrolledWindow )
}
else
{
- m_labelBackgroundColour = wxColour( _T("WHITE") );
+ m_labelBackgroundColour = wxColour( wxT("WHITE") );
}
- m_labelTextColour = wxColour( _T("BLACK") );
+ m_labelTextColour = wxColour( wxT("BLACK") );
// init attr cache
m_attrCache.row = -1;
m_cornerLabelWin->SetSize( 0, 0, m_rowLabelWidth, m_colLabelHeight );
if ( m_colLabelWin && m_colLabelWin->IsShown() )
- m_colLabelWin->SetSize( m_rowLabelWidth, 0, cw-m_rowLabelWidth, m_colLabelHeight);
+ m_colLabelWin->SetSize( m_rowLabelWidth, 0, cw - m_rowLabelWidth, m_colLabelHeight);
if ( m_rowLabelWin && m_rowLabelWin->IsShown() )
- m_rowLabelWin->SetSize( 0, m_colLabelHeight, m_rowLabelWidth, ch-m_colLabelHeight);
+ m_rowLabelWin->SetSize( 0, m_colLabelHeight, m_rowLabelWidth, ch - m_colLabelHeight);
if ( m_gridWin && m_gridWin->IsShown() )
- m_gridWin->SetSize( m_rowLabelWidth, m_colLabelHeight, cw-m_rowLabelWidth, ch-m_colLabelHeight);
+ m_gridWin->SetSize( m_rowLabelWidth, m_colLabelHeight, cw - m_rowLabelWidth, ch - m_colLabelHeight);
}
attrProvider->UpdateAttrCols( 0, -GetNumberCols() );
#endif
}
+
if ( !GetBatchCount() )
{
CalcDimensions();
if (attrProvider)
{
attrProvider->UpdateAttrCols( pos, -((int)numCols) );
+
// ifdef'd out following patch from Paul Gammans
#if 0
// No need to touch row attributes, unless we
attrProvider->UpdateAttrRows( 0, -GetNumberRows() );
#endif
}
+
if ( !GetBatchCount() )
{
CalcDimensions();
if (m_isDragging)
{
- if (m_rowLabelWin->HasCapture()) m_rowLabelWin->ReleaseMouse();
+ if (m_rowLabelWin->HasCapture())
+ m_rowLabelWin->ReleaseMouse();
m_isDragging = false;
}
else
{
// starting to drag-resize a row
- //
if ( CanDragRowSize() )
ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW, m_rowLabelWin);
}
AutoSizeRowLabelSize( row );
ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL, m_colLabelWin);
- m_dragLastPos = -1;
+ m_dragLastPos = -1;
}
}
dc.SetLogicalFunction(wxINVERT);
if ( m_dragLastPos >= 0 )
{
- dc.DrawLine( m_dragLastPos, top, m_dragLastPos, top+ch );
+ dc.DrawLine( m_dragLastPos, top, m_dragLastPos, top + ch );
}
- dc.DrawLine( x, top, x, top+ch );
+ dc.DrawLine( x, top, x, top + ch );
m_dragLastPos = x;
}
break;
if (m_isDragging)
{
- if (m_colLabelWin->HasCapture()) m_colLabelWin->ReleaseMouse();
+ if (m_colLabelWin->HasCapture())
+ m_colLabelWin->ReleaseMouse();
m_isDragging = false;
}
AutoSizeColLabelSize( col );
ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL, m_colLabelWin);
- m_dragLastPos = -1;
+ m_dragLastPos = -1;
}
}
}
ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL, m_colLabelWin);
- m_dragLastPos = -1;
+ m_dragLastPos = -1;
}
// ------------ Right button down
rect.height = ch - rect.y;
m_rowLabelWin->Refresh( true, &rect );
rect.width = cw;
+
// if there is a multicell block, paint all of it
if (m_table)
{
if ( !parent->GetEventHandler()->ProcessEvent( keyEvt ) )
{
-
// try local handlers
//
switch ( event.GetKeyCode() )
{
case WXK_UP:
if ( event.ControlDown() )
- {
MoveCursorUpBlock( event.ShiftDown() );
- }
else
- {
MoveCursorUp( event.ShiftDown() );
- }
break;
case WXK_DOWN:
if ( event.ControlDown() )
- {
MoveCursorDownBlock( event.ShiftDown() );
- }
else
- {
MoveCursorDown( event.ShiftDown() );
- }
break;
case WXK_LEFT:
if ( event.ControlDown() )
- {
MoveCursorLeftBlock( event.ShiftDown() );
- }
else
- {
MoveCursorLeft( event.ShiftDown() );
- }
break;
case WXK_RIGHT:
if ( event.ControlDown() )
- {
MoveCursorRightBlock( event.ShiftDown() );
- }
else
- {
MoveCursorRight( event.ShiftDown() );
- }
break;
case WXK_RETURN:
}
else
{
- if ( GetGridCursorCol() < GetNumberCols()-1 )
+ if ( GetGridCursorCol() < GetNumberCols() - 1 )
{
MoveCursorRight( false );
}
case WXK_END:
if ( event.ControlDown() )
{
- MakeCellVisible( m_numRows-1, m_numCols-1 );
- SetCurrentCell( m_numRows-1, m_numCols-1 );
+ MakeCellVisible( m_numRows-1, m_numCols - 1 );
+ SetCurrentCell( m_numRows-1, m_numCols - 1 );
}
else
{
}
break;
}
+
if ( !IsEditable() )
- {
MoveCursorRight( false );
- break;
- }
- // Otherwise fall through to default
+ else
+ event.Skip();
+ break;
default:
event.Skip();
int colRight = GetColRight(col) - 1;
dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW), 1, wxSOLID) );
- dc.DrawLine( colRight, 0,
- colRight, m_colLabelHeight-1 );
+ dc.DrawLine( colRight, 0, colRight, m_colLabelHeight - 1 );
dc.DrawLine( colLeft, 0, colRight, 0 );
- dc.DrawLine( colLeft, m_colLabelHeight-1,
- colRight+1, m_colLabelHeight-1 );
+ dc.DrawLine( colLeft, m_colLabelHeight - 1,
+ colRight + 1, m_colLabelHeight - 1 );
dc.SetPen( *wxWHITE_PEN );
- dc.DrawLine( colLeft, 1, colLeft, m_colLabelHeight-1 );
+ dc.DrawLine( colLeft, 1, colLeft, m_colLabelHeight - 1 );
dc.DrawLine( colLeft, 1, colRight, 1 );
#endif
// Otherwise, e.g. when stepping from row to row, it would jump between
// left and right part of the cell on every step!
// if ( left < 0 )
- if ( left < 0 || (right-left) >= cw )
+ if ( left < 0 || (right - left) >= cw )
{
xpos = r.GetLeft();
}
xpos += m_scrollLineX;
}
- if ( xpos != -1 || ypos != -1 )
+ if ( xpos != -1 || ypos != -1 )
{
if ( xpos != -1 )
xpos /= m_scrollLineX;
{
if ( m_selectingKeyboard == wxGridNoCellCoords )
m_selectingKeyboard = m_currentCellCoords;
- if ( m_selectingKeyboard.GetRow() < m_numRows-1 )
+ if ( m_selectingKeyboard.GetRow() < m_numRows - 1 )
{
m_selectingKeyboard.SetRow( m_selectingKeyboard.GetRow() + 1 );
MakeCellVisible( m_selectingKeyboard.GetRow(),
return false;
int row = m_currentCellCoords.GetRow();
- if ( (row+1) < m_numRows )
+ if ( (row + 1) < m_numRows )
{
int cw, ch;
m_gridWin->GetClientSize( &cw, &ch );
m_table->SetRowLabelValue( row, s );
if ( !GetBatchCount() )
{
- wxRect rect = CellToRect( row, 0);
+ wxRect rect = CellToRect( row, 0 );
if ( rect.height > 0 )
{
CalcScrolledPosition(0, rect.y, &rect.x, &rect.y);
int col = m_currentCellCoords.GetCol();
if ( GetColWidth(col) <= 0 || GetRowHeight(row) <= 0 )
return;
+
wxRect rect = CellToRect(row, col);
m_gridWin->Refresh(true, &rect);
}
// (VZ)
// No, because it is reasonable to assume the library user know's
// what he is doing. However whe should test against the weaker
- // constariant of minimalAcceptableWidth, as this breaks rendering
+ // constraint of minimalAcceptableWidth, as this breaks rendering
//
// This test then fixes sf.net bug #645734
{
int cw, ch, dummy;
m_gridWin->GetClientSize( &cw, &ch );
- wxRect rect ( CellToRect( row, 0 ) );
+ wxRect rect( CellToRect( row, 0 ) );
rect.x = 0;
CalcScrolledPosition(0, rect.y, &dummy, &rect.y);
rect.width = m_rowLabelWidth;
// autosize row height depending on label text
StringToLines( GetRowLabelValue( row ), lines );
wxClientDC dc( m_rowLabelWin );
- GetTextBoxSize( dc, lines, &w, &h);
+ GetTextBoxSize( dc, lines, &w, &h );
if ( h < m_defaultRowHeight )
h = m_defaultRowHeight;
SetRowSize(row, h);
if ( m_numRows > 0 && m_numCols > 0 )
{
if ( m_selection )
- m_selection->SelectBlock( 0, 0, m_numRows-1, m_numCols-1 );
+ m_selection->SelectBlock( 0, 0, m_numRows - 1, m_numCols - 1 );
}
}