BOOL LLButton::handleHover(S32 x, S32 y, MASK mask)
{
	if (isInEnabledChain() 
		&& (!gFocusMgr.getMouseCapture() || gFocusMgr.getMouseCapture() == this))
		mNeedsHighlight = TRUE;

	if (!childrenHandleHover(x, y, mask))
	{
		if (mMouseDownTimer.getStarted())
		{
			F32 elapsed = getHeldDownTime();
			if( mHeldDownDelay <= elapsed && mHeldDownFrameDelay <= (S32)LLFrameTimer::getFrameCount() - mMouseDownFrame)
			{
				LLSD param;
				param["count"] = mMouseHeldDownCount++;
				if (mHeldDownSignal) (*mHeldDownSignal)(this, param);
			}
		}

		// We only handle the click if the click both started and ended within us
		getWindow()->setCursor(UI_CURSOR_ARROW);
		LL_DEBUGS("UserInput") << "hover handled by " << getName() << LL_ENDL;
	}
	return TRUE;
}
예제 #2
0
BOOL LLProgressView::handleHover(S32 x, S32 y, MASK mask)
{
	if( childrenHandleHover( x, y, mask ) == NULL )
	{
		gViewerWindow->setCursor(UI_CURSOR_WAIT);
	}
	return TRUE;
}
예제 #3
0
BOOL LLModalDialog::handleHover(S32 x, S32 y, MASK mask)		
{ 
	if( childrenHandleHover(x, y, mask) == NULL )
	{
		getWindow()->setCursor(UI_CURSOR_ARROW);
		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << llendl;		
	}
	return TRUE;
}
예제 #4
0
BOOL LLProgressView::handleHover(S32 x, S32 y, MASK mask)
{
	if( childrenHandleHover( x, y, mask ) == NULL )
	{
		lldebugst(LLERR_USER_INPUT) << "hover handled by LLProgressView" << llendl;
		if ( mOutlineRect.pointInRect( x, y ) )
		{
			gViewerWindow->setCursor(UI_CURSOR_ARROW);
		}
		else
		{
			gViewerWindow->setCursor(UI_CURSOR_WAIT);
		}
	}
	return TRUE;
}
예제 #5
0
BOOL DOHexEditor::handleHover(S32 x, S32 y, MASK mask)
{
	BOOL handled = FALSE;
	if(!hasMouseCapture())
	{
		handled = childrenHandleHover(x, y, mask) != NULL;
	}
	if(!handled && mSelecting && hasMouseCapture())
	{
		// continuation of selecting
		getPosAndContext(x, y, TRUE, mCursorPos, mInData, mSecondNibble);
		mSelectionEnd = mCursorPos;
		mHasSelection = (mSelectionStart != mSelectionEnd);
		handled = TRUE;
	}
	return handled;
}
예제 #6
0
BOOL LLButton::handleHover(S32 x, S32 y, MASK mask)
{
	if (!childrenHandleHover(x, y, mask))
	{
		if (mMouseDownTimer.getStarted())
		{
			F32 elapsed = getHeldDownTime();
			if( mHeldDownDelay <= elapsed && mHeldDownFrameDelay <= (S32)LLFrameTimer::getFrameCount() - mMouseDownFrame)
			{
				LLSD param;
				param["count"] = mMouseHeldDownCount++;
				if (mHeldDownSignal) (*mHeldDownSignal)(this, param);
			}
		}

		// We only handle the click if the click both started and ended within us
		getWindow()->setCursor(UI_CURSOR_ARROW);
		lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << llendl;
	}
	return TRUE;
}
예제 #7
0
BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask)
{
	// Note: we don't bother sending the event to the children (the arrow buttons)
	// because they'll capture the mouse whenever they need hover events.
	
	BOOL handled = FALSE;
	if( hasMouseCapture() )
	{
		S32 height = getRect().getHeight();
		S32 width = getRect().getWidth();

		if( VERTICAL == mOrientation )
		{
//			S32 old_pos = mThumbRect.mTop;

			S32 delta_pixels = y - mDragStartY;
			if( mOrigRect.mBottom + delta_pixels < mThickness )
			{
				delta_pixels = mThickness - mOrigRect.mBottom - 1;
			}
			else
			if( mOrigRect.mTop + delta_pixels > height - mThickness )
			{
				delta_pixels = height - mThickness - mOrigRect.mTop + 1;
			}

			mThumbRect.mTop = mOrigRect.mTop + delta_pixels;
			mThumbRect.mBottom = mOrigRect.mBottom + delta_pixels;

			S32 thumb_length = mThumbRect.getHeight();
			S32 thumb_track_length = height - 2 * mThickness;


			if( delta_pixels != mLastDelta || mDocChanged)
			{	
				// Note: delta_pixels increases as you go up.  mDocPos increases down (line 0 is at the top of the page).
				S32 usable_track_length = thumb_track_length - thumb_length;
				if( 0 < usable_track_length )
				{
					S32 variable_lines = getDocPosMax();
					S32 pos = mThumbRect.mTop;
					F32 ratio = F32(pos - mThickness - thumb_length) / usable_track_length;	
	
					S32 new_pos = llclamp( S32(variable_lines - ratio * variable_lines + 0.5f), 0, variable_lines );
					// Note: we do not call updateThumbRect() here.  Instead we let the thumb and the document go slightly
					// out of sync (less than a line's worth) to make the thumb feel responsive.
					changeLine( new_pos - mDocPos, FALSE );
				}
			}

			mLastDelta = delta_pixels;
		
		}
		else
		{
			// Horizontal
//			S32 old_pos = mThumbRect.mLeft;

			S32 delta_pixels = x - mDragStartX;

			if( mOrigRect.mLeft + delta_pixels < mThickness )
			{
				delta_pixels = mThickness - mOrigRect.mLeft - 1;
			}
			else
			if( mOrigRect.mRight + delta_pixels > width - mThickness )
			{
				delta_pixels = width - mThickness - mOrigRect.mRight + 1;
			}

			mThumbRect.mLeft = mOrigRect.mLeft + delta_pixels;
			mThumbRect.mRight = mOrigRect.mRight + delta_pixels;
			
			S32 thumb_length = mThumbRect.getWidth();
			S32 thumb_track_length = width - 2 * mThickness;

			if( delta_pixels != mLastDelta || mDocChanged)
			{	
				// Note: delta_pixels increases as you go up.  mDocPos increases down (line 0 is at the top of the page).
				S32 usable_track_length = thumb_track_length - thumb_length;
				if( 0 < usable_track_length )
				{
					S32 variable_lines = getDocPosMax();
					S32 pos = mThumbRect.mLeft;
					F32 ratio = F32(pos - mThickness) / usable_track_length;	
	
					S32 new_pos = llclamp( S32(ratio * variable_lines + 0.5f), 0, variable_lines);
	
					// Note: we do not call updateThumbRect() here.  Instead we let the thumb and the document go slightly
					// out of sync (less than a line's worth) to make the thumb feel responsive.
					changeLine( new_pos - mDocPos, FALSE );
				}
			}

			mLastDelta = delta_pixels;
		}

		getWindow()->setCursor(UI_CURSOR_ARROW);
		LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL;		
		handled = TRUE;
	}
	else
	{
		handled = childrenHandleHover( x, y, mask ) != NULL;
	}

	// Opaque
	if( !handled )
	{
		getWindow()->setCursor(UI_CURSOR_ARROW);
		LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)"  << LL_ENDL;		
		handled = TRUE;
	}

	mDocChanged = FALSE;
	return handled;
} // end handleHover