2001-05-27 11:22:28 -04: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 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2001-05-27 11:22:28 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_GENERIC_GRIDCTRL_H_
|
|
|
|
#define _WX_GENERIC_GRIDCTRL_H_
|
|
|
|
|
|
|
|
#include "wx/grid.h"
|
2006-10-03 10:28:36 -04:00
|
|
|
|
|
|
|
#if wxUSE_GRID
|
2001-05-27 11:22:28 -04:00
|
|
|
|
|
|
|
#define wxGRID_VALUE_CHOICEINT _T("choiceint")
|
|
|
|
#define wxGRID_VALUE_DATETIME _T("datetime")
|
|
|
|
|
2003-02-05 19:53:46 -05:00
|
|
|
#if wxUSE_DATETIME
|
2007-08-15 07:46:57 -04:00
|
|
|
|
|
|
|
#include "wx/datetime.h"
|
2003-02-05 19:53:46 -05:00
|
|
|
|
2001-05-27 11:22:28 -04:00
|
|
|
// the default renderer for the cells containing Time and dates..
|
2003-08-01 21:04:55 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
|
2001-05-27 11:22:28 -04:00
|
|
|
{
|
|
|
|
public:
|
2005-09-24 17:43:15 -04:00
|
|
|
wxGridCellDateTimeRenderer(const wxString& outformat = wxDefaultDateTimeFormat,
|
|
|
|
const wxString& informat = wxDefaultDateTimeFormat);
|
2001-05-27 11:22:28 -04: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 17:43:15 -04:00
|
|
|
wxString GetString(const wxGrid& grid, int row, int col);
|
2001-05-27 11:22:28 -04:00
|
|
|
|
|
|
|
wxString m_iformat;
|
|
|
|
wxString m_oformat;
|
|
|
|
wxDateTime m_dateDef;
|
|
|
|
wxDateTime::TimeZone m_tz;
|
|
|
|
};
|
|
|
|
|
2003-02-05 19:53:46 -05:00
|
|
|
#endif // wxUSE_DATETIME
|
2001-05-27 11:22:28 -04:00
|
|
|
|
|
|
|
// the default renderer for the cells containing Time and dates..
|
2003-08-01 21:04:55 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellStringRenderer
|
2001-05-27 11:22:28 -04: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 17:43:15 -04:00
|
|
|
wxString GetString(const wxGrid& grid, int row, int col);
|
2001-05-27 11:22:28 -04:00
|
|
|
|
|
|
|
wxArrayString m_choices;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-07-03 15:38:19 -04:00
|
|
|
#if wxUSE_COMBOBOX
|
|
|
|
|
2003-08-01 21:04:55 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor
|
2001-05-27 11:22:28 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxGridCellEnumEditor( const wxString& choices = wxEmptyString );
|
2004-10-13 10:04:19 -04:00
|
|
|
virtual ~wxGridCellEnumEditor() {}
|
2001-05-27 11:22:28 -04: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-21 20:24:07 -04:00
|
|
|
|
|
|
|
DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor)
|
2001-05-27 11:22:28 -04:00
|
|
|
};
|
|
|
|
|
2001-07-03 15:38:19 -04:00
|
|
|
#endif // wxUSE_COMBOBOX
|
2001-05-27 11:22:28 -04:00
|
|
|
|
2003-08-01 21:04:55 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
|
2001-05-27 11:22:28 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { }
|
|
|
|
virtual void Create(wxWindow* parent,
|
|
|
|
wxWindowID id,
|
|
|
|
wxEvtHandler* evtHandler);
|
|
|
|
|
|
|
|
virtual wxGridCellEditor *Clone() const
|
|
|
|
{ return new wxGridCellAutoWrapStringEditor; }
|
2003-07-21 20:24:07 -04:00
|
|
|
|
|
|
|
DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor)
|
2001-05-27 11:22:28 -04:00
|
|
|
};
|
|
|
|
|
2003-08-01 21:04:55 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
|
2001-05-27 11:22:28 -04: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 17:43:15 -04:00
|
|
|
const wxGridCellAttr& attr,
|
2001-05-27 11:22:28 -04:00
|
|
|
const wxRect& rect,
|
|
|
|
int row, int col);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2006-10-03 10:28:36 -04:00
|
|
|
#endif // wxUSE_GRID
|
|
|
|
#endif // _WX_GENERIC_GRIDCTRL_H_
|