X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b63f9a33301b1cead8b9ccbb16e2f50b0d82bbe9..0dd9646ea8b9e6f3a5fa8c42b6a4954cf8e3a48d:/include/wx/generic/headerctrlg.h diff --git a/include/wx/generic/headerctrlg.h b/include/wx/generic/headerctrlg.h index 78f8c42a0d..127f798c40 100644 --- a/include/wx/generic/headerctrlg.h +++ b/include/wx/generic/headerctrlg.h @@ -13,6 +13,7 @@ #include "wx/event.h" #include "wx/vector.h" +#include "wx/overlay.h" // ---------------------------------------------------------------------------- // wxHeaderCtrl @@ -49,11 +50,10 @@ public: private: // implement base class pure virtuals + virtual void DoSetCount(unsigned int count); virtual unsigned int DoGetCount() const; - virtual void DoInsert(const wxHeaderColumn& col, unsigned int idx); - virtual void DoDelete(unsigned int idx); - virtual void DoShowColumn(unsigned int idx, bool show); - virtual void DoShowSortIndicator(unsigned int idx, int sortOrder); + virtual void DoUpdate(unsigned int idx); + virtual void DoScrollHorz(int dx); // override wxWindow methods which must be implemented by a new control @@ -65,35 +65,70 @@ private: // event handlers void OnPaint(wxPaintEvent& event); void OnMouse(wxMouseEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnCaptureLost(wxMouseCaptureLostEvent& event); - // return the horizontal start position of the given column + // return the horizontal start position of the given column in physical + // coordinates int GetColStart(unsigned int idx) const; - // refresh the given column [only] + // refresh the given column [only]; idx must be valid void RefreshCol(unsigned int idx); + // refresh the given column if idx is valid + void RefreshColIfNotNone(unsigned int idx); + // refresh all the controls starting from (and including) the given one void RefreshColsAfter(unsigned int idx); - // all our current columns - typedef wxVector Columns; - Columns m_cols; + // return the column at the given position or -1 if it is beyond the + // rightmost column and put true into onSeparator output parameter if the + // position is near the divider at the right end of this column (notice + // that this means that we return column 0 even if the position is over + // column 1 but close enough to the divider separating it from column 0) + int FindColumnAtPos(int x, bool& onSeparator) const; + + // return true if a drag resizing operation is currently in progress + bool IsResizing() const; - // sorting indicators for the columns: our API is such that it allows using - // multiple columns for sorting, and even if this is not used anywhere in - // practice right now, still support this + // end any drag operation currently in progress (resizing or reordering) + void EndDragging(); + + // start (if m_colBeingResized is -1) or continue resizing the column // - // the values are interpreted in the same way as ShowSortIndicator() - // sortOrder parameter: true/false for ascending/descending sort if the - // corresponding column is used for sorting or -1 otherwise - wxVector m_sortOrders; + // this generates wxEVT_COMMAND_HEADER_BEGIN_RESIZE/RESIZING events and can + // cancel the operation if the user handler decides so + void StartOrContinueResizing(unsigned int col, int xPhysical); + + // end the resizing operation currently in progress and generate an event + // about it with its cancelled flag set if xPhysical is -1 + void EndResizing(int xPhysical); + + // constrain the given position to be larger than the start position of the + // given column plus its minimal width and return the effective width + int ConstrainByMinWidth(unsigned int col, int& xPhysical); + + // update the current position of the resizing marker if xPhysical is a + // valid physical coordinate value or remove it entirely if it is -1 + void UpdateResizingMarker(int xPhysical); + + + // number of columns in the control currently + unsigned int m_numColumns; // index of the column under mouse or -1 if none unsigned int m_hover; + // the column being resized or -1 if there is no resizing operation in + // progress + unsigned int m_colBeingResized; + // the horizontal scroll offset int m_scrollOffset; + // the overlay display used during the dragging operations + wxOverlay m_overlay; + DECLARE_EVENT_TABLE() DECLARE_NO_COPY_CLASS(wxHeaderCtrl)