mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-24 08:34:38 +03:00
102 lines
4.5 KiB
C
102 lines
4.5 KiB
C
|
/***************************************************************************
|
||
|
* This file is part of the Lime Report project *
|
||
|
* Copyright (C) 2015 by Alexander Arin *
|
||
|
* arin_a@bk.ru *
|
||
|
* *
|
||
|
** GNU General Public License Usage **
|
||
|
* *
|
||
|
* This library is free software: you can redistribute it and/or modify *
|
||
|
* it under the terms of the GNU General Public License as published by *
|
||
|
* the Free Software Foundation, either version 3 of the License, or *
|
||
|
* (at your option) any later version. *
|
||
|
* You should have received a copy of the GNU General Public License *
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||
|
* *
|
||
|
** GNU Lesser General Public License **
|
||
|
* *
|
||
|
* This library is free software: you can redistribute it and/or modify *
|
||
|
* it under the terms of the GNU Lesser General Public License as *
|
||
|
* published by the Free Software Foundation, either version 3 of the *
|
||
|
* License, or (at your option) any later version. *
|
||
|
* You should have received a copy of the GNU Lesser General Public *
|
||
|
* License along with this library. *
|
||
|
* If not, see <http://www.gnu.org/licenses/>. *
|
||
|
* *
|
||
|
* This library is distributed in the hope that it will be useful, *
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||
|
* GNU General Public License for more details. *
|
||
|
****************************************************************************/
|
||
|
#ifndef LRHORIZONTALLAYOUT_H
|
||
|
#define LRHORIZONTALLAYOUT_H
|
||
|
#include "lritemdesignintf.h"
|
||
|
|
||
|
namespace LimeReport
|
||
|
{
|
||
|
|
||
|
class HorizontalLayout;
|
||
|
|
||
|
class LayoutMarker : public QGraphicsItem{
|
||
|
public:
|
||
|
explicit LayoutMarker(HorizontalLayout* layout, QGraphicsItem *parent=0);
|
||
|
virtual QRectF boundingRect() const{return m_rect;}
|
||
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
|
||
|
void setHeight(qreal height);
|
||
|
void setWidth(qreal width);
|
||
|
void setColor(QColor color);
|
||
|
qreal width(){return m_rect.width();}
|
||
|
qreal height(){return m_rect.height();}
|
||
|
protected:
|
||
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||
|
private:
|
||
|
QRectF m_rect;
|
||
|
QColor m_color;
|
||
|
HorizontalLayout* m_layout;
|
||
|
};
|
||
|
|
||
|
class HorizontalLayout : public LayoutDesignIntf
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
HorizontalLayout(QObject *owner = 0, QGraphicsItem *parent = 0);
|
||
|
~HorizontalLayout();
|
||
|
BaseDesignIntf *createSameTypeItem(QObject *owner = 0, QGraphicsItem *parent = 0);
|
||
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||
|
void geometryChangedEvent(QRectF newRect, QRectF);
|
||
|
void addChild(BaseDesignIntf *item,bool updateSize=true);
|
||
|
friend class BaseDesignIntf;
|
||
|
void restoreChild(BaseDesignIntf *item);
|
||
|
bool isEmpty() const;
|
||
|
protected:
|
||
|
void collectionLoadFinished(const QString &collectionName);
|
||
|
void objectLoadFinished();
|
||
|
void updateLayoutSize();
|
||
|
void relocateChildren();
|
||
|
void beforeDelete();
|
||
|
void updateItemSize(RenderPass pass, int maxHeight);
|
||
|
bool isNeedUpdateSize(RenderPass pass) const;
|
||
|
void childAddedEvent(BaseDesignIntf *child);
|
||
|
void setChildVisibility(bool value);
|
||
|
int childrenCount();
|
||
|
void initMode(ItemMode mode);
|
||
|
|
||
|
bool canBeSplitted(int height) const;
|
||
|
BaseDesignIntf* cloneUpperPart(int height, QObject* owner=0, QGraphicsItem* parent=0);
|
||
|
BaseDesignIntf* cloneBottomPart(int height, QObject *owner=0, QGraphicsItem *parent=0);
|
||
|
|
||
|
private slots:
|
||
|
void slotOnChildDestroy(QObject *child);
|
||
|
void slotOnChildGeometryChanged(QObject*, QRectF newGeometry, QRectF);
|
||
|
//void slotOnPosChanged(QObject*, QPointF newPos, QPointF );
|
||
|
private:
|
||
|
QList<BaseDesignIntf *> m_children;
|
||
|
bool m_isRelocating;
|
||
|
LayoutMarker* m_layoutMarker;
|
||
|
|
||
|
friend class LayoutMarker;
|
||
|
};
|
||
|
|
||
|
} //namespace LimeReport
|
||
|
#endif // LRHORIZONTALLAYOUT_H
|