示例#1
0
文件: ToolTip.cpp 项目: pedia/raidget
void ShowToolTip()
{
	LLOG("ShowToolTip");
	CloseToolTip();
	if(tipctrl) {
		String text = tipctrl->GetTip();
		LLOG("-> showing tip: " << text << " tipctrl: " << UPP::Name(tipctrl));
		Ctrl *top = tipctrl->GetTopCtrl();
		if(!text.IsEmpty() && top && (top->IsForeground() || top->IsPopUp())) {
			LLOG("-> foreground");
			ToolTip& q = AppToolTip();
			q.Set(text);
			Size sz = q.GetMinSize();
			Rect r = top->GetWorkArea();
			Point p = GetMousePos() + Size(0, 22);
			if(p.y + sz.cy > r.bottom)
				p = GetMousePos() - Size(0, 22);
			q.PopUp(top, p, !showmode);
			showmode = true;
			KillTimeCallback((void *)EndShowMode);
			return;
		}
		LLOG("-> background / empty text, top = " << UPP::Name(top));
	}
	SetTimeCallback(200, callback(EndShowMode), (void *)EndShowMode);
}
示例#2
0
bool  Ctrl::HasFocusDeep() const
{
	GuiLock __;
	if(HasFocus() || HasChildDeep(FocusCtrl())) return true;
	Ctrl *a = GetActiveCtrl();
	if(!a || !a->IsPopUp()) return false;
	a = a->GetOwnerCtrl();
	return a && HasChildDeep(a);
}