wxWidgets/include/wx/generic/dvrenderer.h
Václav Slavík dc73d7f5d4 Cleanup of wxDataViewCtrl cell activation code.
Fix confusion of what cell activation is and inconsistence with native
handling in GTK+. Document the distinction between activating (~
editing) a cell and activating (double-clicking) the whole item.

Deprecate wxDataViewCustomRenderer::LeftClick() and Activate() methods,
replace them with single ActivateCell() that is called for both kinds of
activation.

Fix implementations so that ActivateCell() is not called on
double-click, when it shouldn't, and vice versa: don't send
wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED for cell activation.

Partially reverts r67099 -- restores old 2.9 signatures of compatibility
LeftClick() and Activate() methods.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-10-19 16:20:17 +00:00

69 lines
2.5 KiB
C++

///////////////////////////////////////////////////////////////////////////////
// Name: wx/generic/dvrenderer.h
// Purpose: wxDataViewRenderer for generic wxDataViewCtrl implementation
// Author: Robert Roebling, Vadim Zeitlin
// Created: 2009-11-07 (extracted from wx/generic/dataview.h)
// RCS-ID: $Id$
// Copyright: (c) 2006 Robert Roebling
// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GENERIC_DVRENDERER_H_
#define _WX_GENERIC_DVRENDERER_H_
// ----------------------------------------------------------------------------
// wxDataViewRenderer
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewCustomRendererBase
{
public:
wxDataViewRenderer( const wxString &varianttype,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
virtual ~wxDataViewRenderer();
virtual wxDC *GetDC();
virtual void SetAlignment( int align );
virtual int GetAlignment() const;
virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE)
{ m_ellipsizeMode = mode; }
virtual wxEllipsizeMode GetEllipsizeMode() const
{ return m_ellipsizeMode; }
virtual void SetMode( wxDataViewCellMode mode )
{ m_mode = mode; }
virtual wxDataViewCellMode GetMode() const
{ return m_mode; }
// implementation
// This callback is used by generic implementation of wxDVC itself. It's
// different from the corresponding ActivateCell() method which should only
// be overridable for the custom renderers while the generic implementation
// uses this one for all of them, including the standard ones.
virtual bool WXActivateCell(const wxRect& WXUNUSED(cell),
wxDataViewModel *WXUNUSED(model),
const wxDataViewItem & WXUNUSED(item),
unsigned int WXUNUSED(col),
const wxMouseEvent* WXUNUSED(mouseEvent))
{ return false; }
private:
int m_align;
wxDataViewCellMode m_mode;
wxEllipsizeMode m_ellipsizeMode;
wxDC *m_dc;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
};
#endif // _WX_GENERIC_DVRENDERER_H_