projects
/
platform
/
core
/
uifw
/
dali-demo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove ResourceImage usage from demos
[platform/core/uifw/dali-demo.git]
/
examples
/
text-label
/
text-label-example.cpp
diff --git
a/examples/text-label/text-label-example.cpp
b/examples/text-label/text-label-example.cpp
index
a24e3aa
..
b2ad9a5
100644
(file)
--- a/
examples/text-label/text-label-example.cpp
+++ b/
examples/text-label/text-label-example.cpp
@@
-22,7
+22,7
@@
// EXTERNAL INCLUDES
#include <dali-toolkit/dali-toolkit.h>
// EXTERNAL INCLUDES
#include <dali-toolkit/dali-toolkit.h>
-#include <
dali/public-api/text-abstraction/text-abstraction.h
>
+#include <
iostream
>
// INTERNAL INCLUDES
#include "shared/multi-language-strings.h"
// INTERNAL INCLUDES
#include "shared/multi-language-strings.h"
@@
-34,7
+34,7
@@
using namespace MultiLanguageStrings;
namespace
{
namespace
{
- const char* const BACKGROUND_IMAGE = D
ALI_IMAGE_DIR "button-up.9
.png";
+ const char* const BACKGROUND_IMAGE = D
EMO_IMAGE_DIR "grab-handle
.png";
const unsigned int KEY_ZERO = 10;
const unsigned int KEY_ONE = 11;
const unsigned int KEY_ZERO = 10;
const unsigned int KEY_ONE = 11;
@@
-97,8
+97,6
@@
public:
*/
void Create( Application& application )
{
*/
void Create( Application& application )
{
- DemoHelper::RequestThemeChange();
-
Stage stage = Stage::GetCurrent();
stage.KeyEventSignal().Connect(this, &TextLabelExample::OnKeyEvent);
Stage stage = Stage::GetCurrent();
stage.KeyEventSignal().Connect(this, &TextLabelExample::OnKeyEvent);
@@
-109,16
+107,15
@@
public:
mContainer.SetParentOrigin( ParentOrigin::CENTER );
mLayoutSize = Vector2(stageSize.width*0.6f, stageSize.width*0.6f);
mContainer.SetSize( mLayoutSize );
mContainer.SetParentOrigin( ParentOrigin::CENTER );
mLayoutSize = Vector2(stageSize.width*0.6f, stageSize.width*0.6f);
mContainer.SetSize( mLayoutSize );
+ mContainer.SetDrawMode( DrawMode::OVERLAY_2D );
stage.Add( mContainer );
// Resize the center layout when the corner is grabbed
stage.Add( mContainer );
// Resize the center layout when the corner is grabbed
- mGrabCorner =
Control::New(
);
+ mGrabCorner =
ImageView::New( BACKGROUND_IMAGE
);
mGrabCorner.SetName( "GrabCorner" );
mGrabCorner.SetName( "GrabCorner" );
- mGrabCorner.SetAnchorPoint( AnchorPoint::
BOTTOM_RIGHT
);
+ mGrabCorner.SetAnchorPoint( AnchorPoint::
TOP_CENTER
);
mGrabCorner.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT );
mGrabCorner.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT );
- mGrabCorner.SetSize( Vector2(stageSize.width*0.1f, stageSize.width*0.1f) );
- mGrabCorner.SetZ(1.0f);
- mGrabCorner.SetBackgroundColor( Color::YELLOW );
+ mGrabCorner.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
mContainer.Add( mGrabCorner );
mPanGestureDetector = PanGestureDetector::New();
mContainer.Add( mGrabCorner );
mPanGestureDetector = PanGestureDetector::New();
@@
-144,15
+141,29
@@
public:
// Resize the text-label with pan gesture
void OnPan( Actor actor, const PanGesture& gesture )
{
// Resize the text-label with pan gesture
void OnPan( Actor actor, const PanGesture& gesture )
{
+ // Reset mLayoutSize when the pan starts
+ if( gesture.state == Gesture::Started )
+ {
+ if( mLayoutSize.x < 2.0f )
+ {
+ mLayoutSize.x = 2.0f;
+ }
+
+ if( mLayoutSize.y < 2.0f )
+ {
+ mLayoutSize.y = 2.0f;
+ }
+ }
+
mLayoutSize.x += gesture.displacement.x * 2.0f;
mLayoutSize.y += gesture.displacement.y * 2.0f;
mLayoutSize.x += gesture.displacement.x * 2.0f;
mLayoutSize.y += gesture.displacement.y * 2.0f;
- if( mLayoutSize.x >= 2.0f
&&
+ if( mLayoutSize.x >= 2.0f
||
mLayoutSize.y >= 2.0f )
{
// Avoid pixel mis-alignment issue
mLayoutSize.y >= 2.0f )
{
// Avoid pixel mis-alignment issue
- Vector2 clampedSize = Vector2(
ConvertToEven(static_cast<int>(mLayoutSize.x)
),
-
ConvertToEven(static_cast<int>(mLayoutSize.y)
) );
+ Vector2 clampedSize = Vector2(
std::max( ConvertToEven( static_cast<int>( mLayoutSize.x )), 2
),
+
std::max( ConvertToEven( static_cast<int>( mLayoutSize.y )), 2
) );
mContainer.SetSize( clampedSize );
}
mContainer.SetSize( clampedSize );
}
@@
-283,9
+294,9
@@
void RunTest( Application& application )
}
/** Entry point for Linux & Tizen applications */
}
/** Entry point for Linux & Tizen applications */
-int main( int argc, char **argv )
+int
DALI_EXPORT_API
main( int argc, char **argv )
{
{
- Application application = Application::New( &argc, &argv );
+ Application application = Application::New( &argc, &argv
, DEMO_THEME_PATH
);
RunTest( application );
RunTest( application );