Removed cell highlighting temporarily. Now wxGrid::EnableEditing(bool)
sets the cell edit control to be editable or read-only. Fixed row sizing problem where text was clipped in the cell edit control. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5819 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -49,8 +49,6 @@
|
||||
#define WXGRID_MIN_ROW_HEIGHT 15
|
||||
#define WXGRID_MIN_COL_WIDTH 15
|
||||
#define WXGRID_DEFAULT_SCROLLBAR_WIDTH 16
|
||||
#define WXGRID_DEFAULT_TOPEDIT_WIDTH 300
|
||||
#define WXGRID_DEFAULT_TOPEDIT_HEIGHT 60
|
||||
|
||||
|
||||
class WXDLLEXPORT wxGrid;
|
||||
@@ -398,7 +396,6 @@ class WXDLLEXPORT wxGrid : public wxScrolledWindow
|
||||
int m_numCols;
|
||||
|
||||
wxGridCellCoords m_currentCellCoords;
|
||||
bool m_currentCellHighlighted;
|
||||
|
||||
wxGridCellCoords m_selectedTopLeft;
|
||||
wxGridCellCoords m_selectedBottomRight;
|
||||
@@ -462,8 +459,6 @@ class WXDLLEXPORT wxGrid : public wxScrolledWindow
|
||||
int m_editCtrlType; // for current cell
|
||||
wxWindow* m_cellEditCtrl;
|
||||
bool m_cellEditCtrlEnabled;
|
||||
wxWindow* m_topEditCtrl;
|
||||
bool m_topEditCtrlEnabled;
|
||||
|
||||
|
||||
void Create();
|
||||
@@ -591,16 +586,13 @@ class WXDLLEXPORT wxGrid : public wxScrolledWindow
|
||||
bool IsEditable() { return m_editable; }
|
||||
void EnableEditing( bool edit );
|
||||
|
||||
#if 0 // at the moment the cell edit control is always active
|
||||
void EnableCellEditControl( bool enable );
|
||||
#endif
|
||||
|
||||
bool IsCellEditControlEnabled()
|
||||
{ return (m_cellEditCtrl && m_cellEditCtrlEnabled); }
|
||||
|
||||
void EnableTopEditControl( bool enable );
|
||||
|
||||
bool IsTopEditControlEnabled()
|
||||
{ return (m_topEditCtrl && m_topEditCtrlEnabled); }
|
||||
|
||||
void ShowCellEditControl();
|
||||
void HideCellEditControl();
|
||||
void SetEditControlValue( const wxString& s = wxEmptyString );
|
||||
@@ -691,7 +683,6 @@ class WXDLLEXPORT wxGrid : public wxScrolledWindow
|
||||
wxColour GetCellBackgroundColour( int row, int col );
|
||||
wxColour GetDefaultCellTextColour();
|
||||
wxColour GetCellTextColour( int row, int col );
|
||||
wxColour GetCellHighlightColour();
|
||||
wxFont GetDefaultCellFont();
|
||||
wxFont GetCellFont( int row, int col );
|
||||
void GetDefaultCellAlignment( int *horiz, int *vert );
|
||||
@@ -705,7 +696,6 @@ class WXDLLEXPORT wxGrid : public wxScrolledWindow
|
||||
void SetCellBackgroundColour( int row, int col, const wxColour& );
|
||||
void SetDefaultCellTextColour( const wxColour& );
|
||||
void SetCellTextColour( int row, int col, const wxColour& );
|
||||
void SetCellHighlightColour( const wxColour& );
|
||||
void SetDefaultCellFont( const wxFont& );
|
||||
void SetCellFont( int row, int col, const wxFont& );
|
||||
void SetDefaultCellAlignment( int horiz, int vert );
|
||||
@@ -919,7 +909,7 @@ class WXDLLEXPORT wxGrid : public wxScrolledWindow
|
||||
bool GetEditable() { return IsEditable(); }
|
||||
void SetEditable( bool edit = TRUE ) { EnableEditing( edit ); }
|
||||
bool GetEditInPlace() { return IsCellEditControlEnabled(); }
|
||||
void SetEditInPlace(bool edit = TRUE) { EnableCellEditControl( edit ); }
|
||||
void SetEditInPlace(bool edit = TRUE) { }
|
||||
|
||||
void SetCellAlignment( int align, int row, int col)
|
||||
{ SetCellAlignment(row, col, align, wxCENTER); }
|
||||
|
@@ -941,10 +941,6 @@ void wxGrid::Create()
|
||||
m_colLabelWin = (wxGridColLabelWindow *) NULL;
|
||||
m_cornerLabelWin = (wxGridCornerLabelWindow *) NULL;
|
||||
m_cellEditCtrl = (wxWindow *) NULL;
|
||||
|
||||
// TODO: do we need this or should the top edit control be an add-on ?
|
||||
//
|
||||
m_topEditCtrl = (wxWindow *) NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -998,7 +994,13 @@ void wxGrid::Init()
|
||||
m_colLabelVertAlign = wxTOP;
|
||||
|
||||
m_defaultColWidth = WXGRID_DEFAULT_COL_WIDTH;
|
||||
m_defaultRowHeight = m_gridWin->GetCharHeight() + 8;
|
||||
m_defaultRowHeight = m_gridWin->GetCharHeight();
|
||||
|
||||
#if defined (__WXMOTIF__) // see also text ctrl sizing in ShowCellEditControl()
|
||||
m_defaultRowHeight += 8;
|
||||
#else
|
||||
m_defaultRowHeight += 4;
|
||||
#endif
|
||||
|
||||
m_rowHeights.Alloc( m_numRows );
|
||||
m_rowBottoms.Alloc( m_numRows );
|
||||
@@ -1036,7 +1038,6 @@ void wxGrid::Init()
|
||||
m_colResizeCursor = wxCursor( wxCURSOR_SIZEWE );
|
||||
|
||||
m_currentCellCoords = wxGridNoCellCoords;
|
||||
m_currentCellHighlighted = FALSE;
|
||||
|
||||
m_selectedTopLeft = wxGridNoCellCoords;
|
||||
m_selectedBottomRight = wxGridNoCellCoords;
|
||||
@@ -1063,10 +1064,6 @@ void wxGrid::Init()
|
||||
m_cellEditCtrl->Show( FALSE );
|
||||
m_cellEditCtrlEnabled = TRUE;
|
||||
m_editCtrlType = wxGRID_TEXTCTRL;
|
||||
|
||||
// TODO: do we need this or should the top edit control be an add-on ?
|
||||
//
|
||||
m_topEditCtrlEnabled = FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1970,7 +1967,7 @@ void wxGrid::ClearGrid()
|
||||
{
|
||||
m_table->Clear();
|
||||
SetEditControlValue();
|
||||
if ( !GetBatchCount() ) Refresh();
|
||||
if ( !GetBatchCount() ) m_gridWin->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2444,7 +2441,6 @@ void wxGrid::SetCurrentCell( const wxGridCellCoords& coords )
|
||||
|
||||
if ( m_currentCellCoords != wxGridNoCellCoords )
|
||||
{
|
||||
// HideCurrentCellHighlight( dc );
|
||||
HideCellEditControl();
|
||||
SaveEditControlValue();
|
||||
}
|
||||
@@ -2453,7 +2449,6 @@ void wxGrid::SetCurrentCell( const wxGridCellCoords& coords )
|
||||
|
||||
SetEditControlValue();
|
||||
ShowCellEditControl();
|
||||
// ShowCurrentCellHighlight( dc );
|
||||
|
||||
if ( IsSelection() )
|
||||
{
|
||||
@@ -2909,13 +2904,18 @@ void wxGrid::EnableEditing( bool edit )
|
||||
if ( edit != m_editable )
|
||||
{
|
||||
m_editable = edit;
|
||||
if ( !m_editable ) HideCellEditControl();
|
||||
m_cellEditCtrlEnabled = m_editable;
|
||||
if ( m_editable ) ShowCellEditControl();
|
||||
|
||||
// TODO: extend this for other edit control types
|
||||
//
|
||||
if ( m_editCtrlType == wxGRID_TEXTCTRL )
|
||||
{
|
||||
((wxTextCtrl *)m_cellEditCtrl)->SetEditable( m_editable );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0 // disabled for the moment - the cell control is always active
|
||||
void wxGrid::EnableCellEditControl( bool enable )
|
||||
{
|
||||
if ( m_cellEditCtrl &&
|
||||
@@ -2927,26 +2927,15 @@ void wxGrid::EnableCellEditControl( bool enable )
|
||||
{
|
||||
SetEditControlValue();
|
||||
ShowCellEditControl();
|
||||
// ShowCurrentCellHighlight( dc );
|
||||
}
|
||||
else
|
||||
{
|
||||
// HideCurrentCellHighlight( dc );
|
||||
HideCellEditControl();
|
||||
SaveEditControlValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: not implemented at the moment
|
||||
// Do we want it ?
|
||||
//
|
||||
void wxGrid::EnableTopEditControl( bool enable )
|
||||
{
|
||||
// TODO: do we want this here or should the top edit
|
||||
// control be an add-on class ?
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void wxGrid::ShowCellEditControl()
|
||||
@@ -2972,8 +2961,20 @@ void wxGrid::ShowCellEditControl()
|
||||
int cw, ch;
|
||||
m_gridWin->GetClientSize( &cw, &ch );
|
||||
|
||||
rect.SetLeft( wxMax(0, left) );
|
||||
rect.SetTop( wxMax(0, top) );
|
||||
// Make the edit control large enough to allow for internal margins
|
||||
// TODO: remove this if the text ctrl sizing is improved esp. for unix
|
||||
//
|
||||
#if defined (__WXMOTIF__)
|
||||
rect.SetLeft( wxMax(0, left-4) );
|
||||
rect.SetTop( wxMax(0, top-4) );
|
||||
rect.SetRight( rect.GetRight() + 8 );
|
||||
rect.SetBottom( rect.GetBottom() + 8 );
|
||||
#else
|
||||
rect.SetLeft( wxMax(0, left-2) );
|
||||
rect.SetTop( wxMax(0, top-2) );
|
||||
rect.SetRight( rect.GetRight() + 4 );
|
||||
rect.SetBottom( rect.GetBottom() + 4 );
|
||||
#endif
|
||||
|
||||
m_cellEditCtrl->SetSize( rect );
|
||||
m_cellEditCtrl->Show( TRUE );
|
||||
@@ -3025,34 +3026,6 @@ void wxGrid::SetEditControlValue( const wxString& value )
|
||||
else
|
||||
s = value;
|
||||
|
||||
// TODO: no top edit control implemented at the moment...
|
||||
// Do we want it in this class ?
|
||||
//
|
||||
if ( IsTopEditControlEnabled() )
|
||||
{
|
||||
switch ( m_editCtrlType )
|
||||
{
|
||||
case wxGRID_TEXTCTRL:
|
||||
((wxGridTextCtrl *)m_topEditCtrl)->SetStartValue(s);
|
||||
break;
|
||||
|
||||
case wxGRID_CHECKBOX:
|
||||
// TODO: implement this
|
||||
//
|
||||
break;
|
||||
|
||||
case wxGRID_CHOICE:
|
||||
// TODO: implement this
|
||||
//
|
||||
break;
|
||||
|
||||
case wxGRID_COMBOBOX:
|
||||
// TODO: implement this
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( IsCellEditControlEnabled() )
|
||||
{
|
||||
switch ( m_editCtrlType )
|
||||
@@ -3091,10 +3064,6 @@ void wxGrid::SaveEditControlValue()
|
||||
{
|
||||
ctrl = m_cellEditCtrl;
|
||||
}
|
||||
else if ( IsTopEditControlEnabled() )
|
||||
{
|
||||
ctrl = m_topEditCtrl;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
@@ -3952,14 +3921,6 @@ wxColour wxGrid::GetCellTextColour( int WXUNUSED(row), int WXUNUSED(col) )
|
||||
}
|
||||
|
||||
|
||||
wxColour wxGrid::GetCellHighlightColour()
|
||||
{
|
||||
// TODO: replace this temp test code
|
||||
//
|
||||
return wxColour( 0, 0, 0 );
|
||||
}
|
||||
|
||||
|
||||
wxFont wxGrid::GetDefaultCellFont()
|
||||
{
|
||||
return m_defaultCellFont;
|
||||
@@ -4104,12 +4065,6 @@ void wxGrid::SetCellTextColour( int WXUNUSED(row), int WXUNUSED(col), const wxCo
|
||||
//
|
||||
}
|
||||
|
||||
void wxGrid::SetCellHighlightColour( const wxColour& )
|
||||
{
|
||||
// TODO: everything !!!
|
||||
//
|
||||
}
|
||||
|
||||
void wxGrid::SetDefaultCellFont( const wxFont& )
|
||||
{
|
||||
// TODO: everything !!!
|
||||
|
Reference in New Issue
Block a user