X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fcontact-cards%2Fcontact-card.h;h=d17195296101db777137376514e994d0e347daf3;hb=1b19fd140ff139b5854a1a62447faf31b175d8f6;hp=043bfdebbd9c617d5a6ce5fe2d50498b2b2e9bdb;hpb=e0d5c698d57eaee2da5688c5219a6d0775a96c6f;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/contact-cards/contact-card.h b/examples/contact-cards/contact-card.h index 043bfde..d171952 100644 --- a/examples/contact-cards/contact-card.h +++ b/examples/contact-cards/contact-card.h @@ -2,7 +2,7 @@ #define CONTACT_CARD_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -19,13 +19,15 @@ */ // EXTERNAL INCLUDES -#include +#include #include +#include +#include #include #include -#include +#include -class ContactCardLayoutInfo; +struct ContactCardLayoutInfo; /** * @brief Creates and sets up animations for a contact card @@ -42,55 +44,70 @@ class ContactCardLayoutInfo; class ContactCard : public Dali::RefObject { public: - /** * @brief Constructor. * - * This will create all the controls and add them to the stage so should only be called after the init-signal from the Application has been received. + * This will create all the controls and add them to the window so should only be called after the init-signal from the Application has been received. * + * @param[in] window The window to add the contact card to. * @param[in] contactCardLayoutInfo Reference to the common data used by all contact cards. * @param[in] contactName The name of the contact to display. * @param[in] contactAddress The address of the contact to display. * @param[in] imagePath The path to the image to display. * @param[in] position The unique folded position of this particular contact-card. */ - ContactCard( const ContactCardLayoutInfo& contactCardLayoutInfo, const std::string& contactName, const std::string& contactAddress, const std::string& imagePath, const Dali::Vector2& position ); + ContactCard(Dali::Window window, const ContactCardLayoutInfo& contactCardLayoutInfo, const std::string& contactName, const std::string& contactAddress, const std::string& imagePath, const Dali::Vector2& position); private: - /** * @brief Private Destructor. Will only be deleted when ref-count goes to 0. * - * Unparent the created contact card (i.e. remove from stage). + * Unparent the created contact card (i.e. remove from window). */ ~ContactCard(); /** * @brief Called when this contact card is tapped. - * @param[in] actor The tapped actor. - * @param[in] gesture The tap gesture. + * @param[in] actor The tapped actor. + * @param[in] gesture The tap gesture. + */ + void OnTap(Dali::Actor actor, const Dali::TapGesture& gesture); + + /** + * @brief Animates the fold/unfold animation as required. */ - void OnTap( Dali::Actor actor, const Dali::TapGesture& gesture ); + void Animate(); /** * @brief Called when the animation finishes. - * @param[in] animation The animation which has just finished. + * @param[in] animation The animation which has just finished. */ - void OnAnimationFinished( Dali::Animation& animation ); + void OnAnimationFinished(Dali::Animation& animation); + + /** + * @brief Called when any key event is received + * + * Will use this to fold a contact card if it is unfolded. + * @param[in] event The key event information + */ + void OnKeyEvent(const Dali::KeyEvent& event); + + Dali::TapGestureDetector mTapDetector; ///< Used for tap detection. + Dali::Toolkit::Control mContactCard; ///< Used for the background and to clip the contents. + Dali::Toolkit::Control mHeader; ///< Header shown when unfolded. + Dali::Toolkit::Control mClippedImage; ///< The image representing the contact (whose clipping can be animated). + Dali::Toolkit::Control mMaskedImage; ///< The image with a mask (better quality around the edges than the clipped image when folded). + Dali::Toolkit::Control mNameText; ///< The text shown when folded. + Dali::Toolkit::Control mDetailText; ///< The text shown when unfolded. - Dali::TapGestureDetector mTapDetector; ///< Used for tap detection. - Dali::Toolkit::Control mContactCard; ///< Used for the background and to clip the contents. - Dali::Toolkit::Control mHeader; ///< Header shown when unfolded. - Dali::Toolkit::Control mClippedImage; ///< The image representing the contact (whose clipping can be animated). - Dali::Toolkit::Control mNameText; ///< The text shown when folded. - Dali::Toolkit::Control mDetailText; ///< The text shown when unfolded. + Dali::Animation mAnimation; ///< The fold/unfold animation. - Dali::SlotDelegate< ContactCard > mSlotDelegate; ///< Used to automatically disconnect our member functions from signals that this class connects to upon destruction. Can be used instead of inheriting from ConnectionTracker. + Dali::SlotDelegate mSlotDelegate; ///< Used to automatically disconnect our member functions from signals that this class connects to upon destruction. Can be used instead of inheriting from ConnectionTracker. - const ContactCardLayoutInfo& mContactCardLayoutInfo; ///< Reference to the common data used by all contact cards. - const Dali::Vector2 foldedPosition; ///< The unique position of this card when it is folded. - Dali::Property::Index mClippedImagePropertyIndex; ///< Index used to animate the clipping of mClippedImage. - bool mFolded; ///< Whether the contact card is folded or not. + const ContactCardLayoutInfo& mContactCardLayoutInfo; ///< Reference to the common data used by all contact cards. + const Dali::Vector2 foldedPosition; ///< The unique position of this card when it is folded. + Dali::Property::Index mClippedImagePropertyIndex; ///< Index used to animate the clipping of mClippedImage. + bool mFolded; ///< Whether the contact card is folded or not. }; #endif // CONTACT_CARD_H