#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/linear-layout.h>
+#include <dali-toolkit/devel-api/layouting/hbox-layout.h>
+#include <dali-toolkit/devel-api/layouting/vbox-layout.h>
using namespace Dali;
using namespace Dali::Toolkit;
namespace Demo
{
-LinearExample::LinearExample()
-: mLTRDirection(true)
-{
-}
-
void LinearExample::Create()
{
auto stage = Stage::GetCurrent();
// Create a linear layout
mLinearContainer = Control::New();
- auto layout = LinearLayout::New();
+ mIsHorizontal = false;
+
+ auto layout = VboxLayout::New();
layout.SetAnimateLayout(true);
- layout.SetOrientation( LinearLayout::Orientation::VERTICAL );
DevelControl::SetLayout( mLinearContainer, layout );
mLinearContainer.SetParentOrigin( ParentOrigin::CENTER );
// Mirror items in layout
bool LinearExample::OnDirectionClicked( Button button )
{
- if( !mLTRDirection )
+ if( mDirection )
{
mDirectionButton.SetProperty( PushButton::Property::UNSELECTED_ICON, LTR_IMAGE );
mDirectionButton.SetProperty( PushButton::Property::SELECTED_ICON, LTR_SELECTED_IMAGE );
mDirectionButton.SetProperty( PushButton::Property::SELECTED_ICON, RTL_SELECTED_IMAGE );
mLinearContainer.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
}
- mLTRDirection = !mLTRDirection;
+ mDirection = !mDirection;
return true;
}
// Rotate layout by changing layout
bool LinearExample::OnRotateClicked( Button button )
{
- auto layout = LinearLayout::DownCast( DevelControl::GetLayout( mLinearContainer ) );
- if( layout.GetOrientation() == LinearLayout::Orientation::VERTICAL )
+ mIsHorizontal = !mIsHorizontal;
+ if( mIsHorizontal )
{
- layout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
+ auto hboxLayout = HboxLayout::New();
+ hboxLayout.SetAnimateLayout(true);
+ DevelControl::SetLayout( mLinearContainer, hboxLayout );
}
else
{
- layout.SetOrientation( LinearLayout::Orientation::VERTICAL );
+ auto vboxLayout = VboxLayout::New();
+ vboxLayout.SetAnimateLayout(true);
+ DevelControl::SetLayout( mLinearContainer, vboxLayout );
}
return true;
}
-} // namespace Demo
+} // namespace Demo
\ No newline at end of file
/**
* @file linear-example.hcpp
* @brief Example of a Linear Layout with mirror feature and
- * transition from horizontal to vertical.
+ * tranisition from horizontal to vertical.
*/
class LinearExample final: public ConnectionTracker, public Example
{
public:
- LinearExample();
// Creates a Linear Layout Example and displays it.
virtual void Create() override;
PushButton mDirectionButton;
PushButton mRotateButton;
Control mLinearContainer;
- bool mLTRDirection;
+ bool mDirection = false;
+ bool mIsHorizontal = true;
}; // class LinearContainer
} // namespace Demo
#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/absolute-layout.h>
-#include <dali-toolkit/devel-api/layouting/linear-layout.h>
using namespace Dali;
using namespace Dali::Toolkit;
// Create a table view to show a pair of buttons above each image.
mHorizontalBox = Control::New();
- // Create LinearLayout for this control.
- auto hboxLayout = LinearLayout::New();
+ // Create HBoxLayout for this control.
+ auto hboxLayout = HboxLayout::New();
DevelControl::SetLayout( mHorizontalBox, hboxLayout );
mHorizontalBox.SetName("HBox");
mHorizontalBox.SetBackgroundColor( Color::WHITE );