aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Container.cc39
1 files changed, 16 insertions, 23 deletions
diff --git a/src/FbTk/Container.cc b/src/FbTk/Container.cc
index 3374266..6a8f2a3 100644
--- a/src/FbTk/Container.cc
+++ b/src/FbTk/Container.cc
@@ -410,31 +410,24 @@ void Container::repositionItems() {
410 410
411 411
412unsigned int Container::maxWidthPerClient() const { 412unsigned int Container::maxWidthPerClient() const {
413 switch (alignment()) { 413 unsigned int max_relative_size;
414 case RIGHT: 414 if (size() == 0)
415 case CENTER: 415 max_relative_size = width();
416 case LEFT: 416 else {
417 return m_max_size_per_client; 417 unsigned int borderW = m_item_list.front()->borderWidth();
418 break; 418 // there're count-1 borders to fit in with the windows
419 case RELATIVE: 419 // -> 1 per window plus end
420 if (size() == 0) 420 unsigned int w = width(), h = height();
421 return width(); 421 translateSize(m_orientation, w, h);
422 else { 422 max_relative_size = w < (size()-1)*borderW ? 1 :
423 unsigned int borderW = m_item_list.front()->borderWidth(); 423 (w - (size() - 1) * borderW) / size();
424 // there're count-1 borders to fit in with the windows
425 // -> 1 per window plus end
426 unsigned int w = width(), h = height();
427 translateSize(m_orientation, w, h);
428 if (w < (size()-1)*borderW)
429 return 1;
430 else
431 return (w - (size() - 1) * borderW) / size();
432 }
433 break;
434 } 424 }
435 425
436 // this will never happen anyway 426 if (alignment() == RELATIVE)
437 return 1; 427 return max_relative_size;
428
429 return (m_max_size_per_client < max_relative_size ?
430 m_max_size_per_client : max_relative_size);
438} 431}
439 432
440void Container::for_each(std::mem_fun_t<void, FbWindow> function) { 433void Container::for_each(std::mem_fun_t<void, FbWindow> function) {