File indexing completed on 2024-12-01 08:18:37

0001 /***************************************************************************
0002  *   Copyright (C) 2003-2004 by David Saxton                               *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #ifndef FLOWCONTAINER_H
0012 #define FLOWCONTAINER_H
0013 
0014 #include "flowpart.h"
0015 
0016 class RectangularOverlay;
0017 
0018 /**
0019 @author David Saxton
0020 */
0021 class FlowContainer : public FlowPart
0022 {
0023     Q_OBJECT
0024 public:
0025     FlowContainer(ICNDocument *_icnView, bool newItem, const QString &id);
0026     ~FlowContainer() override;
0027 
0028     bool canResize() const override
0029     {
0030         return true;
0031     }
0032 
0033     /**
0034      * Sets the bound to a simple rectangle if true, so that ICNDocument
0035      * can tell whether an item is being dropped into it
0036      */
0037     void setFullBounds(bool full);
0038 
0039     void updateConnectorPoints(bool add = true) override;
0040 
0041     /**
0042      * Returns whether the container is currently expanded or not
0043      */
0044     bool isExpanded() const
0045     {
0046         return b_expanded;
0047     }
0048     /**
0049      * Returns true if one of this parents is collapsed.
0050      */
0051     bool parentIsCollapsed() const;
0052     void setExpanded(bool expanded);
0053 
0054     void setSelected(bool yes) override;
0055     void setVisible(bool yes) override;
0056 
0057     QSize minimumSize() const override;
0058     /**
0059      * Update the visibility of items, connectors, nodes in the flowcontainer
0060      */
0061     void updateContainedVisibility();
0062 
0063 protected:
0064     void itemPointsChanged() override {};
0065     void updateNodeLevels() override;
0066     void childAdded(Item *child) override;
0067     void childRemoved(Item *child) override;
0068     void updateAttachedPositioning() override;
0069     void postResize() override;
0070     void filterEndPartIDs(QStringList *ids) override;
0071     void drawShape(QPainter &p) override;
0072     void createTopContainerNode();
0073     void createBotContainerNode();
0074 
0075     void buttonStateChanged(const QString &id, bool state) override;
0076 
0077     FPNode *m_ext_in;
0078     FPNode *m_int_in;
0079     FPNode *m_int_out;
0080     FPNode *m_ext_out;
0081     RectangularOverlay *m_rectangularOverlay;
0082 
0083     bool b_expanded;
0084 };
0085 
0086 #endif