示例#1
0
suic::Size TabControl::MeasureOverride(const suic::Size& size)
{
    suic::Size availableSize;

    if (ReadFlag(CoreFlags::IsMeasureDirty))
    {
        _headerHeight = 0;

        int iItems = GetItems()->GetCount();

        for (int i = 0; i < iItems; ++i)
        {
            TabItemPtr tabItem(GetItems()->GetItem(i));

            tabItem->Measure(size);

            if (tabItem->GetDesiredSize().cy > _headerHeight)
            {
                _headerHeight = tabItem->GetDesiredSize().cy;
            }
        }

        TabItemPtr focusTab(_focusItem);

        if (focusTab && focusTab->GetTabContent())
        {
            focusTab->GetTabContent()->Measure(size);
        }

        WriteFlag(CoreFlags::IsMeasureDirty, false);
    }

    return size;
}
示例#2
0
TreeViewItemPtr TreeViewItem::HitTreeItem(suic::Point pt)
{
    if (GetHeader())
    {
        suic::Rect rect = suic::VisualHelper::GetRenderRect(GetHeaderHost().get());

        if (rect.PointIn(pt))
        {
            return this;
        }
    }

    TreeViewItemPtr ret;
    int count = GetItems()->GetCount();

    for (int i = 0; i < count; ++i)
    {
        TreeViewItemPtr item(GetItems()->GetItem(i));

        if (item.get() && (ret=item->HitTreeItem(pt)))
        {
            break;
        }
    }

    return ret;
}
示例#3
0
	void GlooxCLEntry::addToPrivacyList (bool add)
	{
		const auto& jid = GetJID ();

		auto lists = Account_->GetClientConnection ()->GetPrivacyListsManager ();

		auto current = lists->GetCurrentList ();
		auto items = current.GetItems ();
		for (const auto& item : items)
		{
			if (item.GetType () != PrivacyListItem::TJid)
				continue;

			if (item.GetValue () != jid)
				continue;

			if ((item.GetAction () == PrivacyListItem::AAllow && !add) ||
				(item.GetAction () == PrivacyListItem::ADeny && add))
				return;

			if (!add)
			{
				items.removeAll (item);
				break;
			}
		}
		if (add)
			items.append (PrivacyListItem (jid, PrivacyListItem::TJid));

		if (items.size () == current.GetItems ().size ())
			return;

		current.SetItems (items);
		lists->SetList (current);
	}
