diff options
-rw-r--r-- | src/Container.cc | 7 | ||||
-rw-r--r-- | 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 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: Container.cc,v 1.2 2003/08/13 09:39:16 fluxgen Exp $ | 23 | // $Id: Container.cc,v 1.3 2003/09/08 16:28:32 fluxgen Exp $ |
24 | 24 | ||
25 | #include "FbTk/Button.hh" | 25 | #include "FbTk/Button.hh" |
26 | #include "Container.hh" | 26 | #include "Container.hh" |
@@ -28,7 +28,8 @@ | |||
28 | #include "FbTk/EventManager.hh" | 28 | #include "FbTk/EventManager.hh" |
29 | 29 | ||
30 | Container::Container(const FbTk::FbWindow &parent): | 30 | Container::Container(const FbTk::FbWindow &parent): |
31 | FbTk::FbWindow(parent, 0, 0, 1, 1, ExposureMask), m_selected(0) { | 31 | FbTk::FbWindow(parent, 0, 0, 1, 1, ExposureMask), m_selected(0), |
32 | m_update_lock(false) { | ||
32 | 33 | ||
33 | FbTk::EventManager::instance()->add(*this, *this); | 34 | FbTk::EventManager::instance()->add(*this, *this); |
34 | } | 35 | } |
@@ -165,7 +166,7 @@ void Container::exposeEvent(XExposeEvent &event) { | |||
165 | } | 166 | } |
166 | 167 | ||
167 | void Container::repositionItems() { | 168 | void Container::repositionItems() { |
168 | if (size() == 0) | 169 | if (size() == 0 || m_update_lock) |
169 | return; | 170 | return; |
170 | 171 | ||
171 | //!! TODO vertical position | 172 | //!! 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 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: Container.hh,v 1.2 2003/08/13 09:39:16 fluxgen Exp $ | 23 | // $Id: Container.hh,v 1.3 2003/09/08 16:28:32 fluxgen Exp $ |
24 | 24 | ||
25 | #ifndef CONTAINER_HH | 25 | #ifndef CONTAINER_HH |
26 | #define CONTAINER_HH | 26 | #define CONTAINER_HH |
@@ -51,21 +51,28 @@ public: | |||
51 | void removeAll(); | 51 | void removeAll(); |
52 | int find(Item item); | 52 | int find(Item item); |
53 | void setSelected(int index); | 53 | void setSelected(int index); |
54 | /// force update | ||
55 | inline void update() { repositionItems(); } | ||
56 | /// so we can add items without having an graphic update for each item | ||
57 | inline void setUpdateLock(bool value) { m_update_lock = value; } | ||
54 | 58 | ||
55 | // event handler | 59 | /// event handler |
56 | void exposeEvent(XExposeEvent &event); | 60 | void exposeEvent(XExposeEvent &event); |
57 | 61 | ||
58 | // accessors | 62 | /// accessors |
59 | int size() const { return m_item_list.size(); } | 63 | inline int size() const { return m_item_list.size(); } |
60 | const Item selected() const { return m_selected; } | 64 | inline const Item selected() const { return m_selected; } |
61 | Item selected() { return m_selected; } | 65 | inline Item selected() { return m_selected; } |
62 | unsigned int maxWidthPerClient() const; | 66 | unsigned int maxWidthPerClient() const; |
63 | unsigned int maxHeightPerClient() const { return (size() == 0 ? height() : height()/size()); } | 67 | inline unsigned int maxHeightPerClient() const { return (size() == 0 ? height() : height()/size()); } |
68 | inline bool updateLock() const { return m_update_lock; } | ||
69 | |||
64 | private: | 70 | private: |
65 | void repositionItems(); | 71 | void repositionItems(); |
66 | 72 | ||
67 | ItemList m_item_list; | 73 | ItemList m_item_list; |
68 | Item m_selected; | 74 | Item m_selected; |
75 | bool m_update_lock; | ||
69 | }; | 76 | }; |
70 | 77 | ||
71 | #endif // CONTAINER_HH | 78 | #endif // CONTAINER_HH |