File indexing completed on 2024-12-01 03:46:30
0001 /* 0002 KBlackBox - A simple game inspired by an emacs module 0003 0004 SPDX-FileCopyrightText: 2007 Nicolas Roffet <nicolas-kde@roffet.com> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef KBBITEMWITHPOSITION_H 0010 #define KBBITEMWITHPOSITION_H 0011 0012 0013 0014 /** 0015 * @brief Item with position 0016 * 0017 * Items with position can be managed by the class KBBGraphicsItemSet. 0018 */ 0019 class KBBItemWithPosition 0020 { 0021 public: 0022 virtual ~KBBItemWithPosition(); 0023 virtual int position() = 0; 0024 0025 /** 0026 * @brief Destructor for dependent QGraphicsItem 0027 * Some QGraphicsItem s needs to delete other dependent QGraphicsItemo s before being deleted. In this case, this methode should be reimplemented. 0028 * If the object is not a QGraphicsItem, you probably don't need to reimplement it and can just reimplement the normal destructor in a child class. 0029 * 0030 * It's different from the normal destructor that only destroys this QGraphicsItem. By exiting KBlackBox, the QGraphicsScene is been destroyed and call in an arbitrary order the destructors of all QGraphicsItem.s. So the dependent items may be destroy before this one: That's why we cannot always destroy them in the normal destructor of this class. 0031 */ 0032 virtual void cleanDelete(); 0033 0034 0035 virtual void highlight(bool); 0036 virtual void highlightBoth(bool); 0037 0038 /** 0039 * @brief Should the element changes if the game is paused? 0040 * Do nothing. 0041 * Reimplement this methode to do something if the game is paused. 0042 */ 0043 virtual void setPause(bool state); 0044 }; 0045 0046 #endif // KBBITEMWITHPOSITION_H