Exemple #1
0
void aui_Tab::MouseLGrabInside( aui_MouseEvent *mouseData )
{
	if ( IsDisabled() ) return;
	if ( !GetWhichSeesMouse() || GetWhichSeesMouse() == this )
	{
		SetWhichSeesMouse( this );

		PlaySound( AUI_SOUNDBASE_SOUND_EXECUTE );

		
		HideTipWindow();

		
		SetMouseOwnership();
		ReleaseMouseOwnership();
		SetKeyboardFocus();

		m_mouseCode = AUI_ERRCODE_HANDLEDEXCLUSIVE;

		
		if ( !HandleGameSpecificLeftClick( this ) )
		if ( 0 < m_state && m_state < m_numStates - 1 )
			SetState( Mod(m_state+1,m_numStates) );
		else
			SetState( 1 );

		m_attributes |= k_CONTROL_ATTRIBUTE_ACTIVE;

		
		m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_MOUSELGRABINSIDE;
	}
	else
		MouseLGrabOutside( mouseData );
}
void aui_Control::MouseMoveAway( aui_MouseEvent *mouseData )
{

	HideTipWindow();

	if(IsDisabled())
		return;

	Highlight(false);

	if(IsActive()) {
		PlaySound( AUI_SOUNDBASE_SOUND_DEACTIVATE );

		if(m_statusText && StatusBar::GetOwner() == this) {
			StatusBar::SetText("", NULL);
		}

		if ( m_mouseCode == AUI_ERRCODE_UNHANDLED )
			m_mouseCode = AUI_ERRCODE_HANDLED;

		m_attributes &= ~k_CONTROL_ATTRIBUTE_ACTIVE;
		m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_MOUSEMOVEAWAY;

		if ( m_ActionFunc )
			m_ActionFunc( this, 0, 0, m_cookie );
		else if ( m_action )
			m_action->Execute( this, 0, 0 );
	}
}
AUI_ERRCODE aui_Control::HideThis( void )
{

	HideTipWindow();

	return aui_Region::HideThis();
}
void aui_Button::KeyboardCallback( aui_KeyboardEvent *keyboardData )
{







	if ( !GetMouseOwnership() && ( keyboardData->key == AUI_KEYBOARD_KEY_RETURN)) {

		if ( keyboardData->down && !m_keyboardEvent.down )
		{
			PlaySound( AUI_SOUNDBASE_SOUND_ENGAGE );

			HideTipWindow();

			m_attributes |= k_CONTROL_ATTRIBUTE_DOWN;
			m_attributes |= k_CONTROL_ATTRIBUTE_ACTIVE;
			m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_KEYSTATECHANGE;

			m_isRepeating = TRUE;
			m_repeatCount = 0;
			m_startWaitTime = keyboardData->time;
			if ( m_ActionFunc )
				m_ActionFunc( this, AUI_BUTTON_ACTION_PRESS, 0, m_cookie );
			else if ( m_action )
				m_action->Execute( this, AUI_BUTTON_ACTION_PRESS, 0 );
		}

		else if ( !keyboardData->down && m_keyboardEvent.down )
		{
			PlaySound( AUI_SOUNDBASE_SOUND_EXECUTE );

			m_attributes &= ~k_CONTROL_ATTRIBUTE_DOWN;
			m_attributes &= ~k_CONTROL_ATTRIBUTE_ACTIVE;

			m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_KEYSTATECHANGE;

			if(GetAttracting()) {
				SetAttract(false, 0);
			}

			m_isRepeating = FALSE;
			if ( m_ActionFunc )
				m_ActionFunc( this, AUI_BUTTON_ACTION_EXECUTE, 0, m_cookie );
			else if ( m_action )
				m_action->Execute( this, AUI_BUTTON_ACTION_EXECUTE, 0 );
		}
	}
}
void aui_Button::MouseLGrabInside( aui_MouseEvent *mouseData )
{
	if (IsDisabled()) {
		if (g_soundManager) {
			g_soundManager->AddSound(SOUNDTYPE_SFX, 0,
					gamesounds_GetGameSoundID(GAMESOUNDS_GENERALFAIL), 0, 0);
		}
		return;
	}

	if ( !GetWhichSeesMouse() || GetWhichSeesMouse() == this )
	{
		SetWhichSeesMouse( this );

		PlaySound( AUI_SOUNDBASE_SOUND_ENGAGE );

		HideTipWindow();

		SetMouseOwnership();
		SetKeyboardFocus();

		m_mouseCode = AUI_ERRCODE_HANDLEDEXCLUSIVE;

		m_attributes |= k_CONTROL_ATTRIBUTE_DOWN;
		m_attributes |= k_CONTROL_ATTRIBUTE_ACTIVE;
		m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_MOUSELGRABINSIDE;

		m_isRepeating = TRUE;
		m_repeatCount = 0;
		m_startWaitTime = mouseData->time;
		if ( m_ActionFunc )
			m_ActionFunc( this, AUI_BUTTON_ACTION_PRESS, 0, m_cookie );
		else if ( m_action )
			m_action->Execute( this, AUI_BUTTON_ACTION_PRESS, 0 );
	}
	else
		MouseLGrabOutside( mouseData );
}
void ctp2_HyperTextBox::MouseLGrabInside( aui_MouseEvent *mouseData )
{
	if (IsDisabled()) return;

	if ( !GetWhichSeesMouse() || GetWhichSeesMouse() == this )
	{
		SetWhichSeesMouse( this );

		PlaySound( AUI_SOUNDBASE_SOUND_ENGAGE );

		
		HideTipWindow();

		
		SetMouseOwnership();
		SetKeyboardFocus();

		m_mouseCode = AUI_ERRCODE_HANDLEDEXCLUSIVE;

		
		m_attributes |= k_CONTROL_ATTRIBUTE_DOWN;
		m_attributes |= k_CONTROL_ATTRIBUTE_ACTIVE;
		m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_MOUSELGRABINSIDE;

		POINT pos;
		pos.x = mouseData->position.x - m_x;
		pos.y = mouseData->position.y - m_y;

		
		pos.y += m_ranger->GetValueY();

		
		m_selectedHyperLink = NULL;

		ListPos lp = m_hyperLinkList->GetHeadPosition();
		for ( uint32 i = 0;i < m_hyperLinkList->L();i++ ) {
			ctp2_HyperLink *hl = m_hyperLinkList->GetNext( lp );
			RECT rect;
			rect.left = hl->m_static->X();
			rect.top = hl->m_static->Y();
			rect.right = rect.left + hl->m_static->Width();
			rect.bottom = rect.top + hl->m_static->Height();

			if ( PtInRect(&rect, pos) ) {
				hl->m_frame = TRUE;
				hl->m_static->SetTextColor( hl->m_selectColor );
				m_selectedHyperLink = hl;
			}
			else {
				hl->m_frame = FALSE;
				hl->m_static->SetTextColor( hl->m_oldColor );
			}
		}
		







	}
	else
		MouseLGrabOutside( mouseData );
}