#ifndef __DALI_TOOLKIT_INTERNAL_BUTTON_H__
#define __DALI_TOOLKIT_INTERNAL_BUTTON_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.
+ *
+ */
// INTERNAL INCLUDES
-#include <dali/dali.h>
#include <dali-toolkit/public-api/controls/buttons/button.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include "button-painter-impl.h"
/**
* Button is the base class implementation for all buttons.
*/
-class Button : public ControlImpl
+class Button : public Control
{
public:
// Properties
enum
{
- BUTTON_PROPERTY_START_INDEX = ControlImpl::CONTROL_PROPERTY_END_INDEX + 1,
+ BUTTON_PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
BUTTON_PROPERTY_END_INDEX = BUTTON_PROPERTY_START_INDEX + 1000 ///< Reserving 1000 property indices
};
public:
/**
- * @copydoc Dali::Toolkit::Button::SetDimmed( bool dimmed )
+ * @copydoc Dali::Toolkit::Button::SetDisabled( bool disabled )
*/
- void SetDimmed( bool dimmed );
+ void SetDisabled( bool disabled );
/**
- * @copydoc Dali::Toolkit::Button::IsDimmed() const
+ * @copydoc Dali::Toolkit::Button::IsDisabled() const
*/
- bool IsDimmed() const;
+ bool IsDisabled() const;
/**
* @copydoc Dali::Toolkit::Button::SetAnimationTime()
* This method is called from the OnTouchEvent method when the button is down.
* Could be reimplemented in subclasses to provide specific behaviour.
*/
- virtual void OnButtonDown() { }
+ virtual void OnButtonDown();
/**
* This method is called from the OnTouchEvent method when the button is up.
* Could be reimplemented in subclasses to provide specific behaviour.
*/
- virtual void OnButtonUp() { }
+ virtual void OnButtonUp();
/**
* This method is called from the OnTouchEvent method when the touch point leaves the boundary of the button or
*/
virtual float OnAnimationTimeRequested() const;
+ /**
+ * This method is called when the button is removed from the stage.
+ * Could be reimplemented in subclasses to provide specific behaviour.
+ */
+ virtual void OnButtonStageDisconnection() { }
+
public:
/**
* @copydoc Dali::Toolkit::Button::ClickedSignal()
*/
- Toolkit::Button::ClickedSignalV2& ClickedSignal();
+ Toolkit::Button::ClickedSignalType& ClickedSignal();
+
+ /**
+ * @copydoc Dali::Toolkit::Button::StateChangedSignal()
+ */
+ Toolkit::Button::StateChangedSignalType& StateChangedSignal();
/**
* Connects a callback function with the object's signals.
*/
virtual bool OnTouchEvent( const TouchEvent& event );
-private: // From ControlImpl
+private: // From Control
/**
* @copydoc Toolkit::Control::OnInitialize()
*/
virtual void OnControlSizeSet( const Vector3& targetSize );
+ /**
+ * Callback received when the button is disconnected from the stage.
+ * It resets the button status.
+ */
+ void OnControlStageDisconnection();
+
private:
/**
* @param[in] actor The tapped actor.
* @param[in] tap The tap gesture.
*/
- void OnTap(Actor actor, TapGesture tap);
-
-private:
-
- /**
- * Callback received when the button is disconected from the stage.
- * It resets the button status.
- */
- void OnStageDisconnection();
+ void OnTap(Actor actor, const TapGesture& tap);
private:
// Undefined
Button& operator = ( const Button& );
-protected: // Signals
+protected:
enum ButtonState
{
ButtonDown, ///< The button is down.
};
- ButtonState mState; ///< Stores the button state.
-
- bool mDimmed; ///< Stores the dimmed property.
-
ButtonPainterPtr mPainter; ///< Pointer to a ButtonPainter base class.
- Toolkit::Button::ClickedSignalV2 mClickedSignalV2; ///< Signal emitted when the button is clicked.
+ Toolkit::Button::ClickedSignalType mClickedSignal; ///< Signal emitted when the button is clicked.
+ Toolkit::Button::StateChangedSignalType mStateChangedSignal; ///< Signal emitted when the button's state is changed.
TapGestureDetector mTapDetector;
+
+ ButtonState mState; ///< Stores the button state.
+
+ bool mDisabled; ///< Stores the disabled property.
};
} // namespace Internal