File indexing completed on 2024-05-05 05:46:29

0001 /***************************************************************************
0002  *   Copyright (C) 2005 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 MECHANICSGROUP_H
0012 #define MECHANICSGROUP_H
0013 
0014 #include <itemgroup.h>
0015 
0016 class MechanicsItem;
0017 class MechanicsDocument;
0018 typedef QList<MechanicsItem *> MechanicsItemList;
0019 
0020 /**
0021 @author David Saxton
0022 */
0023 class MechanicsGroup : public ItemGroup
0024 {
0025     Q_OBJECT
0026 public:
0027     MechanicsGroup(MechanicsDocument *mechanicsDocument);
0028     ~MechanicsGroup() override;
0029 
0030     /**
0031      * Returns a list of top-level mechanics items only
0032      */
0033     MechanicsItemList toplevelMechItemList() const;
0034     /**
0035      * Sets the selection mode of all MechanicsItems in the group
0036      */
0037     void setSelectionMode(uint sm);
0038     /**
0039      * "Raises" (increases the z value of) the selected group of items
0040      */
0041     void setRaised(bool isRaised);
0042     /**
0043      * Removes all the children of the given item from the group
0044      */
0045     void removeChildren(Item *item);
0046     bool addItem(Item *item);
0047     bool removeItem(Item *item);
0048     bool addQCanvasItem(KtlQCanvasItem *item) override;
0049     bool contains(KtlQCanvasItem *item) const override;
0050     uint count() const override
0051     {
0052         return itemCount();
0053     }
0054     void deleteAllItems() override;
0055     void mergeGroup(ItemGroup *group) override;
0056     void removeAllItems() override;
0057     void removeQCanvasItem(KtlQCanvasItem *item) override;
0058     void setItems(KtlQCanvasItemList list) override;
0059     /**
0060      * Sets the selected state of all items in the group
0061      */
0062     void setSelected(bool sel) override;
0063 
0064     /**
0065      * Extracts the mechanics items from the item list
0066      */
0067     MechanicsItemList extractMechanicsItems() const;
0068 
0069 protected:
0070     void updateInfo();
0071 
0072     bool b_isRaised;
0073 };
0074 
0075 #endif