aboutsummaryrefslogtreecommitdiff
path: root/src/Toolbar.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2004-04-26 15:04:37 (GMT)
committerrathnor <rathnor>2004-04-26 15:04:37 (GMT)
commitd4a871785130ab0d6533bef4f1ec55c4cfd3b8df (patch)
treef07025c5527733c88043ca61316c0af62daf598d /src/Toolbar.cc
parentef6bf03ca19c0c96943894f9d0f0db9bc0bd58fc (diff)
downloadfluxbox_pavel-d4a871785130ab0d6533bef4f1ec55c4cfd3b8df.zip
fluxbox_pavel-d4a871785130ab0d6533bef4f1ec55c4cfd3b8df.tar.bz2
toolbar themeing fixes
Diffstat (limited to 'src/Toolbar.cc')
-rw-r--r--src/Toolbar.cc35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 7dd4c58..15efb99 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Toolbar.cc,v 1.138 2004/01/21 13:36:09 fluxgen Exp $ 25// $Id: Toolbar.cc,v 1.139 2004/04/26 15:04:37 rathnor Exp $
26 26
27#include "Toolbar.hh" 27#include "Toolbar.hh"
28 28
@@ -876,9 +876,24 @@ void Toolbar::rearrangeItems() {
876 int fixed_width = 0; // combined size of all fixed items 876 int fixed_width = 0; // combined size of all fixed items
877 int fixed_items = 0; // number of fixed items 877 int fixed_items = 0; // number of fixed items
878 int relative_items = 0; 878 int relative_items = 0;
879 int last_bw = 0; // we show the largest border of adjoining items
880 bool first = true;
879 for (; item_it != item_it_end; ++item_it) { 881 for (; item_it != item_it_end; ++item_it) {
882 if (!(*item_it)->active())
883 continue;
884
885 if (!first) {
886 if ((*item_it)->borderWidth() > last_bw)
887 fixed_width += (*item_it)->borderWidth();
888 else
889 fixed_width += last_bw;
890 } else
891 first = false;
892
893 last_bw = (*item_it)->borderWidth();
894
880 if ((*item_it)->type() == ToolbarItem::FIXED && (*item_it)->active()) { 895 if ((*item_it)->type() == ToolbarItem::FIXED && (*item_it)->active()) {
881 fixed_width += (*item_it)->width() + (*item_it)->borderWidth()*2; 896 fixed_width += (*item_it)->width();
882 fixed_items++; 897 fixed_items++;
883 } else if ((*item_it)->type() == ToolbarItem::RELATIVE && (*item_it)->active()) { 898 } else if ((*item_it)->type() == ToolbarItem::RELATIVE && (*item_it)->active()) {
884 relative_items++; 899 relative_items++;
@@ -899,14 +914,22 @@ void Toolbar::rearrangeItems() {
899 } 914 }
900 } 915 }
901 // now move and resize the items 916 // now move and resize the items
902 int next_x = 0; 917 // borderWidth added back on straight away
918 int next_x = -2*m_item_list.front()->borderWidth(); // list isn't empty
919 last_bw = 0;
903 for (item_it = m_item_list.begin(); item_it != item_it_end; ++item_it) { 920 for (item_it = m_item_list.begin(); item_it != item_it_end; ++item_it) {
904 if (!(*item_it)->active()) { 921 if (!(*item_it)->active()) {
905 (*item_it)->hide(); 922 (*item_it)->hide();
906 continue; 923 continue;
907 } 924 }
908
909 int borderW = (*item_it)->borderWidth(); 925 int borderW = (*item_it)->borderWidth();
926
927 if (borderW > last_bw)
928 next_x += borderW;
929 else
930 next_x += last_bw;
931 last_bw = borderW;
932
910 (*item_it)->show(); 933 (*item_it)->show();
911 if ((*item_it)->type() == ToolbarItem::RELATIVE) { 934 if ((*item_it)->type() == ToolbarItem::RELATIVE) {
912 int extra = 0; 935 int extra = 0;
@@ -915,12 +938,12 @@ void Toolbar::rearrangeItems() {
915 --rounding_error; 938 --rounding_error;
916 } 939 }
917 940
918 (*item_it)->moveResize(next_x, -borderW, extra + relative_width-2*borderW, height()); 941 (*item_it)->moveResize(next_x, -borderW, extra + relative_width, height());
919 } else { // fixed size 942 } else { // fixed size
920 (*item_it)->moveResize(next_x, -borderW, 943 (*item_it)->moveResize(next_x, -borderW,
921 (*item_it)->width(), height()); 944 (*item_it)->width(), height());
922 } 945 }
923 next_x += (*item_it)->width() + borderW*2; 946 next_x += (*item_it)->width();
924 } 947 }
925 // unlock 948 // unlock
926 m_resize_lock = false; 949 m_resize_lock = false;