git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70201
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
@return
@true if this item should be enabled, @false otherwise.
@return
@true if this item should be enabled, @false otherwise.
- @note Currently disabling items is fully implemented only for the
- native control implementation in wxOSX/Cocoa and wxGTK.
- This feature is only partially supported in the generic
- version (used by wxMSW) and not supported by the wxOSX/Carbon
+ @note Currently disabling items is not supported by the wxOSX/Carbon
implementation.
@since 2.9.2
implementation.
@since 2.9.2
wxDataViewColumn *FindColumnForEditing(const wxDataViewItem& item, wxDataViewCellMode mode);
wxDataViewColumn *FindColumnForEditing(const wxDataViewItem& item, wxDataViewCellMode mode);
+ bool IsCellEditableInMode(const wxDataViewItem& item, const wxDataViewColumn *col, wxDataViewCellMode mode) const;
+
void DrawCellBackground( wxDataViewRenderer* cell, wxDC& dc, const wxRect& rect );
private:
void DrawCellBackground( wxDataViewRenderer* cell, wxDC& dc, const wxRect& rect );
private:
unsigned int col,
const wxMouseEvent *mouseEvent)
{
unsigned int col,
const wxMouseEvent *mouseEvent)
{
- if ( !model->IsEnabled(item, col) )
- return false;
-
if ( mouseEvent )
{
// only react to clicks directly on the checkbox, not elsewhere in the same cell:
if ( mouseEvent )
{
// only react to clicks directly on the checkbox, not elsewhere in the same cell:
const wxDataViewColumn* col)
{
wxDataViewRenderer* renderer = col->GetRenderer();
const wxDataViewColumn* col)
{
wxDataViewRenderer* renderer = col->GetRenderer();
- if (renderer->GetMode() != wxDATAVIEW_CELL_EDITABLE)
+ if ( !IsCellEditableInMode(item, col, wxDATAVIEW_CELL_EDITABLE) )
return;
const wxRect itemRect = GetItemRect(item, col);
return;
const wxRect itemRect = GetItemRect(item, col);
wxDataViewColumn *candidate = m_currentCol;
if ( candidate &&
wxDataViewColumn *candidate = m_currentCol;
if ( candidate &&
- candidate->GetRenderer()->GetMode() != mode &&
+ !IsCellEditableInMode(item, candidate, mode) &&
!m_currentColSetByKeyboard )
{
// If current column was set by mouse to something not editable (in
!m_currentColSetByKeyboard )
{
// If current column was set by mouse to something not editable (in
if ( c->IsHidden() )
continue;
if ( c->IsHidden() )
continue;
- if ( c->GetRenderer()->GetMode() == mode )
+ if ( IsCellEditableInMode(item, c, mode) )
if ( !candidate )
return NULL;
if ( !candidate )
return NULL;
- if ( candidate->GetRenderer()->GetMode() != mode )
+ if ( !IsCellEditableInMode(item, candidate, mode) )
return NULL;
return candidate;
}
return NULL;
return candidate;
}
+bool wxDataViewMainWindow::IsCellEditableInMode(const wxDataViewItem& item,
+ const wxDataViewColumn *col,
+ wxDataViewCellMode mode) const
+{
+ if ( col->GetRenderer()->GetMode() != mode )
+ return false;
+
+ if ( !GetModel()->IsEnabled(item, col->GetModelColumn()) )
+ return false;
+
+ return true;
+}
+
void wxDataViewMainWindow::OnCharHook(wxKeyEvent& event)
{
if ( m_editorCtrl )
void wxDataViewMainWindow::OnCharHook(wxKeyEvent& event)
{
if ( m_editorCtrl )
if (m_lastOnSame && !ignore_other_columns)
{
if ((col == m_currentCol) && (current == m_currentRow) &&
if (m_lastOnSame && !ignore_other_columns)
{
if ((col == m_currentCol) && (current == m_currentRow) &&
- (cell->GetMode() & wxDATAVIEW_CELL_EDITABLE) )
+ IsCellEditableInMode(item, col, wxDATAVIEW_CELL_EDITABLE) )
{
m_renameTimer->Start( 100, true );
}
{
m_renameTimer->Start( 100, true );
}
(current == oldCurrentRow)) && oldWasSelected;
// Call ActivateCell() after everything else as under GTK+
(current == oldCurrentRow)) && oldWasSelected;
// Call ActivateCell() after everything else as under GTK+
- if (cell->GetMode() & wxDATAVIEW_CELL_ACTIVATABLE)
+ if ( IsCellEditableInMode(item, col, wxDATAVIEW_CELL_ACTIVATABLE) )
{
// notify cell about click
cell->PrepareForItem(model, item, col->GetModelColumn());
{
// notify cell about click
cell->PrepareForItem(model, item, col->GetModelColumn());