Exemplo n.º 1
0
BOOL CDropListBox::Expand(PLIST_ITEM pItem)
{
	int i, nPos, nParentPos = GetItemIndex(pItem);
	ASSERT(nParentPos >= 0);
	if(nParentPos < 0 || pItem->GetChildCount() <= 0)
	{
		return FALSE;
	}
	for(i = pItem->GetChildCount() - 1; i >= 0; i--)
	{
		PLIST_ITEM pChild = pItem->GetChildAt(i);
		ASSERT(pChild);

		nPos = GetItemIndex(pChild);
		//already in the listbox
		if(nPos >= 0)
		{
			continue;
		}
		
		InsertListItem(nParentPos + 1, pChild);
	}

	pItem->state &= ~ACBIS_COLLAPSED;
	return TRUE;
}
Exemplo n.º 2
0
void WINAPI duListBox::OnMouseLDown(POINT pt)
{
	if (m_pHotItem != m_pSelItem)
	{
		ListBoxItem *pTemp = m_pSelItem;
		m_pSelItem = m_pHotItem;
		Plugin_Redraw(this, TRUE);

		int nOldSelItemIndex = GetItemIndex(pTemp);
		int nNewSelItemIndex = GetItemIndex(m_pHotItem);
		NotifyUser(DUM_LBSELCHANGED, (WPARAM)nOldSelItemIndex, (LPARAM)nNewSelItemIndex);
	}
}
Exemplo n.º 3
0
bool CPythonPlayer::__HasItem(DWORD dwItemID)
{
	for (int i = 0; i < c_Inventory_Count; ++i)
	{
		if (dwItemID == GetItemIndex(TItemPos (INVENTORY, i)))
			return true;
	}
	for (int i = 0; i < c_DragonSoul_Inventory_Count; ++i)
	{
		if (dwItemID == GetItemIndex(TItemPos (DRAGON_SOUL_INVENTORY, i)))
			return true;
	}

	return false;
}
Exemplo n.º 4
0
void CQueueViewBase::RefreshItem(const CQueueItem* pItem)
{
	wxASSERT(pItem);
	int index = GetItemIndex(pItem);

	wxListCtrl::RefreshItem(index);
}
Exemplo n.º 5
0
bool TabBox::Remove(Control* pControl)
{
	if( pControl == NULL) return false;

	int index = GetItemIndex(pControl);
	bool ret = Box::Remove(pControl);
	if( !ret ) return false;

	if( m_iCurSel == index)	{
		if( GetCount() > 0 ) {
			m_iCurSel=0;
			if (!IsFadeSwitch()) {
				GetItemAt(m_iCurSel)->SetVisible(true);
			}

			pControl->SetMouseEnabled(true);
			if (Box* box = dynamic_cast<Box*>(pControl)) {
				box->SetMouseChildEnabled(true);
			}
			pControl->SetAlpha(255);
		}
		else
			m_iCurSel=-1;

		ArrangeAncestor();
	}
	else if( m_iCurSel > index ) {
		m_iCurSel -= 1;
	}

	return ret;
}
Exemplo n.º 6
0
void CFX_ListCtrl::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl)
{
	int32_t nHitIndex = GetItemIndex(point);

	if (IsMultipleSel())
	{
		if (bCtrl)
		{
			if (m_bCtrlSel)
				m_aSelItems.Add(m_nFootIndex,nHitIndex);
			else
				m_aSelItems.Sub(m_nFootIndex,nHitIndex);

			SelectItems();
		}
		else
		{
			m_aSelItems.DeselectAll();
			m_aSelItems.Add(m_nFootIndex,nHitIndex);
			SelectItems();
		}

		SetCaret(nHitIndex);
	}
	else
	{
		SetSingleSelect(nHitIndex);
	}

	if (!IsItemVisible(nHitIndex))
		ScrollToListItem(nHitIndex);
}
Exemplo n.º 7
0
void cUIMenu::TrySelect( cUIControl * Ctrl, bool Up ) {
	if ( mItems.size() ) {
		if ( !Ctrl->IsType( UI_TYPE_SEPARATOR ) ) {
			SetItemSelected( Ctrl );
		} else {
			Uint32 Index = GetItemIndex( Ctrl );

			if ( Index != eeINDEX_NOT_FOUND ) {
				if ( Up ) {
					if ( Index > 0 ) {
						for ( Int32 i = (Int32)Index - 1; i >= 0; i-- ) {
							if ( !mItems[i]->IsType( UI_TYPE_SEPARATOR ) ) {
								SetItemSelected( mItems[i] );
								return;
							}
						}
					}

					SetItemSelected( mItems[ mItems.size() ] );
				} else {
					for ( Uint32 i = Index + 1; i < mItems.size(); i++ ) {
						if ( !mItems[i]->IsType( UI_TYPE_SEPARATOR ) ) {
							SetItemSelected( mItems[i] );
							return;
						}
					}

					SetItemSelected( mItems[0] );
				}
			}
		}
	}
}
Exemplo n.º 8
0
	BOOL CTabLayoutUI::Remove(CControlUI* pControl)
	{
		if( pControl == NULL) return FALSE;

		int index = GetItemIndex(pControl);
		BOOL ret = CContainerUI::Remove(pControl);
		if( !ret ) return FALSE;

		if( m_iCurSel == index)
		{
			if( GetCount() > 0 )
			{
				m_iCurSel=0;
				GetItemAt(m_iCurSel)->SetVisible(TRUE);
			}
			else
				m_iCurSel=-1;
			NeedParentUpdate();
		}
		else if( m_iCurSel > index )
		{
			m_iCurSel -= 1;
		}

		return ret;
	}
