1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../../css/manpage.css" type="text/css" />
7<title>AppletHomeButtonCallback</title>
8  </head>
9  <body>
10<h1><CODE>nn::applet::CTR::AppletHomeButtonCallback</CODE> Type</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14typedef bool(* nn::applet::CTR::AppletHomeButtonCallback)(uptr arg, bool isActive, nn::applet::CTR::HomeButtonState state);</pre>
15    </div>
16<h2>Description</h2>
17    <div class="section">
18<p>The type of the callback function invoked when HOME is pressed.</p><!-- write here --><P>
19The callback is called when a HOME Button press is detected.
20</P><P>
21Use the <CODE><a href="../../../nn/applet/CTR/SetHomeButtonCallback.html">nn::applet::CTR::SetHomeButtonCallback</a></CODE> function to set the callback.
22</P><P>The value specified in <span class="argument">arg</span> is passed as-is when setting the callback. Use as appropriate.
23</P><P>The <span class="argument">isActive</span> argument specifies whether the application is active. A value of <CODE>true</CODE> means the application is active.
24</P><P>The <span class="argument">state</span> argument specifies the HOME Button state. This is similar to the value obtained by calling the <CODE><a href="../../../nn/applet/CTR/GetHomeButtonState.html">nn::applet::CTR::GetHomeButtonState</a></CODE> function.
25</P><P>
26The return value determines whether to enable detection of HOME Button presses. A return value of <CODE>false</CODE> disables HOME Button detection. The return value should generally be the same as for <span class="argument">isActive</span>.
27</P><P>
28Use as shown in the example below.
29</P><PRE>
30  Example
31  bool myHomeButtonCallback( uptr arg, bool isActive, applet::HomeButtonState state )
32  {
33      NN_UNUSED_VAR(arg);
34      if ( isActive )
35      {
36          if ( state == applet::HOME_BUTTON_SINGLE_PRESSED )
37          {
38             NN_LOG(&quot;HOME BUTTON is clicked.\n&quot;);
39          }
40          else
41          {
42             NN_LOG(&quot;HOME BUTTON is double-clicked.\n&quot;);
43          }
44          return true;
45      }
46      else
47      {
48          return false;
49      }
50  }
51  nnMain()
52  {
53      applet::SetHomeButtonCallback( myHomeButtonCallback, 0 );
5455  }
56</PRE></div>
57<h2>Revision History</h2>
58    <div class="section">
59      <dl class="history">
60        <dt>2010/12/01</dt>
61<dd>Added details.
62        </dd>
63        <dt>2010/11/10</dt>
64<dd>Initial version.<br />
65        </dd>
66      </dl>
67    </div>
68  <hr><p>CONFIDENTIAL</p></body>
69</html>
70