X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbuttons%2Fcheck-box-button-impl.h;h=9d4335a4a74d1d810dade2754e382685277a991c;hp=500cc09fa1d665bff05b693aa92a27b440a71102;hb=38a8b42e1f7765a9b3314a033700fb25d4a6f8fd;hpb=e2eda444afbe82e9591fe198eef339227f90a616 diff --git a/dali-toolkit/internal/controls/buttons/check-box-button-impl.h b/dali-toolkit/internal/controls/buttons/check-box-button-impl.h index 500cc09..9d4335a 100644 --- a/dali-toolkit/internal/controls/buttons/check-box-button-impl.h +++ b/dali-toolkit/internal/controls/buttons/check-box-button-impl.h @@ -1,26 +1,30 @@ #ifndef __DALI_TOOLKIT_INTERNAL_CHECK_BOX_BUTTON_H__ #define __DALI_TOOLKIT_INTERNAL_CHECK_BOX_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 +// EXTERNAL INCLUDES #include +#include +// INTERNAL INCLUDES #include +#include #include "button-impl.h" @@ -48,173 +52,95 @@ public: */ static Dali::Toolkit::CheckBoxButton New(); - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetChecked( bool checked ) - */ - void SetChecked( bool checked ); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::IsChecked() - */ - bool IsChecked() const; - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetBackgroundImage( Image image ) - */ - void SetBackgroundImage( Image image ); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetBackgroundImage( Actor image ) - */ - void SetBackgroundImage( Actor image ); - - /** - * Used by the painter only. - * @return A reference to the background image. - */ - Actor& GetBackgroundImage(); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::GetBackgroundImage() - */ - Actor GetBackgroundImage() const; - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetCheckedImage( Image image ) - */ - void SetCheckedImage( Image image ); - - /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetCheckedImage( Actor image ) - */ - void SetCheckedImage( Actor image ); - - /** - * Used by the painter only. - * @return A reference to the checked image. - */ - Actor& GetCheckedImage(); +public: // From Button /** - * @copydoc Dali::Toolkit::CheckBoxButton::GetCheckedImage() + * @copydoc Toolkit::Internal::Button::SetSelectedImage( Actor image ) */ - Actor GetCheckedImage() const; + virtual void SetSelectedImage( Actor image ); /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetDimmedBackgroundImage( Image image ) + * @copydoc Toolkit::Internal::Button::SetBackgroundImage( Actor image ) */ - void SetDimmedBackgroundImage( Image image ); + virtual void SetBackgroundImage( Actor image ); /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetDimmedBackgroundImage( Actor image ) + * @copydoc Toolkit::Internal::Button::SetDisabledSelectedImage( Actor image ) */ - void SetDimmedBackgroundImage( Actor image ); + virtual void SetDisabledSelectedImage( Actor image ); /** - * Used by the painter only. - * @return A reference to the dimmed background image. + * @copydoc Toolkit::Internal::Button::SetDisabledBackgroundImage( Actor image ) */ - Actor& GetDimmedBackgroundImage(); + virtual void SetDisabledBackgroundImage( Actor image ); - /** - * @copydoc Dali::Toolkit::CheckBoxButton::GetDimmedBackgroundImage() - */ - Actor GetDimmedBackgroundImage() const; +private: // From Button /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetDimmedCheckedImage( Image image ) + * @copydoc Toolkit::Internal::Button::OnLabelSet() */ - void SetDimmedCheckedImage( Image image ); + virtual void OnLabelSet(); /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetDimmedCheckedImage( Actor image ) + * @copydoc Toolkit::Internal::Button::OnSelected() */ - void SetDimmedCheckedImage( Actor image ); + virtual void OnSelected( bool selected ); /** - * Used by the painter only. - * @return A reference to the dimmed checked image. + * @copydoc Toolkit::Internal::Button::OnDisabled( bool disabled ) */ - Actor& GetDimmedCheckedImage(); + virtual void OnDisabled( bool disabled ); - /** - * @copydoc Dali::Toolkit::CheckBoxButton::GetDimmedCheckedImage() - */ - Actor GetDimmedCheckedImage() const; +private: // From Control /** - * Used by the painter only. - * @return A reference to the background image that is fading out. + * @copydoc Dali::Toolkit::Control::OnRelayout() */ - Actor& GetFadeOutBackgroundImage(); - - /** - * Used by the painter only. - * @return A reference to the checked image that is fading out. - */ - Actor& GetFadeOutCheckedImage(); - -protected: // From ControlImpl - - /** - * Respond the activate notification. - */ - virtual void OnActivated(); + virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container ); private: /** - * Perform the click action to click the button. - * @param[in] attributes The attributes to perfrom this action. + * Construct a new CheckBoxButton. */ - void DoClickAction(const PropertyValueContainer& attributes); + CheckBoxButton(); -public: /** - * Performs actions as requested using the action name. - * @param[in] object The object on which to perform the action. - * @param[in] actionName The action to perform. - * @param[in] attributes The attributes with which to perfrom this action. - * @return true if action has been accepted by this control + * A reference counted object may only be deleted by calling Unreference() */ - static bool DoAction(BaseObject* object, const std::string& actionName, const std::vector& attributes); + virtual ~CheckBoxButton(); -protected: // From Button +private: /** - * Registers properties + * Adds the actor to the button. */ - virtual void OnButtonInitialize(); + void AddChild( Actor& actor ); /** - * Emits signals and notifies the painter accordingly with the set button - * properties when the button is released. + * Removes the actor from the button. */ - virtual void OnButtonUp(); + void RemoveChild( Actor& actor ); /** - * Sets the push button animation time. - * @param animationTime The animation time in seconds. + * Adds the actor to the check in animation. + * It creates a check in animation if needed and starts the check in animation. + * @param[in] actor The actor. */ - virtual void OnAnimationTimeSet( float animationTime ); + void StartCheckInAnimation( Actor& actor ); /** - * Retrieves the animation time. - * @return The animation time in seconds. + * Stops the check in animation. */ - virtual float OnAnimationTimeRequested() const; + void StopCheckInAnimation(); -protected: + // slots /** - * Construct a new CheckBoxButton. + * Called when the check in animation finishes. + * It changes the check button paint state. */ - CheckBoxButton(); - - /** - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~CheckBoxButton(); + void CheckInAnimationFinished( Dali::Animation& source ); private: @@ -224,23 +150,11 @@ private: // Undefined CheckBoxButton& operator=( const CheckBoxButton& ); - private: - bool mChecked; ///< Stores the check state. - - Actor mBackgroundImage; ///< Stores the background image. - Actor mCheckedImage; ///< Stores the checked image. - Actor mDimmedCheckedImage; ///< Stores the dimmed checked image. - Actor mDimmedBackgroundImage; ///< Stores the dimmed background image. - Actor mFadeOutBackgroundImage; ///< Stores a background image, which is in a fade out animation, to be removed when the animation finishes. - Actor mFadeOutCheckedImage; ///< Stores a foreground image, which is in a fade out animation, to be removed when the animation finishes. - - // Actions - bool mClickActionPerforming; + Animation mCheckInAnimation; ///< Animation used in the state transitions. + ImageRegionEffect mTickUVEffect; ///< ImageRegionEffect to expand the tick across - // Properties - Property::Index mUseFadeAnimationProperty; - Property::Index mUseCheckAnimationProperty; + PaintState mPaintState; ///< The paint state. }; } // namespace Internal