1 #ifndef DALI_DEMO_INTERNAL_EXPANDING_BUTTONS_IMPL_H
2 #define DALI_DEMO_INTERNAL_EXPANDING_BUTTONS_IMPL_H
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 #include "expanding-buttons.h"
21 #include <dali-toolkit/public-api/controls/control-impl.h>
22 #include <dali/public-api/object/weak-handle.h>
27 namespace Internal // To use TypeRegistry, handle and body classes need the same name
30 class ExpandingButtons : public Dali::Toolkit::Internal::Control
35 * Instantiate a new ExpandingButtons object
37 static Demo::ExpandingButtons New();
51 void RegisterButton( Dali::Toolkit::Control& control );
59 Demo::ExpandingButtons::ExpandingButtonsSignalType& CollapsingSignal();
61 private: // From Control
64 * @copydoc Toolkit::Control::OnInitialize()
66 virtual void OnInitialize() override;
69 * @copydoc Toolkit::Control::OnRelayout()
71 virtual void OnRelayout( const Dali::Vector2& targetSize, Dali::RelayoutContainer& container ) override;
76 * Callback when expand or collapse animation ends.
78 void OnExpandAnimationFinished( Dali::Animation& animation );
81 * Called when the main button clicked.
83 bool OnExpandButtonClicked( Dali::Toolkit::Button button );
88 ExpandingButtons( const ExpandingButtons& );
89 ExpandingButtons& operator=( const ExpandingButtons& );
93 std::vector< Dali::WeakHandle< Dali::Toolkit::Control> > mExpandingControls;
95 Dali::Animation mExpandCollapseAnimation;
97 bool mStyleButtonsHidden;
99 Dali::Size mButtonSize; // Size of the buttons, used in animation calculations.
101 Dali::Toolkit::PushButton mExpandButton; // Main button that is clicked to expand/collapse.
103 Demo::ExpandingButtons::ExpandingButtonsSignalType mCollapsedSignal;
108 inline Internal::ExpandingButtons& GetImpl( Demo::ExpandingButtons& handle )
110 DALI_ASSERT_ALWAYS( handle );
111 Dali::RefObject& object = handle.GetImplementation();
112 return static_cast<Internal::ExpandingButtons&>(object);
115 inline const Internal::ExpandingButtons& GetImpl( const Demo::ExpandingButtons& handle )
117 DALI_ASSERT_ALWAYS( handle );
118 const Dali::RefObject& object = handle.GetImplementation();
119 return static_cast<const Internal::ExpandingButtons&>(object);
124 #endif // DALI_DEMO_INTERNAL_EXPANDING_BUTTONS_IMPL_H