1 ############################################################################
2 ## Name: ext/grid/XS/Grid.xs
3 ## Purpose: XS for Wx::Grid
4 ## Author: Mattia Barbon
7 ## RCS-ID: $Id: Grid.xs 2570 2009-05-17 16:31:20Z mbarbon $
8 ## Copyright: (c) 2001-2009 Mattia Barbon
9 ## Licence: This program is free software; you can redistribute it and/or
10 ## modify it under the same terms as Perl itself
11 #############################################################################
14 #include "cpp/overload.h"
16 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
18 MODULE=Wx PACKAGE=Wx::GridUpdateLocker
21 wxGridUpdateLocker::new( grid = NULL )
25 wxGridUpdateLocker::CLONE()
27 wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
31 wxGridUpdateLocker::DESTROY()
33 wxPli_thread_sv_unregister( aTHX_ "Wx::GridUpdateLocker", THIS, ST(0) );
37 wxGridUpdateLocker::Create( grid )
42 MODULE=Wx PACKAGE=Wx::GridCellCoords
45 wxGridCellCoords::new( r, c )
50 wxGridCellCoords::CLONE()
52 wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
56 wxGridCellCoords::DESTROY()
58 wxPli_thread_sv_unregister( aTHX_ "Wx::GridCellCoords", THIS, ST(0) );
62 wxGridCellCoords::GetRow()
65 wxGridCellCoords::GetCol()
68 wxGridCellCoords::SetRow( r )
72 wxGridCellCoords::SetCol( c )
76 wxGridCellCoords::Set( r, c )
80 MODULE=Wx PACKAGE=Wx::Grid
86 MATCH_VOIDM_REDISP( newDefault )
87 MATCH_ANY_REDISP( newFull )
88 END_OVERLOAD( "Wx::Grid::new" )
94 RETVAL = new wxGrid();
95 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
99 newFull( CLASS, parent, id = wxID_ANY, pos = wxDefaultPosition, size = wxDefaultSize, style = wxWANTS_CHARS, name = wxPanelNameStr )
108 RETVAL = new wxGrid( parent, id, pos, size, style, name );
109 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
114 wxGrid::Create( parent, id = wxID_ANY, pos = wxDefaultPosition, size = wxDefaultSize, style = wxWANTS_CHARS, name = wxPanelNameStr )
123 wxGrid::AppendCols( numCols = 1, updateLabels = true )
128 wxGrid::AppendRows( numRows = 1, updateLabels = true )
136 wxGrid::AutoSizeColLabelSize( col )
140 wxGrid::AutoSizeRowLabelSize( col )
144 wxGrid::AutoSizeColumn( col, setAsMin = true )
149 wxGrid::AutoSizeColumns( setAsMin = true )
153 wxGrid::AutoSizeRow( row, setAsMin = true )
158 wxGrid::AutoSizeRows( setAsMin = true )
165 wxGrid::BlockToDeviceRect( topLeft, bottomRight )
166 wxGridCellCoords* topLeft
167 wxGridCellCoords* bottomRight
169 RETVAL = new wxRect( THIS->BlockToDeviceRect( *topLeft, *bottomRight ) );
174 wxGrid::CanDragColSize()
176 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
179 wxGrid::CanDragColMove()
184 wxGrid::CanDragRowSize()
187 wxGrid::CanDragGridSize()
190 wxGrid::CanEnableCellControl()
193 wxGrid::CellToRectXY( row, col )
197 RETVAL = new wxRect( THIS->CellToRect( row, col ) );
202 wxGrid::CellToRectCo( coords )
203 wxGridCellCoords* coords
205 RETVAL = new wxRect( THIS->CellToRect( *coords ) );
213 wxGrid::ClearSelection()
216 wxGrid::CreateGrid( numRows, numCols, selMode = wxGrid::wxGridSelectCells )
219 wxGridSelectionModes selMode
222 wxGrid::DeleteCols( pos = 0, numCols = 1, updateLabels = true )
228 wxGrid::DeleteRows( pos = 0, numRows = 1, updateLabels = true )
234 wxGrid::DisableCellEditControl()
237 wxGrid::DisableDragGridSize()
240 wxGrid::DisableDragRowSize()
243 wxGrid::DisableDragColSize()
245 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
248 wxGrid::DisableDragColMove()
253 wxGrid::EnableCellEditControl( enable = true )
256 #if WXPERL_W_VERSION_GE( 2, 7, 0 )
259 wxGrid::EnableDragColMove( enable = true )
265 wxGrid::EnableDragColSize( enable = true )
269 wxGrid::EnableDragGridSize( enable = true )
273 wxGrid::EnableDragRowSize( enable = true )
277 wxGrid::EnableEditing( enable = true )
281 wxGrid::EnableGridLines( enable = true )
288 wxGrid::ForceRefresh()
291 wxGrid::GetBatchCount()
294 wxGrid::GetCellAlignment( row, col )
300 THIS->GetCellAlignment( row, col, &x, &y );
302 PUSHs( sv_2mortal( newSViv( x ) ) );
303 PUSHs( sv_2mortal( newSViv( y ) ) );
306 wxGrid::GetCellBackgroundColour( row, col )
310 RETVAL = new wxColour( THIS->GetCellBackgroundColour( row, col ) );
315 wxGrid::GetCellEditor( row, col )
320 wxGrid::GetCellOverflow( row, col )
325 wxGrid::GetCellRenderer( row, col )
330 wxGrid::GetCellFont( row, col )
334 RETVAL = new wxFont( THIS->GetCellFont( row, col ) );
339 wxGrid::GetCellTextColour( row, col )
343 RETVAL = new wxColour( THIS->GetCellTextColour( row, col ) );
348 wxGrid::GetCellValueXY( row, col )
352 RETVAL = THIS->GetCellValue( row, col );
357 wxGrid::GetCellValueCo( coord )
358 wxGridCellCoords* coord
360 RETVAL = THIS->GetCellValue( *coord );
365 wxGrid::GetColLabelAlignment()
369 THIS->GetColLabelAlignment( &x, &y );
371 PUSHs( sv_2mortal( newSViv( x ) ) );
372 PUSHs( sv_2mortal( newSViv( y ) ) );
375 wxGrid::GetColLabelSize()
378 wxGrid::GetColLabelValue( col )
381 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
384 wxGrid::GetColPos( colId )
390 wxGrid::GetColSize( col )
393 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
396 wxGrid::GetColAt( colPos )
402 wxGrid::GetDefaultCellAlignment()
406 THIS->GetDefaultCellAlignment( &x, &y );
408 PUSHs( sv_2mortal( newSViv( x ) ) );
409 PUSHs( sv_2mortal( newSViv( y ) ) );
412 wxGrid::GetDefaultCellBackgroundColour()
414 RETVAL = new wxColour( THIS->GetDefaultCellBackgroundColour() );
419 wxGrid::GetDefaultCellFont()
421 RETVAL = new wxFont( THIS->GetDefaultCellFont() );
426 wxGrid::GetDefaultCellOverflow( )
429 wxGrid::GetDefaultCellTextColour()
431 RETVAL = new wxColour( THIS->GetDefaultCellTextColour() );
436 wxGrid::GetDefaultColLabelSize()
439 wxGrid::GetDefaultColSize()
442 wxGrid::GetColMinimalAcceptableWidth()
444 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
447 wxGrid::GetOrCreateCellAttr( row, col )
454 wxGrid::GetRowMinimalAcceptableHeight()
457 wxGrid::GetDefaultEditor()
460 wxGrid::GetDefaultEditorForType( typeName )
464 wxGrid::GetDefaultEditorForCellCo( coords )
465 wxGridCellCoords* coords
467 RETVAL = THIS->GetDefaultEditorForCell( *coords );
472 wxGrid::GetDefaultEditorForCellXY( x, y )
476 RETVAL = THIS->GetDefaultEditorForCell( x, y );
481 wxGrid::GetDefaultRenderer()
484 wxGrid::GetDefaultRendererForType( typeName )
487 ##wxGridCellRenderer*
488 ##wxGrid::GetDefaultRendererForCellCo( coords )
489 ## wxGridCellCoords* coords
491 ## RETVAL = THIS->GetDefaultRendererForCell( *coords );
496 wxGrid::GetDefaultRendererForCell( x, y )
500 RETVAL = THIS->GetDefaultRendererForCell( x, y );
505 wxGrid::GetRowLabelAlignment()
509 THIS->GetRowLabelAlignment( &x, &y );
511 PUSHs( sv_2mortal( newSViv( x ) ) );
512 PUSHs( sv_2mortal( newSViv( y ) ) );
515 wxGrid::GetDefaultRowLabelSize()
518 wxGrid::GetDefaultRowSize()
521 wxGrid::GetGridCursorCol()
524 wxGrid::GetGridCursorRow()
527 wxGrid::GetGridLineColour()
529 RETVAL = new wxColour( THIS->GetGridLineColour() );
533 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
536 wxGrid::GetDefaultGridLinePen()
538 RETVAL = new wxPen( THIS->GetDefaultGridLinePen() );
542 wxGrid::GetColGridLinePen( col )
545 RETVAL = new wxPen( THIS->GetColGridLinePen( col ) );
549 wxGrid::GetRowGridLinePen( row )
552 RETVAL = new wxPen( THIS->GetRowGridLinePen( row ) );
561 wxGrid::GridLinesEnabled()
564 wxGrid::GetLabelBackgroundColour()
566 RETVAL = new wxColour( THIS->GetLabelBackgroundColour() );
571 wxGrid::GetLabelFont()
573 RETVAL = new wxFont( THIS->GetLabelFont() );
578 wxGrid::GetLabelTextColour()
580 RETVAL = new wxColour( THIS->GetLabelTextColour() );
585 wxGrid::GetNumberCols()
588 wxGrid::GetNumberRows()
591 wxGrid::GetRowLabelSize()
594 wxGrid::GetRowLabelValue( row )
598 wxGrid::GetRowSize( row )
601 #if WXPERL_W_VERSION_GE( 2, 6, 0 )
604 wxGrid::GetScrollLineX()
607 wxGrid::GetScrollLineY()
610 wxGrid::SetScrollLineX( x )
614 wxGrid::SetScrollLineY( y )
620 wxGrid::GetSelectedCells()
623 wxPli_nonobjarray_push<wxGridCellCoordsArray, wxGridCellCoords>
624 ( aTHX_ THIS->GetSelectedCells(), "Wx::GridCellCoords" );
628 wxGrid::GetSelectionBlockTopLeft()
631 wxPli_nonobjarray_push<wxGridCellCoordsArray, wxGridCellCoords>
632 ( aTHX_ THIS->GetSelectionBlockTopLeft(), "Wx::GridCellCoords" );
636 wxGrid::GetSelectionBlockBottomRight()
639 wxPli_nonobjarray_push<wxGridCellCoordsArray, wxGridCellCoords>
640 ( aTHX_ THIS->GetSelectionBlockBottomRight(), "Wx::GridCellCoords" );
644 wxGrid::GetSelectedCols()
647 wxPli_intarray_push( aTHX_ THIS->GetSelectedCols() );
651 wxGrid::GetSelectedRows()
654 wxPli_intarray_push( aTHX_ THIS->GetSelectedRows() );
658 wxGrid::GetSelectionBackground()
660 RETVAL = new wxColour( THIS->GetSelectionBackground() );
665 wxGrid::GetSelectionForeground()
667 RETVAL = new wxColour( THIS->GetSelectionForeground() );
672 wxGrid::GetSelectionMode()
675 wxGrid::GetViewWidth()
678 wxGrid::HideCellEditControl()
680 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
683 wxGrid::HideRowLabels()
686 wxGrid::HideColLabels()
691 wxGrid::InsertCols( pos = 0, numCols = 1, updateLabels = true )
697 wxGrid::InsertRows( pos = 0, numRows = 1, updateLabels = true )
703 wxGrid::IsCellEditControlEnabled()
706 wxGrid::IsCurrentCellReadOnly()
712 wxGrid::IsInSelectionXY( row, col )
716 RETVAL = THIS->IsInSelection( row, col );
721 wxGrid::IsInSelectionCo( coords )
722 wxGridCellCoords* coords
724 RETVAL = THIS->IsInSelection( *coords );
729 wxGrid::IsReadOnly( row, col )
734 wxGrid::IsSelection()
737 wxGrid::IsVisibleXY( row, col, wholeCellVisible = true )
740 bool wholeCellVisible
742 RETVAL = THIS->IsVisible( row, col, wholeCellVisible );
747 wxGrid::IsVisibleCo( coords, wholeCellVisible = true )
748 wxGridCellCoords* coords
749 bool wholeCellVisible
751 RETVAL = THIS->IsVisible( *coords, wholeCellVisible );
756 wxGrid::MakeCellVisibleXY( row, col )
760 THIS->MakeCellVisible( row, col );
763 wxGrid::MakeCellVisibleCo( coords )
764 wxGridCellCoords* coords
766 THIS->MakeCellVisible( *coords );
769 wxGrid::MoveCursorDown( expandSelection )
773 wxGrid::MoveCursorLeft( expandSelection )
777 wxGrid::MoveCursorRight( expandSelection )
781 wxGrid::MoveCursorUp( expandSelection )
785 wxGrid::MoveCursorDownBlock( expandSelection )
789 wxGrid::MoveCursorLeftBlock( expandSelection )
793 wxGrid::MoveCursorRightBlock( expandSelection )
797 wxGrid::MoveCursorUpBlock( expandSelection )
801 wxGrid::MovePageDown()
807 wxGrid::ProcessTableMessage( msg )
808 wxGridTableMessage* msg
812 wxGrid::RegisterDataType( typeName, renderer, editor )
814 wxGridCellRenderer* renderer
815 wxGridCellEditor* editor
819 THIS->RegisterDataType( typeName, renderer, editor );
822 wxGrid::SaveEditControlValue()
828 wxGrid::SelectBlockXYWH( topRow, leftCol, bottomRow, rightCol, addToSelected = false )
835 THIS->SelectBlock( topRow, leftCol, bottomRow, rightCol, addToSelected );
838 wxGrid::SelectBlockPP( topLeft, bottomRight, addToSelected = false )
839 wxGridCellCoords* topLeft
840 wxGridCellCoords* bottomRight
843 THIS->SelectBlock( *topLeft, *bottomRight, addToSelected );
846 wxGrid::SelectCol( col, addToSelected = false )
851 wxGrid::SelectRow( row, addToSelected = false )
855 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
858 wxGrid::SetUseNativeColLabels( native = true )
864 wxGrid::SetCellAlignment( row, col, horiz, vert )
871 wxGrid::SetCellBackgroundColour( row, col, colour )
877 wxGrid::SetCellHighlightColour( colour )
882 wxGrid::SetCellHighlightPenWidth( width )
886 wxGrid::SetCellHighlightROPenWidth( width )
890 wxGrid::SetCellEditor( row, col, editor )
893 wxGridCellEditor* editor
896 THIS->SetCellEditor( row, col, editor );
899 wxGrid::SetCellRenderer( row, col, renderer )
902 wxGridCellRenderer* renderer
905 THIS->SetCellRenderer( row, col, renderer );
908 wxGrid::SetCellFont( row, col, font )
913 THIS->SetCellFont( row, col, *font );
916 wxGrid::SetCellTextColour( row, col, colour )
922 wxGrid::SetCellSize( row, col, rows, cols )
929 wxGrid::SetCellOverflow( row, col, oflo )
935 wxGrid::SetCellValueXY( row, col, s )
940 THIS->SetCellValue( row, col, s );
943 wxGrid::SetCellValueCo( coords, s )
944 wxGridCellCoords* coords
947 THIS->SetCellValue( *coords, s );
950 wxGrid::SetDefaultCellAlignment( horiz, vert )
955 wxGrid::SetDefaultCellBackgroundColour( colour )
959 wxGrid::SetDefaultCellFont( font )
962 THIS->SetDefaultCellFont( *font );
965 wxGrid::SetDefaultCellOverflow( oflo )
969 wxGrid::SetDefaultCellTextColour( colour )
973 wxGrid::SetDefaultColSize( width, resizeExistingCols = false )
975 bool resizeExistingCols
978 wxGrid::SetDefaultEditor( editor )
979 wxGridCellEditor* editor
982 THIS->SetDefaultEditor( editor );
985 wxGrid::SetDefaultRenderer( renderer )
986 wxGridCellRenderer* renderer
989 THIS->SetDefaultRenderer( renderer );
992 wxGrid::SetDefaultRowSize( height, resizeExistingCols = false )
994 bool resizeExistingCols
997 wxGrid::SetColAttr( col, attr )
1002 THIS->SetColAttr( col, attr );
1005 wxGrid::SetColFormatBool( col )
1009 wxGrid::SetColFormatNumber( col )
1013 wxGrid::SetColFormatFloat( col, width = -1, precision = -1 )
1019 wxGrid::SetColFormatCustom( col, typeName )
1024 wxGrid::SetColLabelAlignment( horiz, vert )
1029 wxGrid::SetColLabelSize( height )
1033 wxGrid::SetColLabelValue( col, value )
1038 wxGrid::SetColMinimalAcceptableWidth( int width )
1041 wxGrid::SetRowMinimalAcceptableHeight( int width )
1044 wxGrid::SetColMinimalWidth( col, width )
1049 wxGrid::SetColSize( col, height )
1053 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
1056 wxGrid::SetColPos( col, pos )
1063 wxGrid::SetGridCursor( row, col )
1068 wxGrid::SetGridLineColour( colour )
1072 wxGrid::SetLabelBackgroundColour( colour )
1076 wxGrid::SetLabelFont( font )
1079 THIS->SetLabelFont( *font );
1082 wxGrid::SetLabelTextColour( colour )
1086 wxGrid::SetMargins( extraWidth, extraHeight )
1091 wxGrid::SetReadOnly( row, col, isReadOnly = true )
1097 wxGrid::SetRowAttr( row, attr )
1099 wxGridCellAttr* attr
1102 THIS->SetRowAttr( row, attr );
1105 wxGrid::SetRowLabelAlignment( horiz, vert )
1110 wxGrid::SetRowLabelSize( width )
1114 wxGrid::SetRowLabelValue( row, value )
1119 wxGrid::SetRowMinimalHeight( row, height )
1124 wxGrid::SetRowSize( row, height )
1129 wxGrid::SetSelectionBackground( colour )
1133 wxGrid::SetSelectionForeground( colour )
1137 wxGrid::SetSelectionMode( selmode )
1138 wxGridSelectionModes selmode
1141 wxGrid::SetTable( table, selMode = wxGrid::wxGridSelectCells )
1142 wxGridTableBase* table
1143 wxGridSelectionModes selMode
1146 wxGrid::ShowCellEditControl()
1153 wxGrid::XToEdgeOfCol( x )
1161 wxGrid::YToEdgeOfRow( y )
1165 wxGrid::GetGridWindow()
1168 wxGrid::GetGridRowLabelWindow()
1171 wxGrid::GetGridColLabelWindow()