diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2008-08-18 08:45:44 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2008-08-18 08:45:44 (GMT) |
commit | a30a14ef36bda4ecfd8116963f641e8729350ab8 (patch) | |
tree | 2b59e55194ea0ac12663ccdf04d0010d31d46345 /src/FbTk | |
parent | a23778a44d2469fdc414884f5fe72fde09c100cc (diff) | |
download | fluxbox_lack-a30a14ef36bda4ecfd8116963f641e8729350ab8.zip fluxbox_lack-a30a14ef36bda4ecfd8116963f641e8729350ab8.tar.bz2 |
add top, left, right, and bottom center tab placement options
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/Container.cc | 14 | ||||
-rw-r--r-- | src/FbTk/Container.hh | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/FbTk/Container.cc b/src/FbTk/Container.cc index 381f13f..3374266 100644 --- a/src/FbTk/Container.cc +++ b/src/FbTk/Container.cc | |||
@@ -319,7 +319,7 @@ void Container::repositionItems() { | |||
319 | // if we have a max total size, then we must also resize ourself | 319 | // if we have a max total size, then we must also resize ourself |
320 | // within that bound | 320 | // within that bound |
321 | Alignment align = alignment(); | 321 | Alignment align = alignment(); |
322 | if (m_max_total_size && (align == RIGHT || align == LEFT)) { | 322 | if (m_max_total_size && align != RELATIVE) { |
323 | total_width = (max_width_per_client + borderW) * num_items - borderW; | 323 | total_width = (max_width_per_client + borderW) * num_items - borderW; |
324 | if (total_width > m_max_total_size) { | 324 | if (total_width > m_max_total_size) { |
325 | total_width = m_max_total_size; | 325 | total_width = m_max_total_size; |
@@ -332,14 +332,21 @@ void Container::repositionItems() { | |||
332 | // calling Container::resize here risks infinite loops | 332 | // calling Container::resize here risks infinite loops |
333 | unsigned int neww = total_width, newh = height; | 333 | unsigned int neww = total_width, newh = height; |
334 | translateSize(m_orientation, neww, newh); | 334 | translateSize(m_orientation, neww, newh); |
335 | if ((align == RIGHT && m_orientation != ROT270) || | 335 | if (!(align == LEFT && (m_orientation == ROT0 || |
336 | (align == LEFT && m_orientation == ROT270)) { | 336 | m_orientation == ROT90)) && |
337 | !(align == RIGHT && (m_orientation == ROT180 || | ||
338 | m_orientation == ROT270))) { | ||
337 | int deltax = 0; | 339 | int deltax = 0; |
338 | int deltay = 0; | 340 | int deltay = 0; |
339 | if (m_orientation == ROT0 || m_orientation == ROT180) | 341 | if (m_orientation == ROT0 || m_orientation == ROT180) |
340 | deltax = - (total_width - cur_width); | 342 | deltax = - (total_width - cur_width); |
341 | else | 343 | else |
342 | deltay = - (total_width - cur_width); | 344 | deltay = - (total_width - cur_width); |
345 | // TODO: rounding errors could accumulate in this process | ||
346 | if (align == CENTER) { | ||
347 | deltax = deltax/2; | ||
348 | deltay = deltay/2; | ||
349 | } | ||
343 | 350 | ||
344 | FbWindow::moveResize(x() + deltax, y() + deltay, neww, newh); | 351 | FbWindow::moveResize(x() + deltax, y() + deltay, neww, newh); |
345 | } else { | 352 | } else { |
@@ -405,6 +412,7 @@ void Container::repositionItems() { | |||
405 | unsigned int Container::maxWidthPerClient() const { | 412 | unsigned int Container::maxWidthPerClient() const { |
406 | switch (alignment()) { | 413 | switch (alignment()) { |
407 | case RIGHT: | 414 | case RIGHT: |
415 | case CENTER: | ||
408 | case LEFT: | 416 | case LEFT: |
409 | return m_max_size_per_client; | 417 | return m_max_size_per_client; |
410 | break; | 418 | break; |
diff --git a/src/FbTk/Container.hh b/src/FbTk/Container.hh index 2a97f7f..00f2c88 100644 --- a/src/FbTk/Container.hh +++ b/src/FbTk/Container.hh | |||
@@ -38,7 +38,7 @@ class Container: public FbWindow, public EventHandler, private NotCopyable { | |||
38 | public: | 38 | public: |
39 | // LEFT, RIGHT => fixed total width, fixed icon size | 39 | // LEFT, RIGHT => fixed total width, fixed icon size |
40 | // RELATIVE => fixed total width, relative/variable icon size | 40 | // RELATIVE => fixed total width, relative/variable icon size |
41 | enum Alignment { LEFT, RELATIVE, RIGHT }; | 41 | enum Alignment { LEFT, CENTER, RIGHT, RELATIVE }; |
42 | typedef Button * Item; | 42 | typedef Button * Item; |
43 | typedef const Button * ConstItem; | 43 | typedef const Button * ConstItem; |
44 | typedef std::list<Item> ItemList; | 44 | typedef std::list<Item> ItemList; |