void MY_UI::Controls::Tab_Control::Update(){ if(!Internal_Widget.Needs_Update) return; auto parent = Internal_Widget.Parent; if(Internal_Widget.Alignment == FILL){ if(parent != 0 ){ Utilities::Rect r = parent->GetClientBounds(); SetSize(r.width, r.height); } } ForceUpdate();// force all the children to update themselves }
MY_UI::Controls::Simple_Window* MY_UI::Controls::Tab_Control::Insert(std::string text){ MY_UI::Controls::Tab_Button* b = new MY_UI::Controls::Tab_Button(this); b->SetText(text); MY_UI::Controls::Simple_Window* p = new MY_UI::Controls::Simple_Window(this); auto skin = MY_UI::Internal::WidgetSkin; p->SetDraggable(false);// do not allow moveing the window if(!Tabs.empty()){ b->Align_To_Widget(Tabs.back(), RIGHT | IN_LINE, 2); } else b->SetPos(0, static_cast<int>(-skin->Tab_Hovered.height)); p->Align_To_Widget(b, BOTTOM, -2); b->OnLeftClicked.Add(std::bind(&MY_UI::Controls::Tab_Control::SwitchPage, this, std::placeholders::_1), this, true); auto parent = Internal_Widget.Parent; Utilities::Point size; if(Internal_Widget.Alignment == FILL){ if(parent != 0 ){ Utilities::Rect r = parent->GetClientBounds(); size.x = r.width; size.y = r.height; } } else size = GetSize(); p->SetSize(size.x, size.y - b->GetSize().y); Tabs.push_back(b); Pages.push_back(p); if(CurrentPage == -1){// make sure to set up the first page correctly. CurrentPage = 0; Pages[CurrentPage]->SetFocus(true); Pages[CurrentPage]->SetHidden(false);// unhide this window b->Show_Selected_Texture(); } else { b->Show_UnPressed_Texture(); p->SetHidden(true);// hide the active page } return p; }
CGRect CCXEGLView::getFrame() { TRectangle rc; GetClientBounds(&rc); return (CGRect((float)rc.X(), (float)rc.Y(), (float)rc.Width(), (float)rc.Height())); }