Merge branch 'grid-corner-label'

Add wxGrid::SetCornerLabelValue().

See https://github.com/wxWidgets/wxWidgets/pull/928
This commit is contained in:
Vadim Zeitlin
2018-09-17 22:56:00 +02:00
6 changed files with 366 additions and 55 deletions

View File

@@ -325,28 +325,17 @@ protected:
// wxGridHeaderRenderer and company: like wxGridCellRenderer but for headers
// ----------------------------------------------------------------------------
// Base class for corner window renderer: it is the simplest of all renderers
// and only has a single function
class WXDLLIMPEXP_CORE wxGridCornerHeaderRenderer
// Base class for header cells renderers.
class WXDLLIMPEXP_CORE wxGridHeaderLabelsRenderer
{
public:
// Draw the border around the corner window.
virtual ~wxGridHeaderLabelsRenderer() {}
// Draw the border around cell window.
virtual void DrawBorder(const wxGrid& grid,
wxDC& dc,
wxRect& rect) const = 0;
// make the dtor of a class with virtual functions virtual to avoid g++
// warnings, even though this class is not supposed to be used
// polymorphically
virtual ~wxGridCornerHeaderRenderer() { }
};
// Base class for the row/column header cells renderers
class WXDLLIMPEXP_CORE wxGridHeaderLabelsRenderer
: public wxGridCornerHeaderRenderer
{
public:
// Draw header cell label
virtual void DrawLabel(const wxGrid& grid,
wxDC& dc,
@@ -371,6 +360,11 @@ class WXDLLIMPEXP_CORE wxGridColumnHeaderRenderer
{
};
class WXDLLIMPEXP_CORE wxGridCornerHeaderRenderer
: public wxGridHeaderLabelsRenderer
{
};
// Also define the default renderers which are used by wxGridCellAttrProvider
// by default
class WXDLLIMPEXP_CORE wxGridRowHeaderRendererDefault
@@ -745,8 +739,10 @@ public:
virtual wxString GetRowLabelValue( int row );
virtual wxString GetColLabelValue( int col );
virtual wxString GetCornerLabelValue() const;
virtual void SetRowLabelValue( int WXUNUSED(row), const wxString& ) {}
virtual void SetColLabelValue( int WXUNUSED(col), const wxString& ) {}
virtual void SetCornerLabelValue( const wxString& ) {}
// Attribute handling
//
@@ -870,8 +866,10 @@ public:
void SetRowLabelValue( int row, const wxString& ) wxOVERRIDE;
void SetColLabelValue( int col, const wxString& ) wxOVERRIDE;
void SetCornerLabelValue( const wxString& ) wxOVERRIDE;
wxString GetRowLabelValue( int row ) wxOVERRIDE;
wxString GetColLabelValue( int col ) wxOVERRIDE;
wxString GetCornerLabelValue() const wxOVERRIDE;
private:
wxGridStringArray m_data;
@@ -888,6 +886,8 @@ private:
wxArrayString m_rowLabels;
wxArrayString m_colLabels;
wxString m_cornerLabel;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGridStringTable);
};
@@ -1223,9 +1223,12 @@ public:
wxFont GetLabelFont() const { return m_labelFont; }
void GetRowLabelAlignment( int *horiz, int *vert ) const;
void GetColLabelAlignment( int *horiz, int *vert ) const;
void GetCornerLabelAlignment( int *horiz, int *vert ) const;
int GetColLabelTextOrientation() const;
int GetCornerLabelTextOrientation() const;
wxString GetRowLabelValue( int row ) const;
wxString GetColLabelValue( int col ) const;
wxString GetCornerLabelValue() const;
wxColour GetCellHighlightColour() const { return m_cellHighlightColour; }
int GetCellHighlightPenWidth() const { return m_cellHighlightPenWidth; }
@@ -1247,9 +1250,12 @@ public:
void SetLabelFont( const wxFont& );
void SetRowLabelAlignment( int horiz, int vert );
void SetColLabelAlignment( int horiz, int vert );
void SetCornerLabelAlignment( int horiz, int vert );
void SetColLabelTextOrientation( int textOrientation );
void SetCornerLabelTextOrientation( int textOrientation );
void SetRowLabelValue( int row, const wxString& );
void SetColLabelValue( int col, const wxString& );
void SetCornerLabelValue( const wxString& );
void SetCellHighlightColour( const wxColour& );
void SetCellHighlightPenWidth(int width);
void SetCellHighlightROPenWidth(int width);
@@ -1970,6 +1976,9 @@ protected:
int m_colLabelHorizAlign;
int m_colLabelVertAlign;
int m_colLabelTextOrientation;
int m_cornerLabelHorizAlign;
int m_cornerLabelVertAlign;
int m_cornerLabelTextOrientation;
bool m_defaultRowLabelValues;
bool m_defaultColLabelValues;