X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/733f486aac7f5d92f902d6041338cd6e1bc7d99d..09b895cb4a954494063eb17d3dc302a654fd99e5:/include/wx/generic/grid.h diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index 17d8bb22a1..183dd94e01 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -60,28 +60,28 @@ extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxGridNameStr[]; enum wxGridDirection { wxGRID_COLUMN, - wxGRID_ROW, + wxGRID_ROW }; // ---------------------------------------------------------------------------- // forward declarations // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_ADV wxGrid; -class WXDLLIMPEXP_ADV wxGridCellAttr; -class WXDLLIMPEXP_ADV wxGridCellAttrProviderData; -class WXDLLIMPEXP_ADV wxGridColLabelWindow; -class WXDLLIMPEXP_ADV wxGridCornerLabelWindow; -class WXDLLIMPEXP_ADV wxGridRowLabelWindow; -class WXDLLIMPEXP_ADV wxGridWindow; -class WXDLLIMPEXP_ADV wxGridTypeRegistry; -class WXDLLIMPEXP_ADV wxGridSelection; - -class WXDLLEXPORT wxCheckBox; -class WXDLLEXPORT wxComboBox; -class WXDLLEXPORT wxTextCtrl; +class WXDLLIMPEXP_FWD_ADV wxGrid; +class WXDLLIMPEXP_FWD_ADV wxGridCellAttr; +class WXDLLIMPEXP_FWD_ADV wxGridCellAttrProviderData; +class WXDLLIMPEXP_FWD_ADV wxGridColLabelWindow; +class WXDLLIMPEXP_FWD_ADV wxGridCornerLabelWindow; +class WXDLLIMPEXP_FWD_ADV wxGridRowLabelWindow; +class WXDLLIMPEXP_FWD_ADV wxGridWindow; +class WXDLLIMPEXP_FWD_ADV wxGridTypeRegistry; +class WXDLLIMPEXP_FWD_ADV wxGridSelection; + +class WXDLLIMPEXP_FWD_CORE wxCheckBox; +class WXDLLIMPEXP_FWD_CORE wxComboBox; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; #if wxUSE_SPINCTRL -class WXDLLEXPORT wxSpinCtrl; +class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; #endif // ---------------------------------------------------------------------------- @@ -423,6 +423,8 @@ protected: wxTextCtrl *Text() const { return (wxTextCtrl *)m_control; } // parts of our virtual functions reused by the derived classes + void DoCreate(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler, + long style = 0); void DoBeginEdit(const wxString& startValue); void DoReset(const wxString& startValue); @@ -1088,9 +1090,9 @@ WX_DECLARE_OBJARRAY_WITH_DECL(wxGridCellCoords, wxGridCellCoordsArray, class WXDLLIMPEXP_ADV wxGrid : public wxScrolledWindow { public: - wxGrid() ; + wxGrid(); - wxGrid( wxWindow *parent, + wxGrid( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -1310,8 +1312,11 @@ public: int GetCellHighlightPenWidth() const { return m_cellHighlightPenWidth; } int GetCellHighlightROPenWidth() const { return m_cellHighlightROPenWidth; } + void SetUseNativeColLabels( bool native = true ); void SetRowLabelSize( int width ); void SetColLabelSize( int height ); + void HideRowLabels() { SetRowLabelSize( 0 ); } + void HideColLabels() { SetColLabelSize( 0 ); } void SetLabelBackgroundColour( const wxColour& ); void SetLabelTextColour( const wxColour& ); void SetLabelFont( const wxFont& ); @@ -1620,7 +1625,13 @@ public: // override some base class functions virtual bool Enable(bool enable = true); + virtual wxWindow *GetMainWindowOfCompositeControl() + { return (wxWindow*)m_gridWin; } + // ------- drag and drop +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget(wxDropTarget *dropTarget); +#endif // wxUSE_DRAG_AND_DROP // ------ For compatibility with previous wxGrid only... // @@ -1638,6 +1649,7 @@ public: : wxScrolledWindow( parent, wxID_ANY, wxPoint(x,y), wxSize(w,h), (style|wxWANTS_CHARS), name ) { + InitVars(); Create(); } @@ -1832,6 +1844,8 @@ protected: int m_minAcceptableColWidth; wxArrayInt m_colWidths; wxArrayInt m_colRights; + + bool m_nativeColumnLabels; // get the col/row coords int GetColWidth(int col) const; @@ -1980,6 +1994,7 @@ protected: void Create(); void Init(); + void InitVars(); void CalcDimensions(); void CalcWindowSizes(); bool Redimension( wxGridTableMessage& ); @@ -2018,7 +2033,7 @@ protected: bool GetModelValues(); bool SetModelValues(); - friend class WXDLLIMPEXP_ADV wxGridSelection; + friend class WXDLLIMPEXP_FWD_ADV wxGridSelection; DECLARE_DYNAMIC_CLASS( wxGrid ) DECLARE_EVENT_TABLE() @@ -2247,25 +2262,24 @@ private: }; -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_LEFT_CLICK, 1580) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_RIGHT_CLICK, 1581) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_LEFT_DCLICK, 1582) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_RIGHT_DCLICK, 1583) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_LEFT_CLICK, 1584) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_RIGHT_CLICK, 1585) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_LEFT_DCLICK, 1586) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_LABEL_RIGHT_DCLICK, 1587) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_ROW_SIZE, 1588) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_COL_SIZE, 1589) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_RANGE_SELECT, 1590) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_CHANGE, 1591) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_SELECT_CELL, 1592) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_EDITOR_SHOWN, 1593) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_EDITOR_HIDDEN, 1594) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_EDITOR_CREATED, 1595) - DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_GRID_CELL_BEGIN_DRAG, 1596) -END_DECLARE_EVENT_TYPES() +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_CELL_LEFT_CLICK; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_CELL_RIGHT_CLICK; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_CELL_LEFT_DCLICK; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_CELL_RIGHT_DCLICK; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_LABEL_LEFT_CLICK; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_LABEL_RIGHT_CLICK; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_LABEL_LEFT_DCLICK; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_LABEL_RIGHT_DCLICK; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_ROW_SIZE; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_COL_SIZE; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_RANGE_SELECT; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_CELL_CHANGE; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_SELECT_CELL; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_EDITOR_SHOWN; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_EDITOR_HIDDEN; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_EDITOR_CREATED; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_CELL_BEGIN_DRAG; +extern WXDLLIMPEXP_ADV const wxEventType wxEVT_GRID_COL_MOVE; typedef void (wxEvtHandler::*wxGridEventFunction)(wxGridEvent&); @@ -2307,6 +2321,7 @@ typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreat #define EVT_GRID_CMD_LABEL_RIGHT_DCLICK(id, fn) wx__DECLARE_GRIDEVT(LABEL_RIGHT_DCLICK, id, fn) #define EVT_GRID_CMD_ROW_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(ROW_SIZE, id, fn) #define EVT_GRID_CMD_COL_SIZE(id, fn) wx__DECLARE_GRIDSIZEEVT(COL_SIZE, id, fn) +#define EVT_GRID_CMD_COL_MOVE(id, fn) wx__DECLARE_GRIDSIZEEVT(COL_MOVE, id, fn) #define EVT_GRID_CMD_RANGE_SELECT(id, fn) wx__DECLARE_GRIDRANGESELEVT(RANGE_SELECT, id, fn) #define EVT_GRID_CMD_CELL_CHANGE(id, fn) wx__DECLARE_GRIDEVT(CELL_CHANGE, id, fn) #define EVT_GRID_CMD_SELECT_CELL(id, fn) wx__DECLARE_GRIDEVT(SELECT_CELL, id, fn) @@ -2327,6 +2342,7 @@ typedef void (wxEvtHandler::*wxGridEditorCreatedEventFunction)(wxGridEditorCreat #define EVT_GRID_LABEL_RIGHT_DCLICK(fn) EVT_GRID_CMD_LABEL_RIGHT_DCLICK(wxID_ANY, fn) #define EVT_GRID_ROW_SIZE(fn) EVT_GRID_CMD_ROW_SIZE(wxID_ANY, fn) #define EVT_GRID_COL_SIZE(fn) EVT_GRID_CMD_COL_SIZE(wxID_ANY, fn) +#define EVT_GRID_COL_MOVE(fn) EVT_GRID_CMD_COL_MOVE(wxID_ANY, fn) #define EVT_GRID_RANGE_SELECT(fn) EVT_GRID_CMD_RANGE_SELECT(wxID_ANY, fn) #define EVT_GRID_CELL_CHANGE(fn) EVT_GRID_CMD_CELL_CHANGE(wxID_ANY, fn) #define EVT_GRID_SELECT_CELL(fn) EVT_GRID_CMD_SELECT_CELL(wxID_ANY, fn)