bool UIControlTab::SetParameter(const wstring& _key, const ParamValue& _value) { if (L"addpage" == _key) { const ParamUIHandle& param = dynamic_cast<const ParamUIHandle&>(_value); UIControl* page = new UIControlTabPage(this->m_ui, this->m_ui.NewHandle(), NULL); if (false != this->SetParameter(L"addchild", ParamControlPtr(page))) { if (UIControl* control = this->m_ui.GetControl(param.Get())) { wstring name; ParamWString nameparam(name); if ((false != (control->GetParameter(L"name", nameparam))) && (false != (page->SetParameter(L"name", nameparam))) && (false != page->SetParameter(L"addchild", ParamControlPtr(control))) && (false != control->SetParameter(L"parent", ParamControlPtr(page)))) { this->m_pages.push_back(page); return true; } } } delete page; return false; } else if (L"headerlocation" == _key) { const ParamWString& param = dynamic_cast<const ParamWString&>(_value); const wstring headerlocation = param.Get(); if (L"left" == headerlocation) { this->m_headerlocation = HL_LEFT; return true; } else if (L"right" == headerlocation) { this->m_headerlocation = HL_RIGHT; return true; } else if (L"top" == headerlocation) { this->m_headerlocation = HL_TOP; return true; } else if (L"bottom" == headerlocation) { this->m_headerlocation = HL_BOTTOM; return true; } return false; } return UIControl::SetParameter(_key, _value); }
void UIControlTab::Update() { if (false != this->m_visible) { this->UpdateDirty(); this->UpdateHeaders(); if (this->m_currentpageindex < this->m_pages.size()) { UIControl* page = this->m_pages[this->m_currentpageindex]; page->SetParameter(L"position", ParamPoint(D2D1::Point2F(this->m_startingpagepos.m_x, this->m_startingpagepos.m_y))); page->SetParameter(L"size", ParamSize(D2D1::SizeF(this->m_pagesize.m_width, this->m_pagesize.m_height))); page->Update(); } } }