From: Paul Wisbey
Date: Tue, 27 Jan 2015 09:38:21 +0000 (+0000)
Subject: TextLabel demo
X-Git-Tag: new_text_0.1~20
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F12%2F34912%2F15;p=platform%2Fcore%2Fuifw%2Fdali-demo.git
TextLabel demo
Change-Id: I6b62f7b114ac959fcec3ab1e9381684c1fad8dff
---
diff --git a/build/tizen/examples/Makefile.am b/build/tizen/examples/Makefile.am
index e098223..f85d06d 100644
--- a/build/tizen/examples/Makefile.am
+++ b/build/tizen/examples/Makefile.am
@@ -36,7 +36,8 @@ bin_PROGRAMS = \
builder.example \
image-scaling-irregular-grid.example \
buttons.example \
- logging.example
+ logging.example \
+ text-label.example
daliimagedir = $(appdatadir)/images/
dalimodeldir = $(appdatadir)/models/
@@ -169,3 +170,8 @@ logging_example_SOURCES = $(examples_src_dir)/logging/logging-example.cpp
logging_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS)
logging_example_DEPENDENCIES = $(EXAMPLE_DEPS)
logging_example_LDADD = $(EXAMPLE_LDADD)
+
+text_label_example_SOURCES = $(examples_src_dir)/text/text-label-example.cpp
+text_label_example_CXXFLAGS = $(EXAMPLE_CXXFLAGS)
+text_label_example_DEPENDENCIES = $(EXAMPLE_DEPS)
+text_label_example_LDADD = $(EXAMPLE_LDADD)
diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp
index fb95d3f..f8755c8 100644
--- a/demo/dali-table-view.cpp
+++ b/demo/dali-table-view.cpp
@@ -521,6 +521,14 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit
image.Add( stencil );
}
+ TextLabel label = TextLabel::New();
+ label.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ label.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ label.SetProperty( TextLabel::PROPERTY_MULTI_LINE, true );
+ label.SetProperty( TextLabel::PROPERTY_TEXT, title );
+ label.SetColor( Color::WHITE );
+ content.Add( label );
+
// Set the tile to be keyboard focusable
tile.SetKeyboardFocusable(true);
diff --git a/examples/text/text-label-example.cpp b/examples/text/text-label-example.cpp
new file mode 100644
index 0000000..ebb34b7
--- /dev/null
+++ b/examples/text/text-label-example.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/**
+ * @file text-label-example.cpp
+ * @brief Basic usage of TextLabel control
+ */
+
+// EXTERNAL INCLUDES
+#include
+#include
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+/**
+ * @brief The main class of the demo.
+ */
+class TextLabelExample : public ConnectionTracker
+{
+public:
+
+ TextLabelExample( Application& application )
+ : mApplication( application )
+ {
+ // Connect to the Application's Init signal
+ mApplication.InitSignal().Connect( this, &TextLabelExample::Create );
+ }
+
+ ~TextLabelExample()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * One-time setup in response to Application InitSignal.
+ */
+ void Create( Application& application )
+ {
+ Stage stage = Stage::GetCurrent();
+
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi( 96, 96 );
+
+ TextLabel label = TextLabel::New();
+ label.SetParentOrigin( ParentOrigin::CENTER );
+ stage.Add( label );
+
+ label.SetProperty( TextLabel::PROPERTY_MULTI_LINE, true );
+
+ label.SetProperty( TextLabel::PROPERTY_TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog" );
+
+ // TODO
+ //Property::Value labelText = label.GetProperty( TextLabel::PROPERTY_TEXT );
+ //std::cout << "Got text from label: " << labelText.Get< std::string >() << std::endl;
+ }
+
+private:
+
+ Application& mApplication;
+};
+
+void RunTest( Application& application )
+{
+ TextLabelExample test( application );
+
+ application.MainLoop();
+}
+
+/** Entry point for Linux & Tizen applications */
+int main( int argc, char **argv )
+{
+ Application application = Application::New( &argc, &argv );
+
+ RunTest( application );
+
+ return 0;
+}