Dali 3D User Interface Engine
actor.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 // CLASS HEADER
20 
21 // INTERNAL INCLUDES
27 
34 
35 namespace Dali
36 {
37 
39 {
40 }
41 
43 {
45 
46  return Actor(internal.Get());
47 }
48 
50 {
51  return Actor( dynamic_cast<Dali::Internal::Actor*>(handle.GetObjectPtr()) );
52 }
53 
55 {
56 }
57 
58 Actor::Actor(const Actor& copy)
59 : Handle(copy)
60 {
61 }
62 
64 {
66  return *this;
67 }
68 
69 const std::string& Actor::GetName() const
70 {
71  return GetImplementation(*this).GetName();
72 }
73 
74 void Actor::SetName(const std::string& name)
75 {
76  GetImplementation(*this).SetName(name);
77 }
78 
79 unsigned int Actor::GetId() const
80 {
81  return GetImplementation(*this).GetId();
82 }
83 
84 bool Actor::IsRoot() const
85 {
86  return GetImplementation(*this).IsRoot();
87 }
88 
89 bool Actor::OnStage() const
90 {
91  return GetImplementation(*this).OnStage();
92 }
93 
94 bool Actor::IsLayer() const
95 {
96  return GetImplementation(*this).IsLayer();
97 }
98 
100 {
101  return GetImplementation(*this).GetLayer();
102 }
103 
104 void Actor::Add(Actor actor)
105 {
106  GetImplementation(*this).Add(GetImplementation(actor));
107 }
108 
109 void Actor::Remove(Actor actor)
110 {
112 }
113 
115 {
116  GetImplementation(*this).Unparent();
117 }
118 
119 unsigned int Actor::GetChildCount() const
120 {
121  return GetImplementation(*this).GetChildCount();
122 }
123 
124 Actor Actor::GetChildAt(unsigned int index) const
125 {
126  Internal::ActorPtr child = GetImplementation(*this).GetChildAt( index );
127  return Actor( child.Get() );
128 }
129 
130 Actor Actor::FindChildByName(const std::string& actorName)
131 {
132  Internal::ActorPtr child = GetImplementation(*this).FindChildByName( actorName );
133  return Actor( child.Get() );
134 }
135 
136 Actor Actor::FindChildById(const unsigned int id)
137 {
139  return Actor( child.Get() );
140 }
141 
143 {
144  Internal::Actor* parent = GetImplementation(*this).GetParent();
145 
146  return Actor(parent);
147 }
148 
149 void Actor::SetParentOrigin(const Vector3& origin)
150 {
151  GetImplementation(*this).SetParentOrigin(origin);
152 }
153 
155 {
157 }
158 
159 void Actor::SetAnchorPoint(const Vector3& anchorPoint)
160 {
161  GetImplementation(*this).SetAnchorPoint(anchorPoint);
162 }
163 
165 {
167 }
168 
169 void Actor::SetSize(float width, float height)
170 {
171  GetImplementation(*this).SetSize(width, height);
172 }
173 
174 void Actor::SetSize(float width, float height, float depth)
175 {
176  GetImplementation(*this).SetSize(width, height, depth);
177 }
178 
179 void Actor::SetSize(const Vector2& size)
180 {
181  GetImplementation(*this).SetSize( size );
182 }
183 
184 void Actor::SetSize(const Vector3& size)
185 {
186  GetImplementation(*this).SetSize( size );
187 }
188 
190 {
191  return GetImplementation(*this).GetTargetSize();
192 }
193 
195 {
196  return GetImplementation(*this).GetCurrentSize();
197 }
198 
200 {
201  return GetImplementation(*this).GetNaturalSize();
202 }
203 
204 void Actor::SetPosition(float x, float y)
205 {
206  GetImplementation(*this).SetPosition(x, y);
207 }
208 
209 void Actor::SetPosition(float x, float y, float z)
210 {
211  GetImplementation(*this).SetPosition(x, y, z);
212 }
213 
214 void Actor::SetPosition(const Vector3& position)
215 {
216  GetImplementation(*this).SetPosition(position);
217 }
218 
219 void Actor::SetX(float x)
220 {
221  GetImplementation(*this).SetX(x);
222 }
223 
224 void Actor::SetY(float y)
225 {
226  GetImplementation(*this).SetY(y);
227 }
228 
229 void Actor::SetZ(float z)
230 {
231  GetImplementation(*this).SetZ(z);
232 }
233 
234 void Actor::TranslateBy(const Vector3& distance)
235 {
236  GetImplementation(*this).TranslateBy(distance);
237 }
238 
240 {
241  return GetImplementation(*this).GetCurrentPosition();
242 }
243 
245 {
247 }
248 
250 {
252 }
253 
255 {
257 }
258 
259 void Actor::SetOrientation(const Radian& angle, const Vector3& axis)
260 {
261  GetImplementation(*this).SetOrientation(angle, axis);
262 }
263 
264 void Actor::SetOrientation(const Quaternion& orientation)
265 {
266  GetImplementation(*this).SetOrientation(orientation);
267 }
268 
269 void Actor::RotateBy(const Radian& angle, const Vector3& axis)
270 {
271  GetImplementation(*this).RotateBy(angle, axis);
272 }
273 
274 void Actor::RotateBy(const Quaternion& relativeRotation)
275 {
276  GetImplementation(*this).RotateBy(relativeRotation);
277 }
278 
280 {
282 }
283 
285 {
287 }
288 
290 {
292 }
293 
295 {
297 }
298 
299 void Actor::SetScale(float scale)
300 {
301  GetImplementation(*this).SetScale(scale);
302 }
303 
304 void Actor::SetScale(float scaleX, float scaleY, float scaleZ)
305 {
306  GetImplementation(*this).SetScale(scaleX, scaleY, scaleZ);
307 }
308 
309 void Actor::SetScale(const Vector3& scale)
310 {
311  GetImplementation(*this).SetScale(scale);
312 }
313 
314 void Actor::ScaleBy(const Vector3& relativeScale)
315 {
316  GetImplementation(*this).ScaleBy(relativeScale);
317 }
318 
320 {
321  return GetImplementation(*this).GetCurrentScale();
322 }
323 
325 {
326  return GetImplementation(*this).GetCurrentWorldScale();
327 }
328 
329 void Actor::SetInheritScale( bool inherit )
330 {
331  GetImplementation(*this).SetInheritScale( inherit );
332 }
333 
335 {
336  return GetImplementation(*this).IsScaleInherited();
337 }
338 
340 {
341  GetImplementation(*this).SetSizeModeFactor(factor);
342 }
343 
345 {
346  return GetImplementation(*this).GetSizeModeFactor();
347 }
348 
350 {
352 }
353 
354 void Actor::SetVisible(bool visible)
355 {
356  GetImplementation(*this).SetVisible(visible);
357 }
358 
359 bool Actor::IsVisible() const
360 {
361  return GetImplementation(*this).IsVisible();
362 }
363 
364 void Actor::SetOpacity(float opacity)
365 {
366  GetImplementation(*this).SetOpacity(opacity);
367 }
368 
370 {
371  return GetImplementation(*this).GetCurrentOpacity();
372 }
373 
374 void Actor::SetColor(const Vector4& color)
375 {
376  GetImplementation(*this).SetColor(color);
377 }
378 
380 {
381  return GetImplementation(*this).GetCurrentColor();
382 }
383 
385 {
386  GetImplementation(*this).SetColorMode(colorMode);
387 }
388 
390 {
391  return GetImplementation(*this).GetColorMode();
392 }
393 
395 {
396  return GetImplementation(*this).GetCurrentWorldColor();
397 }
398 
400 {
401  GetImplementation(*this).SetDrawMode( drawMode );
402 }
403 
405 {
406  return GetImplementation(*this).GetDrawMode();
407 }
408 
409 void Actor::SetSensitive(bool sensitive)
410 {
411  GetImplementation(*this).SetSensitive(sensitive);
412 }
413 
414 bool Actor::IsSensitive() const
415 {
416  return GetImplementation(*this).IsSensitive();
417 }
418 
419 bool Actor::ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const
420 {
421  return GetImplementation(*this).ScreenToLocal(localX, localY, screenX, screenY);
422 }
423 
424 void Actor::SetLeaveRequired(bool required)
425 {
426  GetImplementation(*this).SetLeaveRequired(required);
427 }
428 
430 {
431  return GetImplementation(*this).GetLeaveRequired();
432 }
433 
434 void Actor::SetKeyboardFocusable( bool focusable )
435 {
436  GetImplementation(*this).SetKeyboardFocusable(focusable);
437 }
438 
440 {
441  return GetImplementation(*this).IsKeyboardFocusable();
442 }
443 
445 {
446  GetImplementation(*this).SetResizePolicy( policy, dimension );
447 }
448 
450 {
451  return GetImplementation(*this).GetResizePolicy( dimension );
452 }
453 
455 {
456  GetImplementation(*this).SetSizeScalePolicy( policy );
457 }
458 
460 {
461  return GetImplementation(*this).GetSizeScalePolicy();
462 }
463 
465 {
466  return GetImplementation(*this).GetHeightForWidth( width );
467 }
468 
470 {
471  return GetImplementation(*this).GetWidthForHeight( height );
472 }
473 
474 float Actor::GetRelayoutSize( Dimension::Type dimension ) const
475 {
476  return GetImplementation(*this).GetRelayoutSize( dimension );
477 }
478 
479 void Actor::SetPadding( const Padding& padding )
480 {
481  Internal::Actor& impl = GetImplementation(*this);
482 
483  Vector2 widthPadding( padding.left, padding.right );
484  impl.SetPadding( widthPadding, Dimension::WIDTH );
485 
486  Vector2 heightPadding( padding.bottom, padding.top );
487  impl.SetPadding( heightPadding, Dimension::HEIGHT );
488 }
489 
490 void Actor::GetPadding( Padding& paddingOut ) const
491 {
492  const Internal::Actor& impl = GetImplementation(*this);
493 
494  Vector2 widthPadding = impl.GetPadding( Dimension::WIDTH );
495  Vector2 heightPadding = impl.GetPadding( Dimension::HEIGHT );
496 
497  paddingOut.left = widthPadding.x;
498  paddingOut.right = widthPadding.y;
499  paddingOut.bottom = heightPadding.x;
500  paddingOut.top = heightPadding.y;
501 }
502 
503 void Actor::SetMinimumSize( const Vector2& size )
504 {
505  Internal::Actor& impl = GetImplementation(*this);
506 
507  impl.SetMinimumSize( size.x, Dimension::WIDTH );
508  impl.SetMinimumSize( size.y, Dimension::HEIGHT );
509 }
510 
512 {
513  Internal::Actor& impl = GetImplementation(*this);
514 
516 }
517 
518 void Actor::SetMaximumSize( const Vector2& size )
519 {
520  Internal::Actor& impl = GetImplementation(*this);
521 
522  impl.SetMaximumSize( size.x, Dimension::WIDTH );
523  impl.SetMaximumSize( size.y, Dimension::HEIGHT );
524 }
525 
527 {
528  Internal::Actor& impl = GetImplementation(*this);
529 
531 }
532 
534 {
535  return GetImplementation(*this).GetHierarchyDepth();
536 }
537 
539 {
540  return GetImplementation(*this).TouchedSignal();
541 }
542 
544 {
545  return GetImplementation(*this).HoveredSignal();
546 }
547 
549 {
550  return GetImplementation(*this).WheelEventSignal();
551 }
552 
554 {
555  return GetImplementation(*this).OnStageSignal();
556 }
557 
559 {
560  return GetImplementation(*this).OffStageSignal();
561 }
562 
563 unsigned int Actor::AddRenderer( Renderer& renderer )
564 {
565  return GetImplementation(*this).AddRenderer( GetImplementation( renderer ) );
566 }
567 
568 unsigned int Actor::GetRendererCount() const
569 {
570  return GetImplementation(*this).GetRendererCount();
571 }
572 
573 Renderer Actor::GetRendererAt( unsigned int index )
574 {
575  Internal::RendererPtr renderer = GetImplementation(*this).GetRendererAt( index );
576  return Renderer( renderer.Get() );
577 }
578 
580 {
581  GetImplementation(*this).RemoveRenderer( GetImplementation( renderer ) );
582 }
583 
584 void Actor::RemoveRenderer( unsigned int index )
585 {
586  GetImplementation(*this).RemoveRenderer( index );
587 }
588 
590 {
591  return GetImplementation(*this).OnRelayoutSignal();
592 }
593 
595 : Handle(internal)
596 {
597 }
598 
599 } // namespace Dali
Dali Docs Home
Read more about Dali