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_
|
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
2001-05-27 11:22:28 -04:00
|
|
|
#pragma interface "gridctrl.h"
|
|
|
|
#endif
|
|
|
|
|
2003-03-24 13:50:10 -05:00
|
|
|
#if wxUSE_GRID
|
2001-06-10 19:20:31 -04:00
|
|
|
|
2001-05-27 11:22:28 -04:00
|
|
|
#include "wx/grid.h"
|
|
|
|
#include "wx/string.h"
|
2003-07-19 18:01:14 -04:00
|
|
|
#include "wx/arrstr.h"
|
2001-05-27 11:22:28 -04:00
|
|
|
#include "wx/datetime.h"
|
|
|
|
|
|
|
|
#define wxGRID_VALUE_CHOICEINT _T("choiceint")
|
|
|
|
#define wxGRID_VALUE_DATETIME _T("datetime")
|
|
|
|
|
2003-02-05 19:53:46 -05:00
|
|
|
#if 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 wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
|
2001-05-27 11:22:28 -04:00
|
|
|
{
|
|
|
|
public:
|
2005-01-17 16:29:23 -05:00
|
|
|
wxGridCellDateTimeRenderer(wxString outformat = wxDefaultDateTimeFormat,
|
|
|
|
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:
|
|
|
|
wxString GetString(wxGrid& grid, int row, int col);
|
|
|
|
|
|
|
|
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:
|
|
|
|
wxString GetString(wxGrid& grid, int row, int col);
|
|
|
|
|
|
|
|
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,
|
|
|
|
wxGridCellAttr& attr,
|
|
|
|
const wxRect& rect,
|
|
|
|
int row, int col);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2003-03-24 13:50:10 -05:00
|
|
|
#endif // #if wxUSE_GRID
|
2001-06-10 19:20:31 -04:00
|
|
|
|
2001-05-27 11:22:28 -04:00
|
|
|
#endif //_WX_GENERIC_GRIDCTRL_H_
|
|
|
|
|