Use a different image for 'pressed' selection handle
[platform/core/uifw/dali-toolkit.git] / docs / content / programming-guide / boost-function.h
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:
5  \code
6 class TextActor : public RenderableActor
7 {
8 public:
9    ...
10    typedef boost::function<void (TextActor)> TextCallbackType;
11    typedef Signal<TextSignalType, TextCallbackType> TextSignal;
12
13 public:
14      TextSignal SignalTextAvailable();
15     ...
16  }
17  \endcode
18
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.
21
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:
26  \code
27  static float TestSortFunction(const Vector3& position, float sortModifier)
28  {
29    // do something
30  }
31
32  void TestApp::SetRootSort()
33  {
34    Layer root = Stage::GetCurrent().GetLayer( 0 );
35    root.SetSortFunction(TestSortFunction);
36  }
37  \endcode
38  For member functions \b binding needs to be done:
39  \code
40  float TestApp::TestSortFunction(const Vector3& position, float sortModifier)
41  {
42    // do something
43  }
44
45  void TestApp::SetRootSort()
46  {
47    Layer root = Stage::GetCurrent().GetLayer( 0 );
48    root.SetSortFunction(boost::bind(&TestApp::TestSortFunction, this));
49  }
50  \endcode
51  \n\n
52  For more information please see <a href="http://www.boost.org/doc/">the boost project documentation</a>.
53
54  */
55