MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / RearrangeTabButtons

Function RearrangeTabButtons

ogsr_engine/xrGame/ui/UIPdaWnd.cpp:519–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

517}
518
519void RearrangeTabButtons(CUITabControl* pTab, xr_vector<Fvector2>& vec_sign_places)
520{
521 TABS_VECTOR* btn_vec = pTab->GetButtonsVector();
522 TABS_VECTOR::iterator it = btn_vec->begin();
523 TABS_VECTOR::iterator it_e = btn_vec->end();
524 vec_sign_places.clear();
525 vec_sign_places.resize(btn_vec->size());
526
527 Fvector2 pos;
528 pos.set((*it)->GetWndPos());
529 Fvector2 sign_sz;
530 sign_sz.set(9.0f + 3.0f, 11.0f);
531 u32 idx = 0;
532 float btn_text_len = 0.0f;
533 CUIStatic* st = NULL;
534
535 for (; it != it_e; ++it, ++idx)
536 {
537 if (idx != 0)
538 {
539 st = xr_new<CUIStatic>();
540 st->SetAutoDelete(true);
541 pTab->AttachChild(st);
542 st->SetFont((*it)->GetFont());
543 st->SetTextColor(color_rgba(90, 90, 90, 255));
544 st->SetText("//");
545 st->SetWndSize((*it)->GetWndSize());
546 st->AdjustWidthToText();
547 st->SetWndPos(pos);
548 pos.x += st->GetWndSize().x;
549 }
550
551 vec_sign_places[idx].set(pos);
552 vec_sign_places[idx].y += iFloor(((*it)->GetWndSize().y - sign_sz.y) / 2.0f);
553 vec_sign_places[idx].y = (float)iFloor(vec_sign_places[idx].y);
554 pos.x += sign_sz.x;
555
556 (*it)->SetWndPos(pos);
557 (*it)->AdjustWidthToText();
558 btn_text_len = (*it)->GetWndSize().x;
559 pos.x += btn_text_len + 3.0f;
560 }
561}
562bool CUIPdaWnd::OnKeyboard(int dik, EUIMessages keyboard_action)
563{
564 if (WINDOW_KEY_PRESSED == keyboard_action && IsShown())

Callers 2

InitMethod · 0.85
InitMethod · 0.85

Calls 15

color_rgbaFunction · 0.85
GetWndPosMethod · 0.80
AttachChildMethod · 0.80
GetWndSizeMethod · 0.80
AdjustWidthToTextMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
clearMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
setMethod · 0.45
SetFontMethod · 0.45

Tested by

no test coverage detected