#ifndef __DALI_TOOLKIT_CONTROL_H__
#define __DALI_TOOLKIT_CONTROL_H__
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
/**
* @addtogroup CAPI_DALI_TOOLKIT_CONTROLS_MODULE
//Forward declarations.
-class ControlImpl;
+namespace Internal
+{
+class Control;
+}
/**
* @brief Control is the base class for all controls.
*
- * The implementation of the control must be supplied; see ControlImpl for more details.
- * @see ControlImpl
+ * The implementation of the control must be supplied; see Internal::Control for more details.
+ * @see Internal::Control
*/
-class Control : public CustomActor, public ConnectionTrackerInterface
+class Control : public CustomActor
{
public:
- // Action Names
- static const char* const ACTION_CONTROL_ACTIVATED; ///< name "control-activated"
+ /// @name Properties
+ /** @{ */
+ static const Property::Index PROPERTY_BACKGROUND_COLOR; ///< name "background-color", @see SetBackgroundColor, type VECTOR4
+ static const Property::Index PROPERTY_BACKGROUND; ///< name "background", @see SetBackground, type MAP
+ static const Property::Index PROPERTY_WIDTH_POLICY; ///< name "width-policy", @see SetSizePolicy, type STRING
+ static const Property::Index PROPERTY_HEIGHT_POLICY; ///< name "height-policy", @see SetSizePolicy, type STRING
+ static const Property::Index PROPERTY_MINIMUM_SIZE; ///< name "minimum-size", @see SetMinimumSize, type VECTOR3
+ static const Property::Index PROPERTY_MAXIMUM_SIZE; ///< name "maximum-size", @see SetMaximumSize, type VECTOR3
+ static const Property::Index PROPERTY_KEY_INPUT_FOCUS; ///< name "key-input-focus", @see SetKeyInputFocus, type BOOLEAN
+ /** @} */
- // Signal Names
- static const char* const SIGNAL_KEY_EVENT; ///< name "key-event"
+ /// @name Signals
+ /** @{ */
+ static const char* const SIGNAL_KEY_EVENT; ///< name "key-event"
+ /** @} */
+
+ /// @name Actions
+ /** @{ */
+ static const char* const ACTION_CONTROL_ACTIVATED; ///< name "control-activated"
+ /** @} */
/**
* @brief Describes how a control could be resized.
Control(const Control& uiControl);
/**
- * @brief Virtual destructor.
+ * @brief Dali::Control is intended as a base class
*
- * Dali::Object derived classes do not contain member data.
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
*/
- virtual ~Control();
+ ~Control();
public: // operators
*
* @return The implementation.
*/
- ControlImpl& GetImplementation();
+ Internal::Control& GetImplementation();
/**
* @brief Retrieve the Control implementation.
*
* @return The implementation.
*/
- const ControlImpl& GetImplementation() const;
+ const Internal::Control& GetImplementation() const;
+
+ // Size Negotiation
/**
* @brief Sets the size policies for the width and height dimensions.
*/
float GetWidthForHeight( float height );
+ // Key Input
+
/**
* @brief This sets the control to receive key events.
*
*/
void ClearKeyInputFocus();
+ // Gesture Detection
+
/**
* @brief Retrieves the pinch gesture detector of the control.
*
*/
LongPressGestureDetector GetLongPressGestureDetector() const;
-//signals
-public:
+ // Background
/**
- * @brief This signal is emitted when key event is received.
+ * @brief Sets the background color of the control.
*
- * A callback of the following type may be connected:
- * @code
- * bool YourCallbackName(Control control, const KeyEvent& event);
- * @endcode
- * The return value of True, indicates that the touch event should be consumed.
- * Otherwise the signal will be emitted on the next sensitive parent of the actor.
- * @pre The Control has been initialized.
- * @return The signal to connect to.
+ * @param[in] color The required background color of the control
*/
- KeyEventSignalV2& KeyEventSignal();
+ void SetBackgroundColor( const Vector4& color );
-protected:
+ /**
+ * @brief Retrieves the background color of the control.
+ *
+ * @return The background color of the control.
+ */
+ Vector4 GetBackgroundColor() const;
/**
- * @copydoc ConnectionTrackerInterface::SignalConnected
+ * @brief Sets an image as the background of the control.
+ *
+ * The color of this image is blended with the background color @see SetBackgroundColor
+ *
+ * @param[in] image The image to set as the background.
*/
- virtual void SignalConnected( SlotObserver* slotObserver, CallbackBase* callback );
+ void SetBackground( Image image );
/**
- * @copydoc ConnectionTrackerInterface::SignalDisconnected
+ * @brief Clears the background.
*/
- virtual void SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback );
+ void ClearBackground();
/**
- * @copydoc ConnectionTrackerInterface::GetConnectionCount
+ * @brief Retrieves the actor used as the background for this control.
+ *
+ * @return The actor that used as the background for this control.
*/
- virtual std::size_t GetConnectionCount() const;
+ Actor GetBackgroundActor() const;
+
+ // Signals
+
+ /**
+ * @brief This signal is emitted when key event is received.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * bool YourCallbackName(Control control, const KeyEvent& event);
+ * @endcode
+ * The return value of True, indicates that the touch event should be consumed.
+ * Otherwise the signal will be emitted on the next sensitive parent of the actor.
+ * @pre The Control has been initialized.
+ * @return The signal to connect to.
+ */
+ KeyEventSignalV2& KeyEventSignal();
public: // Not intended for application developers
* @param[in] implementation The implementation for this control.
* @return A handle to a newly allocated Dali resource.
*/
- Control(ControlImpl& implementation);
+ Control(Internal::Control& implementation);
/**
* @brief This constructor is used by CustomActor within Dali core to create additional Control handles