Commit 5b7274876c5e0d0c353dbdf7e2c56899e0183a55

Authored by Paul Wisbey
1 parent d59e1560

TextLabel demo

Change-Id: I6b62f7b114ac959fcec3ab1e9381684c1fad8dff
build/tizen/examples/Makefile.am
... ... @@ -36,7 +36,8 @@ bin_PROGRAMS = \
36 36 builder.example \
37 37 image-scaling-irregular-grid.example \
38 38 buttons.example \
39   - logging.example
  39 + logging.example \
  40 + text-label.example
40 41  
41 42 daliimagedir = $(appdatadir)/images/
42 43 dalimodeldir = $(appdatadir)/models/
... ... @@ -169,3 +170,8 @@ logging_example_SOURCES = $(examples_src_dir)/logging/logging-example.cpp
169 170 logging_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS)
170 171 logging_example_DEPENDENCIES = $(EXAMPLE_DEPS)
171 172 logging_example_LDADD = $(EXAMPLE_LDADD)
  173 +
  174 +text_label_example_SOURCES = $(examples_src_dir)/text/text-label-example.cpp
  175 +text_label_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS)
  176 +text_label_example_DEPENDENCIES = $(EXAMPLE_DEPS)
  177 +text_label_example_LDADD = $(EXAMPLE_LDADD)
... ...
demo/dali-table-view.cpp
... ... @@ -521,6 +521,14 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit
521 521 image.Add( stencil );
522 522 }
523 523  
  524 + TextLabel label = TextLabel::New();
  525 + label.SetParentOrigin( ParentOrigin::TOP_LEFT );
  526 + label.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  527 + label.SetProperty( TextLabel::PROPERTY_MULTI_LINE, true );
  528 + label.SetProperty( TextLabel::PROPERTY_TEXT, title );
  529 + label.SetColor( Color::WHITE );
  530 + content.Add( label );
  531 +
524 532 // Set the tile to be keyboard focusable
525 533 tile.SetKeyboardFocusable(true);
526 534  
... ...
examples/text/text-label-example.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 +/**
  19 + * @file text-label-example.cpp
  20 + * @brief Basic usage of TextLabel control
  21 + */
  22 +
  23 +// EXTERNAL INCLUDES
  24 +#include <dali-toolkit/dali-toolkit.h>
  25 +#include <dali/public-api/text-abstraction/text-abstraction.h>
  26 +
  27 +using namespace Dali;
  28 +using namespace Dali::Toolkit;
  29 +
  30 +/**
  31 + * @brief The main class of the demo.
  32 + */
  33 +class TextLabelExample : public ConnectionTracker
  34 +{
  35 +public:
  36 +
  37 + TextLabelExample( Application& application )
  38 + : mApplication( application )
  39 + {
  40 + // Connect to the Application's Init signal
  41 + mApplication.InitSignal().Connect( this, &TextLabelExample::Create );
  42 + }
  43 +
  44 + ~TextLabelExample()
  45 + {
  46 + // Nothing to do here.
  47 + }
  48 +
  49 + /**
  50 + * One-time setup in response to Application InitSignal.
  51 + */
  52 + void Create( Application& application )
  53 + {
  54 + Stage stage = Stage::GetCurrent();
  55 +
  56 + TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
  57 + fontClient.SetDpi( 96, 96 );
  58 +
  59 + TextLabel label = TextLabel::New();
  60 + label.SetParentOrigin( ParentOrigin::CENTER );
  61 + stage.Add( label );
  62 +
  63 + label.SetProperty( TextLabel::PROPERTY_MULTI_LINE, true );
  64 +
  65 + label.SetProperty( TextLabel::PROPERTY_TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog" );
  66 +
  67 + // TODO
  68 + //Property::Value labelText = label.GetProperty( TextLabel::PROPERTY_TEXT );
  69 + //std::cout << "Got text from label: " << labelText.Get< std::string >() << std::endl;
  70 + }
  71 +
  72 +private:
  73 +
  74 + Application& mApplication;
  75 +};
  76 +
  77 +void RunTest( Application& application )
  78 +{
  79 + TextLabelExample test( application );
  80 +
  81 + application.MainLoop();
  82 +}
  83 +
  84 +/** Entry point for Linux & Tizen applications */
  85 +int main( int argc, char **argv )
  86 +{
  87 + Application application = Application::New( &argc, &argv );
  88 +
  89 + RunTest( application );
  90 +
  91 + return 0;
  92 +}
... ...