|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51032 - in sandbox/guigl: boost/guigl boost/guigl/view boost/guigl/widget libs/guigl/build libs/guigl/build/xcodeide/guigl.xcodeproj libs/guigl/example libs/guigl/src/widget
From: stipe_at_[hidden]
Date: 2009-02-05 14:44:54
Author: srajko
Date: 2009-02-05 14:44:53 EST (Thu, 05 Feb 2009)
New Revision: 51032
URL: http://svn.boost.org/trac/boost/changeset/51032
Log:
add custom_drawable, custom widget, and custom_example
Added:
sandbox/guigl/boost/guigl/view/custom_drawable.hpp (contents, props changed)
sandbox/guigl/boost/guigl/widget/custom.hpp (contents, props changed)
sandbox/guigl/libs/guigl/example/custom_example.cpp (contents, props changed)
sandbox/guigl/libs/guigl/src/widget/custom.cpp (contents, props changed)
Text files modified:
sandbox/guigl/boost/guigl/parameters.hpp | 2 ++
sandbox/guigl/libs/guigl/build/Jamfile | 3 ++-
sandbox/guigl/libs/guigl/build/xcodeide/guigl.xcodeproj/project.pbxproj | 8 ++++++++
sandbox/guigl/libs/guigl/example/Jamfile | 7 ++++++-
4 files changed, 18 insertions(+), 2 deletions(-)
Modified: sandbox/guigl/boost/guigl/parameters.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/parameters.hpp (original)
+++ sandbox/guigl/boost/guigl/parameters.hpp 2009-02-05 14:44:53 EST (Thu, 05 Feb 2009)
@@ -33,6 +33,8 @@
BOOST_PARAMETER_UNTYPED_NAME(value)
BOOST_PARAMETER_UNTYPED_NAME(children)
+ BOOST_PARAMETER_UNTYPED_NAME(draw_prologue)
+ BOOST_PARAMETER_UNTYPED_NAME(draw_epilogue)
typedef boost::parameter::aux::empty_typed_arg_list default_parameters;
}
Added: sandbox/guigl/boost/guigl/view/custom_drawable.hpp
==============================================================================
--- (empty file)
+++ sandbox/guigl/boost/guigl/view/custom_drawable.hpp 2009-02-05 14:44:53 EST (Thu, 05 Feb 2009)
@@ -0,0 +1,53 @@
+/*=================================---------------------------------------------
+ Copyright 2008 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)
+-----------------------------------------------===============================*/
+
+#ifndef BOOST__GUIGL__VIEW__CUSTOM_DRAWABLE_HPP
+#define BOOST__GUIGL__VIEW__CUSTOM_DRAWABLE_HPP
+
+#include <boost/guigl/view/base.hpp>
+
+namespace boost { namespace guigl { namespace view {
+
+template<typename Callable, typename BaseView=base>
+class custom_drawable : public BaseView
+{
+public:
+ typedef BaseView base_type;
+
+ template<typename ArgumentPack>
+ custom_drawable(const ArgumentPack &args)
+ : base_type(args)
+ , m_draw_prologue(args[_draw_prologue|Callable()])
+ , m_draw_epilogue(args[_draw_epilogue|Callable()])
+ {}
+ custom_drawable(const custom_drawable &rhs)
+ : base_type(static_cast<const base_type &>(rhs))
+ , m_draw_prologue(rhs.m_draw_prologue)
+ , m_draw_epilogue(rhs.m_draw_epilogue)
+ {}
+
+protected:
+ void draw_prologue()
+ {
+ base_type::draw_prologue();
+ if(m_draw_prologue)
+ m_draw_prologue();
+ };
+ void draw_epilogue()
+ {
+ if(m_draw_epilogue)
+ m_draw_epilogue();
+ base_type::draw_epilogue();
+ };
+private:
+ Callable m_draw_prologue, m_draw_epilogue;
+};
+
+}}}
+
+#endif // BOOST__GUIGL__VIEW__CUSTOM_DRAW_HPP
Added: sandbox/guigl/boost/guigl/widget/custom.hpp
==============================================================================
--- (empty file)
+++ sandbox/guigl/boost/guigl/widget/custom.hpp 2009-02-05 14:44:53 EST (Thu, 05 Feb 2009)
@@ -0,0 +1,47 @@
+/*=================================---------------------------------------------
+ Copyright 2008 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)
+-----------------------------------------------===============================*/
+
+#ifndef BOOST__GUIGL__WIDGET__CUSTOM_HPP
+#define BOOST__GUIGL__WIDGET__CUSTOM_HPP
+
+#include <boost/guigl/export_symbols.hpp>
+#include <boost/guigl/view/custom_drawable.hpp>
+#include <boost/guigl/view/positioned.hpp>
+#include <boost/function.hpp>
+
+namespace boost { namespace guigl { namespace widget {
+
+class custom;
+
+typedef
+ view::custom_drawable<boost::function<void()>,
+ view::positioned<>
+ > custom_base_type;
+
+class custom : public custom_base_type
+{
+public:
+ typedef custom_base_type base_type;
+
+ template<typename ArgumentPack>
+ custom(const ArgumentPack &args)
+ : base_type(args)
+ {}
+ custom(const custom &rhs)
+ : base_type(static_cast<const base_type &>(rhs))
+ {}
+
+protected:
+ friend class ::boost::guigl::access;
+ void BOOST_EXPORT_SYMBOLS draw();
+ bool BOOST_EXPORT_SYMBOLS on_event(const event_type &event_info);
+};
+
+}}}
+
+#endif // BOOST__GUIGL__WIDGET__BUTTON_HPP
Modified: sandbox/guigl/libs/guigl/build/Jamfile
==============================================================================
--- sandbox/guigl/libs/guigl/build/Jamfile (original)
+++ sandbox/guigl/libs/guigl/build/Jamfile 2009-02-05 14:44:53 EST (Thu, 05 Feb 2009)
@@ -24,7 +24,8 @@
application
widget/button widget/labeled_button
widget/slider widget/labeled_slider
- widget/compound widget/label ;
+ widget/compound widget/label
+ widget/custom ;
lib boost_guigl
: $(SOURCES).cpp
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-02-05 14:44:53 EST (Thu, 05 Feb 2009)
@@ -142,6 +142,10 @@
089C813C0E7D814B00CE0901 /* untyped_keyword.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = untyped_keyword.hpp; sourceTree = "<group>"; };
089C81CF0E7D8EEB00CE0901 /* keyword_base.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = keyword_base.hpp; sourceTree = "<group>"; };
089C81F20E7D949400CE0901 /* two_buttons.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = two_buttons.cpp; sourceTree = "<group>"; };
+ 089C8CFE0F3AC3650062EFEC /* custom_drawable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = custom_drawable.hpp; sourceTree = "<group>"; };
+ 089C8D040F3AC52A0062EFEC /* custom.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = custom.hpp; sourceTree = "<group>"; };
+ 089D7DE70F3B738600590295 /* custom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = custom.cpp; sourceTree = "<group>"; };
+ 089D7E0E0F3B75C800590295 /* custom_example.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = custom_example.cpp; sourceTree = "<group>"; };
089D83740E5A35D800325868 /* parameters.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = parameters.hpp; sourceTree = "<group>"; };
089D83780E5A3AA900325868 /* test_parameter_map_compilation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_parameter_map_compilation.cpp; sourceTree = "<group>"; };
089D83800E5A3C0B00325868 /* test_parameter_map_compilation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = test_parameter_map_compilation.hpp; sourceTree = "<group>"; };
@@ -221,6 +225,7 @@
08E17F6F0E773D30008EAE5E /* two_spheres.hpp */,
08A6D3950E7B99C700BF2671 /* two_buttons.hpp */,
089C81F20E7D949400CE0901 /* two_buttons.cpp */,
+ 089D7E0E0F3B75C800590295 /* custom_example.cpp */,
);
name = example;
path = ../../example;
@@ -246,6 +251,7 @@
08DD9E4D0E7B2799008DC46A /* static_base.hpp */,
08ADC1F90E7B62BD00D8CB9D /* static_compound.hpp */,
089F14D60E7DC87700B91674 /* periodic.hpp */,
+ 089C8CFE0F3AC3650062EFEC /* custom_drawable.hpp */,
);
path = view;
sourceTree = "<group>";
@@ -260,6 +266,7 @@
0899266B0E78664900285958 /* compound.cpp */,
0896AFB70E7FFB5800543446 /* labeled_slider.cpp */,
0899FC7A0E805A8100BD5F3E /* label.cpp */,
+ 089D7DE70F3B738600590295 /* custom.cpp */,
);
path = widget;
sourceTree = "<group>";
@@ -316,6 +323,7 @@
089926680E7865B500285958 /* compound.hpp */,
0896AFB40E7FFAF000543446 /* labeled_slider.hpp */,
0899FC770E8059FC00BD5F3E /* label.hpp */,
+ 089C8D040F3AC52A0062EFEC /* custom.hpp */,
);
path = widget;
sourceTree = "<group>";
Modified: sandbox/guigl/libs/guigl/example/Jamfile
==============================================================================
--- sandbox/guigl/libs/guigl/example/Jamfile (original)
+++ sandbox/guigl/libs/guigl/example/Jamfile 2009-02-05 14:44:53 EST (Thu, 05 Feb 2009)
@@ -16,7 +16,12 @@
window_example.cpp two_spheres.cpp two_buttons.cpp
;
-install window_example_stage : window_example
+exe custom_example
+ :
+ custom_example.cpp
+ ;
+
+install window_example_stage : window_example custom_example
: <install-dependencies>on <install-type>EXE
<install-type>LIB <location>$(TOP)/bin/stage/window_example
;
Added: sandbox/guigl/libs/guigl/example/custom_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/guigl/libs/guigl/example/custom_example.cpp 2009-02-05 14:44:53 EST (Thu, 05 Feb 2009)
@@ -0,0 +1,34 @@
+/*=================================---------------------------------------------
+ Copyright 2007,2008 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/custom.hpp>
+
+#include <boost/guigl/platform/opengl.hpp>
+
+using namespace boost::guigl;
+
+void draw_stuff()
+{
+ glColor3d(1.0, 0.0, 0.0);
+ glRectd(0.0, 0.0, 50.0, 50.0);
+}
+
+int main()
+{
+ window test_window1(( _label = "custom example", _size=size_type(300,300) ));
+
+ test_window1 << new widget::custom((
+ _size=size_type(300,300),
+ _draw_prologue=draw_stuff
+ ));
+
+ application::run();
+}
Added: sandbox/guigl/libs/guigl/src/widget/custom.cpp
==============================================================================
--- (empty file)
+++ sandbox/guigl/libs/guigl/src/widget/custom.cpp 2009-02-05 14:44:53 EST (Thu, 05 Feb 2009)
@@ -0,0 +1,26 @@
+/*=================================---------------------------------------------
+ Copyright 2008 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/widget/custom.hpp>
+#include <boost/guigl/view/impl/positioned.hpp>
+
+namespace boost { namespace guigl { namespace widget {
+
+void custom::draw()
+{
+ draw_prologue();
+ draw_epilogue();
+}
+
+bool custom::on_event(const event_type &event_info)
+{
+ return base_type::on_event(event_info);
+}
+
+}}}
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