diff --git a/uppsrc/CtrlLib/ArrayCtrl.cpp b/uppsrc/CtrlLib/ArrayCtrl.cpp index 0330ed786..47ba6445c 100644 --- a/uppsrc/CtrlLib/ArrayCtrl.cpp +++ b/uppsrc/CtrlLib/ArrayCtrl.cpp @@ -544,6 +544,16 @@ int ArrayCtrl::GetLineY(int i) const + (linecy + horzgrid) * (i - ln.GetCount()); } +Rect ArrayCtrl::GetScreenRect(int i, int col) const +{ + return GetCellRect(i, col).Offseted(GetScreenView().TopLeft()); +} + +Rect ArrayCtrl::GetScreenRectM(int i, int col) const +{ + return GetCellRectM(i, col).Offseted(GetScreenView().TopLeft()); +} + ArrayCtrl& ArrayCtrl::SetLineCy(int cy) { linecy = cy; @@ -946,20 +956,21 @@ void ArrayCtrl::AddRowNumCtrl(Ctrl& ctrl) { AddCtrlAt(Null, ctrl); } -Rect ArrayCtrl::GetCellRect(int i, int col) +Rect ArrayCtrl::GetCellRect(int i, int col) const { Rect r; r.top = GetLineY(i) - sb; r.bottom = r.top + GetLineCy(i); int x = 0; + HeaderCtrl& h = const_cast(header); // Ugly!!! for(i = 0; header.GetTabIndex(i) != col; i++) - x += header.GetTabWidth(i); + x += h.GetTabWidth(i); r.left = x - header.GetScroll(); - r.right = r.left + header.GetTabWidth(i) - vertgrid + (col == column.GetCount() - 1); + r.right = r.left + h.GetTabWidth(i) - vertgrid + (col == column.GetCount() - 1); return r; } -Rect ArrayCtrl::GetCellRectM(int i, int col) +Rect ArrayCtrl::GetCellRectM(int i, int col) const { Rect r = GetCellRect(i, col); int cm = column[col].margin; diff --git a/uppsrc/CtrlLib/ArrayCtrl.h b/uppsrc/CtrlLib/ArrayCtrl.h index 32efb5e39..7146bff94 100644 --- a/uppsrc/CtrlLib/ArrayCtrl.h +++ b/uppsrc/CtrlLib/ArrayCtrl.h @@ -232,8 +232,6 @@ private: void InsertCache(int i); void RemoveCache(int i); - void RefreshRow(int i); - void SetSb(); void HeaderLayout(); void Scroll(); @@ -243,8 +241,8 @@ private: void DoClick(Point p, dword flags); void ClickColumn(Point p); void ClickSel(dword flags); - Rect GetCellRect(int i, int col); - Rect GetCellRectM(int i, int col); + Rect GetCellRect(int i, int col) const; + Rect GetCellRectM(int i, int col) const; Point FindCellCtrl(Ctrl *c); void SyncCtrls(int from = 0); @@ -487,6 +485,8 @@ public: const Display& GetDisplay(int row, int col); const Display& GetDisplay(int col); + void RefreshRow(int i); + void SetCtrl(int i, int col, Ctrl& ctrl, bool value = true); ArrayCtrl& SetLineCy(int cy); @@ -497,6 +497,9 @@ public: int GetTotalCy() const; int GetLineAt(int y) const; + Rect GetScreenRect(int i, int col) const; + Rect GetScreenRectM(int i, int col) const; + Point GetClickPos() const { return clickpos; } int GetClickColumn() const { return clickpos.x; } int GetClickRow() const { return clickpos.y; } diff --git a/uppsrc/CtrlLib/HeaderCtrl.cpp b/uppsrc/CtrlLib/HeaderCtrl.cpp index d774fae82..2a63aef78 100644 --- a/uppsrc/CtrlLib/HeaderCtrl.cpp +++ b/uppsrc/CtrlLib/HeaderCtrl.cpp @@ -166,6 +166,7 @@ HeaderCtrl& HeaderCtrl::Proportional() { mode = PROPORTIONAL; SbTotal(); return HeaderCtrl& HeaderCtrl::ReduceNext() { mode = REDUCENEXT; SbTotal(); return *this; } HeaderCtrl& HeaderCtrl::ReduceLast() { mode = REDUCELAST; SbTotal(); return *this; } HeaderCtrl& HeaderCtrl::Absolute() { mode = SCROLL; SbTotal(); return *this; } +HeaderCtrl& HeaderCtrl::Fixed() { mode = FIXED; SbTotal(); return *this; } int HeaderCtrl::SumMin(int from) { @@ -575,6 +576,8 @@ void HeaderCtrl::MouseMove(Point p, dword keyflags) { Refresh(); return; } + if(mode == FIXED) + return; int q = GetSplit(p.x); q = IsNull(q) || q >= 0 ? -1 : -1 - q; if(q != light) @@ -673,7 +676,7 @@ void HeaderCtrl::ShowTab(int i, bool show) { WhenLayout(); } -int HeaderCtrl::FindIndex(int ndx) +int HeaderCtrl::FindIndex(int ndx) const { if(ndx >= 0 && ndx < col.GetCount() && col[ndx].index == ndx) return ndx; for(int i = 0; i < col.GetCount(); i++) diff --git a/uppsrc/CtrlLib/HeaderCtrl.h b/uppsrc/CtrlLib/HeaderCtrl.h index 38e434486..fbdc1049d 100644 --- a/uppsrc/CtrlLib/HeaderCtrl.h +++ b/uppsrc/CtrlLib/HeaderCtrl.h @@ -63,7 +63,7 @@ public: friend class Column; protected: - enum { PROPORTIONAL, REDUCELAST, REDUCENEXT, SCROLL }; + enum { PROPORTIONAL, REDUCELAST, REDUCENEXT, SCROLL, FIXED }; Array col; HScrollBar sb; @@ -128,8 +128,8 @@ public: void SwapTabs(int first, int second); void MoveTab(int from, int to); - int GetTabIndex(int i) { return col[i].index; } - int FindIndex(int ndx); + int GetTabIndex(int i) const { return col[i].index; } + int FindIndex(int ndx) const; void StartSplitDrag(int s); int GetSplit(int x); @@ -149,6 +149,7 @@ public: HeaderCtrl& ReduceNext(); HeaderCtrl& ReduceLast(); HeaderCtrl& Absolute(); + HeaderCtrl& Fixed(); HeaderCtrl& SetStyle(const Style& s) { style = &s; Refresh(); return *this; } HeaderCtrl& Moving(bool b = true) { moving = b; return *this; }