Add wxDataViewTextRendererAttr, blind noop under wxMac
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49730 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
#include "wx/textctrl.h"
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/variant.h"
|
||||
#include "wx/listctrl.h"
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/icon.h"
|
||||
|
||||
@@ -118,6 +117,42 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataViewItemAttr: a structure containing the visual attributes of an item
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// TODO: this should be renamed to wxItemAttr or something general like this
|
||||
|
||||
class WXDLLIMPEXP_ADV wxDataViewItemAttr
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
wxDataViewItemAttr()
|
||||
{
|
||||
m_bold = false;
|
||||
m_italic = false;
|
||||
}
|
||||
|
||||
// setters
|
||||
void SetColour(const wxColour& colour) { m_colour = colour; }
|
||||
void SetBold( bool set ) { m_bold = set; }
|
||||
void SetItalic( bool set ) { m_italic = set; }
|
||||
|
||||
// accessors
|
||||
bool HasColour() const { return m_colour.Ok(); }
|
||||
const wxColour& GetColour() const { return m_colour; }
|
||||
|
||||
bool GetBold() const { return m_bold; }
|
||||
bool GetItalic() const { return m_italic; }
|
||||
|
||||
private:
|
||||
wxColour m_colour;
|
||||
bool m_bold;
|
||||
bool m_italic;
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewModel
|
||||
// ---------------------------------------------------------
|
||||
@@ -143,6 +178,10 @@ public:
|
||||
virtual bool SetValue( const wxVariant &variant,
|
||||
const wxDataViewItem &item, unsigned int col ) = 0;
|
||||
|
||||
// Get text attribute, return false of default attributes should be used
|
||||
virtual bool GetAttr( const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col), wxDataViewItemAttr &WXUNUSED(attr) )
|
||||
{ return false; }
|
||||
|
||||
// define hierachy
|
||||
virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const = 0;
|
||||
virtual bool IsContainer( const wxDataViewItem &item ) const = 0;
|
||||
@@ -197,6 +236,9 @@ public:
|
||||
virtual bool SetValue( const wxVariant &variant,
|
||||
unsigned int row, unsigned int col ) = 0;
|
||||
|
||||
virtual bool GetAttr( unsigned int WXUNUSED(row), unsigned int WXUNUSED(col), wxDataViewItemAttr &WXUNUSED(attr) )
|
||||
{ return false; }
|
||||
|
||||
void RowPrepended();
|
||||
void RowInserted( unsigned int before );
|
||||
void RowAppended();
|
||||
@@ -221,6 +263,7 @@ public:
|
||||
const wxDataViewItem &item, unsigned int col ) const;
|
||||
virtual bool SetValue( const wxVariant &variant,
|
||||
const wxDataViewItem &item, unsigned int col );
|
||||
virtual bool GetAttr( const wxDataViewItem &item, unsigned int col, wxDataViewItemAttr &attr );
|
||||
virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const;
|
||||
virtual bool IsContainer( const wxDataViewItem &item ) const;
|
||||
virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const;
|
||||
|
||||
@@ -78,11 +78,20 @@ public:
|
||||
|
||||
// Create DC on request
|
||||
virtual wxDC *GetDC();
|
||||
|
||||
void SetHasAttr( bool set ) { m_hasAttr = set; }
|
||||
void SetAttr( const wxDataViewItemAttr &attr ) { m_attr = attr; }
|
||||
bool GetWantsAttr() { return m_wantsAttr; }
|
||||
|
||||
private:
|
||||
wxDC *m_dc;
|
||||
int m_align;
|
||||
wxDataViewCellMode m_mode;
|
||||
|
||||
protected:
|
||||
bool m_wantsAttr;
|
||||
bool m_hasAttr;
|
||||
wxDataViewItemAttr m_attr;
|
||||
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
|
||||
@@ -128,13 +137,30 @@ public:
|
||||
virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
|
||||
virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
|
||||
|
||||
private:
|
||||
protected:
|
||||
wxString m_text;
|
||||
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewTextRendererAttr
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxDataViewTextRendererAttr: public wxDataViewTextRenderer
|
||||
{
|
||||
public:
|
||||
wxDataViewTextRendererAttr( const wxString &varianttype = wxT("string"),
|
||||
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
||||
int align = wxDVR_DEFAULT_ALIGNMENT );
|
||||
|
||||
bool Render( wxRect cell, wxDC *dc, int state );
|
||||
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRendererAttr)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewBitmapRenderer
|
||||
// ---------------------------------------------------------
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
// implementation
|
||||
GtkCellRenderer* GetGtkHandle() { return m_renderer; }
|
||||
void GtkInitHandlers();
|
||||
virtual bool GtkHasAttributes() { return false; }
|
||||
|
||||
protected:
|
||||
GtkCellRenderer *m_renderer;
|
||||
@@ -71,6 +72,24 @@ protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewTextRendererAttr
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxDataViewTextRendererAttr: public wxDataViewTextRenderer
|
||||
{
|
||||
public:
|
||||
wxDataViewTextRendererAttr( const wxString &varianttype = wxT("string"),
|
||||
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
|
||||
int align = wxDVR_DEFAULT_ALIGNMENT );
|
||||
|
||||
// implementation
|
||||
bool GtkHasAttributes() { return true; }
|
||||
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRendererAttr)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewBitmapRenderer
|
||||
// ---------------------------------------------------------
|
||||
|
||||
@@ -232,6 +232,22 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewTextRendererAttr
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxDataViewTextRendererAttr: public wxDataViewTextRenderer
|
||||
{
|
||||
public:
|
||||
//
|
||||
// constructors / destructor
|
||||
//
|
||||
wxDataViewTextRendererAttr(wxString const& varianttype=wxT("string"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRendererAttr)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewBitmapRenderer
|
||||
// ---------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user