Beispiel #1
0
void __fastcall TfrmEditLightAnim::OnItemFocused(TElTreeItem* item)
{
    if (item&&FHelper.IsObject(item)){
        ListItem* prop 			= (ListItem*)item->Tag; VERIFY(prop);
        AnsiString nm			= prop->Key();
		CLAItem* I  			= LALib.FindItem(nm.c_str());
        SetCurrentItem			(I,prop);
    }else{
        SetCurrentItem			(0,0);
    }
}
Beispiel #2
0
void CUICarBodyWnd::Show() 
{ 
	InventoryUtilities::SendInfoToActor		("ui_car_body");
	inherited::Show							();
	SetCurrentItem							(NULL);
	InventoryUtilities::UpdateWeight		(*m_pUIOurBagWnd);
}
Beispiel #3
0
bool CUICarBodyWnd::OnItemDbClick(CUICellItem* itm)
{
	CUIDragDropListEx*	old_owner		= itm->OwnerList();
	CUIDragDropListEx*	new_owner		= (old_owner==m_pUIOthersBagList)?m_pUIOurBagList:m_pUIOthersBagList;

	if(m_pOthersObject)
	{
		if( TransferItem		(	CurrentIItem(),
								(old_owner==m_pUIOthersBagList)?m_pOthersObject:m_pOurObject, 
								(old_owner==m_pUIOurBagList)?m_pOthersObject:m_pOurObject, 
								(old_owner==m_pUIOurBagList)
								)
			)
		{
			CUICellItem* ci			= old_owner->RemoveItem(CurrentItem(), false);
			new_owner->SetItem		(ci);
		}
	}else
	{
		if(false && old_owner==m_pUIOurBagList) return true;
		bool bMoveDirection		= (old_owner==m_pUIOthersBagList);

		u16 tmp_id				= (smart_cast<CGameObject*>(m_pOurObject))->ID();
		move_item				(
								bMoveDirection?m_pInventoryBox->ID():tmp_id,
								bMoveDirection?tmp_id:m_pInventoryBox->ID(),
								CurrentIItem()->object().ID());
//.		Actor()->callback		(GameObject::eInvBoxItemTake)(m_pInventoryBox->lua_game_object(), CurrentIItem()->object().lua_game_object() );

	}
	SetCurrentItem				(NULL);

	return						true;
}
Beispiel #4
0
bool CUITradeWnd::OnItemFocusedUpdate(CUICellItem* itm)
{
	if ( itm )
	{
		#ifdef INV_FLOAT_ITEM_INFO
		Fvector2 c_pos			= GetUICursor()->GetCursorPosition();
		Frect vis_rect;
		vis_rect.set			(0,0,UI_BASE_WIDTH, UI_BASE_HEIGHT);

		Frect r;
		r.set					(0.0f, 0.0f, m_uidata->UIItemInfo.GetWidth(), m_uidata->UIItemInfo.GetHeight());
		r.add					(c_pos.x, c_pos.y);

		r.sub					(0.0f,r.height());
		if (false==((vis_rect.x1<r.x1)&&(vis_rect.x2>r.x2)&&(vis_rect.y1<r.y1)&&(vis_rect.y2>r.y2)))
			r.sub				(r.width(),0.0f);
		if (false==((vis_rect.x1<r.x1)&&(vis_rect.x2>r.x2)&&(vis_rect.y1<r.y1)&&(vis_rect.y2>r.y2)))
			r.add				(0.0f,r.height());
		if (false==((vis_rect.x1<r.x1)&&(vis_rect.x2>r.x2)&&(vis_rect.y1<r.y1)&&(vis_rect.y2>r.y2)))
			r.add				(r.width(), 45.0f);

		m_uidata->UIItemInfo.SetWndPos(r.lt);
		SetCurrentItem	(itm);
		#endif
	}
	return true;
}
void MemCheckOutputView::OnSelectionChanged(wxDataViewEvent& event)
{
    // CL_DEBUG1(PLUGIN_PREFIX("MemCheckOutputView::OnSelectionChanged()"));
    if(m_dataViewCtrlErrors->GetCurrentItem().IsOk()) {
        SetCurrentItem(m_dataViewCtrlErrors->GetCurrentItem());
    }
}
Beispiel #6
0
void CUITradeWnd::PerformTrade()
{

	if (m_uidata->UIOurTradeList.ItemsCount()==0 && m_uidata->UIOthersTradeList.ItemsCount()==0) 
		return;

	int our_money			= (int)m_pInvOwner->get_money();
	int others_money		= (int)m_pOthersInvOwner->get_money();

	int delta_price			= int(m_iOurTradePrice-m_iOthersTradePrice);

	our_money				+= delta_price;
	others_money			-= delta_price;

	if(our_money>=0 && others_money>=0 && (m_iOurTradePrice>=0 || m_iOthersTradePrice>0))
	{
		m_pOthersTrade->OnPerformTrade(m_iOthersTradePrice, m_iOurTradePrice);
		
		TransferItems		(&m_uidata->UIOurTradeList,		&m_uidata->UIOthersBagList, m_pOthersTrade,	true);
		TransferItems		(&m_uidata->UIOthersTradeList,	&m_uidata->UIOurBagList,	m_pOthersTrade,	false);
	}else
	{
		if(others_money<0)
			m_uidata->UIDealMsg		= HUD().GetUI()->UIGame()->AddCustomStatic("not_enough_money_other", true);
		else
			m_uidata->UIDealMsg		= HUD().GetUI()->UIGame()->AddCustomStatic("not_enough_money_mine", true);


		m_uidata->UIDealMsg->m_endTime	= Device.fTimeGlobal+2.0f;// sec
	}
	SetCurrentItem			(NULL);
}
Beispiel #7
0
LRESULT ConfigFormUnit::Dispatch( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) {
	switch( msg ) {
	case WM_COMMAND:
		if(LOWORD(wParam) == IDOK) {
			::EndDialog(hWnd, IDOK);
			return TRUE;
		} else if( LOWORD(wParam) == IDCANCEL) {
			::EndDialog(hWnd, IDCANCEL);
			return TRUE;
		} else if( LOWORD(wParam) == IDC_DEFAULT_BUTTON) {
			return TRUE;
		} else if( HIWORD(wParam) == CBN_SELCHANGE ) {
			ChangeOptionValue();
		}
		break;
	case WM_CLOSE:
		EndDialog(hWnd, 0);
		return TRUE;
	 case WM_NOTIFY:
		if( wParam == IDC_OPTIONS_TREE ) {
			// ツリーコントロールの通知で現在選択されているアイテムを認識
			NMHDR* hdr = (LPNMHDR)lParam;
			UINT code = hdr->code;
			if( code == NM_SETCURSOR || code == NM_CLICK || code == NM_SETFOCUS) {
				HTREEITEM hItem = TreeView_GetSelection( TreeControl );
				if( hItem ) SetCurrentItem( hItem );
			}
		}
		break;
	default:
		break;
	}
	return FALSE;
}
Beispiel #8
0
void CUIActorMenu::ResetMode()
{
	ClearAllLists				();
	m_pMouseCapturer			= NULL;
	m_UIPropertiesBox->Hide		();
	SetCurrentItem				(NULL);
}
bool CUIActorMenu::OnItemRButtonClick(CUICellItem* itm)
{
	SetCurrentItem( itm );
	InfoCurItem( NULL );
	ActivatePropertiesBox();
	return false;
}
Beispiel #10
0
void FontComboBox::SetCurrentFont( const String& face )
{
   String findFace = face;
   findFace.Trim();
   if ( findFace.IsEmpty() )
      findFace = "Default";
   SetCurrentItem( FindItem( ' ' + findFace + ' ', 0, true ) ); // find exact match, case insensitive
}
void MemCheckOutputView::OnActivated(wxDataViewEvent& event)
{
    // CL_DEBUG1(PLUGIN_PREFIX("MemCheckOutputView::OnActivated()"));

    wxDataViewItem item = GetLeaf(event.GetItem());
    SetCurrentItem(item);
    JumpToLocation(item);
}
void MemCheckOutputView::OnJumpToLocation(wxCommandEvent& event)
{
    wxDataViewEvent* menuEvent = dynamic_cast<wxDataViewEvent*>(event.GetEventUserData());
    if(!menuEvent) return;

    wxDataViewItem item = GetLeaf(menuEvent->GetItem());
    SetCurrentItem(item);
    JumpToLocation(item);
}
Beispiel #13
0
void CUIMpTradeWnd::ResetItems()
{
	Msg("--ResetItems");
	ResetToOrigin						();
	CleanUserItems						();
	m_store_hierarchy->Reset			();
	UpdateShop							();
	SetCurrentItem						(NULL);
}
Beispiel #14
0
void CUITradeWnd::Show()
{
	InventoryUtilities::SendInfoToActor("ui_trade");
	inherited::Show					(true);
	inherited::Enable				(true);

	SetCurrentItem					(NULL);
	ResetAll						();
	m_uidata->UIDealMsg				= NULL;
}
Beispiel #15
0
CUITradeWnd::CUITradeWnd()
	:	m_bDealControlsVisible	(false),
		m_pTrade(NULL),
		m_pOthersTrade(NULL),
		bStarted(false)
{
	m_uidata = xr_new<CUITradeInternal>();
	Init();
	Hide();
	SetCurrentItem			(NULL);
}
bool wxListBox::FindItem(const wxString& prefix, bool strictlyAfter)
{
    int count = GetCount();
    if ( !count )
    {
        // empty listbox, we can't find anything in it
        return false;
    }

    // start either from the current item or from the next one if strictlyAfter
    // is true
    int first;
    if ( strictlyAfter )
    {
        // the following line will set first correctly to 0 if there is no
        // selection (m_current == -1)
        first = m_current == count - 1 ? 0 : m_current + 1;
    }
    else // start with the current
    {
        first = m_current == -1 ? 0 : m_current;
    }

    int last = first == 0 ? count - 1 : first - 1;

    // if this is not true we'd never exit from the loop below!
    wxASSERT_MSG( first < count && last < count, _T("logic error") );

    // precompute it outside the loop
    size_t len = prefix.length();

    // loop over all items in the listbox
    for ( int item = first; item != last; item < count - 1 ? item++ : item = 0 )
    {
        if ( wxStrnicmp(this->GetString(item).c_str(), prefix, len) == 0 )
        {
            SetCurrentItem(item);

            if ( !(GetWindowStyle() & wxLB_MULTIPLE) )
            {
                DeselectAll(item);
                SelectAndNotify(item);

                if ( GetWindowStyle() & wxLB_EXTENDED )
                    AnchorSelection(item);
            }

            return true;
        }
    }

    // nothing found
    return false;
}
Beispiel #17
0
/*
	SelectItem()

	Imposta l'elemento come selezionato.
	Se la selezione riesce, imposta l'indice interno relativo alla riga corrente.

	int nItem		indice (base 0) dell'elemento
*/
int CListCtrlEx::SelectItem(int nItem)
{
	// riga corrente
	int iCurrentItem = GetCurrentItem();

	// controlla l'indice
	if(nItem >=0 && nItem < CListCtrl::GetItemCount())
	{
		/* M$VC 6.0
		POSITION position;
		position = GetFirstSelectedItemPosition();
		while(position)
			iCurrentItem = GetNextSelectedItem(position);
		*/
		LV_ITEM lvitem;

		// ricava la riga selezionata
		if((iCurrentItem = CListCtrl::GetNextItem(0,LVNI_ALL|LVNI_FOCUSED|LVNI_SELECTED)) < 0)
			iCurrentItem = 0;

		if(iCurrentItem >= 0)
		{
			// elimina la selezione per la riga corrente
			memset(&lvitem,'\0',sizeof(LV_ITEM));
			lvitem.mask = LVIF_STATE;
			lvitem.iItem = iCurrentItem;
			lvitem.iSubItem = 0;
			lvitem.state = 0;
			lvitem.stateMask = LVIS_FOCUSED | LVIS_SELECTED ;
			if(CListCtrl::SetItemState(iCurrentItem,&lvitem))
			{
				// imposta come selezionata la riga specificata
				memset(&lvitem,'\0',sizeof(LV_ITEM));
				lvitem.mask = LVIF_STATE;
				lvitem.iItem = nItem;
				lvitem.iSubItem = 0;
				lvitem.state = LVIS_FOCUSED | LVIS_SELECTED;
				lvitem.stateMask = LVIS_FOCUSED | LVIS_SELECTED;
				if(CListCtrl::SetItemState(nItem,&lvitem))
				{
					// si assicura che la riga sia visibile ed aggiorna l'indice interno
					SetRedraw(FALSE);
					CListCtrl::EnsureVisible(nItem,FALSE);
					SetRedraw(TRUE);

					SetCurrentItem(nItem);
				}
			}
		}
	}

	return(iCurrentItem);
}
Beispiel #18
0
void CUIInventoryWnd::EatItem(PIItem itm)
{
	SetCurrentItem							(NULL);
	if(!itm->Useful())						return;
	CActor *pActor							= smart_cast<CActor*>(Level().CurrentEntity());
	if(!pActor)								return;


	SendEvent_Item_Eat						(itm);

	PlaySnd									(eInvItemUse);
}
void wxListBox::ChangeCurrent(int diff)
{
    int current = m_current == -1 ? 0 : m_current;

    current += diff;

    int last = GetCount() - 1;
    if ( current < 0 )
        current = 0;
    else if ( current > last )
        current = last;

    SetCurrentItem(current);
}
void wxListBox::DoSelect(int item, bool sel)
{
    if ( item != -1 )
    {
        // go to this item first
        SetCurrentItem(item);
    }

    // the current item is the one we want to change: either it was just
    // changed above to be the same as item or item == -1 in which we case we
    // are supposed to use the current one anyhow
    if ( m_current != -1 )
    {
        // [de]select it
        SetSelection(m_current, sel);
    }
}
Beispiel #21
0
bool CUITradeWnd::OnItemDbClick(CUICellItem* itm)
{
	SetCurrentItem						(itm);
	CUIDragDropListEx*	old_owner		= itm->OwnerList();
	
	if(old_owner == &m_uidata->UIOurBagList)
		ToOurTrade				();
	else if(old_owner == &m_uidata->UIOurTradeList)
		ToOurBag				();
	else if(old_owner == &m_uidata->UIOthersBagList)
		ToOthersTrade			();
	else if(old_owner == &m_uidata->UIOthersTradeList)
		ToOthersBag				();
	else
		R_ASSERT2(false, "wrong parent for cell item");

	return true;
}
void wxListBox::Activate(int item)
{
    if ( item != -1 )
        SetCurrentItem(item);
    else
        item = m_current;

    if ( !(GetWindowStyle() & wxLB_MULTIPLE) )
    {
        DeselectAll(item);
    }

    if ( item != -1 )
    {
        DoSelect(item);

        SendEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
    }
}
Beispiel #23
0
void CUIActorMenu::OnBtnPerformTrade(CUIWindow* w, void* d)
{
	if ( m_pTradeActorList->ItemsCount() == 0 && m_pTradePartnerList->ItemsCount() == 0 ) 
	{
		return;
	}

	int actor_money    = (int)m_pActorInvOwner->get_money();
	int partner_money  = (int)m_pPartnerInvOwner->get_money();
	int actor_price    = (int)CalcItemsPrice( m_pTradeActorList,   m_partner_trade, true  );
	int partner_price  = (int)CalcItemsPrice( m_pTradePartnerList, m_partner_trade, false );

	int delta_price    = actor_price - partner_price;
	actor_money        += delta_price;
	partner_money      -= delta_price;

	if ( ( actor_money >= 0 ) && ( partner_money >= 0 ) && ( actor_price >= 0 || partner_price > 0 ) )
	{
		m_partner_trade->OnPerformTrade( partner_price, actor_price );

		TransferItems( m_pTradeActorList,   m_pTradePartnerBagList, m_partner_trade, true );
		TransferItems( m_pTradePartnerList,	m_pTradeActorBagList,	m_partner_trade, false );
	}
	else
	{
		if ( actor_money < 0 )
		{
			CallMessageBoxOK( "not_enough_money_actor" );
		}
		else if ( partner_money < 0 )
		{
			CallMessageBoxOK( "not_enough_money_partner" );
		}
		else
		{
			CallMessageBoxOK( "trade_dont_make" );
		}
	}
	SetCurrentItem					( NULL );

	UpdateItemsPlace				();
}
void wxListBox::DoSetSelection(int n, bool select)
{
    if ( select )
    {
        if ( m_selections.Index(n) == wxNOT_FOUND )
        {
            if ( !HasMultipleSelection() )
            {
                // selecting an item in a single selection listbox deselects
                // all the others
                DeselectAll();
            }

            m_selections.Add(n);

            RefreshItem(n);
        }
        //else: already selected
    }
    else // unselect
    {
        int index = m_selections.Index(n);
        if ( index != wxNOT_FOUND )
        {
            m_selections.RemoveAt(index);

            RefreshItem(n);
        }
        //else: not selected
    }

    // sanity check: a single selection listbox can't have more than one item
    // selected
    wxASSERT_MSG( HasMultipleSelection() || (m_selections.GetCount() < 2),
                  _T("multiple selected items in single selection lbox?") );

    if ( select )
    {
        // the newly selected item becomes the current one
        SetCurrentItem(n);
    }
}
Beispiel #25
0
bool CUITradeWnd::OnItemSelected(CUICellItem* itm)
{
	SetCurrentItem		(itm);
	#ifdef INV_COLORIZE_AMMO
	ClearColorize	();
	
	u32 item_count;

    item_count = m_uidata->UIOurBagList.ItemsCount();
    for (u32 i=0; i<item_count; ++i)
    {
        CUICellItem* ourBag_item = m_uidata->UIOurBagList.GetItemIdx(i);
		PIItem invitem = (PIItem) ourBag_item->m_pData;
        ColorizeItem		(ourBag_item, CanMoveToOther(invitem));
    }
	
	ColorizeAmmo		(itm);
	#endif
	return				false;
}
void MemCheckOutputView::OnJumpToPrev(wxCommandEvent& event)
{
    // CL_DEBUG1(PLUGIN_PREFIX("MemCheckOutputView::OnJumpToPrev()"));

    if(m_currentPageIsEmptyView) return;

    m_notebookOutputView->ChangeSelection(m_notebookOutputView->FindPage(m_panelErrors));

    wxDataViewItem item = m_dataViewCtrlErrors->GetCurrentItem();
    if(item.IsOk()) {
        item = GetAdjacentItem(item, false);
    } else {
        wxDataViewItemArray items;
        m_dataViewCtrlErrorsModel->GetChildren(wxDataViewItem(0), items);
        item = GetLeaf(items.Item(items.GetCount() - 1), false);
    }

    SetCurrentItem(item);
    JumpToLocation(item);
}
Beispiel #27
0
/*
	SelectItem()

	Imposta l'elemento come selezionato.
	Se la selezione riesce, imposta l'indice interno (a base 0) relativo alla riga corrente.
*/
int CListViewEx::SelectItem(int nItem)
{
	// controlla l'indice
	if(nItem >= 0 && nItem < GetListCtrl().GetItemCount())
	{
		LV_ITEM lvitem;

		if(GetCurrentItem() >= 0)
		{
			// elimina la selezione per la riga corrente
			memset(&lvitem,'\0',sizeof(LV_ITEM));
			lvitem.mask      = LVIF_STATE;
			lvitem.iItem     = GetCurrentItem();
			lvitem.iSubItem  = 0;
			lvitem.state     = 0;
			lvitem.stateMask = LVIS_FOCUSED | LVIS_SELECTED;
			GetListCtrl().SetItemState(GetCurrentItem(),&lvitem);

			//if(GetListCtrl().SetItemState(GetCurrentItem(),&lvitem))
			{
				// imposta come selezionata la riga specificata
				memset(&lvitem,'\0',sizeof(LV_ITEM));
				lvitem.mask      = LVIF_STATE;
				lvitem.iItem     = nItem;
				lvitem.iSubItem  = 0;
				lvitem.state     = LVIS_FOCUSED | LVIS_SELECTED;
				lvitem.stateMask = LVIS_FOCUSED | LVIS_SELECTED;
				if(GetListCtrl().SetItemState(nItem,&lvitem))
				{
					// si assicura che la riga sia visibile ed aggiorna l'indice interno
					SetRedraw(FALSE);
					GetListCtrl().EnsureVisible(nItem,TRUE);
					SetRedraw(TRUE);
					SetCurrentItem(nItem);
				}
			}
		}
	}

	return(GetCurrentItem());
}
Beispiel #28
0
bool CUITradeWnd::OnItemFocusLost(CUICellItem* itm)
{
	#ifdef INV_COLORIZE_AMMO
	ClearColorize();

	u32 item_count;

    item_count = m_uidata->UIOurBagList.ItemsCount();
    for (u32 i=0; i<item_count; ++i)
    {
        CUICellItem* ourBag_item = m_uidata->UIOurBagList.GetItemIdx(i);
		PIItem invitem = (PIItem) ourBag_item->m_pData;
        ColorizeItem		(ourBag_item, CanMoveToOther(invitem));
    }
	#endif
	
	#ifdef INV_FLOAT_ITEM_INFO
	SetCurrentItem	(NULL);
	#endif
	return true;
}
bool CUIActorMenu::OnKeyboard(int dik, EUIMessages keyboard_action)
{
/*
	if (UIPropertiesBox.GetVisible())
	{	UIPropertiesBox.OnKeyboard(dik, keyboard_action); }
*/
	InfoCurItem( NULL );
	if ( is_binded(kDROP, dik) )
	{
		if ( WINDOW_KEY_PRESSED == keyboard_action && CurrentIItem() && !CurrentIItem()->IsQuestItem() )
		{

			SendEvent_Item_Drop		(CurrentIItem(), m_pActorInvOwner->object_id());
			SetCurrentItem			(NULL);
		}
		return true;
	}
	
	if ( is_binded(kSPRINT_TOGGLE, dik) )
	{
		if ( WINDOW_KEY_PRESSED == keyboard_action )
		{
			OnPressUserKey();
		}
		return true;
	}	
	
	if ( is_binded(kUSE, dik) )
	{
		if ( WINDOW_KEY_PRESSED == keyboard_action )
		{
			GetHolder()->StartStopMenu( this, true );
		}
		return true;
	}	

	if( inherited::OnKeyboard(dik,keyboard_action) )return true;

	return false;
}
Beispiel #30
0
bool CUIMpTradeWnd::OnItemRButtonClick(CUICellItem* itm)
{	
	CUIDragDropListEx*	owner_list		=	itm->OwnerList();

	SetCurrentItem							(itm);

 	SBuyItemInfo*		iinfo			=	FindItem(itm);
	SBuyItemInfo*		tmp_iinfo		=	NULL;

	if ( !CanBuyOrSellInList				(owner_list) )
	{
		return								false;
	}	

	shared_str			section			=	iinfo->m_name_sect;
	DeleteHelperItems						(owner_list);
	iinfo								=	FindItem(section, SBuyItemInfo::e_bought);
	if ( !iinfo ) iinfo					=	FindItem(section, SBuyItemInfo::e_own);

	if ( iinfo )
	{
		TryToSellItem						(iinfo, true, tmp_iinfo);
	}

	if ( owner_list						==	m_list[e_pistol_ammo] )
	{
		UpdateCorrespondingItemsForList		(m_list[e_pistol]);
	}
	else if ( owner_list				==	m_list[e_rifle_ammo] )
	{
		UpdateCorrespondingItemsForList		(m_list[e_rifle]);
	}
	else
	{
		CreateHelperItems					(owner_list);
	}

	return									false;
}