Exemplo n.º 9
0
bool TabBox::AddAt(Control* pControl, std::size_t iIndex)
{
	bool ret = Box::AddAt(pControl, iIndex);
	if(!ret)
		return ret;

	if(m_iCurSel == -1 && pControl->IsVisible()) {
		m_iCurSel = GetItemIndex(pControl);
	}
	else if( m_iCurSel != -1 && iIndex <= (std::size_t)m_iCurSel ) {
		m_iCurSel += 1;
	}
	else {
		if (!IsFadeSwitch()) {
			pControl->SetVisible(false);
		}
		pControl->SetMouseEnabled(false);
		if (Box* box = dynamic_cast<Box*>(pControl)) {
			box->SetMouseChildEnabled(false);
		}
		pControl->SetAlpha(0);
	}

	return ret;
}
Exemplo n.º 10
0
	bool CTabLayoutUI::Remove(CControlUI* pControl)
	{
		if (pControl == NULL) return false;

		int index = GetItemIndex(pControl);
		bool ret = CContainerUI::Remove(pControl);
		if( !ret ) return false;

		if (m_nCurSel == index)
		{
			if (GetCount() > 0)
			{
				m_nCurSel=0;
				GetItemAt(m_nCurSel)->SetVisible(true);
			}
			else m_nCurSel=-1;
			NeedParentUpdate();
		}
		else if (m_nCurSel > index)
		{
			m_nCurSel -= 1;
		}

		return ret;
	}
Exemplo n.º 11
0
void WINAPI duListBox::OnMouseHover(POINT pt)
{
	if (m_pHotItem)
	{
		int nHotItemIndex = GetItemIndex(m_pHotItem);
		NotifyUser(DUM_LBHOVER, (WPARAM)nHotItemIndex, NULL);
	}
}
Exemplo n.º 12
0
void WINAPI duListBox::OnMouseDbClick(POINT pt)
{
	if (m_pHotItem)
	{
		int nHotItemIndex = GetItemIndex(m_pHotItem);
		NotifyUser(DUM_LBLBUTTONDBCLICK, (WPARAM)nHotItemIndex, NULL);
	}
}
Exemplo n.º 13
0
int32_t CFX_ListCtrl::GetTopItem() const {
  int32_t nItemIndex = GetItemIndex(GetBTPoint());

  if (!IsItemVisible(nItemIndex) && IsItemVisible(nItemIndex + 1))
    nItemIndex += 1;

  return nItemIndex;
}
Exemplo n.º 14
0
int WINAPI duListBox::GetSel()
{
	if (!m_fCombobox)
	{
		if (m_pSelItem == NULL)
			return -1;

		return GetItemIndex(m_pSelItem);
	}
	else
	{
		if (m_pHotItem == NULL)
			return -1;

		return GetItemIndex(m_pHotItem);
	}
}
Exemplo n.º 15
0
	bool CTabLayoutUI::SelectItem(CControlUI* pControl, bool bTriggerEvent)
	{
		int iIndex=GetItemIndex(pControl);
		if (iIndex==-1)
			return false;
		else
			return SelectItem(iIndex, bTriggerEvent);
	}
Exemplo n.º 16
0
	BOOL CTabLayoutUI::SelectItem( CControlUI* pControl )
	{
		int iIndex=GetItemIndex(pControl);
		if (iIndex==-1)
			return FALSE;
		else
			return SelectItem(iIndex);
	}
Exemplo n.º 17
0
// 设置tab页的可见性(根据tab名字)
void CDuiTabCtrl::SetItemVisible(CString strTabName, BOOL bVisible)
{
	int nItem = GetItemIndex(strTabName);
	if(nItem != -1)
	{
		SetItemVisible(nItem, bVisible);
	}
}
Exemplo n.º 18
0
bool TabBox::SelectItem( Control* pControl )
{
	int iIndex = GetItemIndex(pControl);
	if (iIndex==-1)
		return false;
	else
		return SelectItem(iIndex);
}
Exemplo n.º 19
0
	bool CTabLayoutUI::SelectItem(CControlUI* pControl)
	{
		int nIndex = GetItemIndex(pControl);
		if (nIndex == -1)
			return false;
		else
			return SelectItem(nIndex);
	}
