#include "wx/textfile.h"
#include "wx/spinctrl.h"
#include "wx/tokenzr.h"
+#include "wx/renderer.h"
#include "wx/grid.h"
#include "wx/generic/gridsel.h"
DEFINE_EVENT_TYPE(wxEVT_GRID_CELL_RIGHT_CLICK)
DEFINE_EVENT_TYPE(wxEVT_GRID_CELL_LEFT_DCLICK)
DEFINE_EVENT_TYPE(wxEVT_GRID_CELL_RIGHT_DCLICK)
+DEFINE_EVENT_TYPE(wxEVT_GRID_CELL_BEGIN_DRAG)
DEFINE_EVENT_TYPE(wxEVT_GRID_LABEL_LEFT_CLICK)
DEFINE_EVENT_TYPE(wxEVT_GRID_LABEL_RIGHT_CLICK)
DEFINE_EVENT_TYPE(wxEVT_GRID_LABEL_LEFT_DCLICK)
wxGridRowLabelWindow *rowLblWin,
wxGridColLabelWindow *colLblWin,
wxWindowID id, const wxPoint &pos, const wxSize &size );
- ~wxGridWindow();
+ ~wxGridWindow(){}
void ScrollWindow( int dx, int dy, const wxRect *rect );
// in these hash tables is the number of rows/columns)
static const int GRID_HASH_SIZE = 100;
+#if 0
// ----------------------------------------------------------------------------
// private functions
// ----------------------------------------------------------------------------
{
return (y + GRID_SCROLL_LINE_Y - 1) / GRID_SCROLL_LINE_Y;
}
+#endif
// ============================================================================
// implementation
m_colBgOld = m_control->GetBackgroundColour();
m_control->SetBackgroundColour(attr->GetBackgroundColour());
+// Workaround for GTK+1 font setting problem on some platforms
+#if !defined(__WXGTK__) || defined(__WXGTK20__)
m_fontOld = m_control->GetFont();
m_control->SetFont(attr->GetFont());
-
+#endif
// can't do anything more in the base class version, the other
// attributes may only be used by the derived classes
}
m_control->SetBackgroundColour(m_colBgOld);
m_colBgOld = wxNullColour;
}
-
+// Workaround for GTK+1 font setting problem on some platforms
+#if !defined(__WXGTK__) || defined(__WXGTK20__)
if ( m_fontOld.Ok() )
{
m_control->SetFont(m_fontOld);
m_fontOld = wxNullFont;
}
+#endif
}
}
bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event)
{
// accept the simple key presses, not anything with Ctrl/Alt/Meta
- return !(event.ControlDown() || event.AltDown());
+ return !(event.ControlDown() || event.AltDown() || event.GetKeyCode() == WXK_SHIFT);
}
void wxGridCellEditor::StartingKey(wxKeyEvent& event)
wxWindowID id,
wxEvtHandler* evtHandler)
{
+#if wxUSE_SPINCTRL
if ( HasRange() )
{
// create a spin ctrl
wxGridCellEditor::Create(parent, id, evtHandler);
}
else
+#endif
{
// just a text control
wxGridCellTextEditor::Create(parent, id, evtHandler);
{
m_valueOld = 0;
wxString sValue = table->GetValue(row, col);
- if (! sValue.ToLong(&m_valueOld) && ! sValue.IsEmpty())
+ if (! sValue.ToLong(&m_valueOld) && ! sValue.empty())
{
wxFAIL_MSG( _T("this cell doesn't have numeric value") );
return;
}
}
+#if wxUSE_SPINCTRL
if ( HasRange() )
{
Spin()->SetValue((int)m_valueOld);
Spin()->SetFocus();
}
else
+#endif
{
DoBeginEdit(GetString());
}
long value = 0;
wxString text;
+#if wxUSE_SPINCTRL
if ( HasRange() )
{
value = Spin()->GetValue();
text = wxString::Format(wxT("%ld"), value);
}
else
+#endif
{
text = Text()->GetValue();
- changed = (text.IsEmpty() || text.ToLong(&value)) && (value != m_valueOld);
+ changed = (text.empty() || text.ToLong(&value)) && (value != m_valueOld);
}
if ( changed )
void wxGridCellNumberEditor::Reset()
{
+#if wxUSE_SPINCTRL
if ( HasRange() )
{
Spin()->SetValue((int)m_valueOld);
}
else
+#endif
{
DoReset(GetString());
}
// return the value in the spin control if it is there (the text control otherwise)
wxString wxGridCellNumberEditor::GetValue() const
{
- wxString s;
+ wxString s;
- if( HasRange() )
- {
- long value = Spin()->GetValue();
- s.Printf(wxT("%ld"), value);
- }
- else
- {
- s = Text()->GetValue();
- }
- return s;
+#if wxUSE_SPINCTRL
+ if( HasRange() )
+ {
+ long value = Spin()->GetValue();
+ s.Printf(wxT("%ld"), value);
+ }
+ else
+#endif
+ {
+ s = Text()->GetValue();
+ }
+
+ return s;
}
// ----------------------------------------------------------------------------
{
m_valueOld = 0.0;
wxString sValue = table->GetValue(row, col);
- if (! sValue.ToDouble(&m_valueOld) && ! sValue.IsEmpty())
+ if (! sValue.ToDouble(&m_valueOld) && ! sValue.empty())
{
wxFAIL_MSG( _T("this cell doesn't have float value") );
return;
double value = 0.0;
wxString text(Text()->GetValue());
- if ( (text.IsEmpty() || text.ToDouble(&value)) && (value != m_valueOld) )
+ if ( (text.empty() || text.ToDouble(&value)) && (value != m_valueOld) )
{
if (grid->GetTable()->CanSetValueAs(row, col, wxGRID_VALUE_FLOAT))
grid->GetTable()->SetValueAsDouble(row, col, value);
char tmpbuf[2];
tmpbuf[0] = (char) keycode;
tmpbuf[1] = '\0';
- bool is_decimal_point = ( wxString(tmpbuf, *wxConvCurrent) ==
+ wxString strbuf(tmpbuf, *wxConvCurrent);
+ bool is_decimal_point = ( strbuf ==
wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER) );
if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-'
|| is_decimal_point
char tmpbuf[2];
tmpbuf[0] = (char) keycode;
tmpbuf[1] = '\0';
+ wxString strbuf(tmpbuf, *wxConvCurrent);
bool is_decimal_point =
- ( wxString(tmpbuf, *wxConvCurrent) ==
- wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT,
- wxLOCALE_CAT_NUMBER) );
+ ( strbuf == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT,
+ wxLOCALE_CAT_NUMBER) );
if ( (keycode < 128) &&
(wxIsdigit(keycode) || tolower(keycode) == 'e' ||
is_decimal_point || keycode == '+' || keycode == '-') )
wxGrid* grid)
{
wxString value = Combo()->GetValue();
- bool changed = value != m_startValue;
-
- if ( changed )
- grid->GetTable()->SetValue(row, col, value);
+ if ( value == m_startValue )
+ return false;
- m_startValue = wxEmptyString;
- if (m_allowOthers)
- Combo()->SetValue(m_startValue);
- else
- Combo()->SetSelection(0);
+ grid->GetTable()->SetValue(row, col, value);
- return changed;
+ return true;
}
void wxGridCellChoiceEditor::Reset()
// grey out fields if the grid is disabled
if( grid.IsEnabled() )
{
- if ( isSelected )
- {
- dc.SetBrush( wxBrush(grid.GetSelectionBackground(), wxSOLID) );
- }
- else
- {
- dc.SetBrush( wxBrush(attr.GetBackgroundColour(), wxSOLID) );
- }
+ if ( isSelected )
+ {
+ dc.SetBrush( wxBrush(grid.GetSelectionBackground(), wxSOLID) );
+ }
+ else
+ {
+ dc.SetBrush( wxBrush(attr.GetBackgroundColour(), wxSOLID) );
+ }
}
else
{
- dc.SetBrush(wxBrush(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE), wxSOLID));
+ dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE), wxSOLID));
}
dc.SetPen( *wxTRANSPARENT_PEN );
}
else
{
- dc.SetTextBackground(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE));
- dc.SetTextForeground(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_GRAYTEXT));
+ dc.SetTextBackground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
+ dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
}
dc.SetFont( attr.GetFont() );
else
{
wxString tmp = params.BeforeFirst(_T(','));
- if ( !!tmp )
+ if ( !tmp.empty() )
{
long width;
if ( tmp.ToLong(&width) )
}
tmp = params.AfterFirst(_T(','));
- if ( !!tmp )
+ if ( !tmp.empty() )
{
long precision;
if ( tmp.ToLong(&precision) )
else
{
// ...or remove the attribute
- m_attrs.RemoveAt((size_t)n);
+ // No need to DecRef the attribute itself since this is
+ // done be wxGridCellWithAttr's destructor!
+ m_attrs.RemoveAt(n);
n--; count--;
}
}
else
{
// ...or remove the attribute
- m_attrs.RemoveAt((size_t)n);
+ // No need to DecRef the attribute itself since this is
+ // done be wxGridCellWithAttr's destructor!
+ m_attrs.RemoveAt(n);
n--; count--;
}
}
rowOrCol += numRowsOrCols;
else
{
- m_rowsOrCols.RemoveAt((size_t)n);
- m_attrs.RemoveAt((size_t)n);
+ m_rowsOrCols.RemoveAt(n);
+ m_attrs[n]->DecRef();
+ m_attrs.RemoveAt(n);
n--; count--;
}
}
wxGridCellAttr *attrrow = m_data->m_rowAttrs.GetAttr(row);
wxGridCellAttr *attrcol = m_data->m_colAttrs.GetAttr(col);
- if((attrcell != attrrow) && (attrrow !=attrcol) && (attrcell != attrcol)){
- // Two or move are non NULL
+ if((attrcell != attrrow) && (attrrow != attrcol) && (attrcell != attrcol)){
+ // Two or more are non NULL
attr = new wxGridCellAttr;
attr->SetKind(wxGridCellAttr::Merged);
//m_data->m_mergeAttr.SetAttr(attr, row, col);
}
else
- {
+ {
// one or none is non null return it or null.
if(attrrow) attr = attrrow;
- if(attrcol) attr = attrcol;
- if(attrcell) attr = attrcell;
+ if(attrcol)
+ {
+ if(attr)
+ attr->DecRef();
+ attr = attrcol;
+ }
+ if(attrcell)
+ {
+ if(attr)
+ attr->DecRef();
+ attr = attrcell;
+ }
}
}
break;
attr = m_data->m_cellAttrs.GetAttr(row, col);
break;
case (wxGridCellAttr::Col):
- attr = m_data->m_colAttrs.GetAttr(col);
+ attr = m_data->m_colAttrs.GetAttr(col);
break;
case (wxGridCellAttr::Row):
- attr = m_data->m_rowAttrs.GetAttr(row);
+ attr = m_data->m_rowAttrs.GetAttr(row);
break;
default:
// unused as yet...
int client_width = 0;
GetClientSize( &client_width, &client_height );
+#if __WXGTK__
+ wxRect rect;
+ rect.SetX( 1 );
+ rect.SetY( 1 );
+ rect.SetWidth( client_width - 2 );
+ rect.SetHeight( client_height - 2 );
+
+ wxRendererNative::Get().DrawHeaderButton( this, dc, rect, 0 );
+#else
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( *wxWHITE_PEN );
dc.DrawLine( 1, 1, client_width-1, 1 );
dc.DrawLine( 1, 1, 1, client_height-1 );
+#endif
}
}
-wxGridWindow::~wxGridWindow()
-{
-}
-
-
void wxGridWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{
wxPaintDC dc( this );
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 (à la NotebookPageInfo)
+ TODO : Expose more information of a list's layout etc. via appropriate objects (\81à la NotebookPageInfo)
*/
#else
IMPLEMENT_DYNAMIC_CLASS( wxGrid, wxScrolledWindow )
m_rowMinHeights(GRID_HASH_SIZE)
{
Create();
+ SetBestFittingSize(size);
}
bool wxGrid::Create(wxWindow *parent, wxWindowID id,
m_rowMinHeights = wxLongToLongHashMap(GRID_HASH_SIZE) ;
Create() ;
-
+ SetBestFittingSize(size);
return true;
}
wxColour lfg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
wxColour lbg = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
#endif
- m_cornerLabelWin->SetDefaultForegroundColour(lfg);
- m_cornerLabelWin->SetDefaultBackgroundColour(lbg);
- m_rowLabelWin->SetDefaultForegroundColour(lfg);
- m_rowLabelWin->SetDefaultBackgroundColour(lbg);
- m_colLabelWin->SetDefaultForegroundColour(lfg);
- m_colLabelWin->SetDefaultBackgroundColour(lbg);
+ m_cornerLabelWin->SetOwnForegroundColour(lfg);
+ m_cornerLabelWin->SetOwnBackgroundColour(lbg);
+ m_rowLabelWin->SetOwnForegroundColour(lfg);
+ m_rowLabelWin->SetOwnBackgroundColour(lbg);
+ m_colLabelWin->SetOwnForegroundColour(lfg);
+ m_colLabelWin->SetOwnBackgroundColour(lbg);
- m_gridWin->SetDefaultForegroundColour(gfg);
- m_gridWin->SetDefaultBackgroundColour(gbg);
+ m_gridWin->SetOwnForegroundColour(gfg);
+ m_gridWin->SetOwnBackgroundColour(gbg);
Init();
}
m_canDragRowSize = true;
m_canDragColSize = true;
m_canDragGridSize = true;
+ m_canDragCell = false;
m_dragLastPos = -1;
m_dragRowOrCol = -1;
m_isDragging = false;
m_extraWidth =
m_extraHeight = 0;
+
+ m_scrollLineX = GRID_SCROLL_LINE_X;
+ m_scrollLineY = GRID_SCROLL_LINE_Y;
}
// ----------------------------------------------------------------------------
int cw, ch;
GetClientSize( &cw, &ch );
- if ( m_cornerLabelWin->IsShown() )
+ if ( m_cornerLabelWin && m_cornerLabelWin->IsShown() )
m_cornerLabelWin->SetSize( 0, 0, m_rowLabelWidth, m_colLabelHeight );
- if ( m_colLabelWin->IsShown() )
+ if ( m_colLabelWin && m_colLabelWin->IsShown() )
m_colLabelWin->SetSize( m_rowLabelWidth, 0, cw-m_rowLabelWidth, m_colLabelHeight);
- if ( m_rowLabelWin->IsShown() )
+ if ( m_rowLabelWin && m_rowLabelWin->IsShown() )
m_rowLabelWin->SetSize( 0, m_colLabelHeight, m_rowLabelWidth, ch-m_colLabelHeight);
- if ( m_gridWin->IsShown() )
+ if ( m_gridWin && m_gridWin->IsShown() )
m_gridWin->SetSize( m_rowLabelWidth, m_colLabelHeight, cw-m_rowLabelWidth, ch-m_colLabelHeight);
}
XYToCell( x, y, coords );
int cell_rows, cell_cols;
+ bool isFirstDrag = !m_isDragging;
GetCellSize( coords.GetRow(), coords.GetCol(), &cell_rows, &cell_cols );
if ((cell_rows < 0) || (cell_cols < 0))
{
m_selectingKeyboard = coords;
HighlightBlock ( m_selectingKeyboard, coords );
}
+ else if ( CanDragCell() )
+ {
+ if ( isFirstDrag )
+ {
+ if ( m_selectingKeyboard == wxGridNoCellCoords)
+ m_selectingKeyboard = coords;
+
+ SendEvent( wxEVT_GRID_CELL_BEGIN_DRAG,
+ coords.GetRow(),
+ coords.GetCol(),
+ event );
+ }
+ }
else
{
if ( !IsSelection() )
if ( GetRowHeight(row) <= 0 )
return;
+ wxRect rect;
+#ifdef __WXGTK__
+ rect.SetX( 1 );
+ rect.SetY( GetRowTop(row) + 1 );
+ rect.SetWidth( m_rowLabelWidth - 2 );
+ rect.SetHeight( GetRowHeight(row) - 2 );
+
+ CalcScrolledPosition( 0, rect.y, NULL, &rect.y );
+
+ wxWindowDC *win_dc = (wxWindowDC*) &dc;
+
+ wxRendererNative::Get().DrawHeaderButton( win_dc->m_owner, dc, rect, 0 );
+#else
int rowTop = GetRowTop(row),
rowBottom = GetRowBottom(row) - 1;
dc.SetPen( *wxWHITE_PEN );
dc.DrawLine( 1, rowTop, 1, rowBottom );
dc.DrawLine( 1, rowTop, m_rowLabelWidth-1, rowTop );
-
+#endif
dc.SetBackgroundMode( wxTRANSPARENT );
dc.SetTextForeground( GetLabelTextColour() );
dc.SetFont( GetLabelFont() );
int hAlign, vAlign;
GetRowLabelAlignment( &hAlign, &vAlign );
- wxRect rect;
rect.SetX( 2 );
rect.SetY( GetRowTop(row) + 2 );
rect.SetWidth( m_rowLabelWidth - 4 );
if ( GetColWidth(col) <= 0 )
return;
- int colLeft = GetColLeft(col),
- colRight = GetColRight(col) - 1;
+ int colLeft = GetColLeft(col);
+
+ wxRect rect;
+#ifdef __WXGTK__
+ rect.SetX( colLeft + 1 );
+ rect.SetY( 1 );
+ rect.SetWidth( GetColWidth(col) - 2 );
+ rect.SetHeight( m_colLabelHeight - 2 );
+
+ wxWindowDC *win_dc = (wxWindowDC*) &dc;
+
+ wxRendererNative::Get().DrawHeaderButton( win_dc->m_owner, dc, rect, 0 );
+#else
+ int colRight = GetColRight(col) - 1;
dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW),1, wxSOLID) );
dc.DrawLine( colRight, 0,
dc.SetPen( *wxWHITE_PEN );
dc.DrawLine( colLeft, 1, colLeft, m_colLabelHeight-1 );
dc.DrawLine( colLeft, 1, colRight, 1 );
-
+#endif
dc.SetBackgroundMode( wxTRANSPARENT );
dc.SetTextForeground( GetLabelTextColour() );
dc.SetFont( GetLabelFont() );
GetColLabelAlignment( &hAlign, &vAlign );
orient = GetColLabelTextOrientation();
- wxRect rect;
rect.SetX( colLeft + 2 );
rect.SetY( 2 );
rect.SetWidth( GetColWidth(col) - 4 );
EndBatch();
}
+bool wxGrid::Enable(bool enable)
+{
+ if ( !wxScrolledWindow::Enable(enable) )
+ return false;
+
+ // redraw in the new state
+ m_gridWin->Refresh();
+
+ return true;
+}
//
// ------ Edit control functions
m_defaultCellAttr->SetFont(font);
}
+
+// For editors and renderers the type registry takes precedence over the
+// default attr, so we need to register the new editor/renderer for the string
+// data type in order to make setting a default editor/renderer appear to
+// work correctly.
+
void wxGrid::SetDefaultRenderer(wxGridCellRenderer *renderer)
{
- m_defaultCellAttr->SetRenderer(renderer);
+ RegisterDataType(wxGRID_VALUE_STRING,
+ renderer,
+ GetDefaultEditorForType(wxGRID_VALUE_STRING));
}
void wxGrid::SetDefaultEditor(wxGridCellEditor *editor)
{
- m_defaultCellAttr->SetEditor(editor);
+ RegisterDataType(wxGRID_VALUE_STRING,
+ GetDefaultRendererForType(wxGRID_VALUE_STRING),
+ editor);
}
// ----------------------------------------------------------------------------
wxGridCellAttr *wxGrid::GetOrCreateCellAttr(int row, int col) const
{
wxGridCellAttr *attr = (wxGridCellAttr *)NULL;
+ bool canHave = ((wxGrid*)this)->CanHaveAttributes();
- wxCHECK_MSG( m_table, attr,
- _T("we may only be called if CanHaveAttributes() returned true and then m_table should be !NULL") );
+ wxCHECK_MSG( canHave, attr, _T("Cell attributes not allowed"));
+ wxCHECK_MSG( m_table, attr, _T("must have a table") );
attr = m_table->GetAttr(row, col, wxGridCellAttr::Cell);
if ( !attr )
m_canDragGridSize = enable;
}
+void wxGrid::EnableDragCell( bool enable )
+{
+ m_canDragCell = enable;
+}
void wxGrid::SetDefaultRowSize( int height, bool resizeExistingRows )
{
void wxGrid::SetColMinimalWidth( int col, int width )
{
if (width > GetColMinimalAcceptableWidth()) {
- m_colMinWidths[col] = width;
+ wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)col;
+ m_colMinWidths[key] = width;
}
}
void wxGrid::SetRowMinimalHeight( int row, int width )
{
if (width > GetRowMinimalAcceptableHeight()) {
- m_rowMinHeights[row] = width;
+ wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)row;
+ m_rowMinHeights[key] = width;
}
}
int wxGrid::GetColMinimalWidth(int col) const
{
- wxLongToLongHashMap::const_iterator it = m_colMinWidths.find(col);
+ wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)col;
+ wxLongToLongHashMap::const_iterator it = m_colMinWidths.find(key);
return it != m_colMinWidths.end() ? (int)it->second : m_minAcceptableColWidth;
}
int wxGrid::GetRowMinimalHeight(int row) const
{
- wxLongToLongHashMap::const_iterator it = m_rowMinHeights.find(row);
+ wxLongToLongHashMap::key_type key = (wxLongToLongHashMap::key_type)row;
+ wxLongToLongHashMap::const_iterator it = m_rowMinHeights.find(key);
return it != m_rowMinHeights.end() ? (int)it->second : m_minAcceptableRowHeight;
}
width = self->SetOrCalcColumnSizes(true);
height = self->SetOrCalcRowSizes(true);
+ if (!width) width=100;
+ if (!height) height=80;
+
+ // Round up to a multiple the scroll rate NOTE: this still doesn't get rid
+ // of the scrollbars, is there any magic incantaion for that?
+ int xpu, ypu;
+ GetScrollPixelsPerUnit(&xpu, &ypu);
+ if (xpu)
+ width += 1 + xpu - (width % xpu);
+ if (ypu)
+ height += 1 + ypu - (height % ypu);
+
+ // limit to 1/4 of the screen size
int maxwidth, maxheight;
wxDisplaySize( & maxwidth, & maxheight );
-
+ maxwidth /= 2;
+ maxheight /= 2;
if ( width > maxwidth ) width = maxwidth;
if ( height > maxheight ) height = maxheight;
- return wxSize( width, height );
+
+ wxSize best(width, height);
+ // NOTE: This size should be cached, but first we need to add calls to
+ // InvalidateBestSize everywhere that could change the results of this
+ // calculation.
+ // CacheBestSize(size);
+ return best;
}
void wxGrid::Fit()
}
else
{
- rect = wxRect( 0, 0, 0, 0 );
+ rect = wxRect(0,0,0,0);
}
cellRect = CellToRect( bottomRight );
m_gridWin->GetClientSize( &cw, &ch );
if (right < 0 || bottom < 0 || left > cw || top > ch)
- return wxRect( 0, 0, 0, 0);
+ return wxRect(0,0,0,0);
rect.SetLeft( wxMax(0, left) );
rect.SetTop( wxMax(0, top) );