Exemplo n.º 1
0
bool WindowEdit::onCursorMove( const RectInt & window, const PointInt & position, const PointInt & delta )
{
	if ( window.inRect( position ) || m_Editing )
	{
		setCursorState( EDIT );
		return true;
	}

	return false;
}
Exemplo n.º 2
0
bool WindowEdit::onLeftUp( const RectInt & window, const PointInt & position )
{
	if ( window.inRect( position ) )
	{
		return true;
	}
	else
	{
		if ( m_Editing )
		{
			onEndEdit();
			return true;
		}
	}

	return false;
}
Exemplo n.º 3
0
bool WindowButton::onCursorMove( const RectInt & window, const PointInt & position, const PointInt & delta )
{
	bool bInRect = false;
	if ( !m_HotKeyDown )
	{
		if ( visible() && window.inRect( position ) )
			bInRect = true;
	}

	if ( bInRect )
	{
		if ( !m_bGreyed )
		{
			// display the press button
			context()->setCursorState( SELECT );

			if ( m_HotKey != 0 )
			{
				updateTip( CharString().format("%s  '%s'", m_Tip, 
					keyText( Keyboard::unmap( m_HotKey ) ) ) );
			}
			else
				updateTip( m_Tip );
		}

		if ( !m_CursorOver )
		{
			if ( !m_bGreyed )
			{
				postMessage( WB_OVERBUTTON, (dword)this, 0 );
				hoverSound();
			}

			m_CursorOver = true;
			return false;			// return false on the first time a cursor is over a button, so that the other button can set m_CursorOver to false
		}

		return true;
	}
	else if ( m_CursorOver )
		m_CursorOver = false;

	return NodeWindow::onCursorMove( window, position, delta );
}
Exemplo n.º 4
0
bool WindowTree::onCursorMove( const RectInt & window, const PointInt & position, const PointInt & delta )
{
	if ( visible() )
	{
		if ( window.inRect( position ) )
		{
			m_CursorInWindow = true;
			m_LastCursorPosition = windowToScreen( position );

			setCursorState( SELECT );
			return true;
		}
		else
		{
			m_CursorInWindow = false;
		}
	}

	return NodeWindow::onCursorMove( window, position, delta );
}
Exemplo n.º 5
0
bool WindowEdit::onLeftDown( const RectInt & window, const PointInt & position )
{
	if ( window.inRect( position ) )
	{
		if ( m_Editing )
		{
			Font * pFont = windowStyle()->font();
			ASSERT( pFont );

			// get pixel offset from left side of window
			int offset = position.m_X - window.m_Left;
			// move cursor to position in text
			int i = m_EditBegin;
			for(;i<=m_EditEnd && offset > 0;i++)
				offset -= pFont->characterWidth( m_Text[i] );
			// set the cursor position
			m_Cursor = i;

			return true;
		}

		// begin editing
		onBeginEdit();
		return true;
	}
	else
	{
		if ( m_Editing )
		{
			onEndEdit();
			return true;
		}
	}

	return false;
}