#include "wx/combobox.h"
#include "wx/dynarray.h"
#include "wx/timer.h"
+#include "wx/clntdata.h"
// ----------------------------------------------------------------------------
// constants
// class is not documented and is not public at all
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxGridCellWorker
+class WXDLLEXPORT wxGridCellWorker : public wxClientDataContainer
{
public:
wxGridCellWorker() { m_nRef = 1; }
friend class wxGridCellEditorDummyFriend;
};
+#if wxUSE_TEXTCTRL
+
// the editor for string/text data
class WXDLLEXPORT wxGridCellTextEditor : public wxGridCellEditor
{
double m_valueOld;
};
+#endif // wxUSE_TEXTCTRL
+
+#if wxUSE_CHECKBOX
+
// the editor for boolean data
class WXDLLEXPORT wxGridCellBoolEditor : public wxGridCellEditor
{
bool m_startValue;
};
+#endif // wxUSE_CHECKBOX
+
+#if wxUSE_COMBOBOX
+
// the editor for string data allowing to choose from the list of strings
class WXDLLEXPORT wxGridCellChoiceEditor : public wxGridCellEditor
{
bool m_allowOthers;
};
+#endif // wxUSE_COMBOBOX
+
// ----------------------------------------------------------------------------
// wxGridCellAttr: this class can be used to alter the cells appearance in
// the grid by changing their colour/font/... from default. An object of this
// class may be returned by wxGridTable::GetAttr().
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxGridCellAttr
+class WXDLLEXPORT wxGridCellAttr : public wxClientDataContainer
{
public:
enum wxAttrKind
};
// ctors
- wxGridCellAttr()
+ wxGridCellAttr(wxGridCellAttr *attrDefault = NULL)
{
- Init();
+ Init(attrDefault);
+
// MB: args used to be 0,0 here but wxALIGN_LEFT is 0
SetAlignment(-1, -1);
}
};
// the common part of all ctors
- void Init()
- {
- m_nRef = 1;
-
- m_isReadOnly = Unset;
-
- m_renderer = NULL;
- m_editor = NULL;
-
- m_attrkind = wxGridCellAttr::Cell;
- }
+ void Init(wxGridCellAttr *attrDefault = NULL);
// the dtor is private because only DecRef() can delete us
~wxGridCellAttr()
wxAttrKind m_attrkind;
// use Clone() instead
- DECLARE_NO_COPY_CLASS(wxGridCellAttr);
+ DECLARE_NO_COPY_CLASS(wxGridCellAttr)
// suppress the stupid gcc warning about the class having private dtor and
// no friends
// the default implementation is reasonably efficient for the generic case,
// but you might still wish to implement your own for some specific situations
// if you have performance problems with the stock one
-class WXDLLEXPORT wxGridCellAttrProvider
+class WXDLLEXPORT wxGridCellAttrProvider : public wxClientDataContainer
{
public:
wxGridCellAttrProvider();
//////////////////////////////////////////////////////////////////////
-class WXDLLEXPORT wxGridTableBase : public wxObject
+class WXDLLEXPORT wxGridTableBase : public wxObject, public wxClientDataContainer
{
public:
wxGridTableBase();
public:
wxGridStringTable();
wxGridStringTable( int numRows, int numCols );
- ~wxGridStringTable();
+ virtual ~wxGridStringTable();
// these are pure virtual in wxGridTableBase
//
long style = wxWANTS_CHARS,
const wxString& name = wxPanelNameStr );
- ~wxGrid();
+ virtual ~wxGrid();
enum wxGridSelectionModes {wxGridSelectCells,
wxGridSelectRows,
{
m_extraWidth = extraWidth;
m_extraHeight = extraHeight;
+
+ CalcDimensions();
}
// Accessors for component windows
bool Redimension( wxGridTableMessage& );
- bool SendEvent( const wxEventType, int row, int col, wxMouseEvent& );
- bool SendEvent( const wxEventType, int row, int col );
- bool SendEvent( const wxEventType type)
+ int SendEvent( const wxEventType, int row, int col, wxMouseEvent& );
+ int SendEvent( const wxEventType, int row, int col );
+ int SendEvent( const wxEventType type)
{
return SendEvent(type,
m_currentCellCoords.GetRow(),
DECLARE_DYNAMIC_CLASS(wxGridRangeSelectEvent)
};
+
+class WXDLLEXPORT wxGridEditorCreatedEvent : public wxCommandEvent {
+public:
+ wxGridEditorCreatedEvent()
+ : wxCommandEvent()
+ {
+ m_row = 0;
+ m_col = 0;
+ m_ctrl = NULL;
+ }
+
+ wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj,
+ int row, int col, wxControl* ctrl);
+
+ int GetRow() { return m_row; }
+ int GetCol() { return m_col; }
+ wxControl* GetControl() { return m_ctrl; }
+ void SetRow(int row) { m_row = row; }
+ void SetCol(int col) { m_col = col; }
+ void SetControl(wxControl* ctrl) { m_ctrl = ctrl; }
+
+private:
+ int m_row;
+ int m_col;
+ wxControl* m_ctrl;
+
+ DECLARE_DYNAMIC_CLASS(wxGridEditorCreatedEvent)
+};
+
+
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EVENT_TYPE(wxEVT_GRID_CELL_LEFT_CLICK, 1580)
DECLARE_EVENT_TYPE(wxEVT_GRID_CELL_RIGHT_CLICK, 1581)
DECLARE_EVENT_TYPE(wxEVT_GRID_SELECT_CELL, 1592)
DECLARE_EVENT_TYPE(wxEVT_GRID_EDITOR_SHOWN, 1593)
DECLARE_EVENT_TYPE(wxEVT_GRID_EDITOR_HIDDEN, 1594)
+ DECLARE_EVENT_TYPE(wxEVT_GRID_EDITOR_CREATED, 1595)
END_DECLARE_EVENT_TYPES()
typedef void (wxEvtHandler::*wxGridEventFunction)(wxGridEvent&);
typedef void (wxEvtHandler::*wxGridSizeEventFunction)(wxGridSizeEvent&);
typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction)(wxGridRangeSelectEvent&);
+typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreatedEvent&);
#define EVT_GRID_CELL_LEFT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_LEFT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
#define EVT_GRID_CELL_RIGHT_CLICK(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CELL_RIGHT_CLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
#define EVT_GRID_SELECT_CELL(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_SELECT_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
#define EVT_GRID_EDITOR_SHOWN(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_SHOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
#define EVT_GRID_EDITOR_HIDDEN(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_HIDDEN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL ),
+#define EVT_GRID_EDITOR_CREATED(fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_EDITOR_CREATED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEditorCreatedEventFunction) &fn, NULL ),
#if 0 // TODO: implement these ? others ?