X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/30bc4a8fc05fd5621f260b5a16ae7935080e21b1..e9c9f9d42d82e0d6b9418969a188cafb9b06a1fa:/include/wx/generic/grid.h diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index ae7294f833..e74f117ae4 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -31,6 +31,7 @@ #include "wx/combobox.h" #include "wx/dynarray.h" #include "wx/timer.h" +#include "wx/clntdata.h" // ---------------------------------------------------------------------------- // constants @@ -98,7 +99,7 @@ class WXDLLEXPORT wxSpinCtrl; // class is not documented and is not public at all // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxGridCellWorker +class WXDLLEXPORT wxGridCellWorker : public wxClientDataContainer { public: wxGridCellWorker() { m_nRef = 1; } @@ -375,6 +376,8 @@ protected: friend class wxGridCellEditorDummyFriend; }; +#if wxUSE_TEXTCTRL + // the editor for string/text data class WXDLLEXPORT wxGridCellTextEditor : public wxGridCellEditor { @@ -489,6 +492,10 @@ private: double m_valueOld; }; +#endif // wxUSE_TEXTCTRL + +#if wxUSE_CHECKBOX + // the editor for boolean data class WXDLLEXPORT wxGridCellBoolEditor : public wxGridCellEditor { @@ -517,6 +524,10 @@ private: 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 { @@ -551,13 +562,15 @@ private: 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 @@ -571,9 +584,10 @@ public: }; // 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); } @@ -652,17 +666,7 @@ private: }; // 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() @@ -689,7 +693,7 @@ private: 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 @@ -708,7 +712,7 @@ private: // 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(); @@ -742,7 +746,7 @@ private: ////////////////////////////////////////////////////////////////////// -class WXDLLEXPORT wxGridTableBase : public wxObject +class WXDLLEXPORT wxGridTableBase : public wxObject, public wxClientDataContainer { public: wxGridTableBase(); @@ -887,7 +891,7 @@ class WXDLLEXPORT wxGridStringTable : public wxGridTableBase public: wxGridStringTable(); wxGridStringTable( int numRows, int numCols ); - ~wxGridStringTable(); + virtual ~wxGridStringTable(); // these are pure virtual in wxGridTableBase // @@ -1007,7 +1011,7 @@ public: long style = wxWANTS_CHARS, const wxString& name = wxPanelNameStr ); - ~wxGrid(); + virtual ~wxGrid(); enum wxGridSelectionModes {wxGridSelectCells, wxGridSelectRows, @@ -1402,6 +1406,8 @@ public: { m_extraWidth = extraWidth; m_extraHeight = extraHeight; + + CalcDimensions(); } // Accessors for component windows @@ -1763,9 +1769,9 @@ protected: 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(), @@ -1920,6 +1926,36 @@ protected: 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) @@ -1936,12 +1972,14 @@ BEGIN_DECLARE_EVENT_TYPES() 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 ), @@ -1958,6 +1996,7 @@ typedef void (wxEvtHandler::*wxGridRangeSelectEventFunction)(wxGridRangeSelectEv #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 ?