void GxDockBin::Draw() { GxDraw* draw = GxDraw::Get(); GxStyle& style = *GxStyle::Get(); bool empty = true; const GxWidget* const* docks = myLayout.GetWidgets().Data(); for(int i=0; empty && i<myLayout.GetWidgets().Size(); ++i) if(!docks[i]->IsHidden()) empty = false; if(!empty) { GxRecti r(myRect); draw->Rect(r.x, r.y, r.w, r.h, style.c.frameOutline); r.Shrink(1); draw->Rect(r.x, r.y, r.w, r.h, style.c.bgPanel); if(!myScrollbar->IsHidden()) myScrollbar->Draw(); draw->PushScissorRect(r.x, r.y, r.w, r.h); myLayout.Draw(); draw->PopScissorRect(); } }
void GxSelectList::Draw() { GxDraw* draw = GxDraw::Get(); GxStyle& style = *GxStyle::Get(); float hl = GetHighlightValue(); bool lock = IsLockedWidget(); // Draw the list rectangle GxRecti bar(myRect); if(!myScrollbar->IsHidden()) bar.w -= 16; style.Field(bar); // Draw the scrollbar if(!myScrollbar->IsHidden()) myScrollbar->Draw(); // Draw the list of items draw->PushScissorRect(bar.x+2, bar.y+2, bar.w-4, bar.h-4); GxRecti viewRect = draw->GetScissorRect(); GxRecti listR = myGetListRect(); int ox = 2; GxText& settings = style.d.text[0]; settings.maxWidth = listR.w - ox*2; settings.SetAlign(myAlignH, GX_TA_MIDDLE); if(myAlignH == GX_TA_CENTER) ox = listR.w/2; else if(myAlignH == GX_TA_RIGHT) ox = listR.w - ox; for(int i=0; i<myItems.Size(); ++i) { GxRecti r(listR.x, listR.y + i*16, listR.w, 16); if(r.y < viewRect.y+viewRect.h && r.y+r.h > viewRect.y) { if(i == mySelectedItem) draw->Rect(r.x, r.y, r.w, r.h, style.c.textSelect); else if(i == myMouseOverItem) draw->Rect(r.x, r.y, r.w, r.h, style.c.textSelect.Alpha(hl * 0.5f)); settings.Draw(r.x + ox, r.y+r.h/2-2, myItems[i]); } } settings.SetMaxWidth(); draw->PopScissorRect(); }