|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r48810 - in sandbox/guigl: . boost/guigl boost/guigl/view boost/guigl/view/impl boost/guigl/widget libs/guigl/build libs/guigl/build/xcodeide/guigl.xcodeproj libs/guigl/example libs/guigl/src/widget
From: stipe_at_[hidden]
Date: 2008-09-17 03:57:44
Author: srajko
Date: 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
New Revision: 48810
URL: http://svn.boost.org/trac/boost/changeset/48810
Log:
adding periodic, labeled_slider, label
Added:
sandbox/guigl/boost/guigl/view/impl/periodic.hpp (contents, props changed)
sandbox/guigl/boost/guigl/view/periodic.hpp (contents, props changed)
sandbox/guigl/boost/guigl/widget/label.hpp (contents, props changed)
sandbox/guigl/boost/guigl/widget/labeled_slider.hpp (contents, props changed)
sandbox/guigl/libs/guigl/src/widget/label.cpp (contents, props changed)
sandbox/guigl/libs/guigl/src/widget/labeled_slider.cpp (contents, props changed)
Text files modified:
sandbox/guigl/Jamroot | 2 +-
sandbox/guigl/boost/guigl/parameters.hpp | 1 +
sandbox/guigl/boost/guigl/view/draggable.hpp | 9 +++++++--
sandbox/guigl/boost/guigl/view/impl/draggable.hpp | 6 ++++--
sandbox/guigl/boost/guigl/view/impl/navigable.hpp | 2 +-
sandbox/guigl/boost/guigl/view/labeled.hpp | 6 ++++++
sandbox/guigl/boost/guigl/view/navigable.hpp | 12 ++++++++++++
sandbox/guigl/boost/guigl/widget/slider.hpp | 1 +
sandbox/guigl/libs/guigl/build/Jamfile | 4 +++-
sandbox/guigl/libs/guigl/build/xcodeide/guigl.xcodeproj/project.pbxproj | 12 ++++++++++++
sandbox/guigl/libs/guigl/example/two_spheres.cpp | 10 ++++++++++
sandbox/guigl/libs/guigl/example/two_spheres.hpp | 15 +++++++++++++--
sandbox/guigl/libs/guigl/example/window_example.cpp | 19 ++++++++++++++-----
13 files changed, 85 insertions(+), 14 deletions(-)
Modified: sandbox/guigl/Jamroot
==============================================================================
--- sandbox/guigl/Jamroot (original)
+++ sandbox/guigl/Jamroot 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -21,7 +21,7 @@
use-project boost
: $(BOOST_ROOT)
;
-
+
use-project guigl : libs/guigl/build ;
# the Dataflow project and anything using it needs Dataflow and Boost headers
Modified: sandbox/guigl/boost/guigl/parameters.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/parameters.hpp (original)
+++ sandbox/guigl/boost/guigl/parameters.hpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -25,6 +25,7 @@
BOOST_PARAMETER_TYPED_NAME_WDEFAULT(min,const double,0.0)
BOOST_PARAMETER_TYPED_NAME_WDEFAULT(max,const double,1.0)
BOOST_PARAMETER_TYPED_NAME_WDEFAULT(step,const double,0.0)
+ BOOST_PARAMETER_TYPED_NAME_WDEFAULT(period,const double,0.0)
BOOST_PARAMETER_UNTYPED_NAME(children)
typedef boost::parameter::aux::empty_typed_arg_list default_parameters;
Modified: sandbox/guigl/boost/guigl/view/draggable.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/view/draggable.hpp (original)
+++ sandbox/guigl/boost/guigl/view/draggable.hpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -28,8 +28,9 @@
template<typename Derived, typename BaseView=base>
class draggable : public mouse_tracking<BaseView>
{
- typedef mouse_tracking<BaseView> base_type;
public:
+ typedef mouse_tracking<BaseView> base_type;
+
template<typename ArgumentPack>
draggable(const ArgumentPack &args)
: base_type(args)
@@ -43,10 +44,14 @@
{ m_drag_origin = origin; }
private:
- void draggable_on_drag(const position_type &position)
+ void call_draggable_on_drag(const position_type &position)
{
static_cast<Derived *>(this)->draggable_on_drag(position);
}
+ void call_draggable_on_end_drag(const position_type &position)
+ {
+ static_cast<Derived *>(this)->draggable_on_end_drag(position);
+ }
friend struct detail::draggable_static_visitor<Derived,BaseView>;
Modified: sandbox/guigl/boost/guigl/view/impl/draggable.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/view/impl/draggable.hpp (original)
+++ sandbox/guigl/boost/guigl/view/impl/draggable.hpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -40,15 +40,17 @@
if(event_info.direction == direction::down)
{
m_draggable.m_drag_origin = m_draggable.mouse_state().get().position;
- m_draggable.draggable_on_drag(m_draggable.mouse_state().get().position);
+ m_draggable.call_draggable_on_drag(m_draggable.mouse_state().get().position);
}
+ else
+ m_draggable.call_draggable_on_end_drag(m_draggable.mouse_state().get().position);
return true;
}
bool operator()(const movement_event &event_info) const
{
if(m_draggable.mouse_state().get().button_down)
- m_draggable.draggable_on_drag(event_info.position);
+ m_draggable.call_draggable_on_drag(event_info.position);
return true;
}
Modified: sandbox/guigl/boost/guigl/view/impl/navigable.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/view/impl/navigable.hpp (original)
+++ sandbox/guigl/boost/guigl/view/impl/navigable.hpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -23,7 +23,7 @@
glPushMatrix();
glRotated(m_angle.x, 0, 1, 0);
glRotated(m_angle.y, 1, 0, 0);
- glTranslatef(0, 0, -500);
+ glTranslatef(0, 0, -m_distance);
}
template<typename BaseView>
Added: sandbox/guigl/boost/guigl/view/impl/periodic.hpp
==============================================================================
--- (empty file)
+++ sandbox/guigl/boost/guigl/view/impl/periodic.hpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -0,0 +1,19 @@
+/*=================================---------------------------------------------
+ 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__IMPL__PERIODIC_HPP
+#define BOOST__GUIGL__VIEW__IMPL__PERIODIC_HPP
+
+#include <boost/guigl/view/periodic.hpp>
+
+namespace boost { namespace guigl { namespace view {
+
+
+}}}
+
+#endif // BOOST__GUIGL__VIEW__IMPL__PERIODIC_HPP
\ No newline at end of file
Modified: sandbox/guigl/boost/guigl/view/labeled.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/view/labeled.hpp (original)
+++ sandbox/guigl/boost/guigl/view/labeled.hpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -10,6 +10,7 @@
#define BOOST__GUIGL__VIEW__LABELED_HPP
#include <boost/guigl/view/base.hpp>
+#include <boost/guigl/window.hpp>
namespace boost { namespace guigl { namespace view {
@@ -27,6 +28,11 @@
const std::string &label() const
{ return m_label; }
+ void set_label(const std::string &label)
+ {
+ m_label = label;
+ guigl::window::redraw(*this);
+ }
protected:
void draw_prologue();
Modified: sandbox/guigl/boost/guigl/view/navigable.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/view/navigable.hpp (original)
+++ sandbox/guigl/boost/guigl/view/navigable.hpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -11,6 +11,7 @@
#include <boost/guigl/view/base.hpp>
#include <boost/guigl/view/draggable.hpp>
+#include <boost/guigl/window.hpp>
namespace boost { namespace guigl { namespace view {
@@ -24,18 +25,29 @@
navigable(const ArgumentPack &args)
: base_type(args)
, m_angle(0,0)
+ , m_distance(500)
{}
+ double distance() const
+ { return m_distance; }
+
+ void set_distance(double distance)
+ {
+ m_distance = distance;
+ guigl::window::redraw(*this);
+ }
protected:
void draw_prologue();
void draw_epilogue();
void draggable_on_drag(const position_type &position);
+ void draggable_on_end_drag(const position_type &position) {};
friend class draggable<navigable<BaseView>, BaseView>;
private:
position_type m_angle;
+ double m_distance;
};
}}}
Added: sandbox/guigl/boost/guigl/view/periodic.hpp
==============================================================================
--- (empty file)
+++ sandbox/guigl/boost/guigl/view/periodic.hpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -0,0 +1,59 @@
+/*=================================---------------------------------------------
+ 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__PERIODIC_HPP
+#define BOOST__GUIGL__VIEW__PERIODIC_HPP
+
+#include <boost/guigl/view/base.hpp>
+#include <boost/guigl/application.hpp>
+#include <boost/bind.hpp>
+
+namespace boost { namespace guigl { namespace view {
+
+template<typename Derived, typename BaseView=base>
+class periodic : public BaseView
+{
+public:
+ typedef BaseView base_type;
+
+ template<typename ArgumentPack>
+ periodic(const ArgumentPack &args)
+ : base_type(args)
+ , m_enabled(false)
+ {
+ if(args[_period]>0)
+ enable(args[_period]);
+ }
+
+ void enable(double seconds)
+ {
+ m_enabled = true;
+ m_milliseconds = seconds * 1000;
+ timer_callback();
+ }
+
+ void disable()
+ {
+ m_enabled = false;
+ }
+private:
+ void timer_callback()
+ {
+ if(m_enabled)
+ {
+ static_cast<Derived *>(this)->periodic_callback();
+ guigl::application::timeout(boost::bind(&periodic::timer_callback, this), m_milliseconds);
+ }
+ }
+ bool m_enabled;
+ unsigned m_milliseconds;
+};
+
+}}}
+
+#endif // BOOST__GUIGL__VIEW__COLORED_HPP
\ No newline at end of file
Added: sandbox/guigl/boost/guigl/widget/label.hpp
==============================================================================
--- (empty file)
+++ sandbox/guigl/boost/guigl/widget/label.hpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -0,0 +1,41 @@
+/*=================================---------------------------------------------
+ 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__LABEL_HPP
+#define BOOST__GUIGL__WIDGET__LABEL_HPP
+
+#include <boost/guigl/view/colored.hpp>
+#include <boost/guigl/view/labeled.hpp>
+#include <boost/guigl/view/solid_background.hpp>
+#include <boost/guigl/view/positioned.hpp>
+
+namespace boost { namespace guigl { namespace widget {
+
+typedef view::labeled<
+ view::colored<
+ view::solid_background<
+ view::positioned<>
+ > > > label_base_type;
+
+class label : public label_base_type
+{
+ typedef label_base_type base_type;
+public:
+ template<typename ArgumentPack>
+ label(const ArgumentPack &args)
+ : base_type(args)
+ {}
+
+protected:
+ void draw();
+ friend class guigl::access;
+};
+
+}}}
+
+#endif // BOOST__GUIGL__WIDGET__LABELED_BUTTON_HPP
\ No newline at end of file
Added: sandbox/guigl/boost/guigl/widget/labeled_slider.hpp
==============================================================================
--- (empty file)
+++ sandbox/guigl/boost/guigl/widget/labeled_slider.hpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -0,0 +1,39 @@
+/*=================================---------------------------------------------
+ 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__LABELED_SLIDER_HPP
+#define BOOST__GUIGL__WIDGET__LABELED_SLIDER_HPP
+
+#include <boost/guigl/view/colored.hpp>
+#include <boost/guigl/view/labeled.hpp>
+#include <boost/guigl/widget/slider.hpp>
+
+namespace boost { namespace guigl { namespace widget {
+
+typedef view::labeled<
+ view::colored<
+ widget::slider
+ > > labeled_slider_base_type;
+
+class labeled_slider : public labeled_slider_base_type
+{
+ typedef labeled_slider_base_type base_type;
+public:
+ template<typename ArgumentPack>
+ labeled_slider(const ArgumentPack &args)
+ : labeled_slider_base_type(args)
+ {}
+
+protected:
+ void draw();
+ friend class guigl::access;
+};
+
+}}}
+
+#endif // BOOST__GUIGL__WIDGET__LABELED_SLIDER_HPP
\ No newline at end of file
Modified: sandbox/guigl/boost/guigl/widget/slider.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/widget/slider.hpp (original)
+++ sandbox/guigl/boost/guigl/widget/slider.hpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -55,6 +55,7 @@
double m_min, m_max, m_step;
void draggable_on_drag(const position_type &position);
+ void draggable_on_end_drag(const position_type &position) {};
friend class view::draggable<slider,
view::solid_background<
Modified: sandbox/guigl/libs/guigl/build/Jamfile
==============================================================================
--- sandbox/guigl/libs/guigl/build/Jamfile (original)
+++ sandbox/guigl/libs/guigl/build/Jamfile 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -17,7 +17,9 @@
SOURCES =
window application
- widget/button widget/labeled_button widget/slider widget/compound ;
+ widget/button widget/labeled_button
+ widget/slider widget/labeled_slider
+ widget/compound widget/label ;
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 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -104,6 +104,8 @@
0885D48F0E53A32300DFFA5D /* test_field_map_compilation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = test_field_map_compilation.hpp; sourceTree = "<group>"; };
0885D4900E53A32300DFFA5D /* test_parameter_compilation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = test_parameter_compilation.hpp; sourceTree = "<group>"; };
0885D4910E53A32300DFFA5D /* test_parameter_dispatch_compilation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = test_parameter_dispatch_compilation.hpp; sourceTree = "<group>"; };
+ 0896AFB40E7FFAF000543446 /* labeled_slider.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = labeled_slider.hpp; sourceTree = "<group>"; };
+ 0896AFB70E7FFB5800543446 /* labeled_slider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = labeled_slider.cpp; sourceTree = "<group>"; };
08978DC70E5D944B00C79062 /* positioned.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = positioned.hpp; sourceTree = "<group>"; };
08978DCA0E5D94A500C79062 /* base.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = base.hpp; sourceTree = "<group>"; };
08978DD60E5D953000C79062 /* compound.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = compound.hpp; sourceTree = "<group>"; };
@@ -131,6 +133,8 @@
089926680E7865B500285958 /* compound.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = compound.hpp; sourceTree = "<group>"; };
0899266B0E78664900285958 /* compound.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = compound.cpp; sourceTree = "<group>"; };
08998DDF0E528C1F00F583A2 /* window.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = window.hpp; sourceTree = "<group>"; };
+ 0899FC770E8059FC00BD5F3E /* label.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = label.hpp; sourceTree = "<group>"; };
+ 0899FC7A0E805A8100BD5F3E /* label.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = label.cpp; sourceTree = "<group>"; };
089B15050E5302870033B2D8 /* test_field_map.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_field_map.cpp; sourceTree = "<group>"; };
089B15410E5304660033B2D8 /* types.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = types.hpp; sourceTree = "<group>"; };
089C813C0E7D814B00CE0901 /* untyped_keyword.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = untyped_keyword.hpp; sourceTree = "<group>"; };
@@ -143,6 +147,8 @@
089E34A60E5BB90900D9AD51 /* typed_keyword.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = typed_keyword.hpp; sourceTree = "<group>"; };
089E34AB0E5C865400D9AD51 /* typed_name.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = typed_name.hpp; sourceTree = "<group>"; };
089E86720E5A80E500DA4902 /* test_parameter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_parameter.cpp; sourceTree = "<group>"; };
+ 089F14D60E7DC87700B91674 /* periodic.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = periodic.hpp; sourceTree = "<group>"; };
+ 089F14D70E7DC88500B91674 /* periodic.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = periodic.hpp; sourceTree = "<group>"; };
08A048C40E77A1B70034FD11 /* navigable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = navigable.hpp; sourceTree = "<group>"; };
08A048CF0E77A2E70034FD11 /* navigable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = navigable.hpp; sourceTree = "<group>"; };
08A13C090E535040008C8A10 /* field_map.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = field_map.hpp; sourceTree = "<group>"; };
@@ -230,6 +236,7 @@
08A048C40E77A1B70034FD11 /* navigable.hpp */,
08DD9E4D0E7B2799008DC46A /* static_base.hpp */,
08ADC1F90E7B62BD00D8CB9D /* static_compound.hpp */,
+ 089F14D60E7DC87700B91674 /* periodic.hpp */,
);
path = view;
sourceTree = "<group>";
@@ -242,6 +249,8 @@
081B06720E5FD90300EF7F91 /* labeled_button.cpp */,
081B07890E5FF8D100EF7F91 /* slider.cpp */,
0899266B0E78664900285958 /* compound.cpp */,
+ 0896AFB70E7FFB5800543446 /* labeled_slider.cpp */,
+ 0899FC7A0E805A8100BD5F3E /* label.cpp */,
);
path = widget;
sourceTree = "<group>";
@@ -262,6 +271,7 @@
08E17F660E76E062008EAE5E /* three_dimensional.hpp */,
08A048CF0E77A2E70034FD11 /* navigable.hpp */,
08ADC1FD0E7B64E100D8CB9D /* static_compound.hpp */,
+ 089F14D70E7DC88500B91674 /* periodic.hpp */,
);
path = impl;
sourceTree = "<group>";
@@ -285,6 +295,8 @@
0897912F0E5DBB0F00C79062 /* labeled_button.hpp */,
081B076E0E5FF2DC00EF7F91 /* slider.hpp */,
089926680E7865B500285958 /* compound.hpp */,
+ 0896AFB40E7FFAF000543446 /* labeled_slider.hpp */,
+ 0899FC770E8059FC00BD5F3E /* label.hpp */,
);
path = widget;
sourceTree = "<group>";
Modified: sandbox/guigl/libs/guigl/example/two_spheres.cpp
==============================================================================
--- sandbox/guigl/libs/guigl/example/two_spheres.cpp (original)
+++ sandbox/guigl/libs/guigl/example/two_spheres.cpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -11,10 +11,13 @@
#include <boost/guigl/view/impl/colored.hpp>
#include <boost/guigl/view/impl/navigable.hpp>
#include <boost/guigl/view/impl/positioned.hpp>
+#include <boost/guigl/view/impl/periodic.hpp>
#include <boost/guigl/view/impl/solid_background.hpp>
#include <boost/guigl/view/impl/three_dimensional.hpp>
#include <boost/guigl/platform/glu.hpp>
+#include <iostream>
+
void two_spheres::draw_prologue()
{
base_type::draw_prologue();
@@ -32,6 +35,13 @@
draw_epilogue();
}
+void two_spheres::periodic_callback()
+{
+ if(distance()<300 || distance()>500)
+ m_closer = distance()>400;
+ set_distance(distance() + 1 - m_closer*2);
+}
+
void *two_spheres::sphere()
{
if(!s_sphere)
Modified: sandbox/guigl/libs/guigl/example/two_spheres.hpp
==============================================================================
--- sandbox/guigl/libs/guigl/example/two_spheres.hpp (original)
+++ sandbox/guigl/libs/guigl/example/two_spheres.hpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -11,17 +11,21 @@
#include <boost/guigl/view/colored.hpp>
#include <boost/guigl/view/positioned.hpp>
+#include <boost/guigl/view/periodic.hpp>
#include <boost/guigl/view/solid_background.hpp>
#include <boost/guigl/view/navigable.hpp>
#include <boost/guigl/view/three_dimensional.hpp>
+class two_spheres;
+
typedef
boost::guigl::view::colored<
boost::guigl::view::navigable<
boost::guigl::view::three_dimensional<
boost::guigl::view::solid_background<
- boost::guigl::view::positioned<>
- > > > > two_spheres_base_type;
+ boost::guigl::view::periodic<two_spheres,
+ boost::guigl::view::positioned<>
+ > > > > > two_spheres_base_type;
class two_spheres : public two_spheres_base_type
{
@@ -30,12 +34,19 @@
template<typename Args>
two_spheres(const Args &args)
: base_type(args)
+ , m_closer(true)
{}
protected:
void draw();
void draw_prologue();
static void *sphere();
static void *s_sphere;
+
+ friend class boost::guigl::view::periodic<two_spheres,
+ boost::guigl::view::positioned<> >;
+
+ void periodic_callback();
+ bool m_closer;
};
#endif // BOOST__GUIGL__EXAMPLE__TWO_SPHERES_HPP
\ No newline at end of file
Modified: sandbox/guigl/libs/guigl/example/window_example.cpp
==============================================================================
--- sandbox/guigl/libs/guigl/example/window_example.cpp (original)
+++ sandbox/guigl/libs/guigl/example/window_example.cpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -11,8 +11,9 @@
#include <boost/guigl/layout/grid.hpp>
#include <boost/guigl/window.hpp>
#include <boost/guigl/widget/button.hpp>
+#include <boost/guigl/widget/label.hpp>
#include <boost/guigl/widget/labeled_button.hpp>
-#include <boost/guigl/widget/slider.hpp>
+#include <boost/guigl/widget/labeled_slider.hpp>
#include <boost/bind.hpp>
#include <boost/bind/placeholders.hpp>
@@ -47,16 +48,23 @@
window test_window2(( _size=size_type(300,100), _label = "window example 2" ));
window test_window3(( _label = "window example 3" ));
+ test_window1 << new widget::label((
+ _label = "Label",
+ _size=size_type(100,30),
+ _background=color_type(1,1,1),
+ _color=color_type(0,0,0) ));
+
widget::labeled_button *b1 = new widget::labeled_button((
_size=size_type(100,30),
_position=position_type(50, 50),
_background=color_type(1,1,1),
_active_color=color_type(1,0,0),
_color=color_type(0,0,0),
- _label="Button 1"));
-
+ _label="Button"));
test_window1 << b1;
- widget::slider *s = new widget::slider((
+
+ widget::labeled_slider *s = new widget::labeled_slider((
+ _label="Slider",
_size=size_type(100,30),
_position=position_type(50,80),
_background=color_type(0.5,0.5,0.5),
@@ -64,6 +72,7 @@
_min=0.1,_max=0.9,
_step=0.1 ));
test_window1 << s;
+
// clicking the button changes the slider value to 0.5
b1->on_click.connect(boost::bind(&widget::slider::set_value, s, 0.5));
@@ -80,7 +89,7 @@
test_window3 << grid_layout.create<widget::button>(( _background=color_type(1.0/i,1.0/i,1.0/i) ));
window test_window_3d(( _depth = true, _label="3D", _color=make_grey(1) ));
- test_window_3d << new two_spheres(default_parameters());
+ test_window_3d << new two_spheres(_period = 0.01);
application::on_idle().connect(&idle);
application::timeout(&timer, 5000);
Added: sandbox/guigl/libs/guigl/src/widget/label.cpp
==============================================================================
--- (empty file)
+++ sandbox/guigl/libs/guigl/src/widget/label.cpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -0,0 +1,21 @@
+/*=================================---------------------------------------------
+ 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/widget/label.hpp>
+#include <boost/guigl/view/impl/colored.hpp>
+#include <boost/guigl/view/impl/labeled.hpp>
+#include <boost/guigl/view/impl/solid_background.hpp>
+#include <boost/guigl/view/impl/positioned.hpp>
+
+
+namespace boost { namespace guigl { namespace widget {
+
+BOOST_GUIGL_WIDGET_DRAW_IMPL(label)
+
+}}}
\ No newline at end of file
Added: sandbox/guigl/libs/guigl/src/widget/labeled_slider.cpp
==============================================================================
--- (empty file)
+++ sandbox/guigl/libs/guigl/src/widget/labeled_slider.cpp 2008-09-17 03:57:42 EDT (Wed, 17 Sep 2008)
@@ -0,0 +1,18 @@
+/*=================================---------------------------------------------
+ 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/widget/labeled_slider.hpp>
+#include <boost/guigl/view/impl/colored.hpp>
+#include <boost/guigl/view/impl/labeled.hpp>
+
+namespace boost { namespace guigl { namespace widget {
+
+BOOST_GUIGL_WIDGET_DRAW_IMPL(labeled_slider)
+
+}}}
\ No newline at end of file
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