/*---------------------------------------------------------------------------* Project: NintendoWare File: lyt_Group.cpp Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Revision: 13839 $ *---------------------------------------------------------------------------*/ #include "precompiled.h" #include #include #include namespace nw { namespace lyt { Group::Group() { Init(); std::memset(m_Name, 0, sizeof(m_Name)); } Group::Group( const res::Group* pResGroup, Pane* pRootPane ) { Init(); ut::strcpy(m_Name, sizeof(m_Name), pResGroup->name); const char *const paneNameBase = internal::ConvertOffsToPtr(pResGroup, sizeof(res::Group)); for (int i = 0; i < pResGroup->paneNum; ++i) { if (Pane* pFindPane = pRootPane->FindPaneByName(paneNameBase + i * ResourceNameStrMax, true)) { AppendPane(pFindPane); } } } void Group::Init() { m_UserAllocated = false; } Group::~Group() { // OSReport("Group::~Group()\n"); for (PaneLinkList::Iterator it = m_PaneLinkList.GetBeginIter(); it != m_PaneLinkList.GetEndIter();) { PaneLinkList::Iterator currIt = it++; m_PaneLinkList.Erase(currIt); Layout::DeleteObj(&(*currIt)); } } void Group::AppendPane(Pane* pPane) { if (PaneLink* pPaneLink = Layout::NewObj()) { pPaneLink->target = pPane; m_PaneLinkList.PushBack(pPaneLink); } } GroupContainer::~GroupContainer() { // OSReport("GroupContainer::~GroupContainer()\n"); // Groupの後処理 for (GroupList::Iterator it = m_GroupList.GetBeginIter(); it != m_GroupList.GetEndIter();) { GroupList::Iterator currIt = it++; m_GroupList.Erase(currIt); if (! currIt->IsUserAllocated()) { Layout::DeleteObj(&(*currIt)); } } } void GroupContainer::AppendGroup(Group* pGroup) { m_GroupList.PushBack(pGroup); } Group* GroupContainer::FindGroupByName(const char* findName) { // 子供に一致するものが無いか検索 for (GroupList::Iterator it = m_GroupList.GetBeginIter(); it != m_GroupList.GetEndIter(); ++it) { if (internal::EqualsResName(it->GetName(), findName)) { return &(*it); } } return 0; } } // namespace nw::lyt } // namespace nw