示例#4
0
PGraph TAmazonItemBs::GetGraph() const {
  // create graph
  PGraph Graph=TGGraph::New();
  // vertices
  for (int ItemIdN=0; ItemIdN<GetItems(); ItemIdN++){
    PAmazonItem Item=GetItem(ItemIdN);
    TStr VrtxNm=Item->GetStr();
    PVrtx Vrtx=PVrtx(new TGVrtx(ItemIdN, VrtxNm));
    Graph->AddVrtx(Vrtx);
  }
  // edges
  for (int SrcItemIdN=0; SrcItemIdN<GetItems(); SrcItemIdN++){
    PVrtx SrcVrtx=Graph->GetVrtx(SrcItemIdN);
    PAmazonItem SrcItem=GetItem(SrcItemIdN);
    for (int NextItemIdN=0; NextItemIdN<SrcItem->GetNextItemIds(); NextItemIdN++){
      TStr DstItemId=SrcItem->GetNextItemId(NextItemIdN);
      if (IsItem(DstItemId)){
        int DstItemIdN=GetItemIdN(DstItemId);
        PVrtx DstVrtx=Graph->GetVrtx(DstItemIdN);
        PEdge Edge=PEdge(new TGEdge(SrcVrtx, DstVrtx));
        Graph->AddEdge(Edge);
      }
    }
    if (SrcItemIdN%1000==0){printf("%d items converted\r", SrcItemIdN);}
  }
  printf("%d items converted\n", GetItems());
  // return graph
  return Graph;
}
示例#5
0
void ItemsControl::RemoveAt(int iIndex)
{
    if (iIndex < GetItems()->GetCount() && iIndex >= 0)
    {        
        GetItems()->RemoveAt(iIndex);
        InvalidateArrange();
    }
}
示例#6
0
suic::Size TabControl::ArrangeOverride(const suic::Size& size)
{
    ClearVisualChildren();

    _headerPanel.ClearLogicalChildren();

    int iItems = GetItems()->GetCount();
    suic::Rect finalRect(0, 0, size.cx, size.cy);

    if (_isAverage && iItems > 0)
    {
        TabItemPtr tabItem;
        int iWid = size.cx / iItems;
        suic::Size itemSize(iWid, _headerHeight);

        for (int i = 0; i < iItems - 1; ++i)
        {
            tabItem = GetItems()->GetItem(i).get();
            tabItem->SetDesiredSize(itemSize);
        }

        tabItem = GetItems()->GetItem(iItems - 1).get();

        itemSize.cx = size.cx - iWid * (iItems - 1);
        tabItem->SetDesiredSize(itemSize);

        for (int i = 0; i < iItems; ++i)
        {
            tabItem = GetItems()->GetItem(i).get();
            _headerPanel.AddLogicalChild(tabItem.get());
        }

        finalRect.bottom = finalRect.top + _headerHeight;

        AddVisualChild(&_headerPanel);
        _headerPanel.Arrange(finalRect);

        finalRect.top = finalRect.bottom;
        finalRect.bottom = size.cy;
    }

    TabItemPtr focusTab(_focusItem);

    if (focusTab)
    {  
        if (focusTab->GetTabContent())
        {
            AddVisualChild(focusTab->GetTabContent());
            focusTab->GetTabContent()->Arrange(finalRect);
        }
    }

    return size;
}
示例#7
0
void TreeViewItem::Collapse()
{
    WriteFlag(CoreFlags::IsCollapsed, true);

    int count = GetItems()->GetCount();

    for (int i = 0; i < count; ++i)
    {
        TreeViewItemPtr item = TreeViewItemPtr::cast(GetItems()->GetItem(i));

        if (item)
        {
            item->Collapse();
        }
    }
}
void ZCharacterObject::DrawEnchant(ZC_STATE_LOWER AniState_Lower,bool bCharged)
{
    ZItem* pItem = GetItems()->GetSelectedWeapon();

    if(!pItem || !pItem->GetDesc()) {
//		_ASSERT(0);
        return;
    }

    CCMatchItemDesc* pDesc = pItem->GetDesc();

    if (pDesc->m_nType.Ref() != MMIT_MELEE)
        return;

    if(m_pVMesh) {

        static rvector pOutPos[8];//º¸Åë ¾ç¼Õ ÃÖ´ë 4°³±îÁö¸¸ ¾´´Ù.

        bool bDoubleWeapon = m_pVMesh->IsDoubleWeapon();

        int cnt = m_pVMesh->GetLastWeaponTrackPos(pOutPos);

        bool bSlash = false;

        if( (AniState_Lower == ZC_STATE_SLASH) ||
                (AniState_Lower == ZC_STATE_JUMP_SLASH1) ||
                (AniState_Lower == ZC_STATE_JUMP_SLASH2) )
            bSlash = true;

        ZC_ENCHANT etype = GetEnchantType();

//		etype = ZC_ENCHANT_POISON;
//		etype = ZC_ENCHANT_COLD;
//		etype = ZC_ENCHANT_FIRE;
//		etype = ZC_ENCHANT_LIGHTNING;

        CCMatchItemDesc* pENDesc = GetEnchantItemDesc();
        if(pENDesc) {

            int nEFLevel = pENDesc->m_nEffectLevel.Ref();

            //		nEFLevel = 3;

            if( (nEFLevel > 2) || ((nEFLevel > 1) && bCharged ) )			// 3Àº Ç×»óº¸ÀÌ°í 2´Â ±â¸ð¾ÒÀ»¶§ ´Þ¸®¸é¼­µµ »Ñ¸®°í ´Ù´Ô..
            {
                EnChantMovingEffect(pOutPos,cnt,etype,bDoubleWeapon);		// Ä®µé°í ¶Ù¾î´Ù´Ò‹š..
            }

            if( bSlash )													// Ä® Èֵ見š...
            {
                EnChantSlashEffect(pOutPos,cnt,etype,bDoubleWeapon);
            }

            if( (nEFLevel > 1) || bCharged )								// ÀÌÆåÆ® ·¹º§ÀÌ 1º¸´Ù Å©°Å³ª ±â°¡ ¸ðÀÎ »óŶó¸é ÀÎþƮ ÀÌÆåÆ®
            {
                EnChantWeaponEffect(etype,nEFLevel);
            }
        }
    }
}
	void FormatItems()
	{
		ExAssert(m_Ctrl);

		// 获得属性
		items_t* items = (items_t*)GetItems();
		if (items->Empty()) m_FocItm = NULL;
		LONG space = GetSpace();
		LONG offst = (LONG)(LONG_PTR)m_Ctrl->GetState(_T("offset"));

		CRect rect;
		m_Ctrl->GetClientRect(rect);

		CPoint pt;
		LONG w = 0;

		// 遍历列表项
		items_t::iterator_t ite = items->Head();
		items_t::ite_list_t ite_lst = ite->Children();
		items_t::ite_list_t::iterator_t ite_ite = ite_lst.Head();
		for(; ite_ite != ite_lst.Tail(); ++ite_ite)
			FormatItems(*ite_ite, space, offst, pt, w);

		// 设置滚动区域
		m_Ctrl->SetAllRect(CSize(w, pt.y));
		m_Ctrl->SetFraRect(CSize(rect.Width(), rect.Height()));
	}
	// 消息响应
	void OnMessage(IGuiObject* pGui, UINT nMessage, WPARAM wParam = 0, LPARAM lParam = 0)
	{
		switch( nMessage )
		{
		case WM_SETFOCUS:
			if (m_Ctrl == IGuiCtl::GetFocus())
			{
				items_t* items = (items_t*)GetItems();
				if (items->Empty()) break;
				if(!m_FocItm)
					m_FocItm = items->HeadItem();
				if(!m_FocItm) break;
				IGuiCtl* pic = GetFocPic();
				if(!pic) break;

				CRect foc_rct;
				m_FocItm->GetWindowRect(foc_rct);
				pic->SetWindowRect(foc_rct);
				pic->SetVisible(TRUE);
			}
			break;
		default:
			EXP_BASE::OnMessage(pGui, nMessage, wParam, lParam);
		}
	}
