Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51826 - in sandbox/guigl: boost/guigl/view/impl boost/guigl/view/impl/detail libs/guigl/build/xcodeide/guigl.xcodeproj libs/guigl/example
From: stipe_at_[hidden]
Date: 2009-03-18 00:38:21


Author: srajko
Date: 2009-03-18 00:38:19 EDT (Wed, 18 Mar 2009)
New Revision: 51826
URL: http://svn.boost.org/trac/boost/changeset/51826

Log:
modified event propagation order so the events are processed in the reverse order of the child widgets being drawn
Added:
   sandbox/guigl/libs/guigl/example/overlapping_example.cpp (contents, props changed)
Text files modified:
   sandbox/guigl/boost/guigl/view/impl/detail/algorithm.hpp | 14 ++++++++++++++
   sandbox/guigl/boost/guigl/view/impl/static_compound.hpp | 4 ++--
   sandbox/guigl/libs/guigl/build/xcodeide/guigl.xcodeproj/project.pbxproj | 2 ++
   sandbox/guigl/libs/guigl/example/Jamfile | 3 ++-
   4 files changed, 20 insertions(+), 3 deletions(-)

Modified: sandbox/guigl/boost/guigl/view/impl/detail/algorithm.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/view/impl/detail/algorithm.hpp (original)
+++ sandbox/guigl/boost/guigl/view/impl/detail/algorithm.hpp 2009-03-18 00:38:19 EDT (Wed, 18 Mar 2009)
@@ -15,6 +15,7 @@
 #include <boost/fusion/include/is_sequence.hpp>
 #include <boost/fusion/include/for_each.hpp>
 #include <boost/fusion/include/accumulate.hpp>
+#include <boost/fusion/view/reverse_view.hpp>
 #include <boost/utility/enable_if.hpp>
 
 //#include <boost/range/algorithm.hpp>
@@ -53,6 +54,19 @@
         return std::accumulate(sequence.begin(), sequence.end(), init, boost::bind(f,_2,_1));
     }
 
+ template<typename Sequence, typename Init, typename F>
+ typename boost::enable_if<fusion::traits::is_sequence<Sequence>, Init >::type
+ reverse_accumulate(Sequence &sequence, const Init &init, const F&f)
+ {
+ return fusion::accumulate(fusion::reverse_view<Sequence>(sequence), init, f);
+ }
+
+ template<typename Sequence, typename Init, typename F>
+ typename boost::disable_if<fusion::traits::is_sequence<Sequence>, Init >::type
+ reverse_accumulate(Sequence &sequence, const Init &init, const F&f)
+ {
+ return std::accumulate(sequence.rbegin(), sequence.rend(), init, boost::bind(f,_2,_1));
+ }
 }
 
 }}}

Modified: sandbox/guigl/boost/guigl/view/impl/static_compound.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/view/impl/static_compound.hpp (original)
+++ sandbox/guigl/boost/guigl/view/impl/static_compound.hpp 2009-03-18 00:38:19 EDT (Wed, 18 Mar 2009)
@@ -177,12 +177,12 @@
 
             access::on_event(*view.m_button_focus_child, translated_event_info);
         }
- return detail::accumulate(view.children(), false, propagate_button_event<static_compound_event_visitor>(*this, event_info));
+ return detail::reverse_accumulate(view.children(), false, propagate_button_event<static_compound_event_visitor>(*this, event_info));
     }
     
     bool operator()(const movement_event &event_info) const
     {
- return detail::accumulate(view.children(), false, propagate_movement_event<static_compound_event_visitor>(*this, event_info));
+ return detail::reverse_accumulate(view.children(), false, propagate_movement_event<static_compound_event_visitor>(*this, event_info));
     }
 
     bool operator()(const entry_exit_event &event_info) const

Modified: sandbox/guigl/libs/guigl/build/xcodeide/guigl.xcodeproj/project.pbxproj
==============================================================================
--- sandbox/guigl/libs/guigl/build/xcodeide/guigl.xcodeproj/project.pbxproj (original)
+++ sandbox/guigl/libs/guigl/build/xcodeide/guigl.xcodeproj/project.pbxproj 2009-03-18 00:38:19 EDT (Wed, 18 Mar 2009)
@@ -87,6 +87,7 @@
 /* End PBXAggregateTarget section */
 
 /* Begin PBXFileReference section */
+ 08177B6C0F703A48003A0028 /* overlapping_example.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = overlapping_example.cpp; sourceTree = "<group>"; };
                 081B05C30E5FCCB600EF7F91 /* clickable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = clickable.hpp; sourceTree = "<group>"; };
                 081B05CA0E5FCE1300EF7F91 /* clickable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = clickable.hpp; sourceTree = "<group>"; };
                 081B06720E5FD90300EF7F91 /* labeled_button.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = labeled_button.cpp; sourceTree = "<group>"; };
@@ -230,6 +231,7 @@
                                 089C81F20E7D949400CE0901 /* two_buttons.cpp */,
                                 089D7E0E0F3B75C800590295 /* custom_example.cpp */,
                                 08A19B410F3F7D930003AC68 /* window_only_example.cpp */,
+ 08177B6C0F703A48003A0028 /* overlapping_example.cpp */,
                         );
                         name = example;
                         path = ../../example;

Modified: sandbox/guigl/libs/guigl/example/Jamfile
==============================================================================
--- sandbox/guigl/libs/guigl/example/Jamfile (original)
+++ sandbox/guigl/libs/guigl/example/Jamfile 2009-03-18 00:38:19 EDT (Wed, 18 Mar 2009)
@@ -25,9 +25,10 @@
 
 exe custom_example : custom_example.cpp ;
 exe window_only_example : window_only_example.cpp ;
+exe overlapping_example : overlapping_example.cpp ;
 
 install window_example_stage
- : window_example custom_example window_only_example
+ : window_example custom_example window_only_example overlapping_example
     : <install-dependencies>on <install-type>EXE
       <install-type>LIB <location>$(TOP)/bin/stage/window_example
     ;

Added: sandbox/guigl/libs/guigl/example/overlapping_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/guigl/libs/guigl/example/overlapping_example.cpp 2009-03-18 00:38:19 EDT (Wed, 18 Mar 2009)
@@ -0,0 +1,27 @@
+/*=================================---------------------------------------------
+ Copyright 2009 Stjepan Rajko
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+-----------------------------------------------===============================*/
+
+
+#include <boost/guigl/application.hpp>
+#include <boost/guigl/window.hpp>
+
+#include <boost/guigl/widget/labeled_button.hpp>
+
+using namespace boost::guigl;
+
+window example_window(( _label = "overlapping example", _size=size_type(300,300) ));
+
+int main()
+{
+ example_window << new widget::labeled_button(( _label = "Bottom", _position=position_type(0,0), _size=size_type(200,200) ));
+ example_window << new widget::labeled_button(( _label = "Top", _position=position_type(100,100), _size=size_type(200,200) ));
+
+ application::run();
+
+ return 0;
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk