DECLARE_EVENT_TABLE()
};
-class WXDLLEXPORT wxGridWindow : public wxPanel
+class WXDLLEXPORT wxGridWindow : public wxWindow
{
public:
wxGridWindow()
{
return m_colText;
}
- else if (m_defGridAttr != this)
+ else if (m_defGridAttr && m_defGridAttr != this)
{
return m_defGridAttr->GetTextColour();
}
{
if (HasBackgroundColour())
return m_colBack;
- else if (m_defGridAttr != this)
+ else if (m_defGridAttr && m_defGridAttr != this)
return m_defGridAttr->GetBackgroundColour();
else
{
{
if (HasFont())
return m_font;
- else if (m_defGridAttr != this)
+ else if (m_defGridAttr && m_defGridAttr != this)
return m_defGridAttr->GetFont();
else
{
if ( hAlign ) *hAlign = m_hAlign;
if ( vAlign ) *vAlign = m_vAlign;
}
- else if (m_defGridAttr != this)
+ else if (m_defGridAttr && m_defGridAttr != this)
m_defGridAttr->GetAlignment(hAlign, vAlign);
else
{
if ( !renderer )
{
- if ( this != m_defGridAttr )
+ if (m_defGridAttr && this != m_defGridAttr )
{
// if we still don't have one then use the grid default
// (no need for IncRef() here neither)
if ( !editor )
{
- if ( this != m_defGridAttr )
+ if ( m_defGridAttr && this != m_defGridAttr )
{
// if we still don't have one then use the grid default
// (no need for IncRef() here neither)
//////////////////////////////////////////////////////////////////////
-IMPLEMENT_DYNAMIC_CLASS( wxGridWindow, wxPanel )
+IMPLEMENT_DYNAMIC_CLASS( wxGridWindow, wxWindow )
-BEGIN_EVENT_TABLE( wxGridWindow, wxPanel )
+BEGIN_EVENT_TABLE( wxGridWindow, wxWindow )
EVT_PAINT( wxGridWindow::OnPaint )
EVT_MOUSEWHEEL( wxGridWindow::OnMouseWheel)
EVT_MOUSE_EVENTS( wxGridWindow::OnMouseEvent )
wxGridRowLabelWindow *rowLblWin,
wxGridColLabelWindow *colLblWin,
wxWindowID id, const wxPoint &pos, const wxSize &size )
- : wxPanel( parent, id, pos, size, wxWANTS_CHARS, "grid window" )
+ : wxWindow( parent, id, pos, size, wxWANTS_CHARS, "grid window" )
{
m_owner = parent;
m_rowLabelWin = rowLblWin;
void wxGridWindow::ScrollWindow( int dx, int dy, const wxRect *rect )
{
- wxPanel::ScrollWindow( dx, dy, rect );
+ wxWindow::ScrollWindow( dx, dy, rect );
m_rowLabelWin->ScrollWindow( 0, dy, rect );
m_colLabelWin->ScrollWindow( dx, 0, rect );
}
m_cellEditCtrlEnabled = FALSE;
- m_defaultCellAttr = new wxGridCellAttr(m_defaultCellAttr);
+ m_defaultCellAttr = new wxGridCellAttr();
// Set default cell attributes
+ m_defaultCellAttr->SetDefAttr(m_defaultCellAttr);
m_defaultCellAttr->SetKind(wxGridCellAttr::Default);
m_defaultCellAttr->SetFont(GetFont());
m_defaultCellAttr->SetAlignment(wxALIGN_LEFT, wxALIGN_TOP);
m_defaultCellAttr->SetTextColour(
- wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOWTEXT));
+ wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
m_defaultCellAttr->SetBackgroundColour(
- wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
+ wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
m_defaultCellAttr->SetRenderer(new wxGridCellStringRenderer);
m_defaultCellAttr->SetEditor(new wxGridCellTextEditor);
m_selectingTopLeft = wxGridNoCellCoords;
m_selectingBottomRight = wxGridNoCellCoords;
- m_selectionBackground = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHT);
- m_selectionForeground = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
+ m_selectionBackground = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
+ m_selectionForeground = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
m_editable = TRUE; // default for whole grid
m_batchCount = 0;
m_extraWidth =
- m_extraHeight = 50;
+ m_extraHeight = 0;
}
// ----------------------------------------------------------------------------
int cw, ch;
GetClientSize( &cw, &ch );
- if ( m_colLabelWin->IsShown() )
- cw -= m_rowLabelWidth;
if ( m_rowLabelWin->IsShown() )
+ cw -= m_rowLabelWidth;
+ if ( m_colLabelWin->IsShown() )
ch -= m_colLabelHeight;
// grid total size
|| editor->IsAcceptedKey(event) )
{
EnableCellEditControl();
- editor->StartingKey(event);
+
+ // the editor could be not shown for a variety of
+ // reasons (i.e. blocked by the app or whatever), so
+ // check if it really was created
+ if ( m_cellEditCtrlEnabled )
+ {
+ editor->StartingKey(event);
+ }
}
else
{