mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
CtrlLib: ArrayCtrl: WhenMouseMove, ToolTip minor changes
git-svn-id: svn://ultimatepp.org/upp/trunk@2008 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
476261a533
commit
45b79fd439
5 changed files with 54 additions and 20 deletions
|
|
@ -160,6 +160,7 @@ public:
|
|||
|
||||
void Set(int i, T *ptr) { B::value.Set(i, ptr); }
|
||||
T *PopDetach() { B::key.Drop(); return B::value.PopDetach(); }
|
||||
T *Detach(int i) { B::key.Remove(i); return B::value.Detach(i); }
|
||||
|
||||
ArrayMap(const ArrayMap& s, int) : AMap<K, T, Array<T>, HashFn>(s, 1) {}
|
||||
ArrayMap(pick_ Index<K, HashFn>& ndx, pick_ Array<T>& val) : AMap<K, T, Array<T>, HashFn>(ndx, val) {}
|
||||
|
|
|
|||
|
|
@ -134,4 +134,10 @@ Client is responsible for deletion of the element.&]
|
|||
[s6; Invalidates iterators to ArrayMap.&]
|
||||
[s7; [* Return value]-|Value.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:ArrayMap`:`:Detach`(int`):%- [*@4 T]_`*[* Detach]([@(0.0.255) int]_[*@3 i])&]
|
||||
[s2; Removes element [%-*@3 i]. but does not destroy it `- the heap
|
||||
pointer to the element is returned. Client is responsible for
|
||||
deletion of the element.&]
|
||||
[s3; &]
|
||||
[s0; ]
|
||||
|
|
@ -1410,15 +1410,19 @@ void ArrayCtrl::DoPoint(Point p, bool dosel) {
|
|||
SetWantFocus();
|
||||
}
|
||||
|
||||
int ArrayCtrl::GetClickColumn(int ii, Point p)
|
||||
{
|
||||
for(int i = 0; i < column.GetCount(); i++)
|
||||
if(GetCellRect(ii, i).Contains(p))
|
||||
return i;
|
||||
return Null;
|
||||
}
|
||||
|
||||
void ArrayCtrl::ClickColumn(Point p)
|
||||
{
|
||||
clickpos.x = Null;
|
||||
if(clickpos.y >= 0)
|
||||
for(int i = 0; i < column.GetCount(); i++)
|
||||
if(GetCellRect(clickpos.y, i).Contains(p)) {
|
||||
clickpos.x = i;
|
||||
break;
|
||||
}
|
||||
clickpos.x = GetClickColumn(clickpos.y, p);
|
||||
}
|
||||
|
||||
void ArrayCtrl::ClickSel(dword flags)
|
||||
|
|
@ -1529,13 +1533,28 @@ void ArrayCtrl::SyncInfo()
|
|||
|
||||
void ArrayCtrl::MouseMove(Point p, dword)
|
||||
{
|
||||
int ii = Null;
|
||||
if(WhenMouseMove) {
|
||||
ii = GetLineAt(p.y + sb);
|
||||
DDUMP(ii);
|
||||
if(IsNull(ii))
|
||||
WhenMouseMove(Null);
|
||||
else
|
||||
WhenMouseMove(Point(GetClickColumn(ii, p), ii));
|
||||
}
|
||||
if(mousemove && !IsReadOnly()) {
|
||||
int i = GetLineAt(p.y + sb);
|
||||
if(!IsNull(i)) SetCursor(i);
|
||||
if(IsNull(ii))
|
||||
ii = GetLineAt(p.y + sb);
|
||||
if(!IsNull(ii)) SetCursor(ii);
|
||||
}
|
||||
SyncInfo();
|
||||
}
|
||||
|
||||
void ArrayCtrl::MouseLeave()
|
||||
{
|
||||
WhenMouseMove(Null);
|
||||
}
|
||||
|
||||
Image ArrayCtrl::CursorImage(Point p, dword)
|
||||
{
|
||||
return header.GetSplit(p.x) < 0 || header.GetMode() == HeaderCtrl::FIXED ? Image::Arrow()
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ public:
|
|||
virtual void LeftUp(Point p, dword flags);
|
||||
virtual void RightDown(Point p, dword);
|
||||
virtual void MouseMove(Point p, dword);
|
||||
virtual void MouseLeave();
|
||||
virtual void MouseWheel(Point p, int zdelta, dword keyflags);
|
||||
virtual Image CursorImage(Point p, dword);
|
||||
virtual void DragAndDrop(Point p, PasteClip& d);
|
||||
|
|
@ -244,6 +245,7 @@ private:
|
|||
|
||||
void DoPoint(Point p, bool dosel = true);
|
||||
void DoClick(Point p, dword flags);
|
||||
int GetClickColumn(int ii, Point p);
|
||||
void ClickColumn(Point p);
|
||||
void ClickSel(dword flags);
|
||||
Rect GetCellRect(int i, int col) const;
|
||||
|
|
@ -307,6 +309,7 @@ protected:
|
|||
|
||||
public:
|
||||
Callback WhenLeftDouble;
|
||||
Callback1<Point> WhenMouseMove;
|
||||
Callback WhenEnterKey;
|
||||
Callback WhenLeftClick;
|
||||
Callback1<Bar&> WhenBar;
|
||||
|
|
@ -318,6 +321,7 @@ public:
|
|||
Callback WhenCtrlsAction;
|
||||
Callback WhenSel;
|
||||
|
||||
|
||||
Callback WhenDrag;
|
||||
Callback3<int, int, PasteClip&> WhenDropCell;
|
||||
Callback2<int, PasteClip&> WhenDropInsert;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
NAMESPACE_UPP
|
||||
|
||||
#define LLOG(x) // DLOG(x)
|
||||
#define LLOG(x) DLOG(x)
|
||||
|
||||
ToolTip::ToolTip()
|
||||
{
|
||||
|
|
@ -87,23 +87,27 @@ void ShowToolTip()
|
|||
SetTimeCallback(200, callback(EndShowMode), (void *)EndShowMode);
|
||||
}
|
||||
|
||||
void SyncToolTip(Ctrl *ctrl)
|
||||
{
|
||||
if(ctrl != tipctrl || ctrl && ctrl->GetTip() != AppToolTip().Get()) {
|
||||
LLOG("ToolTipHook / ctrl change " << UPP::Name(ctrl) << " -> " << UPP::Name(ctrl));
|
||||
tipctrl = ctrl;
|
||||
KillTimeCallback((void *)SyncToolTip);
|
||||
if(showmode)
|
||||
ShowToolTip();
|
||||
else {
|
||||
LLOG("ToolTipHook -> SetTimeCallback");
|
||||
SetTimeCallback(1000, callback(ShowToolTip), (void *)SyncToolTip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ToolTipHook(Ctrl *ctrl, bool inframe, int event, Point p, int zdelta, dword keyflags)
|
||||
{
|
||||
if(event == Ctrl::MOUSEMOVE && ctrl != &AppToolTip())
|
||||
{
|
||||
ctrl = Ctrl::GetVisibleChild(ctrl, p, inframe);
|
||||
SyncToolTip(Ctrl::GetVisibleChild(ctrl, p, inframe));
|
||||
LLOG("ToolTipHook MOUSEMOVE " << UPP::Name(ctrl) << " inframe: " << inframe);
|
||||
if(ctrl != tipctrl || ctrl->GetTip() != AppToolTip().Get() && showmode) {
|
||||
LLOG("ToolTipHook / ctrl change " << UPP::Name(ctrl) << " -> " << UPP::Name(ctrl));
|
||||
tipctrl = ctrl;
|
||||
KillTimeCallback((void *)ToolTipHook);
|
||||
if(showmode)
|
||||
ShowToolTip();
|
||||
else {
|
||||
LLOG("ToolTipHook -> SetTimeCallback");
|
||||
SetTimeCallback(1000, callback(ShowToolTip), (void *)ToolTipHook);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(event == Ctrl::MOUSELEAVE) {
|
||||
LLOG("ToolTipHook MOUSELEAVE " << UPP::Name(ctrl));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue