197 lines
18 KiB
HTML
197 lines
18 KiB
HTML
<!-- HTML header for doxygen 1.8.8-->
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<!-- For Mobile Devices -->
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta name="generator" content="Doxygen 1.8.12"/>
|
|
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
|
<title>Ewol: Ewol Widget in OpenGl: EWOL: Object model</title>
|
|
<!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
|
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
|
|
<script type="text/javascript" src="doxy-boot.js"></script>
|
|
</head>
|
|
<body>
|
|
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
|
|
<div class="container">
|
|
<div class="navbar-header">
|
|
<a class="navbar-brand">Ewol: Ewol Widget in OpenGl 0.10.0</a>
|
|
</div>
|
|
<div id="navbar" class="navbar-collapse collapse">
|
|
<ul class="nav navbar-nav">
|
|
<li><a href="index.html">Main Page</a></li>
|
|
<li><a href="pages.html">Related Pages</a></li>
|
|
<li><a href="namespaces.html">Namespaces</a></li>
|
|
<li><a href="annotated.html">Classes</a></li>
|
|
<li><a href="files.html">Files</a></li>
|
|
</ul>
|
|
<ul class="nav navbar-nav navbar-right">
|
|
<li class="dropdown">
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
|
|
Link-libs<span class="caret"></span>
|
|
</a>
|
|
<ul class="dropdown-menu">
|
|
<li><a href="http://HeeroYui.github.io/lutin">lutin</a></li>
|
|
<li><a href="http://atria-soft.github.io/ewol">ewol</a></li>
|
|
<li><a href="http://atria-soft.github.io/echrono">echrono</a></li>
|
|
<li><a href="http://atria-soft.github.io/etk">etk</a></li>
|
|
<li><a href="http://atria-soft.github.io/ejson">ejson</a></li>
|
|
<li><a href="http://atria-soft.github.io/exml">exml</a></li>
|
|
<li><a href="http://atria-soft.github.io/esvg">esvg</a></li>
|
|
<li><a href="http://atria-soft.github.io/egami">egami</a></li>
|
|
<li><a href="http://atria-soft.github.io/gale">gale</a></li>
|
|
<li><a href="http://atria-soft.github.io/ege">ege</a></li>
|
|
<li><a href="http://atria-soft.github.io/elog">elog</a></li>
|
|
<li><a href="http://atria-soft.github.io/ememory">ememory</a></li>
|
|
<li><a href="http://atria-soft.github.io/enet">enet</a></li>
|
|
<li><a href="http://atria-soft.github.io/eproperty">eproperty</a></li>
|
|
<li><a href="http://atria-soft.github.io/esignal">esignal</a></li>
|
|
<li><a href="http://atria-soft.github.io/etranslate">etranslate</a></li>
|
|
<li><a href="http://atria-soft.github.io/zeus">zeus</a></li>
|
|
<li><a href="http://musicdsp.github.io/audio-ess">audio-ess</a></li>
|
|
<li><a href="http://musicdsp.github.io/audio">audio</a></li>
|
|
<li><a href="http://musicdsp.github.io/audio-drain">audio-drain</a></li>
|
|
<li><a href="http://musicdsp.github.io/audio-orchestra">audio-orchestra</a></li>
|
|
<li><a href="http://musicdsp.github.io/audio-river">audio-river</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div id="search-box" class="input-group">
|
|
<div class="input-group-btn">
|
|
<button aria-expanded="false" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
|
<span class="glyphicon glyphicon-search"></span>
|
|
<span class="caret"></span>
|
|
</button>
|
|
<ul class="dropdown-menu">
|
|
<li><a href="#">All</a></li>
|
|
<li><a href="#">Classes</a></li>
|
|
<li><a href="#">Namespaces</a></li>
|
|
<li><a href="#">Files</a></li>
|
|
<li><a href="#">Functions</a></li>
|
|
<li><a href="#">Variables</a></li>
|
|
<li><a href="#">Typedefs</a></li>
|
|
<li><a href="#">Enumerations</a></li>
|
|
<li><a href="#">Enumerator</a></li>
|
|
<li><a href="#">Friends</a></li>
|
|
<li><a href="#">Macros</a></li>
|
|
<li><a href="#">Pages</a></li>
|
|
</ul>
|
|
</div>
|
|
<button id="search-close" type="button" class="close" aria-label="Close">
|
|
<span aria-hidden="true"></span>
|
|
</button>
|
|
<input id="search-field" class="form-control" accesskey="S" onkeydown="searchBox.OnSearchFieldChange(event);" placeholder="Search ..." type="text">
|
|
</div>
|
|
</div><!--/.nav-collapse -->
|
|
</div>
|
|
</nav>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div class="content" id="content">
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-sm-12 panel panel-default" style="padding-bottom: 15px;">
|
|
<div style="margin-bottom: 15px;margin-top: 60px;">
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.12 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
</script>
|
|
<div id="main-nav"></div>
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">EWOL: Object model </div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="toc"><h3>Table of Contents</h3>
|
|
<ul><li class="level1"><a href="#ewol_tutorial_object_model_objectives">Objectifs: </a></li>
|
|
<li class="level1"><a href="#ewol_tutorial_object_model_object">Basis of the ewol::Object </a></li>
|
|
<li class="level1"><a href="#ewol_tutorial_object_model_create">Create an Object: </a></li>
|
|
<li class="level1"><a href="#ewol_tutorial_object_model_remove">Remove an Object: </a></li>
|
|
<li class="level1"><a href="#ewol_tutorial_object_model_find">Retrieve an Object: </a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="textblock"><h1><a class="anchor" id="ewol_tutorial_object_model_objectives"></a>
|
|
Objectifs: </h1>
|
|
<ul>
|
|
<li>Understand ewol basic <a class="el" href="classewol_1_1_object.html" title="Basic message classes for ewol system this class mermit at every Object to communicate between them...">ewol::Object</a></li>
|
|
<li>Use <a class="el" href="classewol_1_1_object.html" title="Basic message classes for ewol system this class mermit at every Object to communicate between them...">ewol::Object</a> correctly</li>
|
|
</ul>
|
|
<h1><a class="anchor" id="ewol_tutorial_object_model_object"></a>
|
|
Basis of the ewol::Object </h1>
|
|
<p>An object in Ewol is a simple class: <a class="el" href="classewol_1_1_object.html" title="Basic message classes for ewol system this class mermit at every Object to communicate between them...">ewol::Object</a> This object is the basis of all element in the ewol system. This is designed to manage many common things:</p>
|
|
<ul>
|
|
<li>Unique ID</li>
|
|
<li>Name</li>
|
|
<li>Parameters</li>
|
|
<li>Signal generation</li>
|
|
<li>Xml configuration</li>
|
|
<li>Removing</li>
|
|
</ul>
|
|
<p><b>Note:</b></p>
|
|
<div class="fragment"><div class="line">Please do not compare with the gObject basic class...</div></div><!-- fragment --><h1><a class="anchor" id="ewol_tutorial_object_model_create"></a>
|
|
Create an Object: </h1>
|
|
<p>Creating an object is really simple:</p>
|
|
<div class="fragment"><div class="line"><a class="codeRef" doxygen="/home/heero/dev/perso/out/doc/release/ememory.tag:http://atria-soft.github.io/ememory/" href="http://atria-soft.github.io/ememory/classememory_1_1_shared_ptr.html">ewol::widget::ButtonShared</a> tmpButon = ewol::widget::Button::create();</div><div class="line">APPL_INFO(<span class="stringliteral">"We just create a button widget with unique ID="</span> << tmpButon-><a class="code" href="classewol_1_1_object.html#ae11b9bed4b94f3edbb724c8b416a90d4">getId</a>() << <span class="stringliteral">" name='"</span> << tmpButon-><a class="code" href="classewol_1_1_object.html#a61eacd4d36c9cb0d108c2dbcddbdd4dc">propertyName</a>.<a class="codeRef" doxygen="/home/heero/dev/perso/out/doc/release/eproperty.tag:http://atria-soft.github.io/eproperty/" href="http://atria-soft.github.io/eproperty/classeproperty_1_1_property_type.html#aaf54e7f327af57ae5b735c4df8e92d1c">get</a>() << <span class="stringliteral">"'"</span>);</div></div><!-- fragment --><p>Note that all object created are <a class="elRef" doxygen="/home/heero/dev/perso/out/doc/release/ememory.tag:http://atria-soft.github.io/ememory/" href="http://atria-soft.github.io/ememory/classememory_1_1_shared_ptr.html">ememory::SharedPtr</a> base for the current version on std::shared_ptr. We wrapped it because the current inplementation of std::shared_ptr is not thread safe, and we want use a thread-safe version of it.</p>
|
|
<p><b>Note:</b></p>
|
|
<div class="fragment"><div class="line">The widget is not stored in a ememory::SharedPtr<ewol::widget::Button> but in a ewol::widget::ButtonShared to simplify the using of the pointer.</div><div class="line">You have also: ememory::WeakPtr<ewol::widget::Button> = ewol::widget::ButtonWeak</div></div><!-- fragment --><p>Set the name of the object:</p>
|
|
<div class="fragment"><div class="line">tmpButon-><a class="code" href="classewol_1_1_object.html#a61eacd4d36c9cb0d108c2dbcddbdd4dc">propertyName</a>.<a class="codeRef" doxygen="/home/heero/dev/perso/out/doc/release/eproperty.tag:http://atria-soft.github.io/eproperty/" href="http://atria-soft.github.io/eproperty/classeproperty_1_1_property_type.html#a29dd42486e15d92b9ea94d30e99854e1">set</a>(<span class="stringliteral">"my widget name"</span>);</div><div class="line">APPL_INFO(<span class="stringliteral">"We just create an Object with ID="</span> << tmpButon-><a class="code" href="classewol_1_1_object.html#ae11b9bed4b94f3edbb724c8b416a90d4">getId</a>() << <span class="stringliteral">" name='"</span> << tmpButon-><a class="code" href="classewol_1_1_object.html#a61eacd4d36c9cb0d108c2dbcddbdd4dc">propertyName</a>.<a class="codeRef" doxygen="/home/heero/dev/perso/out/doc/release/eproperty.tag:http://atria-soft.github.io/eproperty/" href="http://atria-soft.github.io/eproperty/classeproperty_1_1_property_type.html#aaf54e7f327af57ae5b735c4df8e92d1c">get</a>() << <span class="stringliteral">"'"</span>);</div></div><!-- fragment --><h1><a class="anchor" id="ewol_tutorial_object_model_remove"></a>
|
|
Remove an Object: </h1>
|
|
<p>Simply use the function: </p><div class="fragment"><div class="line">tmpButon-><a class="code" href="classewol_1_1_object.html#a17820bb66bee9d140d0571f9f966f025">destroy</a>();</div></div><!-- fragment --><p>This function request his parrent to remove the <a class="elRef" doxygen="/home/heero/dev/perso/out/doc/release/ememory.tag:http://atria-soft.github.io/ememory/" href="http://atria-soft.github.io/ememory/classememory_1_1_shared_ptr.html">ememory::SharedPtr</a> it keep on it. And when all <a class="elRef" doxygen="/home/heero/dev/perso/out/doc/release/ememory.tag:http://atria-soft.github.io/ememory/" href="http://atria-soft.github.io/ememory/classememory_1_1_shared_ptr.html">ememory::SharedPtr</a> is removed the object will be really removed.</p>
|
|
<p>At his point we can think an object is alive all the time someone keep a reference on it, then when you are not a parrent of the object, do not keep a <a class="elRef" doxygen="/home/heero/dev/perso/out/doc/release/ememory.tag:http://atria-soft.github.io/ememory/" href="http://atria-soft.github.io/ememory/classememory_1_1_shared_ptr.html">ememory::SharedPtr</a> but a <a class="elRef" doxygen="/home/heero/dev/perso/out/doc/release/ememory.tag:http://atria-soft.github.io/ememory/" href="http://atria-soft.github.io/ememory/classememory_1_1_weak_ptr.html">ememory::WeakPtr</a>.</p>
|
|
<p><b>Note:</b></p>
|
|
<div class="fragment"><div class="line">If some Object is not removed when you close the application, the system inform you with displaying all object alive.</div></div><!-- fragment --><h1><a class="anchor" id="ewol_tutorial_object_model_find"></a>
|
|
Retrieve an Object: </h1>
|
|
<p>In Ewol this is possible to get a object with his name.</p>
|
|
<h2>Find a global Object (ouside an Object) </h2>
|
|
<div class="fragment"><div class="line"><span class="preprocessor">#include <<a class="code" href="_context_8hpp.html">ewol/context/Context.hpp</a>></span></div><div class="line"></div><div class="line"><a class="codeRef" doxygen="/home/heero/dev/perso/out/doc/release/ememory.tag:http://atria-soft.github.io/ememory/" href="http://atria-soft.github.io/ememory/classememory_1_1_shared_ptr.html">ewol::ObjectShared</a> tmpObject = <a class="code" href="_context_8hpp.html#a32db0d1e16baf02f1edf72bebd3b90e0">ewol::getContext</a>().getEObjectManager().<a class="code" href="classewol_1_1object_1_1_manager.html#ab22e6735a8dbac7c8f1323c18623f319">getObjectNamed</a>(<span class="stringliteral">"obj Name"</span>);</div><div class="line"><span class="keywordflow">if</span> (tmpObject == <span class="keyword">nullptr</span>) {</div><div class="line"> APPL_ERROR(<span class="stringliteral">"The Object does not exist"</span>);</div><div class="line">}</div></div><!-- fragment --><h2>Find a global Object (inside an Object) </h2>
|
|
<div class="fragment"><div class="line"><a class="codeRef" doxygen="/home/heero/dev/perso/out/doc/release/ememory.tag:http://atria-soft.github.io/ememory/" href="http://atria-soft.github.io/ememory/classememory_1_1_shared_ptr.html">ewol::ObjectShared</a> tmpObject = getObjectNamed(<span class="stringliteral">"obj Name"</span>);</div><div class="line"><span class="keywordflow">if</span> (tmpObject == <span class="keyword">nullptr</span>) {</div><div class="line"> APPL_ERROR(<span class="stringliteral">"The Object does not exist"</span>);</div><div class="line">}</div></div><!-- fragment --><h2>Find a sub-object </h2>
|
|
<div class="fragment"><div class="line"><a class="codeRef" doxygen="/home/heero/dev/perso/out/doc/release/ememory.tag:http://atria-soft.github.io/ememory/" href="http://atria-soft.github.io/ememory/classememory_1_1_shared_ptr.html">ewol::ObjectShared</a> tmpObject = getSubObjectNamed(<span class="stringliteral">"obj Name"</span>);</div><div class="line"><span class="keywordflow">if</span> (tmpObject == NULL) {</div><div class="line"> APPL_ERROR(<span class="stringliteral">"The Object does not exist"</span>);</div><div class="line">}</div></div><!-- fragment --><h2>retriving your object type </h2>
|
|
<p>It could be really interesting to retrive your own instance:</p>
|
|
<div class="fragment"><div class="line"><a class="codeRef" doxygen="/home/heero/dev/perso/out/doc/release/ememory.tag:http://atria-soft.github.io/ememory/" href="http://atria-soft.github.io/ememory/classememory_1_1_shared_ptr.html">ewol::ObjectShared</a> tmpObject ...;</div><div class="line"></div><div class="line">appl::MyOwnObjectShared myObject = std::dynamic_pointer_cast<appl::MyOwnObject>(tmpObject);</div></div><!-- fragment --> </div></div><!-- contents -->
|
|
<!-- HTML footer for doxygen 1.8.8-->
|
|
<!-- start footer part -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Mon Oct 24 2016 15:35:52 for Ewol: Ewol Widget in OpenGl by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.12
|
|
</small></address>
|
|
</body>
|
|
</html>
|