Example #1
0
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 );
		}
	}
}
Example #2
0
void aui_Button::MouseLDragAway( aui_MouseEvent *mouseData )
{

	aui_Control::MouseLDragAway(mouseData);

	if (IsDisabled()) return;

	if ( GetMouseOwnership() == this )
	{
		PlaySound( AUI_SOUNDBASE_SOUND_DISENGAGE );

		if ( m_mouseCode == AUI_ERRCODE_UNHANDLED )
			m_mouseCode = AUI_ERRCODE_HANDLED;

		m_attributes &= ~k_CONTROL_ATTRIBUTE_DOWN;
		m_attributes &= ~k_CONTROL_ATTRIBUTE_ACTIVE;
		m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_MOUSELDRAGAWAY;

		m_isRepeating = FALSE;
		if ( m_ActionFunc )
			m_ActionFunc( this, AUI_BUTTON_ACTION_RELEASE, 0, m_cookie );
		else if ( m_action )
			m_action->Execute( this, AUI_BUTTON_ACTION_RELEASE, 0 );
	}
}
Example #3
0
void aui_Tab::MouseLDropInside( aui_MouseEvent *mouseData )
{
	if ( IsDisabled() ) return;
	if ( !GetWhichSeesMouse() || GetWhichSeesMouse() == this )
	{
		SetWhichSeesMouse( this );

		
		if ( GetMouseOwnership() != NULL )
		{
			PlaySound( AUI_SOUNDBASE_SOUND_ACTIVATE );

			
			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_MOUSELDROPINSIDE;

			if ( m_ActionFunc )
				m_ActionFunc( this, AUI_SWITCH_ACTION_NULL, 0, m_cookie );
			else if ( m_action )
				m_action->Execute( this, AUI_SWITCH_ACTION_NULL, 0 );
		}
	}
	else
		MouseLDropOutside( mouseData );
}
Example #4
0
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 );
	}
}
Example #5
0
void aui_Control::SendKeyboardAction()
{
	if(m_ActionFunc) {
		m_ActionFunc(this, m_keyboardAction, 0, m_cookie);
	} else if(m_action) {
		m_action->Execute(this, m_keyboardAction, 0);
	}
}
Example #6
0
void aui_Button::MouseLDropInside( aui_MouseEvent *mouseData )
{
	if (IsDisabled()) {
		g_soundManager->AddGameSound(GAMESOUNDS_DISABLED);
		return;
	}
	if ( !GetWhichSeesMouse() || GetWhichSeesMouse() == this )
	{
		SetWhichSeesMouse( this );

		if ( GetMouseOwnership() == this )
		{

			ReleaseMouseOwnership();

			PlaySound( AUI_SOUNDBASE_SOUND_EXECUTE );

			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_MOUSELDROPINSIDE;

			m_isRepeating = FALSE;

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

			if ( !HandleGameSpecificLeftClick( this ) )
			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 );
		}
		else
		{
			PlaySound( AUI_SOUNDBASE_SOUND_ACTIVATE );

			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_MOUSELDROPINSIDE;
		}
	}
	else
		MouseLDropOutside( mouseData );
}
AUI_ERRCODE aui_MovieButton::Idle( void )
{
	if ( m_movie )
	{

		if ( !m_movie->GetDestSurface() ) {
			m_movie->SetDestSurface( m_window->TheSurface() );
		}

		if ( !m_movie->IsOpen() ) {
			uint32 flags = m_flags;

			if (m_fullScreen) {
				flags |= k_AUI_MOVIE_PLAYFLAG_ONSCREEN;
			}

			RECT adjustedRect = {m_x, m_y, m_x+m_width, m_y+m_height};

			ToScreen(&adjustedRect);

			if (m_movie->Open(flags, g_c3ui->Secondary(), &adjustedRect) != AUI_ERRCODE_OK) {

				SetMovie(NULL);
				if (GetActionFunc())
					GetActionFunc()(this, AUI_BUTTON_ACTION_EXECUTE, 0, 0);
			}
		}

		if (m_movie)
		{
			if ( !m_movie->IsPlaying() && !m_movie->IsFinished())
			{
				m_movie->Play();
			}

			(void) m_movie->Process();

			if (m_movie->IsFinished() && !(m_flags & k_AUI_MOVIE_PLAYFLAG_PLAYANDHOLD))
			{
				if (m_ActionFunc)
					m_ActionFunc((aui_Control *)this, AUI_BUTTON_ACTION_EXECUTE, 0, NULL);
			}
		}
	}

	return AUI_ERRCODE_OK;
}
Example #8
0
sint32 aui_Tab::SetState( sint32 state )
{
	sint32 prevState = m_state;
	m_state = state;
	
    if (m_state)
	{
		
		
		if ( m_numStates == 2 ) m_state = 1;

		m_attributes |= k_CONTROL_ATTRIBUTE_ON;
		if ( m_pane->IsHidden() ) m_pane->Show();
	}
	else
	{
		m_attributes &= ~k_CONTROL_ATTRIBUTE_ON;
		if ( !m_pane->IsHidden() ) m_pane->Hide();
	}

	
	m_state = Mod(m_state,m_numStates);

	if ( m_ActionFunc )
		m_ActionFunc(
			this,
			m_state ? AUI_SWITCH_ACTION_ON : AUI_SWITCH_ACTION_OFF,
			(uint32)m_state,
			m_cookie );
	else if ( m_action )
		m_action->Execute(
			this,
			m_state ? AUI_SWITCH_ACTION_ON : AUI_SWITCH_ACTION_OFF,
			(uint32)m_state );

	
	if ( prevState != m_state )
		m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_UPDATE;

	return prevState;
}
Example #9
0
void aui_Control::MouseMoveOver( aui_MouseEvent *mouseData )
{
	if(IsDisabled())
		return;

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

		if(GetWhichSeesMouse() == this) {

			Highlight();

			PlaySound( AUI_SOUNDBASE_SOUND_ACTIVATE );

			if(m_statusText)
			{
				StatusBar::SetText(m_statusText, this);
			}
			else if(m_statusTextCopy)
			{
				StatusBar::SetText(m_statusTextCopy, this);
			}

			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_MOUSEMOVEOVER;

			if ( m_ActionFunc )
				m_ActionFunc( this, 0, 0, m_cookie );
			else if ( m_action )
				m_action->Execute( this, 0, 0 );
		}
	}
	else
	{
		MouseMoveOutside( mouseData );
	}
}
Example #10
0
void aui_Tab::MouseLDragAway( aui_MouseEvent *mouseData )
{
	if ( IsDisabled() ) return;
	
	if ( GetMouseOwnership() == NULL )
	{
		PlaySound( AUI_SOUNDBASE_SOUND_DEACTIVATE );

		
		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_MOUSELDRAGAWAY;

		if ( m_ActionFunc )
			m_ActionFunc( this, AUI_SWITCH_ACTION_NULL, 0, m_cookie );
		else if ( m_action )
			m_action->Execute( this, AUI_SWITCH_ACTION_NULL, 0 );
	}
}
Example #11
0
void aui_Button::PostChildrenCallback( aui_MouseEvent *mouseData )
{
	if ( m_isRepeating && mouseData->time - m_startWaitTime > m_timeOut )
	{
		if ( mouseData->time - m_lastRepeatTime > m_repeatTime )
		{
			m_lastRepeatTime = mouseData->time;

			if ( m_ActionFunc )
				m_ActionFunc(
					this,
					AUI_BUTTON_ACTION_PRESS,
					(uint32)++m_repeatCount,
					m_cookie );
			else if ( m_action )
				m_action->Execute(
					this,
					AUI_BUTTON_ACTION_PRESS,
					(uint32)++m_repeatCount );
		}
	}
}
Example #12
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_MenuButton::MouseLDragAway( aui_MouseEvent *mouseData )
{
	if (IsDisabled()) return;

	if ( GetMouseOwnership() == this)
	{
		PlaySound( AUI_SOUNDBASE_SOUND_DISENGAGE );

		if ( m_mouseCode == AUI_ERRCODE_UNHANDLED )
			m_mouseCode = AUI_ERRCODE_HANDLED;

		m_attributes &= ~k_CONTROL_ATTRIBUTE_DOWN;
		m_attributes &= ~k_CONTROL_ATTRIBUTE_ACTIVE;
		m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_MOUSELDRAGAWAY;

		m_isRepeating = FALSE;
		if ( m_ActionFunc )
			m_ActionFunc( this, AUI_BUTTON_ACTION_RELEASE, 0, m_cookie );
		else if ( m_action )
			m_action->Execute( this, AUI_BUTTON_ACTION_RELEASE, 0 );

		if(mouseData->position.y >= Y() + Height()) {
			SetWhichSeesMouse(NULL);
			mouseData->position.y -= Height();
			m_menu->ActivateMenu(mouseData);
		} else if(mouseData->position.x >= X() + Width()) {
			if(m_rightNeighbor) {
				m_rightNeighbor->MouseLGrabInside(mouseData);
			}
			m_menu->Close();
		} else if(mouseData->position.x < X()) {
			if(m_leftNeighbor) {
				m_leftNeighbor->MouseLGrabInside(mouseData);
			}
			m_menu->Close();
		}
	}
}
Example #14
0
void ctp2_HyperTextBox::MouseLDropInside( aui_MouseEvent *mouseData )
{
	if (IsDisabled()) return;

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

		
		if ( GetMouseOwnership() == this )
		{
			
			ReleaseMouseOwnership();

			PlaySound( AUI_SOUNDBASE_SOUND_EXECUTE );

			
			m_mouseCode = AUI_ERRCODE_HANDLEDEXCLUSIVE;

			


			
			
			
			m_attributes &= ~k_CONTROL_ATTRIBUTE_ACTIVE;

			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;
					m_selectedHyperLink = hl;
				}
				else {
					hl->m_frame = FALSE;
					hl->m_static->SetTextColor( hl->m_oldColor );
				}
			}

			if ( m_selectedHyperLink ) {

				
				m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_MOUSELDROPINSIDE;

				

				if ( !HandleGameSpecificLeftClick( this ) )
				if ( m_ActionFunc )
					m_ActionFunc( this, CTP2_HYPERLINK_ACTION_EXECUTE, 0, m_cookie );
				else if ( m_action )
					m_action->Execute( this, CTP2_HYPERLINK_ACTION_EXECUTE, 0 );
				else {
					
					open_GreatLibrary();
					if(g_greatLibrary) {
						g_greatLibrary->SetLibrary(m_selectedHyperLink->m_index, (DATABASE)m_selectedHyperLink->m_db);
					}
				}
			}
			else {
				m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_UPDATE;
			}
		}
		else
		{
			PlaySound( AUI_SOUNDBASE_SOUND_ACTIVATE );

			
			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_MOUSELDROPINSIDE;
		}
	}
	else
		MouseLDropOutside( mouseData );
}