Esempio n. 1
0
void Background::MouseLDoubleClickInside(aui_MouseEvent *data)
{
	if (IsDisabled()) return;

	if (GetWhichSeesMouse() && GetWhichSeesMouse() != this) return;
	SetWhichSeesMouse(this);

	Assert(g_tiledMap != NULL);
	if (g_tiledMap == NULL) return;

	data->position.x -= X();
	data->position.y -= Y();

	if (s_savedEvents.GetCount() > 0) {
		SavedMouseEvent *ev = s_savedEvents.GetTail();
		if(ev->type == SEV_LGRAB) {
			ev->type = SEV_LDOUBLE;
			memcpy(&ev->event, data, sizeof(aui_MouseEvent));
		} else {
			ev = new SavedMouseEvent;
			memcpy(&ev->event, data, sizeof(aui_MouseEvent));
			ev->type = SEV_LDOUBLE;
			s_savedEvents.AddTail(ev);
		}
	} else {
		g_tiledMap->Click(data, TRUE);
	}

    m_lbutton_isdown = TRUE;

}
Esempio n. 2
0
void aui_Button::MouseLDragOver( aui_MouseEvent *mouseData )
{

	aui_Control::MouseLDragOver(mouseData);

	if (IsDisabled()) return;

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

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

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

			m_isRepeating = TRUE;
		}
	}
	else
		MouseLDragOutside( mouseData );
}
Esempio n. 3
0
aui_Region *aui_Region::SetWhichSeesMouse(aui_Region * region, BOOL force )
{
	aui_Region * prevRegion = GetWhichSeesMouse();

	if (force)
    {
		s_whichSeesMouse = region;
    }
	else if (region && region->IsBlind())
    {
        // Ignore this one
        s_whichSeesMouse = NULL;
    }
    else
    {
        s_whichSeesMouse = region;
    }

#if FALSE

#ifdef _DEBUG

#define STATUS_BAR_MOUSE_OVER_LDL_DEBUG_INFORMATION
#ifdef STATUS_BAR_MOUSE_OVER_LDL_DEBUG_INFORMATION
		StatusBar::SetText(aui_Ldl::GetBlock(GetWhichSeesMouse()));
#endif
#endif
#endif

	return prevRegion;
}
Esempio n. 4
0
void Background::MouseLGrabInside(aui_MouseEvent *data)
{
	if (IsDisabled()) return;

	if (GetWhichSeesMouse() && GetWhichSeesMouse() != this) return;
	SetWhichSeesMouse(this);

	Assert(g_tiledMap != NULL);
	if (g_tiledMap == NULL) return;

	data->position.x -= X();
	data->position.y -= Y();

	SavedMouseEvent *ev = new SavedMouseEvent;
	memcpy(&ev->event, data, sizeof(aui_MouseEvent));
	ev->type = SEV_LGRAB;
	s_savedEvents.AddTail(ev);


    m_lbutton_isdown = TRUE;










	data->position.x += X();
	data->position.y += Y();
}
Esempio n. 5
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 );
}
Esempio n. 6
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 );
}
Esempio n. 7
0
void Background::MouseMoveInside(aui_MouseEvent *data)

