GRegion::GRegion(GRegion &c) : GRect(c.x1, c.y1, c.x2, c.y2) { Size = Alloc = 0; Current = 0; a = 0; SetSize(c.Length()); for (int i=0; i<Size; i++) { a[i] = c.a[i]; } }
void GWindow::Pour() { GRegion Client(GetClient()); GRegion Update; bool HasTools = false; GViewI *v; { GRegion Tools; for (v = Children.First(); v; v = Children.Next()) { GView *k = dynamic_cast<GView*>(v); if (k && k->_IsToolBar) { GRect OldPos = v->GetPos(); Update.Union(&OldPos); if (HasTools) { // 2nd and later toolbars if (v->Pour(Tools)) { if (!v->Visible()) { v->Visible(true); } if (OldPos != v->GetPos()) { // position has changed update... v->Invalidate(); } Tools.Subtract(&v->GetPos()); Update.Subtract(&v->GetPos()); } } else { // First toolbar if (v->Pour(Client)) { HasTools = true; if (!v->Visible()) { v->Visible(true); } if (OldPos != v->GetPos()) { v->Invalidate(); } GRect Bar(v->GetPos()); Bar.x2 = GetClient().x2; Tools = Bar; Tools.Subtract(&v->GetPos()); Client.Subtract(&Bar); Update.Subtract(&Bar); } } } } } for (v = Children.First(); v; v = Children.Next()) { GView *k = dynamic_cast<GView*>(v); if (!(k && k->_IsToolBar)) { GRect OldPos = v->GetPos(); Update.Union(&OldPos); if (v->Pour(Client)) { if (!v->Visible()) { v->Visible(true); } if (OldPos != v->GetPos()) { // position has changed update... v->Invalidate(); } Client.Subtract(&v->GetPos()); Update.Subtract(&v->GetPos()); } else { // make the view not visible // v->Visible(FALSE); } } } for (int i=0; i<Update.Length(); i++) { Invalidate(Update[i]); } }