//Resize logics void ExpandoTextCtrl::AdjustCtrl(long newHeight) { //If the required height is more than the maxHieght, decrease it to that if(maxHeight != -1 && newHeight > maxHeight) { newHeight = maxHeight; } //If the required height is less than the minHieght, increase it to that if(minHeight != -1 && newHeight < minHeight) { newHeight = minHeight; } decHeight = newHeight; SetMinSize(wxSize(GetMinSize().GetWidth(), newHeight)); //If requested height between min and max height, resize the Expando if(newHeight != GetSize().GetHeight()) { bool hasSizer = GetContainingSizer() != NULL; if(!hasSizer) { SetSize(GetSize().GetWidth(), newHeight); } //Throw a LayoutNeeded Event wxExpandEvent evt(wxEVT_ETC_LAYOUT_NEEDED, GetId()); evt.SetEventObject(this); evt.height = newHeight; evt.numLines = GetNumberOfLines(); GetEventHandler()->ProcessEvent(evt); } }
void TimelinePanel::addChild(Effect* effect) { EffectPanel* child = new EffectPanel(scrollMe, effect, isConstant, this, wxID_ANY); effectBox->Add(child, wxSizerFlags(0).Expand().Center()); children.push_back(child); if (speedBox != 0) speedBox->Show(true); if (children.size() >= NUM_EFFECT_TYPES) addButton->Show(false); GetContainingSizer()->SetVirtualSizeHints(GetParent()); }
wxInfoBarGeneric::BarPlacement wxInfoBarGeneric::GetBarPlacement() const { wxSizer * const sizer = GetContainingSizer(); if ( !sizer ) return BarPlacement_Unknown; const wxSizerItemList& siblings = sizer->GetChildren(); if ( siblings.GetFirst()->GetData()->GetWindow() == this ) return BarPlacement_Top; else if ( siblings.GetLast()->GetData()->GetWindow() == this ) return BarPlacement_Bottom; else return BarPlacement_Unknown; }
void TimelinePanel::destroyChild(EffectPanel* child) { std::vector<EffectPanel*>::iterator iter = children.begin(); for (; iter != children.end(); iter++) { if (*iter == child) { children.erase(iter); break; } } child->Destroy(); if (children.size() <= 0 && speedBox != 0) speedBox->Show(false); addButton->Show(true); GetContainingSizer()->SetVirtualSizeHints(GetParent()); }
wxInfoBarGeneric::BarPlacement wxInfoBarGeneric::GetBarPlacement() const { wxSizer * const sizer = GetContainingSizer(); if ( !sizer ) return BarPlacement_Unknown; // FIXME-VC6: can't compare "const wxInfoBarGeneric *" and "wxWindow *", // so need this workaround wxWindow * const self = const_cast<wxInfoBarGeneric *>(this); const wxSizerItemList& siblings = sizer->GetChildren(); if ( siblings.GetFirst()->GetData()->GetWindow() == self ) return BarPlacement_Top; else if ( siblings.GetLast()->GetData()->GetWindow() == self ) return BarPlacement_Bottom; else return BarPlacement_Unknown; }