{
	if (IsDisabled()) return;

	if (GetWhichSeesMouse() && GetWhichSeesMouse() != this) return;
	SetWhichSeesMouse(this);

    Assert(data);

    MapPoint tmp;

    if (g_tiledMap && g_tiledMap->GetMouseTilePos(tmp)){
        m_current_mouse_tile = tmp;
    }

    if (data->movecount==0) {
        ProcessLastMouseMoveThisFrame(data);
    }

	if (g_tiledMap != NULL) {
		g_tiledMap->SetHiliteMouseTile(m_current_mouse_tile);
		g_tiledMap->DrawHilite( TRUE );
	}
}
Esempio n. 8
0
void aui_Control::MouseRDragInside( aui_MouseEvent *mouseData )
{

	if(IsDisabled())
		return;

	if ( GetWhichSeesMouse() && GetWhichSeesMouse() != this )
		MouseRDragAway( mouseData );
	else if ( !IsActive() )
		MouseRDragOver( mouseData );
}
Esempio n. 9
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 );
}
Esempio n. 10
0
void aui_Tab::MouseRGrabInside( aui_MouseEvent *mouseData )
{
	if ( IsDisabled() ) return;
	if ( !GetWhichSeesMouse() || GetWhichSeesMouse() == this ) {
		SetWhichSeesMouse( this );

		HandleGameSpecificRightClick((void *)this);
		m_mouseCode = AUI_ERRCODE_HANDLED;
	}
	else {
		MouseRGrabOutside( mouseData );
	}
}
Esempio n. 11
0
void C3Slider::MouseRGrabInside( aui_MouseEvent *mouseData )
{
	if (IsDisabled()) return;

	if ( !m_thumb ) return;

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

		return;
	}
	else
		MouseRGrabOutside( mouseData );
}
Esempio n. 12
0
void aui_Control::MouseNoChange( aui_MouseEvent *mouseData )
{

	if ( m_isMouseInside )
	if ( !GetWhichSeesMouse() || GetWhichSeesMouse() == this )
	if ( !mouseData->lbutton && !mouseData->rbutton )
	if ( mouseData->time - m_noChangeTime > m_timeOut )
	{
		SetWhichSeesMouse( this );

		if ( ShowTipWindow( mouseData ) )
			if ( m_mouseCode == AUI_ERRCODE_UNHANDLED )
				m_mouseCode = AUI_ERRCODE_HANDLED;
	}
}
Esempio n. 13
0
void Background::MouseRDoubleClickInside(aui_MouseEvent *data)
{
	if (IsDisabled()) return;

	if (GetWhichSeesMouse() && GetWhichSeesMouse() != this) return;
	SetWhichSeesMouse(this);

	Assert(g_tiledMap != NULL);
	if (g_tiledMap == NULL) return;

	data->position.x -= X();
	data->position.y -= Y();

	g_tiledMap->Click(data, TRUE);

    m_lbutton_isdown = TRUE;

}
Esempio n. 14
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 );
	}
}
Esempio n. 15
0
void Background::ProcessLastMouseMoveThisFrame(aui_MouseEvent *data)
{
	Assert(data);
	MapPoint cur, old;

	g_selected_item->GetOldMouseTilePos(old);
	if(m_current_mouse_tile.x != -1
	&& m_current_mouse_tile   != old
	){
		if((   m_lbutton_isdown == FALSE
		    || g_theProfileDB->IsUseCTP2Mode()
		   )
		&& (   g_selected_item->IsLocalArmy()
		    || g_selected_item->GetState() == SELECT_TYPE_LOCAL_ARMY_UNLOADING
		    ||(g_selected_item->IsLocalCity() && g_theProfileDB->IsDebugCityAstar())
		   )
		){
			g_selected_item->SetDrawablePathDest(m_current_mouse_tile);
		}
		else
		{
			g_selected_item->SetCurMouseTile(m_current_mouse_tile);
		}

		g_infoBar->SetTextFromMap(m_current_mouse_tile);

		if(!GetWhichSeesMouse() || GetWhichSeesMouse() == this)
			StatusBar::SetText(g_infoBar->GetText());

		if(ScenarioEditor::IsShown())
		{
			sint32 x,y;
			char lemurpoo[_MAX_PATH];
			x = m_current_mouse_tile.x;
			y = m_current_mouse_tile.y;
			sprintf(lemurpoo, "x: %d, y: %d", x, y);
			ctp2_Static *tf = (ctp2_Static *)aui_Ldl::GetObject("ScenarioEditor.WorldControls.PosField");
			tf->SetText(lemurpoo);
		}
	}
}
Esempio n. 16
0
void Background::MouseLDropInside(aui_MouseEvent *data)
{
	if (IsDisabled()) return;

	if (GetWhichSeesMouse() && GetWhichSeesMouse() != this) return;
	SetWhichSeesMouse(this);

	data->position.x -= X();
	data->position.y -= Y();

	SavedMouseEvent *ev = new SavedMouseEvent;
	memcpy(&ev->event, data, sizeof(aui_MouseEvent));
	ev->type = SEV_LDROP;
	s_savedEvents.AddTail(ev);


    m_lbutton_isdown = FALSE;


	data->position.x += X();
	data->position.y += Y();
}
Esempio n. 17
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 );
}
Esempio n. 18
0
void Background::MouseLDragInside( aui_MouseEvent *data )
{
	if ( IsDisabled() ) return;
	if (GetWhichSeesMouse() && GetWhichSeesMouse() != this) return;
	if ( !GetWhichSeesMouse() ) SetWhichSeesMouse( this );

	MapPoint tmp;

	data->position.x -= X();
	data->position.y -= Y();

    if (g_tiledMap && g_tiledMap->GetMouseTilePos(tmp)){
		if (m_current_mouse_tile != tmp) {
			SavedMouseEvent *ev = new SavedMouseEvent;
			memcpy(&ev->event, data, sizeof(aui_MouseEvent));
			ev->type = SEV_LDRAG;
			s_savedEvents.AddTail(ev);


		}
        m_current_mouse_tile = tmp;
    }

    if (data->movecount==0) {
        ProcessLastMouseMoveThisFrame(data);
    }

	if (g_tiledMap != NULL) {
		g_tiledMap->SetHiliteMouseTile(m_current_mouse_tile);
		g_tiledMap->DrawHilite( TRUE );
	}


	data->position.x += X();
	data->position.y += Y();
}
Esempio n. 19
0
void aui_Region::MouseLDragOver( aui_MouseEvent *mouseData )
{
	if ( IsDisabled() ) return;
	if ( !GetWhichSeesMouse() ) SetWhichSeesMouse( this );
}
Esempio n. 20
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 );
}
Esempio n. 21
0
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 );
}
Esempio n. 22
0
void aui_Region::MouseNoChange( aui_MouseEvent *mouseData )
{
	if ( IsDisabled() ) return;
	if ( m_isMouseInside && !GetWhichSeesMouse() ) SetWhichSeesMouse( this );
}
Esempio n. 23
0
AUI_ERRCODE aui_Region::ResetThis( void )
{
	if ( GetWhichSeesMouse() == this ) SetWhichSeesMouse( NULL );

	return AUI_ERRCODE_OK;
}
Esempio n. 24
0
void aui_Region::MouseRDropInside( aui_MouseEvent *mouseData )
{
	if ( IsDisabled() ) return;
	if ( !GetWhichSeesMouse() ) SetWhichSeesMouse( this );
}