X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=base%2Fdali-toolkit%2Finternal%2Fcontrols%2Ftext-input%2Ftext-input-popup-impl.h;h=cd5b2be5badaf48af12960e3ffd306b6a93500d1;hp=afc641215db91b3e4bc4969afd09d2ddaea1a79c;hb=58186fc1abcee2136a81c2060f90e9fb4f0ddeca;hpb=d5e3ed5f5b1c8fdba3ae97ead8729620f54b3836 diff --git a/base/dali-toolkit/internal/controls/text-input/text-input-popup-impl.h b/base/dali-toolkit/internal/controls/text-input/text-input-popup-impl.h index afc6412..cd5b2be 100644 --- a/base/dali-toolkit/internal/controls/text-input/text-input-popup-impl.h +++ b/base/dali-toolkit/internal/controls/text-input/text-input-popup-impl.h @@ -22,6 +22,7 @@ #include #include +#include namespace Dali { @@ -47,6 +48,34 @@ public: StateShown }; + enum Buttons + { + ButtonsCut, + ButtonsCopy, + ButtonsPaste, + ButtonsSelect, + ButtonsSelectAll, + ButtonsClipboard, + ButtonsEnumEnd + }; + + struct ButtonRequirement + { + TextInputPopup::Buttons buttonId; + std::size_t orderOfPriority; + std::string name; + std::string caption; + Image iconImage; + bool enabled; + }; + + static const char* const OPTION_SELECT_WORD; + static const char* const OPTION_SELECT_ALL; + static const char* const OPTION_CUT; + static const char* const OPTION_COPY; + static const char* const OPTION_PASTE; + static const char* const OPTION_CLIPBOARD; + // Signal names static const char* const SIGNAL_PRESSED; static const char* const SIGNAL_HIDE_FINISHED; @@ -123,10 +152,14 @@ public: /** * Create a background to be used when button pressed * @param[in] requiredSize size Image actor should be - * @param[in] finalFlag flag to be set if option is the final one. * @return Returns an Image Actor to be used a pressed background */ - ImageActor CreatePressedBackground( const Vector3 requiredSize, const bool finalFlag ); + ImageActor CreatePressedBackground( const Vector3 requiredSize ); + + /** + * Creates a ordered vector of button options + */ + void CreateOrderedListOfOptions(); /** * Adds a popup option. @@ -171,10 +204,78 @@ public: */ Actor GetRootActor() const; + /** + * Set the Cut and Paste buttons color when in normal state + * @param[in] color color to use + */ + void SetCutPastePopUpColor( const Vector4& color ); + + /** + * Get the set color of the Copy and Paste PopUp buttons + * @return color + */ + const Vector4& GetCutPastePopUpColor() const; + + /** + * Set the Cut and Paste button color when pressed. + * @param[in] color color to use + */ + void SetCutPastePopUpPressedColor( const Vector4& color ); + + /** + * Get the Cut and Paste pressed button color. + * @return color + */ + const Vector4& GetCutPastePopUpPressedColor() const; + + /** + * Toggle if a popup button should be enabled (shown) or not + * @param[in] requiredButton Button Id to enable or disable + * @param[in] enable toggle to enable (true) or disable (false) + */ + void TogglePopUpButtonOnOff( TextInputPopup::Buttons requiredButton, bool enable ); + + /** + * Set the Button Priority Position + * @param[in] button Button id for priority to be set on + * @param[in] priority Priority level, 1 is highest so will appear first. 0 priority will not show the button. + */ + void SetButtonPriorityPosition( TextInputPopup::Buttons button, unsigned int priority ); + + /** + * Get the Button Priority Position + * @param[in] button Button id to get priority of + * @return the button priority, 1 is highest, 0 is not shown. + */ + unsigned int GetButtonPriorityPosition( TextInputPopup::Buttons button ) const; + + /** + * Adds Popup options which have been enabled. + */ + void AddPopupOptions(); + + /** + * Set Boundary that PopUp should stay within + * @param[in] boundingRectangle coordinates of bounding box from Top Left + */ + void SetPopupBoundary( const Rect& boundingRectangle ); + private: /** - * Adds popup to the stage (ideally on a separate top-most layer and as an overlay) + * Creates a Button with the required parameters. + * @param[in] buttonId enum representing the button + * @param[in] orderOfPriority Position in toolbar button should be position, 1 is first from left to right. + * @param[in] name Given name for Button actor + * @param[in] caption Text to display in button + * @param[in] iconImage Icon to display in button + * @param[in] enabled Toggle if button should be used or not, this is decided by the current state/conditions. + */ + TextInputPopup::ButtonRequirement CreateRequiredButton( TextInputPopup::Buttons buttonId, std::size_t orderOfPriority, + const std::string& name, const std::string& caption, Image iconImage, bool enabled ); + + /** + * Adds Popup to the stage (ideally on a separate top-most layer and as an overlay) */ void AddToStage(); @@ -184,12 +285,43 @@ private: void ApplyConfinementConstraint(); /** - * Removes popup from the stage. + * Create a layer to hold the stencil + * @param[in] size Size to of layer + */ + void CreateLayer( const Vector2& size ); + + /** + * Create a stencil to clip the scroll view content + * @param[in] size Size to of stencil + */ + void CreateStencil( const Vector2& size ); + + /** + * Popup has started to scroll + * @param[in] position current scroll view position + */ + void OnScrollStarted( const Vector3& position ); + + /** + * Popup has stopped scrolling + * @param[in] position current scroll view position + */ + void OnScrollCompleted( const Vector3& position ); + + /** + * Create a scroll view to hold the popup buttons and allow scrolling if too many buttons to fit within the visible boundary + * @param[in] scrollViewSize size of content of the scroll view which can exceed its visible size + * @param[in] visibleSize size of the visible scroll view + */ + void CreateScrollView( const Vector2& scrollViewSize, const Vector2& visibleSize ); + + /** + * Removes Popup from the stage. */ void RemoveFromStage(); /** - * Called when a button is pressed in the popup + * Called when a button is pressed in the Popup * @param[in] button The button pressed. */ bool OnButtonPressed( Toolkit::Button button ); @@ -220,6 +352,26 @@ private: ActorContainer mDividerContainer; ///< List of dividers added to popup. Animation mAnimation; ///< Popup Hide/Show animation. + Actor mStencil; ///< Stencil to clip scrollview + Toolkit::ScrollView mScrollView; ///< Scrollview to house the popup + Layer mLayer; ///< Layer to house the scroll view and stencil + + std::vector mOrderListOfButtons; // List of buttons in the order to be displayed and a flag to indicate if needed. + + Vector4 mCutPasteButtonsColor; // Color of the cut and paste popup + Vector4 mCutPasteButtonsPressedColor; // Color of the cut and paste buttons when pressed. + Vector4 mBorderColor; // Color of the border around the Cut and Paste Popup + + Rect mBoundingRect; // Boundary that Popup must stay within. + + // Priority of Options/Buttons in the Cut and Paste pop-up, higher priority buttons are displayed first, left to right. + std::size_t mSelectOptionPriority; // Position of Select Button + std::size_t mSelectAllOptionPriority; // Position of Select All button + std::size_t mCutOptionPriority; // Position of Cut button + std::size_t mCopyOptionPriority; // Position of Copy button + std::size_t mPasteOptionPriority; // Position of Paste button + std::size_t mClipboardOptionPriority; // Position of Clipboard button + PressedSignalV2 mPressedSignal; ///< Signal emitted when a button within the popup is pressed. HideFinishedSignalV2 mHideFinishedSignal; ///< Signal emitted when popup is completely hidden ShowFinishedSignalV2 mShowFinishedSignal; ///< Signal emitted when popup is completely shown