1 /*! \page boost-function Boost function usage
2 <h2 class="pg">Signal handler functions</h2>
3 boost::function is mostly used to define callback function types in Dali.
4 For example in text-actor.h:
6 class TextActor : public RenderableActor
10 typedef boost::function<void (TextActor)> TextCallbackType;
11 typedef Signal<TextSignalType, TextCallbackType> TextSignal;
14 TextSignal SignalTextAvailable();
19 \p "boost::function<void (TextActor)>" specifies a function type which has no return value and takes \p TextActor as an argument.
20 The application can set a function of this type to be called when the text available signal is emitted.
22 <h2 class="pg">Specifying custom functions (eg. sorting)</h2>
23 Dali::Layer::SetSortFunction() is an example where the developer should use a boost function in order to specify the sorting algorithm.\n
24 This API accepts both standalone functions or class methods.\n
25 Standalone functions can be simply given as:
27 static float TestSortFunction(const Vector3& position, float sortModifier)
32 void TestApp::SetRootSort()
34 Layer root = Stage::GetCurrent().GetLayer( 0 );
35 root.SetSortFunction(TestSortFunction);
38 For member functions \b binding needs to be done:
40 float TestApp::TestSortFunction(const Vector3& position, float sortModifier)
45 void TestApp::SetRootSort()
47 Layer root = Stage::GetCurrent().GetLayer( 0 );
48 root.SetSortFunction(boost::bind(&TestApp::TestSortFunction, this));
52 For more information please see <a href="http://www.boost.org/doc/">the boost project documentation</a>.