示例#11
0
文件: GCombo.cpp 项目: FEI17N/Lgi
bool GCombo::Insert(char *p, int Index)
{
	bool Status = false;

	if (p)
	{
		if (Handle())
		{
			char *n = LgiToNativeCp(p);
			if (n)
			{
				if (Index < 0)
				{
					Index = GetItems();
				}

				Status = SendMessage(Handle(), CB_INSERTSTRING, Index, (long)n) == Index;
				DeleteArray(n);
			}
		}
		else
		{
			d->InitStrs.Insert(NewStr(p), Index);
			Status = true;
		}
	}

	return Status;
}
示例#12
0
void wxXmlSerializer::SetRootItem(xsSerializable* root)
{
    wxASSERT(root);
    wxASSERT(root->IsKindOf(CLASSINFO(xsSerializable)));

	if( m_pRoot )delete m_pRoot;

    if(root && root->IsKindOf(CLASSINFO(xsSerializable)))
    {
        m_pRoot = root;
    }
	else
		m_pRoot = new xsSerializable();

	// update pointers to parent manager
	m_mapUsedIDs.clear();
	
	m_pRoot->m_pParentManager = this;
	m_mapUsedIDs[m_pRoot->GetId()] = m_pRoot;
	
	xsSerializable *pItem;
	SerializableList lstItems;
	GetItems(NULL, lstItems);
	
	SerializableList::compatibility_iterator node = lstItems.GetFirst();
	while( node )
	{
		pItem = node->GetData();
		
		pItem->m_pParentManager = this;
		m_mapUsedIDs[pItem->GetId()] = pItem;
		
		node = node->GetNext();
	}
}
示例#13
0
文件: NCache.cpp 项目: refnum/nano
//============================================================================
//		NCache::Purge : Purge the cache.
//----------------------------------------------------------------------------
void NCache::Purge(void)
{	NCacheItemList					theItems;
	NCacheItemListConstIterator		theIter;



	// Check our state
	if (!NeedsPurge())
		return;
	
	
	
	// Get the state we need
	//
	// Items are sorted with least-recently-used to the front.
	theItems = GetItems();
	
	sort(theItems, NCompareLRU());



	// Purge the cache
	for (theIter = theItems.begin(); theIter != theItems.end(); theIter++)
		{
		if (theIter->theValue->IsPurgeable())
			RemoveKey(theIter->theKey);
		
		if (!NeedsPurge())
			break;
		}
}
示例#14
0
void CGUIDialogMediaFilter::UpdateControls()
{
  for (std::map<std::string, Filter>::iterator itFilter = m_filters.begin(); itFilter != m_filters.end(); itFilter++)
  {
    if (itFilter->second.controlType != "list")
      continue;

    std::vector<std::string> items;
    int size = GetItems(itFilter->second, items, true);

    std::string label = g_localizeStrings.Get(itFilter->second.label);
    BaseSettingControlPtr control = GetSettingControl(itFilter->second.setting->GetId());
    if (control == NULL)
      continue;

    if (size <= 0 ||
       (size == 1 && itFilter->second.field != FieldSet && itFilter->second.field != FieldTag))
       CONTROL_DISABLE(control->GetID());
    else
    {
      CONTROL_ENABLE(control->GetID());
      label = StringUtils::Format(g_localizeStrings.Get(21470).c_str(), label.c_str(), size);
    }
    SET_CONTROL_LABEL(control->GetID(), label);
  }
}
示例#15
0
bool Inventory::LoadContents(ItemFactory &factory)
{
    // check if the contents has already been loaded...
    if( ContentsLoaded() )
    {
        return true;
    }

    sLog.Debug("Inventory", "Recursively loading contents of inventory %u", inventoryID() );

    //load the list of items we need
    std::vector<uint32> items;
    if( !GetItems( factory, items ) )
    {
        sLog.Error("Inventory", "Failed  to get items of %u", inventoryID() );
        return false;
    }

    //Now get each one from the factory (possibly recursing)
    ItemData into;
    uint32 characterID;
    uint32 corporationID;
    uint32 locationID;
    std::vector<uint32>::iterator cur, end;
    cur = items.begin();
    end = items.end();
    for(; cur != end; cur++)
    {
        // Each "cur" item should be checked to see if they are "owned" by the character connected to this client,
        // and if not, then do not "get" the entire contents of this for() loop for that item, except in the case that
        // this item is located in space or belongs to this character's corporation:
        factory.db().GetItem( *cur, into );
        if( factory.GetUsingClient() != NULL )
        {
            characterID = factory.GetUsingClient()->GetCharacterID();
            corporationID = factory.GetUsingClient()->GetCorporationID();
            locationID = factory.GetUsingClient()->GetLocationID();
        }
        else
            sLog.Error( "Inventory::LoadContents()", "Failed to resolve pointer to Client object currently using the ItemFactory." );
        if( (into.ownerID == characterID) || (characterID == 0) || (into.ownerID == corporationID) || (into.locationID == locationID) )
        {
            // Continue to GetItem() if the client calling this is owned by the character that owns this item
            // --OR--
            // The characterID == 0, which means this is attempting to load the character of this client for the first time.

            InventoryItemRef i = factory.GetItem( *cur );
            if( !i )
            {
                sLog.Error("Inventory::LoadContents()", "Failed to load item %u contained in %u. Skipping.", *cur, inventoryID() );
                continue;
            }

            AddItem( i );
        }
    }

    mContentsLoaded = true;
    return true;
}
示例#16
0
void GetItems(QTreeWidgetItem *widget, QList<QTreeWidgetItem *> &items)
{
	for(int i = 0; i < widget->childCount(); ++i)
	{
		items.append(widget->child(i));
		GetItems(widget->child(i), items);
	}
}
示例#17
0
bool wxXmlSerializer::Contains(wxClassInfo *type)
{
	SerializableList lstItems;
		
	GetItems( type, lstItems );
		
	return !lstItems.IsEmpty();
}
示例#18
0
void TAmazonItemBs::SaveXml(const TStr& FNm){
  PSOut XmlSOut=TFOut::New(FNm);
  for (int ItemIdN=0; ItemIdN<GetItems(); ItemIdN++){
    PAmazonItem Item=GetItem(ItemIdN);
    PXmlDoc XmlDoc=Item->GetXmlDoc();
    XmlDoc->SaveTxt(XmlSOut); XmlSOut->PutDosLn();
  }
}
示例#19
0
void TabControl::OnInitialized()
{
    __super::OnInitialized();

    suic::VisualHelper::SetLogicalParent(this, &_headerPanel);

    if (GetItems()->GetCount() > 0 && !_focusItem)
    {
        Selector::SelectItem(GetItems()->GetItem(0), true);
    }

    TabItemPtr focusTab(_focusItem);

    if (focusTab)
    {
        focusTab->GetTabContent()->Measure(suic::Size());
    }
}
示例#20
0
void TAmazonItemBs::GetVoidItemIdV(TStrV& VoidItemIdV) const {
  VoidItemIdV.Clr();
  for (int ItemIdN=0; ItemIdN<GetItems(); ItemIdN++){
    PAmazonItem Item=GetItem(ItemIdN);
    for (int NextItemIdN=0; NextItemIdN<Item->GetNextItemIds(); NextItemIdN++){
      TStr NextItemId=Item->GetNextItemId(NextItemIdN);
      if (!IsItem(NextItemId)){VoidItemIdV.AddUnique(NextItemId);}
    }
  }
}
示例#21
0
void TreeViewItem::OnMouseLeftButtonDbclk(suic::MouseEventArg& e)
{
    __super::OnMouseLeftButtonDbclk(e);

    if (GetItems()->GetCount() > 0)
    {
        suic::RoutedEventArg er(this);
        _expand->OnClick(er);
    }

    e.Handled(true);
}
示例#22
0
TreeViewItemPtr TreeViewItem::HitTreeItemByUserData(suic::ObjectPtr obj)
{
    if (GetUserData() == obj)
    {
        return this;
    }

    TreeViewItemPtr ret;
    int count = GetItems()->GetCount();

    for (int i = 0; i < count; ++i)
    {
        TreeViewItemPtr item(GetItems()->GetItem(i));

        if (item.get() && (ret=item->HitTreeItemByUserData(obj)))
        {
            break;
        }
    }

    return ret;
}
示例#23
0
suic::Size ItemsControl::MeasureItems(suic::Size availableSize, bool bHorz)
{
    suic::Size retSize;

    for (int i = 0; i < GetItems()->GetCount(); ++i)
    {
        suic::ElementPtr item(GetItems()->GetItem(i));

        if (item)
        {
            item->Measure(availableSize);
            retSize.cy += item->GetDesiredSize().cy;

            if (item->GetDesiredSize().cx > retSize.cx)
            {
                retSize.cx = item->GetDesiredSize().cx;
            }
        }
    }

    return retSize;
}
示例#24
0
int wxMacDataBrowserListControl::ListGetSelections( wxArrayInt& aSelections ) const
{
    aSelections.Empty();
    wxArrayMacDataItemPtr selectedItems;
    GetItems( wxMacDataBrowserRootContainer, false , kDataBrowserItemIsSelected, selectedItems);

    int count = selectedItems.GetCount();

    for ( int i = 0; i < count; ++i)
    {
        aSelections.Add(GetLineFromItem(selectedItems[i]));
    }

    return count;
}
示例#25
0
udSettingsCategory* udSettings::GetCategory(const wxString& name)
{
	SerializableList lstCategories;
	GetItems( CLASSINFO(udSettingsCategory), lstCategories );
	
	SerializableList::compatibility_iterator node = lstCategories.GetFirst();
	while( node )
	{
		if( ((udSettingsCategory*)node->GetData())->GetName() == name ) return (udSettingsCategory*)node->GetData();
		
		node = node->GetNext();
	}
	
	return NULL;
}
示例#26
0
bool TreeViewItem::RemoveItem(TreeViewItem* pItem)
{
    bool bRet = false;
    int count = GetItems()->GetCount();

    for (int i = 0; i < count; ++i)
    {
        TreeViewItemPtr item(GetItems()->GetItem(i));

        if (item.get() == pItem)
        {
            RemoveChild(pItem);
            bRet = true;

            break;
        }
        else if (bRet=item->RemoveItem(pItem))
        {
            break;
        }
    }

    return bRet;
}
示例#27
0
CVariantInfo* CChoiceTypeInfo::AddVariant(const CMemberId& memberId,
        const void* memberPtr,
        const CTypeRef& memberType)
{
    if ( GetVariants().Size() == 1 &&
            !GetVariantInfo(kFirstMemberIndex)->GetId().IsAttlist() ) {
        // simple
        SetReadFunction(&TFunc::ReadChoiceSimple);
        SetSkipFunction(&TFunc::SkipChoiceSimple);
    }
    CVariantInfo* variantInfo = new CVariantInfo(this, memberId,
            TPointerOffsetType(memberPtr),
            memberType);
    GetItems().AddItem(variantInfo);
    return variantInfo;
}
示例#28
0
int wxXmlSerializer::GetIDCount(long id)
{
	int nCount = 0;

    SerializableList items;
    GetItems(CLASSINFO(xsSerializable), items);

	SerializableList::compatibility_iterator node = items.GetFirst();
	while(node)
	{
		if( node->GetData()->GetId() == id ) nCount++;
		node = node->GetNext();
	}

	if( m_pRoot->GetId() == id ) nCount++;

	return nCount;
}
示例#29
0
xsProperty* udSettings::GetProperty(const wxString& name)
{
	udSettingsCategory *pCategory;
	xsProperty *pProperty;
	
	SerializableList lstCategories;
	GetItems( CLASSINFO(udSettingsCategory), lstCategories );
	
	SerializableList::compatibility_iterator node = lstCategories.GetFirst();
	while( node )
	{
		pCategory = (udSettingsCategory*)node->GetData();
		
		pProperty = pCategory->GetProperty( name );
		if( pProperty ) return pProperty;
		
		node = node->GetNext();
	}
	
	return NULL;
}
示例#30
0
/*!
 * \brief Create all configuration items.
 */
void CNutConfDoc::AddAllItems()
{
    CConfigTree *treeCtrl = wxGetApp().GetMainFrame()->GetTreeCtrl();

    wxGetApp().GetMainFrame()->GetPropertyListWindow()->Fill(NULL);

    treeCtrl->DeleteAllItems();

    CConfigItem *item = new CConfigItem();
    wxTreeItemId rootId = treeCtrl->AddRoot(wxT(""), -1, -1, new CTreeItemData(item));

    item->SetTreeItem(rootId);
    item->UpdateTreeItem(*treeCtrl);
    m_items.Append(item);

    AddChildItems(m_root, rootId);

    UpdateAllViews();

    if (GetItems().GetCount() > 0) {
        wxGetApp().GetMainFrame()->GetTreeCtrl()->Expand(rootId);
    }
    wxGetApp().GetMainFrame()->GetTreeCtrl()->SetFocus();
}