Removed the DPI hacks
[platform/core/uifw/dali-demo.git] / examples / text / text-label-example.cpp
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     TextLabel label = TextLabel::New();
57     label.SetParentOrigin( ParentOrigin::CENTER );
58     stage.Add( label );
59
60     label.SetProperty( TextLabel::PROPERTY_MULTI_LINE, true );
61
62     label.SetProperty( TextLabel::PROPERTY_TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog" );
63
64     // TODO
65     //Property::Value labelText = label.GetProperty( TextLabel::PROPERTY_TEXT );
66     //std::cout << "Got text from label: " << labelText.Get< std::string >() << std::endl;
67   }
68
69 private:
70
71   Application& mApplication;
72 };
73
74 void RunTest( Application& application )
75 {
76   TextLabelExample test( application );
77
78   application.MainLoop();
79 }
80
81 /** Entry point for Linux & Tizen applications */
82 int main( int argc, char **argv )
83 {
84   Application application = Application::New( &argc, &argv );
85
86   RunTest( application );
87
88   return 0;
89 }