1 #ifndef DALI_DEMO_INTERNAL_EXPANDING_BUTTONS_IMPL_H
2 #define DALI_DEMO_INTERNAL_EXPANDING_BUTTONS_IMPL_H
5 * Copyright (c) 2020 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 <dali-toolkit/public-api/controls/control-impl.h>
21 #include <dali/public-api/object/weak-handle.h>
22 #include "expanding-buttons.h"
26 namespace Internal // To use TypeRegistry, handle and body classes need the same name
28 class ExpandingButtons : public Dali::Toolkit::Internal::Control
32 * Instantiate a new ExpandingButtons object
34 static Demo::ExpandingButtons New();
47 void RegisterButton(Dali::Toolkit::Control& control);
54 Demo::ExpandingButtons::ExpandingButtonsSignalType& CollapsingSignal();
56 private: // From Control
58 * @copydoc Toolkit::Control::OnInitialize()
60 virtual void OnInitialize() override;
63 * @copydoc Toolkit::Control::OnRelayout()
65 virtual void OnRelayout(const Dali::Vector2& targetSize, Dali::RelayoutContainer& container) override;
69 * Callback when expand or collapse animation ends.
71 void OnExpandAnimationFinished(Dali::Animation& animation);
74 * Called when the main button clicked.
76 bool OnExpandButtonClicked(Dali::Toolkit::Button button);
80 ExpandingButtons(const ExpandingButtons&);
81 ExpandingButtons& operator=(const ExpandingButtons&);
84 std::vector<Dali::WeakHandle<Dali::Toolkit::Control> > mExpandingControls;
86 Dali::Animation mExpandCollapseAnimation;
88 bool mStyleButtonsHidden;
90 Dali::Size mButtonSize; // Size of the buttons, used in animation calculations.
92 Dali::Toolkit::PushButton mExpandButton; // Main button that is clicked to expand/collapse.
94 Demo::ExpandingButtons::ExpandingButtonsSignalType mCollapsedSignal;
97 } // namespace Internal
99 inline Internal::ExpandingButtons& GetImpl(Demo::ExpandingButtons& handle)
101 DALI_ASSERT_ALWAYS(handle);
102 Dali::RefObject& object = handle.GetImplementation();
103 return static_cast<Internal::ExpandingButtons&>(object);
106 inline const Internal::ExpandingButtons& GetImpl(const Demo::ExpandingButtons& handle)
108 DALI_ASSERT_ALWAYS(handle);
109 const Dali::RefObject& object = handle.GetImplementation();
110 return static_cast<const Internal::ExpandingButtons&>(object);
115 #endif // DALI_DEMO_INTERNAL_EXPANDING_BUTTONS_IMPL_H