Commit 9ece25b3a03c7f83d922c46a9004bd4fa8fb9443
Committed by
Paul Wisbey
1 parent
c99d36a5
Emojis Example
Change-Id: I1d3e62c1ad548c1c81b4c8dab2246c22a68249aa Signed-off-by: Richard Underhill <r.underhill@partner.samsung.com>
Showing
8 changed files
with
650 additions
and
1 deletions
com.samsung.dali-demo.xml
| @@ -76,7 +76,9 @@ | @@ -76,7 +76,9 @@ | ||
| 76 | <ui-application appid="text-label-multi-language.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-label-multi-language.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 76 | <ui-application appid="text-label-multi-language.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-label-multi-language.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 77 | <label>Multi-language Text Label</label> | 77 | <label>Multi-language Text Label</label> |
| 78 | </ui-application> | 78 | </ui-application> |
| 79 | - | 79 | + <ui-application appid="text-label-emojis.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-label-emojis.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 80 | + <label>Emojis Text Label</label> | ||
| 81 | + </ui-application> | ||
| 80 | <ui-application appid="logging.example" exec="/usr/apps/com.samsung.dali-demo/bin/logging.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 82 | <ui-application appid="logging.example" exec="/usr/apps/com.samsung.dali-demo/bin/logging.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 81 | <label>Logging</label> | 83 | <label>Logging</label> |
| 82 | </ui-application> | 84 | </ui-application> |
demo/dali-demo.cpp
| @@ -49,6 +49,7 @@ int main(int argc, char **argv) | @@ -49,6 +49,7 @@ int main(int argc, char **argv) | ||
| 49 | demo.AddExample(Example("image-scaling-irregular-grid.example", DALI_DEMO_STR_TITLE_IMAGE_SCALING)); | 49 | demo.AddExample(Example("image-scaling-irregular-grid.example", DALI_DEMO_STR_TITLE_IMAGE_SCALING)); |
| 50 | demo.AddExample(Example("text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL)); | 50 | demo.AddExample(Example("text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL)); |
| 51 | demo.AddExample(Example("text-label-multi-language.example", DALI_DEMO_STR_TITLE_TEXT_LABEL)/*TODO - new string*/); | 51 | demo.AddExample(Example("text-label-multi-language.example", DALI_DEMO_STR_TITLE_TEXT_LABEL)/*TODO - new string*/); |
| 52 | + demo.AddExample(Example("text-label-emojis.example", "Emoji Text")/*TODO - new string*/); | ||
| 52 | demo.AddExample(Example("animated-shapes.example", "Animated Shapes")); | 53 | demo.AddExample(Example("animated-shapes.example", "Animated Shapes")); |
| 53 | demo.AddExample(Example("path-animation.example", "Path Animation")); | 54 | demo.AddExample(Example("path-animation.example", "Path Animation")); |
| 54 | app.MainLoop(); | 55 | app.MainLoop(); |
examples/text-label-emojis/emoji-strings.h
0 → 100644
| 1 | +#ifndef __DALI_DEMO_EMOJI_STRINGS_H__ | ||
| 2 | +#define __DALI_DEMO_EMOJI_STRINGS_H__ | ||
| 3 | + | ||
| 4 | +/* | ||
| 5 | + * Copyright (c) 2015 Samsung Electronics Co., Ltd. | ||
| 6 | + * | ||
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 8 | + * you may not use this file except in compliance with the License. | ||
| 9 | + * You may obtain a copy of the License at | ||
| 10 | + * | ||
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 12 | + * | ||
| 13 | + * Unless required by applicable law or agreed to in writing, software | ||
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 16 | + * See the License for the specific language governing permissions and | ||
| 17 | + * limitations under the License. | ||
| 18 | + * | ||
| 19 | + */ | ||
| 20 | + | ||
| 21 | +// EXTERNAL INCLUDES | ||
| 22 | +#include <string> | ||
| 23 | + | ||
| 24 | +namespace EmojiStrings | ||
| 25 | +{ | ||
| 26 | + struct Emoji | ||
| 27 | + { | ||
| 28 | + uint32_t mUnicode; | ||
| 29 | + std::string mUTF8; | ||
| 30 | + std::string mDescription; | ||
| 31 | + }; | ||
| 32 | + | ||
| 33 | + const Emoji EMOJIS[] = { | ||
| 34 | + | ||
| 35 | + { 0x1F601,"\xF0\x9F\x98\x81","grinning face with smiling eyes" }, | ||
| 36 | + { 0x1F602,"\xF0\x9F\x98\x82","face with tears of joy" }, | ||
| 37 | + //{ 0x1F603,"\xF0\x9F\x98\x83","smiling face with open mouth" }, | ||
| 38 | + //{ 0x1F604,"\xF0\x9F\x98\x84","smiling face with open mouth and smiling eyes" }, | ||
| 39 | + { 0x1F605,"\xF0\x9F\x98\x85","smiling face with open mouth and cold sweat" }, | ||
| 40 | + //{ 0x1F606,"\xF0\x9F\x98\x86","smiling face with open mouth and tightly-closed eyes" }, | ||
| 41 | + { 0x1F609,"\xF0\x9F\x98\x89","winking face" }, | ||
| 42 | + { 0x1F60A,"\xF0\x9F\x98\x8A","smiling face with smiling eyes" }, | ||
| 43 | + { 0x1F60B,"\xF0\x9F\x98\x8B","face savouring delicious food" }, | ||
| 44 | + { 0x1F60C,"\xF0\x9F\x98\x8C","relieved face" }, | ||
| 45 | + { 0x1F60D,"\xF0\x9F\x98\x8D","smiling face with heart-shaped eyes" }, | ||
| 46 | + { 0x1F60F,"\xF0\x9F\x98\x8F","smirking face" }, | ||
| 47 | + //{ 0x1F612,"\xF0\x9F\x98\x92","unamused face" }, | ||
| 48 | + //{ 0x1F613,"\xF0\x9F\x98\x93","face with cold sweat" }, | ||
| 49 | + //{ 0x1F614,"\xF0\x9F\x98\x94","pensive face" }, | ||
| 50 | + //{ 0x1F616,"\xF0\x9F\x98\x96","confounded face" }, | ||
| 51 | + { 0x1F618,"\xF0\x9F\x98\x98","face throwing a kiss" }, | ||
| 52 | + { 0x1F61A,"\xF0\x9F\x98\x9A","kissing face with closed eyes" }, | ||
| 53 | + //{ 0x1F61C,"\xF0\x9F\x98\x9C","face with stuck-out tongue and winking eye" }, | ||
| 54 | + //{ 0x1F61D,"\xF0\x9F\x98\x9D","face with stuck-out tongue and tightly-closed eyes" }, | ||
| 55 | + //{ 0x1F61E,"\xF0\x9F\x98\x9E","disappointed face" }, | ||
| 56 | + { 0x1F620,"\xF0\x9F\x98\xA0","angry face" }, | ||
| 57 | + | ||
| 58 | + /* | ||
| 59 | + { "POUTING FACE", | ||
| 60 | + { "CRYING FACE", | ||
| 61 | + { "PERSEVERING FACE", | ||
| 62 | + { "FACE WITH LOOK OF TRIUMPH", | ||
| 63 | + { "DISAPPOINTED BUT RELIEVED FACE", | ||
| 64 | + { "FEARFUL FACE", | ||
| 65 | + { "WEARY FACE", | ||
| 66 | + { "SLEEPY FACE", | ||
| 67 | + { "TIRED FACE", | ||
| 68 | + { "LOUDLY CRYING FACE", | ||
| 69 | + { "FACE WITH OPEN MOUTH AND COLD SWEAT", | ||
| 70 | + { "FACE SCREAMING IN FEAR", | ||
| 71 | + { "ASTONISHED FACE", | ||
| 72 | + { "FLUSHED FACE", | ||
| 73 | + { "DIZZY FACE", | ||
| 74 | + { "FACE WITH MEDICAL MASK", | ||
| 75 | + { "GRINNING CAT FACE WITH SMILING EYES", | ||
| 76 | + { "CAT FACE WITH TEARS OF JOY", | ||
| 77 | + { "SMILING CAT FACE WITH OPEN MOUTH", | ||
| 78 | + { "SMILING CAT FACE WITH HEART-SHAPED EYES", | ||
| 79 | + { "CAT FACE WITH WRY SMILE", | ||
| 80 | + { "KISSING CAT FACE WITH CLOSED EYES", | ||
| 81 | + { "POUTING CAT FACE", | ||
| 82 | + { "CRYING CAT FACE", | ||
| 83 | + { "WEARY CAT FACE", | ||
| 84 | + { "FACE WITH NO GOOD GESTURE", | ||
| 85 | + { "FACE WITH OK GESTURE", | ||
| 86 | + { "PERSON BOWING DEEPLY", | ||
| 87 | + { "SEE-NO-EVIL MONKEY", | ||
| 88 | + { "HEAR-NO-EVIL MONKEY", | ||
| 89 | + { "SPEAK-NO-EVIL MONKEY", | ||
| 90 | + { "HAPPY PERSON RAISING ONE HAND", | ||
| 91 | + { "PERSON RAISING BOTH HANDS IN CELEBRATION", | ||
| 92 | + { "PERSON FROWNING", | ||
| 93 | + { "PERSON WITH POUTING FACE", | ||
| 94 | + { "PERSON WITH FOLDED HANDS", | ||
| 95 | + */ | ||
| 96 | + | ||
| 97 | + }; | ||
| 98 | + | ||
| 99 | + const unsigned int NUMBER_OF_EMOJIS = 12; | ||
| 100 | + | ||
| 101 | +} // EmojiStrings | ||
| 102 | + | ||
| 103 | +#endif // __DALI_DEMO_EMOJI_STRINGS_H__ |
examples/text-label-emojis/text-label-emojis.cpp
0 → 100644
| 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 | +// INTERNAL INCLUDES | ||
| 19 | + | ||
| 20 | +#include "vertical-layout.h" | ||
| 21 | +#include "emoji-strings.h" | ||
| 22 | + | ||
| 23 | +// EXTERNAL INCLUDES | ||
| 24 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 25 | +#include <dali/public-api/text-abstraction/text-abstraction.h> | ||
| 26 | +#include <iostream> | ||
| 27 | + | ||
| 28 | +using namespace Dali; | ||
| 29 | +using namespace Dali::Toolkit; | ||
| 30 | +using namespace EmojiStrings; | ||
| 31 | + | ||
| 32 | + // TODO Need to expose Text::RENDER..... | ||
| 33 | +const int ATLAS_RENDERER = 0; | ||
| 34 | + | ||
| 35 | +// This example shows how to create and display Hello World! using a simple TextActor | ||
| 36 | +// | ||
| 37 | +class EmojiExample : public ConnectionTracker | ||
| 38 | +{ | ||
| 39 | +public: | ||
| 40 | + | ||
| 41 | + typedef uint32_t SizeType; | ||
| 42 | + | ||
| 43 | + EmojiExample( Application& application ) | ||
| 44 | + : mApplication( application ) | ||
| 45 | + { | ||
| 46 | + std::cout << "EmoticonController::EmoticonController" << std::endl; | ||
| 47 | + | ||
| 48 | + // Connect to the Application's Init signal | ||
| 49 | + mApplication.InitSignal().Connect( this, &EmojiExample::Create ); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + ~EmojiExample() | ||
| 53 | + { | ||
| 54 | + // Nothing to do here; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + // The Init signal is received once (only) during the Application lifetime | ||
| 58 | + void Create( Application& application ) | ||
| 59 | + { | ||
| 60 | + | ||
| 61 | + mLayout = VerticalLayout::New(); | ||
| 62 | + mLayout.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 63 | + mLayout.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 64 | + Stage stage = Stage::GetCurrent(); | ||
| 65 | + stage.Add( mLayout ); | ||
| 66 | + stage.KeyEventSignal().Connect(this, &EmojiExample::OnKeyEvent); | ||
| 67 | + | ||
| 68 | + for( unsigned int index = 0u; index < NUMBER_OF_EMOJIS; ++index ) | ||
| 69 | + { | ||
| 70 | + const Emoji& emoji = EMOJIS[index]; | ||
| 71 | + const std::string text = emoji.mUTF8 + " " + emoji.mDescription; | ||
| 72 | + TextLabel label = TextLabel::New(); | ||
| 73 | + label.SetParentOrigin( ParentOrigin::TOP_CENTER ); | ||
| 74 | + label.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | ||
| 75 | + label.SetProperty( TextLabel::Property::MULTI_LINE, true ); | ||
| 76 | + label.SetProperty( TextLabel::Property::RENDERING_BACKEND, 0 ); | ||
| 77 | + label.SetProperty( TextLabel::Property::TEXT, text ); | ||
| 78 | + mLayout.AddLabel( label ); | ||
| 79 | + mLayout.TouchedSignal().Connect( this, &EmojiExample::OnTouchEvent ); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + const Vector2& size = stage.GetSize(); | ||
| 83 | + const float height = mLayout.GetHeightForWidth( size.width ); | ||
| 84 | + mLayout.SetSize( Size( size.width, height ) ); | ||
| 85 | + mLayout.TouchedSignal().Connect( this, &EmojiExample::OnTouchEvent ); | ||
| 86 | + | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + bool OnTouchEvent( Actor actor, const TouchEvent& event ) | ||
| 90 | + { | ||
| 91 | + if( 1u == event.GetPointCount() ) | ||
| 92 | + { | ||
| 93 | + const TouchPoint::State state = event.GetPoint(0u).state; | ||
| 94 | + | ||
| 95 | + // Clamp to integer values; this is to reduce flicking due to pixel misalignment | ||
| 96 | + const float localPoint = static_cast<float>( static_cast<int>( event.GetPoint( 0 ).local.y ) ); | ||
| 97 | + | ||
| 98 | + if( TouchPoint::Down == state ) | ||
| 99 | + { | ||
| 100 | + mLastPoint = localPoint; | ||
| 101 | + mAnimation = Animation::New( 0.25f ); | ||
| 102 | + } | ||
| 103 | + else if( TouchPoint::Motion == state ) | ||
| 104 | + { | ||
| 105 | + if( mAnimation ) | ||
| 106 | + { | ||
| 107 | + mAnimation.MoveBy( mLayout, Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunctions::Linear ); | ||
| 108 | + mAnimation.Play(); | ||
| 109 | + mLastPoint = localPoint; | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + return true; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * Main key event handler | ||
| 119 | + */ | ||
| 120 | + void OnKeyEvent(const KeyEvent& event) | ||
| 121 | + { | ||
| 122 | + if(event.state == KeyEvent::Down) | ||
| 123 | + { | ||
| 124 | + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) | ||
| 125 | + { | ||
| 126 | + mApplication.Quit(); | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + | ||
| 132 | +private: | ||
| 133 | + Application& mApplication; | ||
| 134 | + VerticalLayout mLayout; | ||
| 135 | + Animation mAnimation; | ||
| 136 | + float mLastPoint; | ||
| 137 | +}; | ||
| 138 | + | ||
| 139 | +void RunTest( Application& application ) | ||
| 140 | +{ | ||
| 141 | + EmojiExample test( application ); | ||
| 142 | + | ||
| 143 | + application.MainLoop(); | ||
| 144 | +} | ||
| 145 | + | ||
| 146 | +// Entry point for Linux & SLP applications | ||
| 147 | +// | ||
| 148 | +int main( int argc, char **argv ) | ||
| 149 | +{ | ||
| 150 | + Application application = Application::New( &argc, &argv ); | ||
| 151 | + | ||
| 152 | + RunTest( application ); | ||
| 153 | + | ||
| 154 | + return 0; | ||
| 155 | +} |
examples/text-label-emojis/vertical-layout-impl.cpp
0 → 100644
| 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 | ||
| 19 | +#include "vertical-layout-impl.h" | ||
| 20 | + | ||
| 21 | +// INTERNAL INCLUDES | ||
| 22 | +#include "vertical-layout.h" | ||
| 23 | + | ||
| 24 | +namespace Dali | ||
| 25 | +{ | ||
| 26 | + | ||
| 27 | +namespace Toolkit | ||
| 28 | +{ | ||
| 29 | + | ||
| 30 | +namespace Internal | ||
| 31 | +{ | ||
| 32 | + | ||
| 33 | +Toolkit::VerticalLayout VerticalLayout::New() | ||
| 34 | +{ | ||
| 35 | + // Create the implementation, temporarily owned by this handle on stack | ||
| 36 | + IntrusivePtr< VerticalLayout > impl = new VerticalLayout(); | ||
| 37 | + | ||
| 38 | + // Pass ownership to CustomActor handle | ||
| 39 | + Toolkit::VerticalLayout handle( *impl ); | ||
| 40 | + | ||
| 41 | + // Second-phase init of the implementation | ||
| 42 | + // This can only be done after the CustomActor connection has been made... | ||
| 43 | + impl->Initialize(); | ||
| 44 | + | ||
| 45 | + return handle; | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +VerticalLayout::VerticalLayout() | ||
| 49 | +: Control( ControlBehaviour( CONTROL_BEHAVIOUR_NONE ) ) | ||
| 50 | +{ | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +VerticalLayout::~VerticalLayout() | ||
| 54 | +{ | ||
| 55 | +} | ||
| 56 | + | ||
| 57 | +void VerticalLayout::OnInitialize() | ||
| 58 | +{ | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +Vector3 VerticalLayout::GetNaturalSize() | ||
| 62 | +{ | ||
| 63 | + Vector3 size = Vector3::ZERO; | ||
| 64 | + | ||
| 65 | + CustomActor self = Self(); | ||
| 66 | + for( unsigned int index = 0u, count = self.GetChildCount(); index < count; ++index ) | ||
| 67 | + { | ||
| 68 | + Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( self.GetChildAt( index ) ); | ||
| 69 | + | ||
| 70 | + if( label ) | ||
| 71 | + { | ||
| 72 | + Vector3 labelSize = label.GetNaturalSize(); | ||
| 73 | + | ||
| 74 | + size.width = ( labelSize.width > size.width ) ? labelSize.width : size.width; | ||
| 75 | + size.height += labelSize.height; | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + return size; | ||
| 80 | +} | ||
| 81 | + | ||
| 82 | +float VerticalLayout::GetHeightForWidth( float width ) | ||
| 83 | +{ | ||
| 84 | + float height = 0.f; | ||
| 85 | + | ||
| 86 | + CustomActor self = Self(); | ||
| 87 | + for( unsigned int index = 0u, count = self.GetChildCount(); index < count; ++index ) | ||
| 88 | + { | ||
| 89 | + Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( self.GetChildAt( index ) ); | ||
| 90 | + | ||
| 91 | + if( label ) | ||
| 92 | + { | ||
| 93 | + height += label.GetHeightForWidth( width ); | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + return height; | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +float VerticalLayout::GetWidthForHeight( float height ) | ||
| 101 | +{ | ||
| 102 | + return 0.f; | ||
| 103 | +} | ||
| 104 | + | ||
| 105 | +void VerticalLayout::OnFontChange( bool defaultFontChange, bool defaultFontSizeChange ) | ||
| 106 | +{ | ||
| 107 | +} | ||
| 108 | + | ||
| 109 | +void VerticalLayout::OnRelayout( const Vector2& size, ActorSizeContainer& container ) | ||
| 110 | +{ | ||
| 111 | + CustomActor self = Self(); | ||
| 112 | + | ||
| 113 | + Vector3 position; | ||
| 114 | + for( unsigned int index = 0u, count = self.GetChildCount(); index < count; ++index ) | ||
| 115 | + { | ||
| 116 | + Size childSize = size; | ||
| 117 | + Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( self.GetChildAt( index ) ); | ||
| 118 | + | ||
| 119 | + if( label ) | ||
| 120 | + { | ||
| 121 | + label.SetPosition( position ); | ||
| 122 | + | ||
| 123 | + childSize.height = label.GetHeightForWidth( size.width ); | ||
| 124 | + position.height += childSize.height; | ||
| 125 | + | ||
| 126 | + label.SetSize( childSize ); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + container.push_back( ActorSizePair( label, childSize ) ); | ||
| 130 | + } | ||
| 131 | +} | ||
| 132 | + | ||
| 133 | +void VerticalLayout::AddLabel( Toolkit::TextLabel label ) | ||
| 134 | +{ | ||
| 135 | + Self().Add( label ); | ||
| 136 | + | ||
| 137 | + RelayoutRequest(); | ||
| 138 | +} | ||
| 139 | + | ||
| 140 | +} // namespace Internal | ||
| 141 | + | ||
| 142 | +} // namespace Toolkit | ||
| 143 | + | ||
| 144 | +} // namespace Dali |
examples/text-label-emojis/vertical-layout-impl.h
0 → 100644
| 1 | +#ifndef __DALI_DEMO_VERTICAL_LAYOUT_IMPL_H__ | ||
| 2 | +#define __DALI_DEMO_VERTICAL_LAYOUT_IMPL_H__ | ||
| 3 | + | ||
| 4 | +/* | ||
| 5 | + * Copyright (c) 2015 Samsung Electronics Co., Ltd. | ||
| 6 | + * | ||
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 8 | + * you may not use this file except in compliance with the License. | ||
| 9 | + * You may obtain a copy of the License at | ||
| 10 | + * | ||
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 12 | + * | ||
| 13 | + * Unless required by applicable law or agreed to in writing, software | ||
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 16 | + * See the License for the specific language governing permissions and | ||
| 17 | + * limitations under the License. | ||
| 18 | + * | ||
| 19 | + */ | ||
| 20 | + | ||
| 21 | +// INTERNAL INCLUDES | ||
| 22 | +#include "vertical-layout.h" | ||
| 23 | + | ||
| 24 | +namespace Dali | ||
| 25 | +{ | ||
| 26 | + | ||
| 27 | +namespace Toolkit | ||
| 28 | +{ | ||
| 29 | + | ||
| 30 | +namespace Internal | ||
| 31 | +{ | ||
| 32 | + | ||
| 33 | +class VerticalLayout : public Control | ||
| 34 | +{ | ||
| 35 | +public: | ||
| 36 | + /** | ||
| 37 | + * @copydoc Dali::Toollkit::TextLabel::New() | ||
| 38 | + */ | ||
| 39 | + static Toolkit::VerticalLayout New(); | ||
| 40 | + | ||
| 41 | + VerticalLayout(); | ||
| 42 | + | ||
| 43 | + virtual ~VerticalLayout(); | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * @copydoc Control::OnInitialize() | ||
| 47 | + */ | ||
| 48 | + virtual void OnInitialize(); | ||
| 49 | + | ||
| 50 | + // Size negotiation methods inherited from Internal::Control | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * @copydoc Control::GetNaturalSize() | ||
| 54 | + */ | ||
| 55 | + virtual Vector3 GetNaturalSize(); | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * @copydoc Control::GetHeightForWidth() | ||
| 59 | + */ | ||
| 60 | + virtual float GetHeightForWidth( float width ); | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * @copydoc Control::GetWidthForHeight() | ||
| 64 | + */ | ||
| 65 | + virtual float GetWidthForHeight( float height ); | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * @copydoc Control::OnFontChange() | ||
| 69 | + */ | ||
| 70 | + virtual void OnFontChange( bool defaultFontChange, bool defaultFontSizeChange ); | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * @copydoc Control::OnRelayout() | ||
| 74 | + */ | ||
| 75 | + virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container ); | ||
| 76 | + | ||
| 77 | + void AddLabel( Toolkit::TextLabel label ); | ||
| 78 | + | ||
| 79 | +private: | ||
| 80 | + // Undefined copy constructor and assignment operators | ||
| 81 | + VerticalLayout(const VerticalLayout&); | ||
| 82 | + VerticalLayout& operator=(const VerticalLayout& rhs); | ||
| 83 | +}; | ||
| 84 | + | ||
| 85 | +} // namespace Internal | ||
| 86 | + | ||
| 87 | +} // namespace Toolkit | ||
| 88 | + | ||
| 89 | +} // namespace Dali | ||
| 90 | + | ||
| 91 | +#endif // __DALI_DEMO_VERTICAL_LAYOUT_IMPL_H__ |
examples/text-label-emojis/vertical-layout.cpp
0 → 100644
| 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 | ||
| 19 | +#include "vertical-layout.h" | ||
| 20 | + | ||
| 21 | +// INTERNAL INCLUDES | ||
| 22 | +#include "vertical-layout-impl.h" | ||
| 23 | + | ||
| 24 | +namespace Dali | ||
| 25 | +{ | ||
| 26 | + | ||
| 27 | +namespace Toolkit | ||
| 28 | +{ | ||
| 29 | + | ||
| 30 | +VerticalLayout VerticalLayout::New() | ||
| 31 | +{ | ||
| 32 | + return Internal::VerticalLayout::New(); | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +VerticalLayout::VerticalLayout() | ||
| 36 | +{ | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +VerticalLayout::VerticalLayout( const VerticalLayout& handle ) | ||
| 40 | +: Control( handle ) | ||
| 41 | +{ | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +VerticalLayout& VerticalLayout::operator=( const VerticalLayout& handle ) | ||
| 45 | +{ | ||
| 46 | + if( &handle != this ) | ||
| 47 | + { | ||
| 48 | + Control::operator=( handle ); | ||
| 49 | + } | ||
| 50 | + return *this; | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +VerticalLayout VerticalLayout::DownCast( BaseHandle handle ) | ||
| 54 | +{ | ||
| 55 | + return Control::DownCast<VerticalLayout, Internal::VerticalLayout>( handle ); | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | +VerticalLayout::~VerticalLayout() | ||
| 59 | +{ | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +VerticalLayout::VerticalLayout( Internal::VerticalLayout& internal ) | ||
| 63 | +: Control( internal ) | ||
| 64 | +{ | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +VerticalLayout::VerticalLayout( Dali::Internal::CustomActor* internal ) | ||
| 68 | +: Control( internal ) | ||
| 69 | +{ | ||
| 70 | +} | ||
| 71 | + | ||
| 72 | +void VerticalLayout::AddLabel( TextLabel label ) | ||
| 73 | +{ | ||
| 74 | + GetImpl( *this ).AddLabel( label ); | ||
| 75 | +} | ||
| 76 | + | ||
| 77 | +Internal::VerticalLayout& VerticalLayout::GetImpl( VerticalLayout& verticalLayout ) | ||
| 78 | +{ | ||
| 79 | + DALI_ASSERT_ALWAYS( verticalLayout ); | ||
| 80 | + | ||
| 81 | + Dali::RefObject& handle = verticalLayout.GetImplementation(); | ||
| 82 | + | ||
| 83 | + return static_cast<Internal::VerticalLayout&>(handle); | ||
| 84 | +} | ||
| 85 | + | ||
| 86 | +} // namespace Toolkit | ||
| 87 | + | ||
| 88 | +} // namespace Dali |
examples/text-label-emojis/vertical-layout.h
0 → 100644
| 1 | +#ifndef __DALI_DEMO_VERTICAL_LAYOUT_H__ | ||
| 2 | +#define __DALI_DEMO_VERTICAL_LAYOUT_H__ | ||
| 3 | + | ||
| 4 | +/* | ||
| 5 | + * Copyright (c) 2015 Samsung Electronics Co., Ltd. | ||
| 6 | + * | ||
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 8 | + * you may not use this file except in compliance with the License. | ||
| 9 | + * You may obtain a copy of the License at | ||
| 10 | + * | ||
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 12 | + * | ||
| 13 | + * Unless required by applicable law or agreed to in writing, software | ||
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 16 | + * See the License for the specific language governing permissions and | ||
| 17 | + * limitations under the License. | ||
| 18 | + * | ||
| 19 | + */ | ||
| 20 | + | ||
| 21 | +// EXTERNAL INCLUDES | ||
| 22 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 23 | + | ||
| 24 | +namespace Dali | ||
| 25 | +{ | ||
| 26 | + | ||
| 27 | +namespace Toolkit | ||
| 28 | +{ | ||
| 29 | + | ||
| 30 | +namespace Internal | ||
| 31 | +{ | ||
| 32 | +class VerticalLayout; | ||
| 33 | +} // namespace Internal | ||
| 34 | + | ||
| 35 | +class VerticalLayout : public Toolkit::Control | ||
| 36 | +{ | ||
| 37 | +public: | ||
| 38 | + static VerticalLayout New(); | ||
| 39 | + | ||
| 40 | + VerticalLayout(); | ||
| 41 | + | ||
| 42 | + VerticalLayout( const VerticalLayout& handle ); | ||
| 43 | + | ||
| 44 | + VerticalLayout& operator=( const VerticalLayout& handle ); | ||
| 45 | + | ||
| 46 | + ~VerticalLayout(); | ||
| 47 | + | ||
| 48 | + VerticalLayout( Internal::VerticalLayout& internal ); | ||
| 49 | + | ||
| 50 | + explicit VerticalLayout( Dali::Internal::CustomActor* internal ); | ||
| 51 | + | ||
| 52 | + VerticalLayout DownCast( BaseHandle handle ); | ||
| 53 | + | ||
| 54 | + void AddLabel( TextLabel label ); | ||
| 55 | + | ||
| 56 | + Internal::VerticalLayout& GetImpl( VerticalLayout& verticalLayout ); | ||
| 57 | + | ||
| 58 | +private: | ||
| 59 | +}; | ||
| 60 | + | ||
| 61 | +} // namespace Toolkit | ||
| 62 | + | ||
| 63 | +} // namespace Dali | ||
| 64 | + | ||
| 65 | +#endif // __DALI_DEMO_VERTICAL_LAYOUT_H__ |