diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2010-09-15 10:43:30 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2010-09-15 10:43:30 (GMT) |
commit | 0beda162d466f8a925093c68b23302d8a79af977 (patch) | |
tree | d327d6f7d44ad8b7134cecbbcbba9d21fa8d9c40 | |
parent | 12e1ef78265a621dc51f7b9af245d81431835dcc (diff) | |
download | fluxbox-0beda162d466f8a925093c68b23302d8a79af977.zip fluxbox-0beda162d466f8a925093c68b23302d8a79af977.tar.bz2 |
code deduplication by using <algorithm> and FbTk/STLUtil.hh
-rw-r--r-- | src/Toolbar.cc | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 4ed765a..8951923 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc | |||
@@ -52,6 +52,7 @@ | |||
52 | #include "FbTk/Shape.hh" | 52 | #include "FbTk/Shape.hh" |
53 | #include "FbTk/SimpleObserver.hh" | 53 | #include "FbTk/SimpleObserver.hh" |
54 | #include "FbTk/MemFun.hh" | 54 | #include "FbTk/MemFun.hh" |
55 | #include "FbTk/STLUtil.hh" | ||
55 | 56 | ||
56 | // use GNU extensions | 57 | // use GNU extensions |
57 | #ifndef _GNU_SOURCE | 58 | #ifndef _GNU_SOURCE |
@@ -72,11 +73,14 @@ | |||
72 | #endif | 73 | #endif |
73 | #include <iterator> | 74 | #include <iterator> |
74 | #include <typeinfo> | 75 | #include <typeinfo> |
76 | #include <functional> | ||
75 | 77 | ||
76 | using std::string; | 78 | using std::string; |
77 | using std::pair; | 79 | using std::pair; |
78 | using std::list; | 80 | using std::list; |
79 | 81 | ||
82 | using FbTk::STLUtil::forAll; | ||
83 | |||
80 | namespace FbTk { | 84 | namespace FbTk { |
81 | 85 | ||
82 | template<> | 86 | template<> |
@@ -518,18 +522,11 @@ void Toolbar::reconfigure() { | |||
518 | if (theme()->shape() && m_shape.get()) | 522 | if (theme()->shape() && m_shape.get()) |
519 | m_shape->update(); | 523 | m_shape->update(); |
520 | 524 | ||
521 | ItemList::iterator item_it = m_item_list.begin(); | 525 | forAll(m_item_list, std::mem_fun(&ToolbarItem::updateSizing)); |
522 | ItemList::iterator item_it_end = m_item_list.end(); | ||
523 | for (; item_it != item_it_end; ++item_it) { | ||
524 | (*item_it)->updateSizing(); | ||
525 | } | ||
526 | 526 | ||
527 | rearrangeItems(); | 527 | rearrangeItems(); |
528 | 528 | ||
529 | for (item_it = m_item_list.begin(); item_it != item_it_end; ++item_it) { | 529 | forAll(m_item_list, std::bind2nd(std::mem_fun(&ToolbarItem::renderTheme), alpha())); |
530 | (*item_it)->renderTheme(alpha()); | ||
531 | } | ||
532 | |||
533 | 530 | ||
534 | // we're done with all resizing and stuff now we can request a new | 531 | // we're done with all resizing and stuff now we can request a new |
535 | // area to be reserved on screen | 532 | // area to be reserved on screen |
@@ -794,10 +791,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
794 | break; | 791 | break; |
795 | } | 792 | } |
796 | 793 | ||
797 | ItemList::iterator item_it = m_item_list.begin(); | 794 | forAll(m_item_list, std::bind2nd(std::mem_fun(&ToolbarItem::setOrientation), orient)); |
798 | ItemList::iterator item_it_end = m_item_list.end(); | ||
799 | for (; item_it != item_it_end; ++item_it) | ||
800 | (*item_it)->setOrientation(orient); | ||
801 | } | 795 | } |
802 | 796 | ||
803 | void Toolbar::updateVisibleState() { | 797 | void Toolbar::updateVisibleState() { |
@@ -812,10 +806,7 @@ void Toolbar::toggleHidden() { | |||
812 | frame.window.move(frame.x_hidden, frame.y_hidden); | 806 | frame.window.move(frame.x_hidden, frame.y_hidden); |
813 | else { | 807 | else { |
814 | frame.window.move(frame.x, frame.y); | 808 | frame.window.move(frame.x, frame.y); |
815 | ItemList::iterator item_it = m_item_list.begin(); | 809 | forAll(m_item_list, std::mem_fun(&ToolbarItem::parentMoved)); |
816 | ItemList::iterator item_it_end = m_item_list.end(); | ||
817 | for ( ; item_it != item_it_end; ++item_it) | ||
818 | (*item_it)->parentMoved(); | ||
819 | } | 810 | } |
820 | 811 | ||
821 | } | 812 | } |