ItemGroup Class Reference

#include <itemgroup.h>

Inheritance diagram for ItemGroup:

Inheritance graph
[legend]
Collaboration diagram for ItemGroup:

Collaboration graph
[legend]
List of all members.

Public Slots

void slotAlignHorizontally ()
void slotAlignVertically ()
void slotDistributeHorizontally ()
void slotDistributeVertically ()

Signals

void itemAdded (Item *item)
void itemRemoved (Item *item)

Public Member Functions

 ItemGroup (ItemDocument *view, const char *name=0)
virtual ~ItemGroup ()
ItemactiveItem () const
uint itemCount () const
virtual bool addQCanvasItem (QCanvasItem *qcanvasItem)=0
virtual void setItems (QCanvasItemList list)=0
virtual void removeQCanvasItem (QCanvasItem *qcanvasItem)=0
virtual bool contains (QCanvasItem *qcanvasItem) const =0
virtual uint count () const=0
bool isEmpty () const
virtual void mergeGroup (ItemGroup *group)=0
virtual void removeAllItems ()=0
virtual void deleteAllItems ()=0
ItemList items (bool excludeParented=true) const
virtual void setSelected (bool sel)=0
bool itemsHaveSameData () const
bool itemsHaveSameDataValue (const QString &id) const
bool itemsHaveDefaultData () const
bool itemsAreSameType () const

Protected Member Functions

void registerItem (Item *item)
void unregisterItem (Item *item)
void updateAreSameStatus ()

Protected Attributes

ItemList m_itemList
bool b_itemsAreSameType
ItemDocumentp_view
ICNDocumentp_icnDocument
MechanicsDocumentp_mechanicsDocument
Itemm_activeItem

Detailed Description

Generic base class for controlling a selection of Item. Provides some functionality such as for dealing with item data
Author:
David Saxton

Definition at line 34 of file itemgroup.h.


Member Function Documentation

Item* ItemGroup::activeItem (  )  const [inline]

Returns a pointer to the "active" CNItem - i.e. the last CNItem to be added to the CNItemGroup. This will always return a pointer to a single item, unless there are no CNItems in the group

Definition at line 46 of file itemgroup.h.

References m_activeItem.

Referenced by ICNDocument::fillContextMenu(), CircuitDocument::fillContextMenu(), PropertiesListView::slotCreate(), and ItemEditor::slotUpdate().

ItemList ItemGroup::items ( bool  excludeParented = true  )  const

Returns a list of all the Items in the group.

Parameters:
excludeParented whether to return items whose (grand-) parents are already in the list.

Definition at line 43 of file itemgroup.cpp.

References m_itemList.

Referenced by CNItemGroup::connectors(), ICNDocument::copy(), CircuitDocument::createSubcircuit(), CircuitDocument::fillContextMenu(), MechanicsGroup::mergeGroup(), CNItemGroup::mergeGroup(), CMItemMove::mouseMoved(), CMItemMove::mousePressedInitial(), CMMechItemMove::mouseReleased(), CMItemMove::mouseReleased(), and CNItemGroup::nodes().

virtual void ItemGroup::setSelected ( bool  sel  )  [pure virtual]

Sets the selected state of all items in the group

Implemented in CNItemGroup, and MechanicsGroup.

Referenced by CMSelect::mouseMoved(), and ItemDocument::select().

bool ItemGroup::itemsHaveSameData (  )  const

Returns true iff either there are no items, or itemsAreSameType and the value of each data (excluding hidden data) for each item is the same

Definition at line 101 of file itemgroup.cpp.

References itemsAreSameType(), itemsHaveSameDataValue(), and m_itemList.

Referenced by itemsHaveDefaultData(), and ItemEditor::updateMergeDefaults().

bool ItemGroup::itemsHaveSameDataValue ( const QString &  id  )  const

Returns truee iff either there are no items, or itemsAreSameType and the value of the data with the given id is the same for each item

Definition at line 78 of file itemgroup.cpp.

References itemsAreSameType(), and m_itemList.

Referenced by itemsHaveSameData(), and PropertiesListView::slotUpdate().

bool ItemGroup::itemsHaveDefaultData (  )  const

Returns true iff all the iff itemsHaveSameData() returns true and the value of the data are the defaults

Definition at line 123 of file itemgroup.cpp.

References itemsHaveSameData(), and m_itemList.

Referenced by ItemEditor::updateMergeDefaults().

bool ItemGroup::itemsAreSameType (  )  const [inline]

Returns true if all the items in the group are the same (e.g. resistors). This is checked for by looking at the ids of the items, and seeing if the string before "__#" is the same Note: if there are zero items in the group, then this will return true

Definition at line 89 of file itemgroup.h.

References b_itemsAreSameType.

Referenced by CircuitDocument::fillContextMenu(), itemsHaveSameData(), itemsHaveSameDataValue(), and CircuitDocument::slotInitItemActions().

void ItemGroup::slotAlignHorizontally (  )  [slot]

Align the selected items horizontally so that their positions have the same y coordinate.

Definition at line 192 of file itemgroup.cpp.

References m_itemList, p_icnDocument, and ItemDocument::requestStateSave().

Referenced by ItemDocument::alignHorizontally().

void ItemGroup::slotAlignVertically (  )  [slot]

Align the selected items horizontally so that their positions have the same x coordinate.

Definition at line 212 of file itemgroup.cpp.

References m_itemList, p_icnDocument, and ItemDocument::requestStateSave().

Referenced by ItemDocument::alignVertically().

void ItemGroup::slotDistributeHorizontally (  )  [slot]

Distribute the selected items horizontally so that they have the same spacing in the horizontal direction.

Definition at line 232 of file itemgroup.cpp.

References m_itemList, Item::offsetX(), p_icnDocument, ItemDocument::requestStateSave(), and Item::width().

Referenced by ItemDocument::distributeHorizontally().

void ItemGroup::slotDistributeVertically (  )  [slot]

Distribute the selected items vertically so that they have the same spacing in the vertical direction.

Definition at line 278 of file itemgroup.cpp.

References Item::height(), m_itemList, Item::offsetY(), p_icnDocument, and ItemDocument::requestStateSave().

Referenced by ItemDocument::distributeVertically().

void ItemGroup::registerItem ( Item item  )  [protected]

Subclasses must call this to register the item with the data interface

Definition at line 144 of file itemgroup.cpp.

References m_itemList, and updateAreSameStatus().

Referenced by MechanicsGroup::addItem(), and CNItemGroup::addItem().

void ItemGroup::unregisterItem ( Item item  )  [protected]

Subclasses must call this to unregister the item with the data interface

Definition at line 155 of file itemgroup.cpp.

References m_itemList, and updateAreSameStatus().

Referenced by MechanicsGroup::removeItem(), and CNItemGroup::removeItem().


The documentation for this class was generated from the following files:
Generated on Tue May 8 17:05:45 2007 for KTechLab by  doxygen 1.5.1