You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.5 KiB
C++
75 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <QSizeF>
|
|
#include <QVector>
|
|
#include "ZxDynamic.h"
|
|
#include "IxSerDes.h"
|
|
#include "iPlotBase_global.h"
|
|
|
|
class ZxRenderItem;
|
|
|
|
/// 布局器
|
|
/// @note 简单起见, 我们暂不支持嵌套布局
|
|
class I_PLOTBASE_EXPORT ZxLayout
|
|
: virtual public IxDynObj
|
|
, virtual public IxSerDes
|
|
{
|
|
ZX_DECLARE_DYNAMIC
|
|
|
|
public:
|
|
|
|
ZxLayout();
|
|
ZxLayout(const ZxLayout & c);
|
|
|
|
virtual void clear();
|
|
virtual ZxLayout* clone() const;
|
|
|
|
protected:
|
|
|
|
/// 布局
|
|
virtual void onLayout();
|
|
|
|
/// 应用自动尺寸
|
|
/// @return true表示已处理, false表示交回给Item来处理.
|
|
virtual bool onApplyAutoSize();
|
|
|
|
/// 获取建议尺寸
|
|
virtual QSizeF getSizeHint() const;
|
|
|
|
virtual void onSerialize(ZxSerializer* ser);
|
|
virtual void onDeserialize(ZxSerializer* ser);
|
|
|
|
virtual ZxRenderItem* getOwner() const;
|
|
virtual void setOwner(ZxRenderItem* p);
|
|
|
|
virtual void onChildItemAdded(ZxRenderItem* pItem);
|
|
virtual void onChildItemRemoved(ZxRenderItem* pItem);
|
|
|
|
ZxRenderItem* m_pOwner;
|
|
friend class ZxRenderItem;
|
|
};
|
|
|
|
/// 层叠布局.
|
|
/// 各子图元都拉伸成同样尺寸, 一个叠一个地放在一起.
|
|
/// @note 注意和 ZxStackLayer 相区别
|
|
class I_PLOTBASE_EXPORT ZxLayerLayout
|
|
: public ZxLayout
|
|
{
|
|
ZX_DECLARE_DYNAMIC
|
|
|
|
public:
|
|
|
|
ZxLayerLayout();
|
|
ZxLayerLayout(const ZxLayerLayout& c);
|
|
virtual ZxLayerLayout* clone() const;
|
|
|
|
protected:
|
|
|
|
virtual void onLayout();
|
|
virtual QSizeF getSizeHint() const;
|
|
};
|
|
|
|
|
|
|
|
|