Exemplo n.º 20
0
void WINAPI duListBox::OnMouseRDown(POINT pt)
{
	if (m_pHotItem)
	{
		int nHotItemIndex = GetItemIndex(m_pHotItem);
		NotifyUser(DUM_LBRBUTTONDOWN, (WPARAM)nHotItemIndex, NULL);
	}
}
Exemplo n.º 21
0
// 获取tab页的可见性
BOOL CDuiTabCtrl::GetItemVisible(CString strTabName)
{
	int nItem = GetItemIndex(strTabName);
	if(nItem != -1)
	{
		return GetItemVisible(nItem);
	}

	return FALSE;
}
Exemplo n.º 22
0
void CFeedIcoItemListCtrl::RemoveFeed(CRssFeed & feed)
{
	int nIndex = GetItemIndex(&feed);

	m_stringMatcher.RemoveItem((void*)&feed);

	RemoveItemforMap(feed, nIndex);

	DeleteItem(nIndex);
}
Exemplo n.º 23
0
void CHistory::GetStartEndIndexesForPeriod(COleDateTime from, COleDateTime to, int& nStart, int &nEnd)
{
	if(arItems.GetSize() == 0)
	{
		nStart = nEnd = -1;
		return;
	}
	
	// start
	if(from.GetStatus() != COleDateTime::valid || from <= arItems[arItems.GetUpperBound()].date)
		nStart = arItems.GetUpperBound();
	else
		nStart = GetItemIndex(from, false);
	
	// end
	if(to.GetStatus() != COleDateTime::valid || to >= arItems[0].date)
		nEnd = 0;
	else
		nEnd = GetItemIndex(to, false);
}
Exemplo n.º 24
0
bool CPythonPlayer::__HasEnoughArrow()
{
	CItemData * pItemData;
	if (CItemManager::Instance().GetItemDataPointer(GetItemIndex(TItemPos(INVENTORY, c_Equipment_Arrow)), &pItemData))
	if (CItemData::ITEM_TYPE_WEAPON == pItemData->GetType())
	if (CItemData::WEAPON_ARROW == pItemData->GetSubType())
	{
		return true;
	}

	PyCallClassMemberFunc(m_ppyGameWindow, "OnCannotShotError", Py_BuildValue("(is)", GetMainCharacterIndex(), "EMPTY_ARROW"));
	return false;
}
Exemplo n.º 25
0
void CQueueViewBase::RefreshItem(const CQueueItem* pItem)
{
	wxASSERT(pItem);
	int index = GetItemIndex(pItem);

#ifdef __WXMSW__
	wxRect rect;
	GetItemRect(index, rect);
	RefreshRect(rect, false);
#else
	wxListCtrl::RefreshItem(index);
#endif
}
Exemplo n.º 26
0
bool CTabLayoutUI::Add(CControlUI* pControl)
{
    bool ret = CContainerUI::Add(pControl);

    if (!ret) return ret;

    if (m_iCurSel == -1 && pControl->IsVisible()) {
        m_iCurSel = GetItemIndex(pControl);
    } else {
        pControl->SetVisible(false);
    }

    return ret;
}
Exemplo n.º 27
0
int CDropListBox::AtomicDeleteListItem( PLIST_ITEM pItem )
{
	int nPos = GetItemIndex(pItem);
	//not in the listbox
	if(nPos < 0)
	{
		return nPos;
	}
	
	pItem->state |= ACBIS_INVISIBLE;
	DeleteString(nPos);

	return nPos;
}
Exemplo n.º 28
0
int QueueWindow::RemoveQueueItem(QueueOperation * op) {
	if (!ValidType(op->GetType()))
		return -1;

	int index = GetItemIndex(op);
	if (index == -1)
		return -1;

	BOOL res = ListView_DeleteItem(m_hwnd,index);
	if (res == FALSE)
		return -1;

	return -1;
}
Exemplo n.º 29
0
bool CTabLayoutUI::AddAt(CControlUI* pControl, int iIndex)
{
    bool ret = CContainerUI::AddAt(pControl, iIndex);

    if (!ret) return ret;

    if (m_iCurSel == -1 && pControl->IsVisible()) {
        m_iCurSel = GetItemIndex(pControl);
    } else if (m_iCurSel != -1 && iIndex <= m_iCurSel) {
        m_iCurSel += 1;
    } else {
        pControl->SetVisible(false);
    }

    return ret;
}
Exemplo n.º 30
0
void CQueueViewBase::InsertItem(CServerItem* pServerItem, CQueueItem* pItem)
{
    const int newIndex = GetItemIndex(pServerItem) + pServerItem->GetChildrenCount(true) + 1;

    pServerItem->AddChild(pItem);
    m_itemCount++;

    if (m_insertionStart == -1) {
        assert(!m_insertionCount);
        m_insertionStart = newIndex;
    }
    ++m_insertionCount;

    if (pItem->GetType() == QueueItemType::File || pItem->GetType() == QueueItemType::Folder) {
        m_fileCount++;
        m_fileCountChanged = true;
    }
}