aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Container.cc7
-rw-r--r--src/FbTk/Container.hh2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/FbTk/Container.cc b/src/FbTk/Container.cc
index 6270c6a..cea761b 100644
--- a/src/FbTk/Container.cc
+++ b/src/FbTk/Container.cc
@@ -324,7 +324,7 @@ void Container::repositionItems() {
324 // if we have a max total size, then we must also resize ourself 324 // if we have a max total size, then we must also resize ourself
325 // within that bound 325 // within that bound
326 Alignment align = alignment(); 326 Alignment align = alignment();
327 if (m_max_total_size && align != RELATIVE) { 327 if (m_max_total_size && (align != RELATIVE && align != RELATIVE_SMART)) {
328 total_width = (max_width_per_client + borderW) * num_items - borderW; 328 total_width = (max_width_per_client + borderW) * num_items - borderW;
329 if (total_width > m_max_total_size) { 329 if (total_width > m_max_total_size) {
330 total_width = m_max_total_size; 330 total_width = m_max_total_size;
@@ -379,7 +379,7 @@ void Container::repositionItems() {
379 unsigned int totalDemands = 0; 379 unsigned int totalDemands = 0;
380 std::vector<unsigned int> buttonDemands; 380 std::vector<unsigned int> buttonDemands;
381 381
382 if (align == RELATIVE || total_width == m_max_total_size) { 382 if (align == RELATIVE_SMART && total_width == m_max_total_size) {
383 buttonDemands.reserve(num_items); 383 buttonDemands.reserve(num_items);
384 for (it = begin(); it != it_end; ++it) { 384 for (it = begin(); it != it_end; ++it) {
385 buttonDemands.push_back((*it)->preferredWidth()); 385 buttonDemands.push_back((*it)->preferredWidth());
@@ -440,7 +440,7 @@ void Container::repositionItems() {
440 // rotate the x and y coords 440 // rotate the x and y coords
441 tmpx = next_x; 441 tmpx = next_x;
442 tmpy = -borderW; 442 tmpy = -borderW;
443 if (align == RELATIVE && totalDemands) { 443 if ((align == RELATIVE || align == RELATIVE_SMART) && totalDemands) {
444 tmpw = buttonDemands.at(i)*total_width/totalDemands + extra; 444 tmpw = buttonDemands.at(i)*total_width/totalDemands + extra;
445 } else { 445 } else {
446 tmpw = max_width_per_client + extra; 446 tmpw = max_width_per_client + extra;
@@ -469,6 +469,7 @@ unsigned int Container::maxWidthPerClient() const {
469 case LEFT: 469 case LEFT:
470 return m_max_size_per_client; 470 return m_max_size_per_client;
471 break; 471 break;
472 case RELATIVE_SMART:
472 case RELATIVE: 473 case RELATIVE:
473 if (size() == 0) 474 if (size() == 0)
474 return width(); 475 return width();
diff --git a/src/FbTk/Container.hh b/src/FbTk/Container.hh
index 0f8ac08..2dc6475 100644
--- a/src/FbTk/Container.hh
+++ b/src/FbTk/Container.hh
@@ -39,7 +39,7 @@ class Container: public FbWindow, public EventHandler, private NotCopyable {
39public: 39public:
40 // LEFT, RIGHT => fixed total width, fixed icon size 40 // LEFT, RIGHT => fixed total width, fixed icon size
41 // RELATIVE => fixed total width, relative/variable icon size 41 // RELATIVE => fixed total width, relative/variable icon size
42 enum Alignment { LEFT, CENTER, RIGHT, RELATIVE }; 42 enum Alignment { LEFT, CENTER, RIGHT, RELATIVE, RELATIVE_SMART };
43 typedef Button * Item; 43 typedef Button * Item;
44 typedef const Button * ConstItem; 44 typedef const Button * ConstItem;
45 typedef std::list<Item> ItemList; 45 typedef std::list<Item> ItemList;