From 87c97a966801bd1bdd38e11304061bdbe5248d2e Mon Sep 17 00:00:00 2001 From: fluxgen Date: Wed, 13 Aug 2003 09:39:16 +0000 Subject: since Button changed to a FbWindow we can change the container to hold fbwindows --- src/Container.cc | 19 ++++++++++++------- src/Container.hh | 12 +++--------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/Container.cc b/src/Container.cc index 0fff44a..6c2dfef 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.1 2003/08/11 15:28:33 fluxgen Exp $ +// $Id: Container.cc,v 1.2 2003/08/13 09:39:16 fluxgen Exp $ #include "FbTk/Button.hh" #include "Container.hh" @@ -59,7 +59,7 @@ void Container::insertItems(ItemList &item_list, int pos) { ItemList::iterator it = m_item_list.begin(); ItemList::iterator it_end = m_item_list.end(); for (; it != it_end; ++it) { - if ((*it)->window().parent() != this) + if ((*it)->parent() != this) return; } @@ -87,7 +87,7 @@ void Container::insertItem(Item item, int pos) { return; // it must be a child of this window - if (item->window().parent() != this) + if (item->parent() != this) return; if (pos >= size() || pos < 0) { @@ -177,10 +177,15 @@ void Container::repositionItems() { int next_x = 0; for (; it != it_end; ++it, next_x += max_width_per_client) { // resize each clients including border in size - (*it)->moveResize(next_x - (*it)->window().borderWidth(), - (*it)->window().borderWidth(), - max_width_per_client - (*it)->window().borderWidth(), - height() + (*it)->window().borderWidth()); + (*it)->moveResize(next_x - (*it)->borderWidth(), + -(*it)->borderWidth(), + max_width_per_client - (*it)->borderWidth(), + height() + (*it)->borderWidth()); (*it)->clear(); } } + + +unsigned int Container::maxWidthPerClient() const { + return (size() == 0 ? width() : (width() + size()*m_item_list.front()->borderWidth())/size()); +} diff --git a/src/Container.hh b/src/Container.hh index 474e55b..ffa7d93 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.1 2003/08/11 15:28:33 fluxgen Exp $ +// $Id: Container.hh,v 1.2 2003/08/13 09:39:16 fluxgen Exp $ #ifndef CONTAINER_HH #define CONTAINER_HH @@ -31,15 +31,9 @@ #include -class ContainerTheme; - -namespace FbTk { -class Button; -}; - class Container:public FbTk::FbWindow, public FbTk::EventHandler, private FbTk::NotCopyable { public: - typedef FbTk::Button * Item; + typedef FbTk::FbWindow * Item; typedef std::list ItemList; explicit Container(const FbTk::FbWindow &parent); @@ -65,7 +59,7 @@ public: int size() const { return m_item_list.size(); } const Item selected() const { return m_selected; } Item selected() { return m_selected; } - unsigned int maxWidthPerClient() const { return (size() == 0 ? width() : width()/size()); } + unsigned int maxWidthPerClient() const; unsigned int maxHeightPerClient() const { return (size() == 0 ? height() : height()/size()); } private: void repositionItems(); -- cgit v0.11.2