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
[Tizen] Update demo to use LinearLayout.
[platform/core/uifw/dali-demo.git]
/
examples
/
layouting
/
linear-example.cpp
diff --git
a/examples/layouting/linear-example.cpp
b/examples/layouting/linear-example.cpp
index
a499005
..
9f56222
100644
(file)
--- a/
examples/layouting/linear-example.cpp
+++ b/
examples/layouting/linear-example.cpp
@@
-20,8
+20,7
@@
#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
-#include <dali-toolkit/devel-api/layouting/hbox-layout.h>
-#include <dali-toolkit/devel-api/layouting/vbox-layout.h>
+#include <dali-toolkit/devel-api/layouting/linear-layout.h>
using namespace Dali;
using namespace Dali::Toolkit;
using namespace Dali;
using namespace Dali::Toolkit;
@@
-69,6
+68,11
@@
void CreateChildImageView( ImageView& imageView, const char* filename, Size size
namespace Demo
{
namespace Demo
{
+LinearExample::LinearExample()
+: mLTRDirection(true)
+{
+}
+
void LinearExample::Create()
{
auto stage = Stage::GetCurrent();
void LinearExample::Create()
{
auto stage = Stage::GetCurrent();
@@
-93,10
+97,9
@@
void LinearExample::Create()
// Create a linear layout
mLinearContainer = Control::New();
// Create a linear layout
mLinearContainer = Control::New();
- mIsHorizontal = false;
-
- auto layout = VboxLayout::New();
+ auto layout = LinearLayout::New();
layout.SetAnimateLayout(true);
layout.SetAnimateLayout(true);
+ layout.SetOrientation( LinearLayout::Orientation::VERTICAL );
DevelControl::SetLayout( mLinearContainer, layout );
mLinearContainer.SetParentOrigin( ParentOrigin::CENTER );
DevelControl::SetLayout( mLinearContainer, layout );
mLinearContainer.SetParentOrigin( ParentOrigin::CENTER );
@@
-129,7
+132,7
@@
void LinearExample::Remove()
// Mirror items in layout
bool LinearExample::OnDirectionClicked( Button button )
{
// Mirror items in layout
bool LinearExample::OnDirectionClicked( Button button )
{
- if(
m
Direction )
+ if(
!mLTR
Direction )
{
mDirectionButton.SetProperty( PushButton::Property::UNSELECTED_ICON, LTR_IMAGE );
mDirectionButton.SetProperty( PushButton::Property::SELECTED_ICON, LTR_SELECTED_IMAGE );
{
mDirectionButton.SetProperty( PushButton::Property::UNSELECTED_ICON, LTR_IMAGE );
mDirectionButton.SetProperty( PushButton::Property::SELECTED_ICON, LTR_SELECTED_IMAGE );
@@
-141,27
+144,23
@@
bool LinearExample::OnDirectionClicked( Button button )
mDirectionButton.SetProperty( PushButton::Property::SELECTED_ICON, RTL_SELECTED_IMAGE );
mLinearContainer.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
}
mDirectionButton.SetProperty( PushButton::Property::SELECTED_ICON, RTL_SELECTED_IMAGE );
mLinearContainer.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
}
- m
Direction = !m
Direction;
+ m
LTRDirection = !mLTR
Direction;
return true;
}
// Rotate layout by changing layout
bool LinearExample::OnRotateClicked( Button button )
{
return true;
}
// Rotate layout by changing layout
bool LinearExample::OnRotateClicked( Button button )
{
-
mIsHorizontal = !mIsHorizontal
;
- if(
mIsHorizontal
)
+
auto layout = LinearLayout::DownCast( DevelControl::GetLayout( mLinearContainer ) )
;
+ if(
layout.GetOrientation() == LinearLayout::Orientation::VERTICAL
)
{
{
- auto hboxLayout = HboxLayout::New();
- hboxLayout.SetAnimateLayout(true);
- DevelControl::SetLayout( mLinearContainer, hboxLayout );
+ layout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
}
else
{
}
else
{
- auto vboxLayout = VboxLayout::New();
- vboxLayout.SetAnimateLayout(true);
- DevelControl::SetLayout( mLinearContainer, vboxLayout );
+ layout.SetOrientation( LinearLayout::Orientation::VERTICAL );
}
return true;
}
}
return true;
}
-} // namespace Demo
\ No newline at end of file
+} // namespace Demo