lock graphic while doing stuff

This commit is contained in:
fluxgen 2003-09-08 16:28:32 +00:00
parent a4e781298c
commit 825273e01f
2 changed files with 18 additions and 10 deletions

View file

@ -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

View file

@ -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