void wxFoldPanelBar::RefreshPanelsFrom(size_t i) { Freeze(); // if collapse to bottom is on, the panels that are not expanded // should be drawn at the bottom. All panels that are expanded // are drawn on top. The last expanded panel gets all the extra space if(m_extraStyle & wxFPB_COLLAPSE_TO_BOTTOM) { int offset = 0; for(size_t j = 0; j < m_panels.GetCount(); j++) { if(m_panels.Item(j)->IsExpanded()) offset += m_panels.Item(j)->Reposition(offset); } // put all non collapsed panels at the bottom where there is space, else // put them right behind the expanded ones RepositionCollapsedToBottom(); } else { int pos = m_panels.Item(i)->GetItemPos() + m_panels.Item(i)->GetPanelLength(); for(i++; i < m_panels.GetCount(); i++) pos += m_panels.Item(i)->Reposition(pos); } Thaw(); }
void wxFoldPanelBar::OnSizePanel(wxSizeEvent &event) { // skip all stuff when we are not initialised yet if(!m_controlCreated) { event.Skip(); return; } // now size the fold panel area and the // lower bar in such a way that the bar is always // visible wxRect foldrect = GetRect(); // fold panel itself. If too little space, // don't show it #if 0 if(foldrect.GetHeight() < 23) foldrect.SetHeight(0); else foldrect.SetHeight(foldrect.GetHeight() - 22); #endif foldrect.SetX(0); foldrect.SetY(0); m_foldPanel->SetSize(foldrect); if(m_extraStyle & wxFPB_COLLAPSE_TO_BOTTOM) { wxRect rect = RepositionCollapsedToBottom(); bool vertical = IsVertical(); if((vertical && rect.GetHeight() > 0) || (!vertical && rect.GetWidth() > 0)) RefreshRect(rect); } else { wxRect rect = RepositionCollapsedToTop(); bool vertical = IsVertical(); if((vertical && rect.GetHeight() > 0) || (!vertical && rect.GetWidth() > 0)) RefreshRect(rect); } // TODO: A smart way to check wether the old - new width of the // panel changed, if so no need to resize the fold panel items RedisplayFoldPanelItems(); // tool panel for icons and other stuff #if 0 wxRect bottomrect = GetRect(); if(bottomrect.GetHeight() < 22) bottomrect.SetY(0); else bottomrect.SetY(bottomrect.GetHeight() - 22); bottomrect.SetHeight(22); bottomrect.SetX(0); m_bottomPanel->SetSize(bottomrect); // TODO: redraw the bitmap properly // use the captionbar algorithm for that m_bottomPanel->Refresh(); #endif }