Esempio n. 1
0
bool CUICellItem::OnMouseAction(float x, float y, EUIMessages mouse_action)
{
	if ( mouse_action == WINDOW_LBUTTON_DOWN )
	{
		GetMessageTarget()->SendMessage( this, DRAG_DROP_ITEM_LBUTTON_CLICK, NULL );
		GetMessageTarget()->SendMessage( this, DRAG_DROP_ITEM_SELECTED, NULL );
		m_mouse_selected_item = this;
		return false;
	}
	else if ( mouse_action == WINDOW_MOUSE_MOVE )
	{
		if ( pInput->iGetAsyncBtnState(0) && m_mouse_selected_item && m_mouse_selected_item == this )
		{
			GetMessageTarget()->SendMessage( this, DRAG_DROP_ITEM_DRAG, NULL );
			return true;
		}
	}
	else if ( mouse_action == WINDOW_LBUTTON_DB_CLICK )
	{
		GetMessageTarget()->SendMessage( this, DRAG_DROP_ITEM_DB_CLICK, NULL );
		return true;
	}
	else if ( mouse_action == WINDOW_RBUTTON_DOWN )
	{
		GetMessageTarget()->SendMessage( this, DRAG_DROP_ITEM_RBUTTON_CLICK, NULL );
		return true;
	}
	
	m_mouse_selected_item = NULL;
	return false;
};
Esempio n. 2
0
void CUIScrollBar::SendMessage(CUIWindow *pWnd, s16 msg, void *pData)
{
	if(pWnd == m_DecButton){
		if(msg == BUTTON_CLICKED || msg == BUTTON_DOWN)
		{
			TryScrollDec();
		}
	}else if(pWnd == m_IncButton){
		if(msg == BUTTON_CLICKED || msg == BUTTON_DOWN)
		{
			TryScrollInc();
		}
	}else if(pWnd == m_ScrollBox){
		if(msg == SCROLLBOX_MOVE){
			//вычислить новое положение прокрутки
			ClampByViewRect		();
			if(m_bIsHorizontal)
			{
				SetPosScrollFromView(m_ScrollBox->GetWndPos().x,m_ScrollBox->GetWidth(),GetHeight());
				if (GetMessageTarget())
					GetMessageTarget()->SendMessage(this, SCROLLBAR_HSCROLL);
			}else
			{
				SetPosScrollFromView(m_ScrollBox->GetWndPos().y,m_ScrollBox->GetHeight(),GetWidth());
				if (GetMessageTarget())
					GetMessageTarget()->SendMessage(this, SCROLLBAR_VSCROLL);
			}
		}
	}
	CUIWindow::SendMessage(pWnd, msg, pData);
}
Esempio n. 3
0
void CUIWindow::OnFocusLost()
{
	m_dwFocusReceiveTime	= 0;
	m_bCursorOverWindow		= false;	
	
	if (GetMessageTarget())
        GetMessageTarget()->SendMessage(this, WINDOW_FOCUS_LOST, NULL);	
}
Esempio n. 4
0
void CUIScrollBar::TryScrollInc()
{
	if(ScrollInc())
		if(m_bIsHorizontal)
			GetMessageTarget()->SendMessage(this, SCROLLBAR_HSCROLL);
		else
			GetMessageTarget()->SendMessage(this, SCROLLBAR_VSCROLL);
}
Esempio n. 5
0
void CUIWindow::OnFocusReceive()
{
	m_dwFocusReceiveTime	= Device.dwTimeGlobal;
	m_bCursorOverWindow		= true;	
	

	if (GetMessageTarget())
        GetMessageTarget()->SendMessage(this, WINDOW_FOCUS_RECEIVED, NULL);
}
Esempio n. 6
0
bool CUIListBoxItem::OnMouseDown(int mouse_btn)
{
	if (mouse_btn==MOUSE_1)
	{
		smart_cast<CUIScrollView*>(GetParent()->GetParent())->SetSelected(this);
		GetMessageTarget()->SendMessage(this, LIST_ITEM_SELECT, &tag);
		GetMessageTarget()->SendMessage(this, LIST_ITEM_CLICKED, &tag);
		return true;
	}else
		return false;
}
Esempio n. 7
0
bool CUIScrollBox::OnMouse(float x, float y, EUIMessages mouse_action)
{
	bool cursor_over;

	if(x>=-10.0f && x<GetWidth()+10.0f && y>=-10.0f && y<GetHeight()+10.0f)
		cursor_over = true;
	else
		cursor_over = false;

	bool im_capturer = (GetParent()->GetMouseCapturer()==this);

	if(mouse_action == WINDOW_LBUTTON_DOWN)
	{
		GetParent()->SetCapture(this, true);
	}
	else if(mouse_action == WINDOW_LBUTTON_UP)
	{		
		GetParent()->SetCapture(this, false);
	}
	else if(im_capturer && mouse_action == WINDOW_MOUSE_MOVE && cursor_over)
	{
		Fvector2	pos		= GetWndPos();
		Fvector2	delta	= GetUICursor()->GetPosDelta();

		if(m_bIsHorizontal)
			pos.x				+= delta.x;
		else
			pos.y				+= delta.y;

		SetWndPos			(pos);

		GetMessageTarget()->SendMessage(this, SCROLLBOX_MOVE);
	}
	return				true;
}
Esempio n. 8
0
void UITaskListWnd::Show( bool status )
{
	inherited::Show( status );
	GetMessageTarget()->SendMessage( this, PDA_TASK_HIDE_HINT, NULL );
	if(status)
		UpdateList();
}
Esempio n. 9
0
void CUICellItem::Update()
{
	if (m_pParentList)
		EnableHeading(m_pParentList->GetVerticalPlacement());

	if(Heading())
	{
		SetHeading			( 90.0f * (PI/180.0f) );
		SetHeadingPivot		(Fvector2().set(0.0f,0.0f), Fvector2().set(0.0f,GetWndSize().y), true);
	}else
		ResetHeadingPivot	();

	inherited::Update();
	
	if ( CursorOverWindow() )
	{
		Frect clientArea;
		m_pParentList->GetClientArea(clientArea);
		Fvector2 cp			= GetUICursor()->GetCursorPosition();
		if(clientArea.in(cp))
			GetMessageTarget()->SendMessage(this, DRAG_DROP_ITEM_FOCUSED_UPDATE, NULL);
	}
	
	m_b_already_drawn=false;
 
}
Esempio n. 10
0
void CUICustomEdit::Enable(bool status)
{
	inherited::Enable( status );
	if ( !status )
	{
		GetMessageTarget()->SendMessage( this, WINDOW_KEYBOARD_CAPTURE_LOST );
	}
}
Esempio n. 11
0
bool CUITabButton::OnMouseDown(int mouse_btn){
	if (mouse_btn==MOUSE_1)
	{
		GetMessageTarget()->SendMessage(this, TAB_CHANGED);		
		return true;
	}else
		return false;
}
Esempio n. 12
0
void CUIMMShniaga::OnBtnClick(){
	if (0 == xr_strcmp("btn_new_game", m_selected->WindowName()))
            ShowNewGame();
		else if (0 == xr_strcmp("btn_new_back", m_selected->WindowName()))
            ShowMain();
		else
            GetMessageTarget()->SendMessage(m_selected, BUTTON_CLICKED);
}
Esempio n. 13
0
void CUIStatsPlayerList::RecalcSize(){
	CUIScrollView::RecalcSize();
    if(GetHeight()<m_pad->GetHeight())
	{
		SetHeight(m_pad->GetHeight());
		GetMessageTarget()->SendMessage(this, CHILD_CHANGED_SIZE, NULL);
	}
}
Esempio n. 14
0
void CUICustomEdit::SendMessage(CUIWindow* pWnd, s16 msg, void* pData)
{
	//кто-то другой захватил клавиатуру
	if ( msg == WINDOW_KEYBOARD_CAPTURE_LOST && m_bInputFocus)
	{
		m_bInputFocus = false;
		GetMessageTarget()->SendMessage		( this, EDIT_TEXT_COMMIT, NULL );
	}
}
Esempio n. 15
0
void UITaskListWndItem::SendMessage( CUIWindow* pWnd, s16 msg, void* pData )
{
	if ( pWnd == m_bt_focus )
	{
		if ( msg == BUTTON_DOWN )
		{
			GetMessageTarget()->SendMessage( this, PDA_TASK_SET_TARGET_MAP, (void*)m_task );
		}
	}
/*	
	if ( pWnd == m_bt_view )
	{
		if ( m_bt_view->GetCheck() && msg == BUTTON_CLICKED )
		{
			GetMessageTarget()->SendMessage( this, PDA_TASK_HIDE_MAP_SPOT, (void*)m_task );
//			Msg( " HIDE task  id = %d", m_task->m_ID );
			return;
		}
		if ( !m_bt_view->GetCheck() && msg == BUTTON_CLICKED )
		{
			GetMessageTarget()->SendMessage( this, PDA_TASK_SHOW_MAP_SPOT, (void*)m_task );
//			Msg( " show task  id = %d", m_task->m_ID );
			return;
		}
	}
*/
	if ( pWnd == m_name )
	{
		if ( msg == BUTTON_DOWN )
		{
			Level().GameTaskManager().SetActiveTask( m_task );
			return;
		}

		if ( msg == WINDOW_LBUTTON_DB_CLICK )
		{
			GetMessageTarget()->SendMessage( this, PDA_TASK_SET_TARGET_MAP, (void*)m_task );
		}
	}

	inherited::SendMessage( pWnd, msg, pData );
}
Esempio n. 16
0
void CUICustomEdit::press_tab()
{
	if (!m_next_focus_capturer)
		return;

	m_bInputFocus						= false;
	GetParent()->SetKeyboardCapture		( this, false );
	GetMessageTarget()->SendMessage		( this, EDIT_TEXT_COMMIT, NULL );
	GetParent()->SetKeyboardCapture		( m_next_focus_capturer, true );
	m_next_focus_capturer->CaptureFocus	( true );
}
Esempio n. 17
0
void CUIListBox::SendMessage(CUIWindow* pWnd, s16 msg, void* pData)
{
	if (m_pad->IsChild(pWnd))
	{
		switch (msg){
			case LIST_ITEM_SELECT:	
				GetMessageTarget()->SendMessage(this, LIST_ITEM_SELECT, pData);
				break;
			case LIST_ITEM_CLICKED:
				GetMessageTarget()->SendMessage(this, LIST_ITEM_CLICKED, pData);
				break;
			case LIST_ITEM_FOCUS_RECEIVED:
				if (m_bImmediateSelection)
                    SetSelected(pWnd);
				break;
		}		
	}

	CUIScrollView::SendMessage(pWnd, msg, pData);
}
Esempio n. 18
0
bool CUICellItem::OnMouse(float x, float y, EUIMessages mouse_action)
{
	if(mouse_action == WINDOW_LBUTTON_DOWN){
		GetMessageTarget()->SendMessage(this, DRAG_DROP_ITEM_SELECTED, NULL);
		return false;
	}else
	if(mouse_action == WINDOW_MOUSE_MOVE && pInput->iGetAsyncBtnState(0)){
		GetMessageTarget()->SendMessage(this, DRAG_DROP_ITEM_DRAG, NULL);
		return true;
	}else
	if(mouse_action==WINDOW_LBUTTON_DB_CLICK){
		GetMessageTarget()->SendMessage(this, DRAG_DROP_ITEM_DB_CLICK, NULL);
		return true;
	}else
	if(mouse_action==WINDOW_RBUTTON_DOWN){
		GetMessageTarget()->SendMessage(this, DRAG_DROP_ITEM_RBUTTON_CLICK, NULL);
		return true;
	}
	
	return false;
};
Esempio n. 19
0
bool CUICellItem::OnKeyboard(int dik, EUIMessages keyboard_action)
{
	if (WINDOW_KEY_PRESSED == keyboard_action)
	{
		if (GetAccelerator() == dik)
		{
			GetMessageTarget()->SendMessage(this, DRAG_DROP_ITEM_DB_CLICK, NULL);
			return		true;
		}
	}
	return inherited::OnKeyboard(dik, keyboard_action);
}
Esempio n. 20
0
void CUIMessageBoxEx::SendMessage(CUIWindow* pWnd, s16 msg, void* pData /* = NULL */){
	CUIWndCallback::OnEvent(pWnd, msg, pData);
	if (pWnd == m_pMessageBox)
	{
		switch (msg){
			case MESSAGE_BOX_OK_CLICKED:
			case MESSAGE_BOX_YES_CLICKED:
			case MESSAGE_BOX_NO_CLICKED:
			case MESSAGE_BOX_CANCEL_CLICKED:
			case MESSAGE_BOX_QUIT_WIN_CLICKED:
			case MESSAGE_BOX_QUIT_GAME_CLICKED:
				GetHolder()->StartStopMenu(this, true);
			default:
				break;
		}

		if (GetMessageTarget())
            GetMessageTarget()->SendMessage(this,msg,pData);
	}
	
}
Esempio n. 21
0
void CUIMessageBox::OnYesOk()
{
    switch (m_eMessageBoxStyle)
    {
    case 		MESSAGEBOX_OK:
    case 		MESSAGEBOX_INFO:
        GetMessageTarget()->SendMessage(m_UIButtonYesOk, MESSAGE_BOX_OK_CLICKED);
        GetMessageTarget()->SendMessage(this, MESSAGE_BOX_OK_CLICKED);
        break;

    case 		MESSAGEBOX_DIRECT_IP:
    case 		MESSAGEBOX_YES_NO_CANCEL:
    case 		MESSAGEBOX_YES_NO_COPY:
    case 		MESSAGEBOX_PASSWORD:
    case 		MESSAGEBOX_YES_NO:
        GetMessageTarget()->SendMessage(m_UIButtonYesOk, MESSAGE_BOX_YES_CLICKED);
        GetMessageTarget()->SendMessage(this, MESSAGE_BOX_YES_CLICKED);
        break;
    case 		MESSAGEBOX_QUIT_WINDOWS:
        GetMessageTarget()->SendMessage(this, MESSAGE_BOX_QUIT_WIN_CLICKED);
        break;
    case 		MESSAGEBOX_QUIT_GAME:
        GetMessageTarget()->SendMessage(this, MESSAGE_BOX_QUIT_GAME_CLICKED);
        break;
    };
}
Esempio n. 22
0
bool CUIScrollBox::OnMouseAction(float x, float y, EUIMessages mouse_action)
{
	Fvector2	border;
	border.x	= 512.0f; // :)
	border.y	= 512.0f;

	bool over_x = ( x >= -border.x && x < (GetWidth()  + border.x) );
	bool over_y = ( y >= -border.y && y < (GetHeight() + border.y) );
		
	bool cursor_over = false;
	if(over_x && over_y)
	{
		cursor_over = true;
	}

	bool im_capturer = (GetParent()->GetMouseCapturer() == this);

	if(mouse_action == WINDOW_LBUTTON_DOWN || mouse_action == WINDOW_LBUTTON_DB_CLICK)
	{
		GetParent()->SetCapture(this, true);
		return true;
	}
	if(mouse_action == WINDOW_LBUTTON_UP)
	{		
		GetParent()->SetCapture(this, false);
		return true;
	}
	
	if(im_capturer && mouse_action == WINDOW_MOUSE_MOVE && cursor_over)
	{
		Fvector2	pos		= GetWndPos();
		Fvector2	delta	= GetUICursor().GetCursorPositionDelta();

		if(IsHorizontal())
			pos.x				+= delta.x;
		else
			pos.y				+= delta.y;

		SetWndPos			(pos);

		GetMessageTarget()->SendMessage(this, SCROLLBOX_MOVE);
	}

	if( !cursor_over )
	{
		GetParent()->SetCapture(this, false);
	}
	return true;
}
Esempio n. 23
0
void UITaskListWndItem::Update()
{
	inherited::Update();
	update_view();

	if ( m_task && m_name->CursorOverWindow() && show_hint_can )
	{
		if ( Device.dwTimeGlobal > ( m_name->FocusReceiveTime() + 700 ) )
		{
			show_hint = true;
			GetMessageTarget()->SendMessage( this, PDA_TASK_SHOW_HINT, (void*)m_task );
			return;
		}
	}
}
Esempio n. 24
0
void CUICustomEdit::press_escape()
{
	if ( xr_strlen( ec().str_edit() ) != 0 )
	{
		if ( !m_read_mode )
		{
			ec().set_edit( "" );
		}
	}
	else
	{
		m_bInputFocus					= false;
		GetParent()->SetKeyboardCapture	( this, false );
		GetMessageTarget()->SendMessage	( this, EDIT_TEXT_CANCEL, NULL );
	}
}
Esempio n. 25
0
bool CUI3tButton::OnMouseDown(int mouse_btn)
{
	if (m_bCheckMode)
	{
		if (mouse_btn==MOUSE_1)
		{
			if (m_eButtonState == BUTTON_NORMAL)
				m_eButtonState = BUTTON_PUSHED;
			else
				m_eButtonState = BUTTON_NORMAL;
		}
		GetMessageTarget()->SendMessage(this, BUTTON_CLICKED, NULL);
		return true;
	}
	else
		return CUIButton::OnMouseDown(mouse_btn);
}
Esempio n. 26
0
bool CUIBagWnd::SetMenuLevel(MENU_LEVELS level)
{
	// check range
	if (level < mlRoot || level > mlWpnSubType) 
		return false;

	m_btnBack.Enable(mlRoot != level);

	// check we really change state
	if (m_mlCurrLevel == level)
		return false;

	m_mlCurrLevel = level;	

	GetMessageTarget()->SendMessage(this, XR_MENU_LEVEL_CHANGED, NULL);

	return true;
}
Esempio n. 27
0
void CUICellItem::Update()
{
	EnableHeading(m_pParentList->GetVerticalPlacement());
	if(Heading())
	{
		SetHeading			( 90.0f * (PI/180.0f) );
		SetHeadingPivot		(Fvector2().set(0.0f,0.0f), Fvector2().set(0.0f,GetWndSize().y), true);
	}else
		ResetHeadingPivot	();

	inherited::Update();
	
	if ( CursorOverWindow() )
	{
		Frect clientArea;
		m_pParentList->GetClientArea(clientArea);
		Fvector2 cp			= GetUICursor().GetCursorPosition();
		if(clientArea.in(cp))
			GetMessageTarget()->SendMessage(this, DRAG_DROP_ITEM_FOCUSED_UPDATE, NULL);
	}
	
	PIItem item = (PIItem)m_pData;
	if ( item )
	{
		m_has_upgrade = item->has_any_upgrades();

//		Fvector2 size      = GetWndSize();
//		Fvector2 up_size = m_upgrade->GetWndSize();
//		pos.x = size.x - up_size.x - 4.0f;
		Fvector2 pos;
		pos.set( m_upgrade_pos );
		if ( ChildsCount() )
		{
			pos.x += m_text->GetWndSize().x + 2.0f;
		}
		m_upgrade->SetWndPos( pos );
	}
	m_upgrade->Show( m_has_upgrade );
}
Esempio n. 28
0
void UITaskListWnd::OnFocusReceive()
{
	inherited::OnFocusReceive();
	GetMessageTarget()->SendMessage( this, PDA_TASK_HIDE_HINT, NULL );
}
Esempio n. 29
0
void UITaskListWndItem::hide_hint()
{
	show_hint_can   = false;
	show_hint       = false;
	GetMessageTarget()->SendMessage( this, PDA_TASK_HIDE_HINT, NULL );
}
Esempio n. 30
0
void UITaskListWnd::SendMessage( CUIWindow* pWnd, s16 msg, void* pData )
{
	GetMessageTarget()->SendMessage( pWnd, msg, pData );
	inherited::SendMessage( pWnd, msg, pData );
	CUIWndCallback::OnEvent( pWnd, msg, pData );
}