Ejemplo n.º 1
0
void ToolTipShow(Win *w, int x, int y, const unicode_t *s)
{
	ToolTipHide();
	if (!w) return;
	crect r = w->ScreenRect();
	tip = new TBToolTip(w, r.left + x, r.top + y, s);
	tip->Enable();
	tip->Show(Win::SHOW_INACTIVE);
}
Ejemplo n.º 2
0
void ToolBar::EventEnterLeave( cevent* pEvent )
{
	if ( pEvent->Type() == EV_LEAVE )
	{
		DelAllTimers();
		ToolTipHide();
	}
	else
	{
//printf("TIMER\n");
		DelAllTimers();
		SetTimer( 0, 200 );
	}
}
/*
================
CSyntaxRichEditCtrl::OnChar
================
*/
void CSyntaxRichEditCtrl::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{

	if (nChar == VK_TAB) {
		return;	// tab is handle in OnKeyDown
	}

	CRichEditCtrl::OnChar(nChar, nRepCnt, nFlags);

	// if the auto-complete list box is up
	if (autoCompleteStart >= 0) {
		long selStart, selEnd;

		if (charType[nChar] == CT_NAME) {
			AutoCompleteUpdate();
			return;
		} else if (nChar == VK_BACK) {
			GetSel(selStart, selEnd);

			if (selStart > autoCompleteStart) {
				AutoCompleteUpdate();
			} else {
				AutoCompleteHide();
			}

			return;
		} else {
			AutoCompleteHide();
		}
	}

	// if the function parameter tool tip is up
	if (funcParmToolTipStart >= 0) {
		long selStart, selEnd;

		if (nChar == ')' || nChar == VK_ESCAPE) {
			ToolTipHide();
		} else if (nChar == VK_BACK) {
			GetSel(selStart, selEnd);

			if (selStart < funcParmToolTipStart) {
				ToolTipHide();
			}
		}
	}

	// show keyword auto-completion
	if (keyWordAutoCompletion && charType[nChar] == CT_NAME && funcParmToolTipStart < 0) {
		long selStart, selEnd;
		int line, column, length, i;
		char buffer[1024];

		GetSel(selStart, selEnd);
		line = LineFromChar(selStart);
		length = GetLine(line, buffer, sizeof(buffer));
		column = selStart - LineIndex(line);

		if (column <= 1 || charType[buffer[column-2]] == CT_WHITESPACE) {
			if (column >= length-1 || charType[buffer[column]] == CT_WHITESPACE) {

				autoCompleteListBox.ResetContent();

				for (i = 0; keyWords[i].keyWord; i++) {
					autoCompleteListBox.AddString(keyWords[i].keyWord);
				}

				AutoCompleteShow(selStart - 1);
			}
		}

		return;
	}

	// highlight braced sections
	if (nChar == '{') {
		BracedSectionStart('{', '}');
	} else if (nChar == '}') {
		BracedSectionEnd('{', '}');
	} else if (nChar == '(') {
		BracedSectionStart('(', ')');
	} else if (nChar == ')') {
		BracedSectionEnd('(', ')');
	} else if (nChar == '[') {
		BracedSectionStart('[', ']');
	} else if (nChar == ']') {
		BracedSectionEnd('[', ']');
	} else if (nChar == '<') {
		BracedSectionStart('<', '>');
	} else if (nChar == '>') {
		BracedSectionEnd('<', '>');
	}

	// show object member auto-completion
	if (nChar == '.' && GetObjectMembers && funcParmToolTipStart < 0) {
		int charIndex;
		CString name;

		if (GetNameBeforeCurrentSelection(name, charIndex)) {
			autoCompleteListBox.ResetContent();

			if (GetObjectMembers(name, autoCompleteListBox)) {
				AutoCompleteShow(charIndex);
			}
		}

		return;
	}

	// show function parameter tool tip
	if (nChar == '(' && GetFunctionParms) {
		int charIndex;
		CString name;

		if (GetNameBeforeCurrentSelection(name, charIndex)) {
			CString parmString;

			if (GetFunctionParms(name, parmString)) {
				ToolTipShow(charIndex, parmString);
			}
		}

		return;
	}
}
Ejemplo n.º 4
0
bool ToolBar::EventMouse( cevent_mouse* pEvent )
{
	{
		_ticks = 0;
		//_mPoint = pEvent->Point();
		_nextTip = GetNodeByPos( pEvent->Point().x, pEvent->Point().y );

		if ( _curTip && !_nextTip )
		{
			ToolTipHide();
			_curTip = _nextTip = 0;
		}
	}

	switch ( pEvent->Type() )
	{
		case EV_MOUSE_PRESS:
		case EV_MOUSE_DOUBLE:
		{
			ToolTipHide();
			_curTip = _nextTip = 0;
			DelAllTimers();

			if ( pEvent->Button() != MB_L ) { break; }

			Node* p = GetNodeByPos( pEvent->Point().x, pEvent->Point().y );

			if ( !p ) { break; }

			SetCapture();
			_pressed = p;
			Invalidate();
		}
		break;

		case EV_MOUSE_RELEASE:
		{
			ToolTipHide();
			_curTip = _nextTip = 0;
			DelAllTimers();
			SetTimer(0,200);

			if ( pEvent->Button() != MB_L ) { break; }

			if ( !_pressed ) { break; }

			ReleaseCapture();
			Node* p = GetNodeByPos( pEvent->Point().x, pEvent->Point().y );

			if ( _pressed == p )
			{
				Command( p->cmd, 0, this, 0 );
			}

			_pressed = 0;
			Invalidate();
		}
		break;

	};

	return true;
}