aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-13 09:39:16 (GMT)
committerfluxgen <fluxgen>2003-08-13 09:39:16 (GMT)
commit87c97a966801bd1bdd38e11304061bdbe5248d2e (patch)
tree52ddd7e948c2f84a15e2caa0dc53c721ba6f94a2 /src
parent86016331b02ae9480d48404701d81d4e28c2d8a4 (diff)
downloadfluxbox_paul-87c97a966801bd1bdd38e11304061bdbe5248d2e.zip
fluxbox_paul-87c97a966801bd1bdd38e11304061bdbe5248d2e.tar.bz2
since Button changed to a FbWindow we can change the container to hold fbwindows
Diffstat (limited to 'src')
-rw-r--r--src/Container.cc19
-rw-r--r--src/Container.hh12
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 @@
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.1 2003/08/11 15:28:33 fluxgen Exp $ 23// $Id: Container.cc,v 1.2 2003/08/13 09:39:16 fluxgen Exp $
24 24
25#include "FbTk/Button.hh" 25#include "FbTk/Button.hh"
26#include "Container.hh" 26#include "Container.hh"
@@ -59,7 +59,7 @@ void Container::insertItems(ItemList &item_list, int pos) {
59 ItemList::iterator it = m_item_list.begin(); 59 ItemList::iterator it = m_item_list.begin();
60 ItemList::iterator it_end = m_item_list.end(); 60 ItemList::iterator it_end = m_item_list.end();
61 for (; it != it_end; ++it) { 61 for (; it != it_end; ++it) {
62 if ((*it)->window().parent() != this) 62 if ((*it)->parent() != this)
63 return; 63 return;
64 } 64 }
65 65
@@ -87,7 +87,7 @@ void Container::insertItem(Item item, int pos) {
87 return; 87 return;
88 88
89 // it must be a child of this window 89 // it must be a child of this window
90 if (item->window().parent() != this) 90 if (item->parent() != this)
91 return; 91 return;
92 92
93 if (pos >= size() || pos < 0) { 93 if (pos >= size() || pos < 0) {
@@ -177,10 +177,15 @@ void Container::repositionItems() {
177 int next_x = 0; 177 int next_x = 0;
178 for (; it != it_end; ++it, next_x += max_width_per_client) { 178 for (; it != it_end; ++it, next_x += max_width_per_client) {
179 // resize each clients including border in size 179 // resize each clients including border in size
180 (*it)->moveResize(next_x - (*it)->window().borderWidth(), 180 (*it)->moveResize(next_x - (*it)->borderWidth(),
181 (*it)->window().borderWidth(), 181 -(*it)->borderWidth(),
182 max_width_per_client - (*it)->window().borderWidth(), 182 max_width_per_client - (*it)->borderWidth(),
183 height() + (*it)->window().borderWidth()); 183 height() + (*it)->borderWidth());
184 (*it)->clear(); 184 (*it)->clear();
185 } 185 }
186} 186}
187
188
189unsigned int Container::maxWidthPerClient() const {
190 return (size() == 0 ? width() : (width() + size()*m_item_list.front()->borderWidth())/size());
191}
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 @@
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.1 2003/08/11 15:28:33 fluxgen Exp $ 23// $Id: Container.hh,v 1.2 2003/08/13 09:39:16 fluxgen Exp $
24 24
25#ifndef CONTAINER_HH 25#ifndef CONTAINER_HH
26#define CONTAINER_HH 26#define CONTAINER_HH
@@ -31,15 +31,9 @@
31 31
32#include <list> 32#include <list>
33 33
34class ContainerTheme;
35
36namespace FbTk {
37class Button;
38};
39
40class Container:public FbTk::FbWindow, public FbTk::EventHandler, private FbTk::NotCopyable { 34class Container:public FbTk::FbWindow, public FbTk::EventHandler, private FbTk::NotCopyable {
41public: 35public:
42 typedef FbTk::Button * Item; 36 typedef FbTk::FbWindow * Item;
43 typedef std::list<Item> ItemList; 37 typedef std::list<Item> ItemList;
44 38
45 explicit Container(const FbTk::FbWindow &parent); 39 explicit Container(const FbTk::FbWindow &parent);
@@ -65,7 +59,7 @@ public:
65 int size() const { return m_item_list.size(); } 59 int size() const { return m_item_list.size(); }
66 const Item selected() const { return m_selected; } 60 const Item selected() const { return m_selected; }
67 Item selected() { return m_selected; } 61 Item selected() { return m_selected; }
68 unsigned int maxWidthPerClient() const { return (size() == 0 ? width() : width()/size()); } 62 unsigned int maxWidthPerClient() const;
69 unsigned int maxHeightPerClient() const { return (size() == 0 ? height() : height()/size()); } 63 unsigned int maxHeightPerClient() const { return (size() == 0 ? height() : height()/size()); }
70private: 64private:
71 void repositionItems(); 65 void repositionItems();