//************************************************************************ // Set the size of the object //************************************************************************ void CLCDObject::SetSize(int iWidth,int iHeight) { SIZE OldSize = m_Size; m_Size.cx = iWidth; m_Size.cy = iHeight; OnSizeChanged(OldSize); }
bool NFrameBase::SetSizeImpl(int width, int height, bool force) { if(!force && (IsAutoSize() || (layout_ >= LayoutSizeStart && parentFrame_ != NULL))) return false; int frameWidth = (minSize_.Width < 0) ? width : (width >= minSize_.Width ? width : minSize_.Width); int frameHeight = (minSize_.Height < 0) ? height : (height >= minSize_.Height ? height : minSize_.Height); frameWidth = (maxSize_.Width > 0 && frameWidth > maxSize_.Width) ? maxSize_.Width : frameWidth; frameHeight = (maxSize_.Height > 0 && frameHeight > maxSize_.Height) ? maxSize_.Height : frameHeight; if(frameRect_.Width() == frameWidth && frameRect_.Height() == frameHeight) return false; Invalidate(); frameRect_.SetSize(frameWidth, frameHeight); Invalidate(); OnSizeChanged(frameWidth, frameHeight); SizeEventData eventData; eventData.width = width; eventData.height = height; SizeEvent.Invoke(this, &eventData); // Relayout all children FrameList::const_iterator ite = childs_.begin(); while(ite != childs_.end()) { NFrameBase* const& child = *ite; child->ReLayout(); ++ ite; } return true; }
void AWidget::SetSize(const ivec2& size) { m_vSize = size; if(m_vSize.x < 0) m_vSize.x = 0; if(m_vSize.y < 0) m_vSize.y = 0; OnSizeChanged(); }
void NervColumnLayout::AddChild(std::unique_ptr<NervWindow> in_child){ int y = 0; if (children.size() != 0){ y = children.back()->GetBottomRightPoint().y; } children.push_back(std::move(in_child)); auto new_child = children.back().get(); new_child->SetPosition(NervPoint{ 0, y }); new_child->SetParent(*this); NervSize sz = children.back()->GetSize(); sz.x = size.x; new_child->SetSize(sz); new_child->Show(); new_child->BindCallback(NervEvent::LostKeyboardFocus, std::make_unique<NervCallback>([this](void* arg){ PerformCallback(NervEvent::LostKeyboardFocus,arg); })); new_child->BindCallback(NervEvent::SizeLimitChanged, std::make_unique<NervCallback>([this](void*){ OnSizeLimitChanged(); })); new_child->BindCallback(NervEvent::SizeChanged, std::make_unique<NervCallback>([this](void*){ OnSizeChanged(); })); resize_manager.LockHeight(y+sz.y); }
void CLCDObject::SetSize(SIZE s) { SIZE OldSize = m_Size; m_Size = s; OnSizeChanged(OldSize); }