From 825273e01f066e9dd7e865b9c80df69960e1e9f5 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Mon, 8 Sep 2003 16:28:32 +0000 Subject: lock graphic while doing stuff --- src/Container.cc | 7 ++++--- src/Container.hh | 21 ++++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/Container.cc b/src/Container.cc index 6c2dfef..5c87379 100644 --- a/src/Container.cc +++ b/src/Container.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Container.cc,v 1.2 2003/08/13 09:39:16 fluxgen Exp $ +// $Id: Container.cc,v 1.3 2003/09/08 16:28:32 fluxgen Exp $ #include "FbTk/Button.hh" #include "Container.hh" @@ -28,7 +28,8 @@ #include "FbTk/EventManager.hh" Container::Container(const FbTk::FbWindow &parent): - FbTk::FbWindow(parent, 0, 0, 1, 1, ExposureMask), m_selected(0) { + FbTk::FbWindow(parent, 0, 0, 1, 1, ExposureMask), m_selected(0), + m_update_lock(false) { FbTk::EventManager::instance()->add(*this, *this); } @@ -165,7 +166,7 @@ void Container::exposeEvent(XExposeEvent &event) { } void Container::repositionItems() { - if (size() == 0) + if (size() == 0 || m_update_lock) return; //!! TODO vertical position diff --git a/src/Container.hh b/src/Container.hh index ffa7d93..5f2ca4b 100644 --- a/src/Container.hh +++ b/src/Container.hh @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Container.hh,v 1.2 2003/08/13 09:39:16 fluxgen Exp $ +// $Id: Container.hh,v 1.3 2003/09/08 16:28:32 fluxgen Exp $ #ifndef CONTAINER_HH #define CONTAINER_HH @@ -51,21 +51,28 @@ public: void removeAll(); int find(Item item); void setSelected(int index); + /// force update + inline void update() { repositionItems(); } + /// so we can add items without having an graphic update for each item + inline void setUpdateLock(bool value) { m_update_lock = value; } - // event handler + /// event handler void exposeEvent(XExposeEvent &event); - // accessors - int size() const { return m_item_list.size(); } - const Item selected() const { return m_selected; } - Item selected() { return m_selected; } + /// accessors + inline int size() const { return m_item_list.size(); } + inline const Item selected() const { return m_selected; } + inline Item selected() { return m_selected; } unsigned int maxWidthPerClient() const; - unsigned int maxHeightPerClient() const { return (size() == 0 ? height() : height()/size()); } + inline unsigned int maxHeightPerClient() const { return (size() == 0 ? height() : height()/size()); } + inline bool updateLock() const { return m_update_lock; } + private: void repositionItems(); ItemList m_item_list; Item m_selected; + bool m_update_lock; }; #endif // CONTAINER_HH -- cgit v0.11.2