예제 #1
0
void ToolBar::EventEnterLeave( cevent* pEvent )
{
	if ( pEvent->Type() == EV_LEAVE )
	{
		DelAllTimers();
		ToolTipHide();
	}
	else
	{
//printf("TIMER\n");
		DelAllTimers();
		SetTimer( 0, 200 );
	}
}
예제 #2
0
Win::~Win()
{
	wth_DropWindow(this);

	if (modal) // ???? может и не надо
	{
		((ModalStruct*)modal)->EndModal(0);
	}

	if (handle)
	{
		DelAllTimers();
		DestroyWindow(handle);
		DelWinFromHash(handle);
	}

	for (int i =0; i<childList.count(); i++)
	{
		childList[i]->parent = 0;
	}

	if (parent) {
		for (int i = 0; i<parent->childList.count(); i++)
			if (parent->childList[i] == this)
			{
				parent->childList.del(i);
				break;
			}
	}

	if (upLayout)
	{
		upLayout->DelObj(this);
	}

	if (mouseWindow == this)
		mouseWindow = 0;
}
	bool ScrollBar::EventMouse( cevent_mouse* pEvent )
	{
		switch ( pEvent->Type() )
		{

			case EV_MOUSE_MOVE:
				if ( trace )
				{
					int p = vertical ? ( pEvent->Point().y - b1Rect.bottom )
					        : ( pEvent->Point().x - b1Rect.right );
					p -= traceBPoint;
					int n = len - bsize;

					if ( n <= 0 ) { break; }

					//if (p>=n) p = n-1;
					//if (p<0) p = 0;

					int n1 = si.size - si.pageSize;
					int x = ( int64( p ) * n1 ) / n;

					if ( x >= n1 ) { x = n1; }

					if ( x < 0 ) { x = 0; }

					SendManagedCmd( SCMD_SCROLL_TRACK, &x ); //(void*)x);
				}

				break;

			case EV_MOUSE_DOUBLE:
			case EV_MOUSE_PRESS:
				if ( pEvent->Button() != MB_L )
				{
					break;
				}

				{
					int subId = 0;

					if ( b1Rect.In( pEvent->Point() ) )
					{
						b1Pressed = true;
						subId = ( vertical ) ? SCMD_SCROLL_LINE_UP : SCMD_SCROLL_LINE_LEFT;
					}
					else if ( b2Rect.In( pEvent->Point() ) )
					{
						b2Pressed = true;
						subId = ( vertical ) ? SCMD_SCROLL_LINE_DOWN : SCMD_SCROLL_LINE_RIGHT;
					}
					else if ( b3Rect.In( pEvent->Point() ) )
					{
						traceBPoint = ( vertical ) ? ( pEvent->Point().y - b3Rect.top ) : ( pEvent->Point().x - b3Rect.left );
						trace = true;
						SetCapture();
						break;
					}
					else if ( !b3Rect.IsEmpty() )
					{
						if ( vertical )
						{
							if ( pEvent->Point().y < b3Rect.top )
							{
								subId = SCMD_SCROLL_PAGE_UP;
							}
							else
							{
								subId = SCMD_SCROLL_PAGE_DOWN;
							}
						}
						else
						{
							if ( pEvent->Point().x < b3Rect.left )
							{
								subId = SCMD_SCROLL_PAGE_LEFT;
							}
							else
							{
								subId = SCMD_SCROLL_PAGE_RIGHT;
							}
						}
					}

					if ( subId != 0 )
					{
						SetCapture();
						SendManagedCmd( subId, 0 );
						SetTimer( subId, 100 );
					}
				}

				this->Invalidate();
				break;

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

				if ( IsCaptured() )
				{
					b1Pressed = false ;
					b2Pressed = false ;
					ReleaseCapture();
					DelAllTimers();
					Invalidate();
					trace = false;
				}

				break;

			default:
				;
		}

		return true;
	}
예제 #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;
}