2001-05-27 15:22:28 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: generic/gridctrl.h
|
|
|
|
// Purpose: wxGrid controls
|
|
|
|
// Author: Paul Gammans, Roger Gammans
|
|
|
|
// Modified by:
|
|
|
|
// Created: 11/04/2001
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) The Computer Surgery (paul@compsurg.co.uk)
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
2001-05-27 15:22:28 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_GENERIC_GRIDCTRL_H_
|
|
|
|
#define _WX_GENERIC_GRIDCTRL_H_
|
|
|
|
|
|
|
|
#include "wx/grid.h"
|
2006-10-03 14:28:36 +00:00
|
|
|
|
|
|
|
#if wxUSE_GRID
|
2001-05-27 15:22:28 +00:00
|
|
|
|
|
|
|
#define wxGRID_VALUE_CHOICEINT _T("choiceint")
|
|
|
|
#define wxGRID_VALUE_DATETIME _T("datetime")
|
|
|
|
|
2003-02-06 00:53:46 +00:00
|
|
|
#if wxUSE_DATETIME
|
|
|
|
|
2001-05-27 15:22:28 +00:00
|
|
|
// the default renderer for the cells containing Time and dates..
|
2003-08-02 01:04:55 +00:00
|
|
|
class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
|
2001-05-27 15:22:28 +00:00
|
|
|
{
|
|
|
|
public:
|
2005-09-24 21:43:15 +00:00
|
|
|
wxGridCellDateTimeRenderer(const wxString& outformat = wxDefaultDateTimeFormat,
|
|
|
|
const wxString& informat = wxDefaultDateTimeFormat);
|
2001-05-27 15:22:28 +00:00
|
|
|
|
|
|
|
// draw the string right aligned
|
|
|
|
virtual void Draw(wxGrid& grid,
|
|
|
|
wxGridCellAttr& attr,
|
|
|
|
wxDC& dc,
|
|
|
|
const wxRect& rect,
|
|
|
|
int row, int col,
|
|
|
|
bool isSelected);
|
|
|
|
|
|
|
|
virtual wxSize GetBestSize(wxGrid& grid,
|
|
|
|
wxGridCellAttr& attr,
|
|
|
|
wxDC& dc,
|
|
|
|
int row, int col);
|
|
|
|
|
|
|
|
virtual wxGridCellRenderer *Clone() const;
|
|
|
|
|
|
|
|
// parameters string format is "width[,precision]"
|
|
|
|
virtual void SetParameters(const wxString& params);
|
|
|
|
|
|
|
|
protected:
|
2005-09-24 21:43:15 +00:00
|
|
|
wxString GetString(const wxGrid& grid, int row, int col);
|
2001-05-27 15:22:28 +00:00
|
|
|
|
|
|
|
wxString m_iformat;
|
|
|
|
wxString m_oformat;
|
|
|
|
wxDateTime m_dateDef;
|
|
|
|
wxDateTime::TimeZone m_tz;
|
|
|
|
};
|
|
|
|
|
2003-02-06 00:53:46 +00:00
|
|
|
#endif // wxUSE_DATETIME
|
2001-05-27 15:22:28 +00:00
|
|
|
|
|
|
|
// the default renderer for the cells containing Time and dates..
|
2003-08-02 01:04:55 +00:00
|
|
|
class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellStringRenderer
|
2001-05-27 15:22:28 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxGridCellEnumRenderer( const wxString& choices = wxEmptyString );
|
|
|
|
|
|
|
|
// draw the string right aligned
|
|
|
|
virtual void Draw(wxGrid& grid,
|
|
|
|
wxGridCellAttr& attr,
|
|
|
|
wxDC& dc,
|
|
|
|
const wxRect& rect,
|
|
|
|
int row, int col,
|
|
|
|
bool isSelected);
|
|
|
|
|
|
|
|
virtual wxSize GetBestSize(wxGrid& grid,
|
|
|
|
wxGridCellAttr& attr,
|
|
|
|
wxDC& dc,
|
|
|
|
int row, int col);
|
|
|
|
|
|
|
|
virtual wxGridCellRenderer *Clone() const;
|
|
|
|
|
|
|
|
// parameters string format is "item1[,item2[...,itemN]]"
|
|
|
|
virtual void SetParameters(const wxString& params);
|
|
|
|
|
|
|
|
protected:
|
2005-09-24 21:43:15 +00:00
|
|
|
wxString GetString(const wxGrid& grid, int row, int col);
|
2001-05-27 15:22:28 +00:00
|
|
|
|
|
|
|
wxArrayString m_choices;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-07-03 19:38:19 +00:00
|
|
|
#if wxUSE_COMBOBOX
|
|
|
|
|
2003-08-02 01:04:55 +00:00
|
|
|
class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor
|
2001-05-27 15:22:28 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxGridCellEnumEditor( const wxString& choices = wxEmptyString );
|
2004-10-13 14:04:19 +00:00
|
|
|
virtual ~wxGridCellEnumEditor() {}
|
2001-05-27 15:22:28 +00:00
|
|
|
|
|
|
|
virtual wxGridCellEditor* Clone() const;
|
|
|
|
|
|
|
|
virtual bool EndEdit(int row, int col, wxGrid* grid);
|
|
|
|
virtual void BeginEdit(int row, int col, wxGrid* grid);
|
|
|
|
|
|
|
|
private:
|
|
|
|
long int m_startint;
|
2003-07-22 00:24:07 +00:00
|
|
|
|
|
|
|
DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor)
|
2001-05-27 15:22:28 +00:00
|
|
|
};
|
|
|
|
|
2001-07-03 19:38:19 +00:00
|
|
|
#endif // wxUSE_COMBOBOX
|
2001-05-27 15:22:28 +00:00
|
|
|
|
2003-08-02 01:04:55 +00:00
|
|
|
class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
|
2001-05-27 15:22:28 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { }
|
|
|
|
virtual void Create(wxWindow* parent,
|
|
|
|
wxWindowID id,
|
|
|
|
wxEvtHandler* evtHandler);
|
|
|
|
|
|
|
|
virtual wxGridCellEditor *Clone() const
|
|
|
|
{ return new wxGridCellAutoWrapStringEditor; }
|
2003-07-22 00:24:07 +00:00
|
|
|
|
|
|
|
DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor)
|
2001-05-27 15:22:28 +00:00
|
|
|
};
|
|
|
|
|
2003-08-02 01:04:55 +00:00
|
|
|
class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
|
2001-05-27 15:22:28 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxGridCellAutoWrapStringRenderer() : wxGridCellStringRenderer() { }
|
|
|
|
|
|
|
|
virtual void Draw(wxGrid& grid,
|
|
|
|
wxGridCellAttr& attr,
|
|
|
|
wxDC& dc,
|
|
|
|
const wxRect& rect,
|
|
|
|
int row, int col,
|
|
|
|
bool isSelected);
|
|
|
|
|
|
|
|
virtual wxSize GetBestSize(wxGrid& grid,
|
|
|
|
wxGridCellAttr& attr,
|
|
|
|
wxDC& dc,
|
|
|
|
int row, int col);
|
|
|
|
|
|
|
|
virtual wxGridCellRenderer *Clone() const
|
|
|
|
{ return new wxGridCellAutoWrapStringRenderer; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxArrayString GetTextLines( wxGrid& grid,
|
|
|
|
wxDC& dc,
|
2005-09-24 21:43:15 +00:00
|
|
|
const wxGridCellAttr& attr,
|
2001-05-27 15:22:28 +00:00
|
|
|
const wxRect& rect,
|
|
|
|
int row, int col);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2006-10-03 14:28:36 +00:00
|
|
|
#endif // wxUSE_GRID
|
|
|
|
#endif // _WX_GENERIC_GRIDCTRL_H_
|