2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
20 * @brief This is the header file for the %Control class.
22 * This header file contains the declarations of the %Control class.
25 #ifndef _FUI_CONTROL_H_
26 #define _FUI_CONTROL_H_
28 #include <FBaseTypes.h>
29 #include <FBaseString.h>
30 #include <FGrpCanvas.h>
31 #include <FGrpColor.h>
32 #include <FGrpPoint.h>
33 #include <FGrpRectangle.h>
34 #include <FUiIFocusEventListener.h>
35 #include <FUiIKeyEventListener.h>
36 #include <FUiITouchEventListener.h>
37 #include <FUiITouchModeChangedEventListener.h>
38 #include <FUiIDragDropEventListener.h>
39 #include <FUiCompositeMode.h>
41 namespace Tizen { namespace Ui { namespace Animations {
42 class ControlAnimator;
46 namespace Tizen { namespace Ui {
48 class AccessibilityContainer;
51 class TouchGestureDetector;
55 * @brief This class is the abstract base class of all the UI control classes.
59 * @remarks In order for a control to be displayed, it must first be bound to a window of the underlying window system. The control's window is
60 * created when it (or its ancestor) is added to a valid control containment hierarchy. A containment hierarchy is valid if and
61 * only if the root of the hierarchy is an instance of the Window class.
63 * The %Control class is the abstract base class of all user interface elements. It encapsulates a
64 * "window" of the underlying window system, and provides the infrastructure necessary for the
65 * elements to respond to user inputs. The %Control class also determines how a key event is dispatched
68 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/controls.htm">UI Controls</a>.
71 * The following examples demonstrate how to use the %Control class.
77 * pControl->SetSize(100, 100); // 100 pixels wide and 100 pixels long
79 * // Sets the position
80 * pControl->SetPosition(5, 5); // Control is drawn 5 pixels down and 5 pixels left from the top-left corner of its parent
86 * // Gets a instance of Canvas
87 * Canvas* pCanvas = pControl->GetCanvasN();
89 * // Fills the canvas with white color
90 * pCanvas->Clear(Tizen::Graphics::Color(255, 255, 255));
92 * // Shows changes on screen
93 * pControl->Invalidate(true);
101 * // Implements MyKeyEventListener
102 * IKeyEventListener* pKeyListener = new MyKeyEventListener();
103 * pControl->SetFocus();
105 * // The added key listener should be deleted after use
106 * pControl->AddKeyEventListener(*pKeyListener);
110 class _OSP_EXPORT_ Control
111 : public Tizen::Base::Object
116 * This destructor overrides Tizen::Base::Object::~Object().
120 virtual ~Control(void);
123 * Adds the IFocusEventListener instance to the %Control instance. @n
124 * The added listener gets notified when the control gains or loses its focus.
128 * @param[in] listener The event listener to add
129 * @see RemoveFocusEventListener()
131 void AddFocusEventListener(IFocusEventListener& listener);
134 * Adds the IKeyEventListener instance to the %Control instance. @n
135 * The added listener gets notified when a key is pressed, released, or long pressed.
139 * @param[in] listener The event listener to add
140 * @see RemoveKeyEventListener()
142 void AddKeyEventListener(IKeyEventListener& listener);
145 * Adds the ITouchEventListener instance to the %Control instance. @n
146 * The added listener gets notified when a touch event such as a press or a release is fired.
150 * @param[in] listener The event listener to add
151 * @see RemoveTouchEventListener()
153 void AddTouchEventListener(ITouchEventListener& listener);
156 * Adds the ITouchModeChangedEventListener instance to the %Control instance. @n
157 * The added listener gets notified when the device's touch mode is changed.
161 * @param[in] listener The event listener to add
162 * @see RemoveTouchModeChangedEventListener()
164 void AddTouchModeChangedEventListener(Tizen::Ui::ITouchModeChangedEventListener& listener);
167 * Adds the IDragDropEventListener instance to the %Control instance. @n
168 * The added listener gets notified when a drag or a drop happens in the control.
172 * @param[in] listener The event listener to add
173 * @see RemoveDragDropEventListener()
175 void AddDragDropEventListener(IDragDropEventListener& listener);
178 * Removes the focus listener instance. @n
179 * The removed listener is not notified even when focus events are fired.
183 * @param[in] listener The listener to remove
184 * @see AddFocusEventListener()
186 void RemoveFocusEventListener(IFocusEventListener& listener);
189 * Removes the key event listener instance. @n
190 * The removed listener is not notified even when key events are fired.
194 * @param[in] listener The listener to remove
195 * @see AddKeyEventListener()
197 void RemoveKeyEventListener(IKeyEventListener& listener);
200 * Removes the touch event listener instance. @n
201 * The removed listener is not notified even when touch events are fired.
205 * @param[in] listener The listener to remove
206 * @see AddTouchEventListener()
208 void RemoveTouchEventListener(ITouchEventListener& listener);
211 * Removes the touch mode changed event listener instance. @n
212 * The removed listener is not notified even when the touch mode changed events are fired.
216 * @param[in] listener The listener to remove
217 * @see AddTouchModeChangedEventListener()
219 void RemoveTouchModeChangedEventListener(Tizen::Ui::ITouchModeChangedEventListener& listener);
222 * Adds the IDragDropEventListener instance to the %Control instance. @n
223 * The added listener gets notified when a drag or a drop happens in the control.
227 * @param[in] listener The event listener to add
228 * @see Tizen::Ui::IDragDropEventListener::OnTouchDragged()
229 * @see Tizen::Ui::IDragDropEventListener::OnTouchDropped()
230 * @see RemoveDragDropEventListener()
232 void RemoveDragDropEventListener(IDragDropEventListener& listener);
235 * Overrides this method to provide user-specific initialization code before the control is added to a container.
239 * @return An error code
240 * @exception E_SUCCESS The method is successful.
241 * @exception E_FAILURE The method has failed.
242 * @remarks This method is called when the control is about to be added to a container.
243 * @remarks To cancel adding this control to the parent, return @c E_FAILURE in this method.
244 * @see OnTerminating()
246 virtual result OnInitializing(void);
249 * Overrides this method to provide user-specific termination code.
252 * @brief <i> [Compatibility] </i>
257 * @compatibility This method has compatibility issues with OSP compatible applications. @n
258 * For more information, see @ref CompOnTerminatingPage "here".
260 * @return An error code
261 * @exception E_SUCCESS The method is successful.
262 * @exception E_FAILURE The method has failed.
263 * @remarks This method is called right before the control is removed successfully from the container.
264 * @remarks To cancel removing this control from the parent, return @c E_FAILURE in this method.
265 * @see OnInitializing()
267 virtual result OnTerminating(void);
271 * @page CompOnTerminatingPage Compatibility for OnTerminating()
272 * @section CompOnterminatingPage IssueSection Issues
273 * Implementing this method in OSP compatible applications has the following issues: @n
274 * -# OnTerminating() callback is called from child to parent.
276 * @section CompOnTerminatingPage SolutionSection Resolutions
277 * This issue has been resolved in Tizen. @n
278 * -# OnTerminating() callback is called from parent to child.
283 * Called asynchronously when the user event that is sent by SendUserEvent() method is
284 * dispatched to the control.
288 * @param[in] requestId The user-defined event ID
289 * @param[in] pArgs A pointer to the argument list
290 * @see SendUserEvent()
292 virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
295 * Checks whether the control is movable.
299 * @return @c true if the control is movable, @n
301 * @exception E_SUCCESS The method is successful.
302 * @remarks The specific error code can be accessed using the GetLastResult() method.
303 * @remarks When control is not movable SetPosition() and SetBounds() return @c E_UNSUPPORTED_OPERATION.
307 bool IsMovable(void) const;
310 * Checks whether the control is resizable.
314 * @return @c true if the control is resizable, @n
316 * @exception E_SUCCESS The method is successful.
317 * @remarks Even if this method returns @c true, the size can be changed internally.
318 * @remarks The specific error code can be accessed using the GetLastResult() method.
319 * @remarks When control is not resizable,
320 * SetSize(), SetBounds(), SetMinimumSize() and SetMaximumSize() return @c E_UNSUPPORTED_OPERATION.
323 * @see SetMinimumSize()
324 * @see SetMaximumSize()
326 bool IsResizable(void) const;
329 * Gets the position and the size of the control.
333 * @return An instance of the Tizen::Graphics::Rectangle that represents the position of top-left corner,
334 * the width, and the height of the control
335 * @remarks The shape of the control is rectangular that is defined by the top-left point,
336 * and the width or height. The position
337 * of the top-left point is relative to the top-left corner of the parent container.
340 Tizen::Graphics::Rectangle GetBounds(void) const;
343 * Gets the position and the size of the control.
347 * @param[out] x The x position of top-left corner of the control
348 * @param[out] y The y position of top-left corner of the control
349 * @param[out] width The width of the rectangular region
350 * @param[out] height The height of the rectangular region
351 * @remarks The shape of the control is regarded as a rectangle that is defined
352 * by the top-left point and the width or height.
353 * The position of the top-left point is relative to the top-left corner of
354 * the parent container.
357 void GetBounds(int& x, int& y, int& width, int& height) const;
360 * Gets the position of the control's top-left corner.
364 * @return The position of the control's top-left corner
365 * @remarks The position of top-left corner is relative to the top-left corner of its parent container.
368 Tizen::Graphics::Point GetPosition(void) const;
371 * Gets the position of the control's top-left corner.
375 * @param[out] x The x position of the control's top-left corner
376 * @param[out] y The y position of the control's top-left corner
377 * @remarks The position of top-left corner is relative to the top-left corner of its parent container.
380 void GetPosition(int& x, int& y) const;
383 * Gets the size of the control.
387 * @return The size of the control
390 Tizen::Graphics::Dimension GetSize(void) const;
393 * Gets the size of the control.
397 * @param[out] width The width of the control
398 * @param[out] height The height of the control
401 void GetSize(int& width, int& height) const;
404 * Gets the x position of the control. @n
405 * The position of control is relative to the top-left corner of its parent container.
409 * @return The x position of the control
414 int GetX(void) const;
417 * Gets the y position of the control. @n
418 * The position of control is relative to the top-left corner of its parent container.
422 * @return The y position of the control
427 int GetY(void) const;
430 * Gets the width of the control.
434 * @return The width of the control
439 int GetWidth(void) const;
442 * Gets the height of the control.
446 * @return The height of the control
451 int GetHeight(void) const;
454 * Gets the minimum size of the control.
458 * @return The minimum size of the control
459 * @exception E_SUCCESS The method is successful.
460 * @exception E_SYSTEM A system error has occurred.
461 * @remarks The first call of the method returns the system-defined minimum size.
462 * @remarks The specific error code can be accessed using the GetLastResult() method.
464 Tizen::Graphics::Dimension GetMinimumSize(void) const;
467 * Gets the maximum size of the control.
471 * @return The maximum size of the control
472 * @exception E_SUCCESS The method is successful.
473 * @exception E_SYSTEM A system error has occurred.
474 * @remarks The first call of the method returns the system-defined maximum size.
475 * @remarks The specific error code can be accessed using the GetLastResult() method.
477 Tizen::Graphics::Dimension GetMaximumSize(void) const;
480 * Gets a font of the control.
484 * @return The font name set in the control, @n
485 * else an empty string if the font is not set
488 Tizen::Base::String GetFont(void) const;
491 * Sets the position and size of the control.
495 * @return An error code
496 * @param[in] rect The new bounds of the control
497 * @exception E_SUCCESS The method is successful.
498 * @exception E_INVALID_OPERATION The control has not been constructed as yet.
499 * @exception E_UNSUPPORTED_OPERATION This control is neither movable nor resizable.
500 * @exception E_INVALID_ARG The specified input parameter is invalid.
501 * @exception E_SYSTEM A system error has occurred.
502 * @remarks Do not override this method.
503 * @remarks The size of the control must be within the range defined by the minimum size and the maximum size.
506 * @see GetMinimumSize()
507 * @see GetMaximumSize()
511 result SetBounds(const Tizen::Graphics::Rectangle& rect);
514 * Sets the position and size of the control. @n
515 * The position is set at (x, y), and the @c width and @c height parameters contain
516 * the width and height values of the object, respectively.
520 * @return An error code
521 * @param[in] x The new x position of the control
522 * @param[in] y The new y position of the control
523 * @param[in] width The new width of the control
524 * @param[in] height The new height of the control
525 * @exception E_SUCCESS The method is successful.
526 * @exception E_INVALID_OPERATION The control has not been constructed as yet.
527 * @exception E_UNSUPPORTED_OPERATION This control is neither movable nor resizable.
528 * @exception E_INVALID_ARG A specified input parameter is invalid.
529 * @exception E_SYSTEM A system error has occurred.
530 * @remarks Do not override this method.
531 * @remarks The size of the control must be within the range defined by the minimum size and the maximum size.
534 * @see GetMinimumSize()
535 * @see GetMaximumSize()
539 result SetBounds(int x, int y, int width, int height);
542 * Sets the relative position of the control.
546 * @return An error code
547 * @param[in] Position The new position
548 * @exception E_SUCCESS The method is successful.
549 * @exception E_INVALID_OPERATION The control has not been constructed as yet.
550 * @exception E_UNSUPPORTED_OPERATION This control is not movable.
551 * @exception E_SYSTEM A system error has occurred.
552 * @remarks Do not override this method.
553 * @remarks The position of the control are relative to the top-left corner of its parent.
557 result SetPosition(const Tizen::Graphics::Point& Position);
560 * Sets the position of the control.
563 * @return An error code
564 * @param[in] x The new x position of the control
565 * @param[in] y The new y position of the control
566 * @exception E_SUCCESS The method is successful.
567 * @exception E_INVALID_OPERATION The control has not been constructed as yet.
568 * @exception E_UNSUPPORTED_OPERATION This control is not movable.
569 * @exception E_SYSTEM A system error has occurred.
570 * @remarks Do not override this method.
571 * @remarks The x,y position of the control are relative to the top-left corner of its parent.
575 result SetPosition(int x, int y);
578 * Sets the size of the control. @n
582 * @return An error code
583 * @param[in] size The new width and height
584 * @exception E_SUCCESS The method is successful.
585 * @exception E_INVALID_OPERATION The control has not been constructed as yet.
586 * @exception E_UNSUPPORTED_OPERATION This control is not resizable.
587 * @exception E_INVALID_ARG The specified input parameter is invalid.
588 * @exception E_SYSTEM A system error has occurred.
589 * @remarks Do not override this method.
590 * @remarks The size of the control must be within the range defined by the minimum size and the maximum size.
592 * @see GetMinimumSize()
593 * @see GetMaximumSize()
596 result SetSize(const Tizen::Graphics::Dimension& size);
599 * Sets the size of the control. @n
600 * The @c width and @c height parameters contain the width and height values of the object, respectively.
604 * @return An error code
605 * @param[in] width The new width of the control
606 * @param[in] height The new height of the control
607 * @exception E_SUCCESS The method is successful.
608 * @exception E_INVALID_OPERATION The control has not been constructed as yet.
609 * @exception E_UNSUPPORTED_OPERATION This control is not resizable.
610 * @exception E_INVALID_ARG A specified input parameter is invalid.
611 * @exception E_SYSTEM A system error has occurred.
612 * @remarks Do not override this method.
613 * @remarks The size of the control must be within the range defined by the minimum size and the maximum size.
615 * @see GetMinimumSize()
616 * @see GetMaximumSize()
619 result SetSize(int width, int height);
622 * Sets the minimum size of the control.
626 * @return An error code
627 * @param[in] newMinDim The new minimum size of the control
628 * @exception E_SUCCESS The method is successful.
629 * @exception E_UNSUPPORTED_OPERATION This control is not resizable.
630 * @exception E_INVALID_ARG The specified input parameter is invalid.
631 * @exception E_SYSTEM A system error has occurred.
632 * @remarks This method can affect the maximum size and the current size of the control. @n
633 * The control needs to be redrawn to reflect the change in its size. @n
634 * If the current maximum size or the control size is smaller than the new minimum size,
635 * it becomes the same as the new minimum size.
638 result SetMinimumSize(const Tizen::Graphics::Dimension& newMinDim);
641 * Sets the maximum size of the control.
645 * @return An error code
646 * @param[in] newMaxDim The new maximum size of the control
647 * @exception E_SUCCESS The method is successful.
648 * @exception E_UNSUPPORTED_OPERATION This control is not resizable.
649 * @exception E_INVALID_ARG The specified input parameter is invalid.
650 * @exception E_SYSTEM A system error has occurred.
651 * @remarks This method can affect the minimum size and the current size of the control. @n
652 * The control needs to be redrawn to reflect the change in its size. @n
653 * If the current minimum size or the control size is greater than the new maximum size,
654 * it becomes the same as the new maximum size.
657 result SetMaximumSize(const Tizen::Graphics::Dimension& newMaxDim);
660 * Converts the specified screen position to the position in control's coordinate system.
664 * @return The position relative to the top-left corner of the control's client-area
665 * @param[in] screenPosition The position relative to the top-left corner of the screen
666 * @see ConvertToScreenPosition()
668 Tizen::Graphics::Point ConvertToControlPosition(const Tizen::Graphics::Point& screenPosition) const;
671 * Converts the specified position in the control's coordinate system to the screen position.
675 * @return The position relative to the top-left corner of the screen
676 * @param[in] controlPosition The position relative to the top-left corner of the control's client-area
677 * @see ConvertToControlPosition()
679 Tizen::Graphics::Point ConvertToScreenPosition(const Tizen::Graphics::Point& controlPosition) const;
682 * Sets the font of the control.
686 * @return An error code
687 * @param[in] fontName The app font name or system font name @n
688 * The app font name is retrieved using Tizen::Graphics::Font::GetFaceName(Tizen::Base::String& filepath). @n
689 * The system font name is retrieved using Tizen::Graphics::Font::GetSystemFontListN().
690 * Sets an empty string to reset.
691 * @exception E_SUCCESS The method is successful.
692 * @exception E_FILE_NOT_FOUND The specified font cannot be found or accessed.
693 * @remarks At first, the value of @c fontName is considered app font name if it matches one of the face names of the font files which are located in @b '/res/font'.
694 * If not, the value of @c fontName is considered system font name if it matches one of the retrieved values using Tizen::Graphics::Font::GetSystemFontListN().
695 * @remarks The control first attempts to find the control font. If it fails, then it searches for the application default font and the system font, in sequence.
698 result SetFont(const Tizen::Base::String& fontName);
701 * Checks whether the specified @c point is inside the control.
705 * @return @c true if the specified @c point is inside the control, @n
707 * @param[in] point The point to check
708 * @remarks The specified @c point must be defined relative to the top-left corner of the control.
710 bool Contains(const Tizen::Graphics::Point& point) const;
713 * Checks whether the specified point is inside the control.
717 * @return @c true if the specified point is inside the control, @n
719 * @param[in] x The x position of the point to check
720 * @param[in] y The y position of the point to check
721 * @remarks The specified point must be defined relative to the top-left corner of the control.
723 bool Contains(int x, int y) const;
726 * Draws child controls recursively.
729 * @brief <i> [Compatibility] </i>
734 * @compatibility This method has compatibility issues with OSP compatible applications. @n
735 * For more information, see @ref CompDrawPage "here".
737 * @return An error code
738 * @exception E_SUCCESS The method is successful.
739 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
740 * Note: This control cannot be displayed.
741 * @exception E_SYSTEM A system error has occurred.
742 * @remarks This method calls OnDraw() immediately in a synchronous way.
749 * @page CompDrawPage Compatibility for Draw()
750 * @section CompDrawPage IssueSection Issues
751 * Implementing this method in OSP compatible applications has the following issues: @n
752 * -# Draw() method draws child controls in a recursive way regardless of the visibility of the parent.
754 * @section CompDrawPage SolutionSection Resolutions
755 * This issue has been resolved in Tizen. @n
756 * -# Draw() method does not draw child controls if the control itself is not visible.
765 * @param[in] recursive Set to @c true to draw child controls recursively, @n
767 * @return An error code
768 * @exception E_SUCCESS The method is successful.
769 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
770 * Note: This control cannot be displayed.
771 * @exception E_SYSTEM A system error has occurred.
772 * @remarks This method calls OnDraw() immediately in a synchronous way.
775 result Draw(bool recursive);
778 * Shows the control on the screen.
781 * @final Although this method is virtual, it should not be overridden.
782 * If overridden, it may not work as expected.
784 * @return An error code
785 * @exception E_SUCCESS The method is successful.
786 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
787 * Note: This control cannot be displayed.
788 * @exception E_SYSTEM A system error has occurred.
789 * @remarks Do not override this method.
791 virtual result Show(void);
794 * Invalidates the control.
798 * @param[in] recursive Set to @c true to invalidate child controls recursively, @n
800 * @exception E_SUCCESS The method is successful.
801 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
802 * Note: This control cannot be displayed.
803 * @exception E_SYSTEM A system error has occurred.
804 * @remarks The specific error code can be accessed using the GetLastResult() method.
805 * @remarks OnDraw() is not called immediately, but called asynchronously just before the screen is updated.
808 void Invalidate(bool recursive);
811 * Invalidates the control of the specified position and size.
815 * @param[in] bounds The position relative to the top-left corner of the control
816 * @exception E_SUCCESS The method is successful.
817 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation. @n
818 * Note: This control cannot be displayed.
819 * @remarks The specific error code can be accessed using the GetLastResult() method.
822 void InvalidateBounds(const Tizen::Graphics::Rectangle& bounds);
825 * Draws the control asynchronously.
829 * @param[in] show Set to @c true to also show the control, @n
831 * @remarks This method posts a draw event in the event queue. @n
832 * Drawing requested by %RequestRedraw() occurs when the draw event is fired to the control.
834 void RequestRedraw(bool show = true) const;
837 * Creates and returns a graphics canvas whose bounds (that is, position and size) are equal to those
842 * @return The graphic canvas of the control, @n
843 * else @c null if an exception occurs
844 * @exception E_SUCCESS The method is successful.
845 * @exception E_SYSTEM A system error has occurred.
846 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
847 * @remarks The method allocates a Tizen::Graphics::Canvas whose bounds are equal to that of the control.
848 * It is the developer's responsibility to deallocate the canvas after use.
849 * The canvas is guaranteed to be valid only if the properties of the parent controls of the canvas remain unchanged.
850 * Therefore, one must delete previously allocated canvas and create a new canvas using the %GetCanvasN() method
851 * if the size or position of the control is changed.
852 * @remarks The specific error code can be accessed using the GetLastResult() method.
853 * @remarks The Frame and Form (and between different Form instances) share a single frame-buffer. Therefore,
854 * if custom drawing is performed on the graphic canvas of Frame and Form
855 * then it will appear on the screen regardless of which control is currently visible on the screen.
856 * @see GetCanvasN(const Tizen::Graphics::Rectangle& bounds) const
857 * @see GetCanvasN(int x, int y, int width, int height) const
860 * MyForm::OnDraw(void)
862 * result r = E_SUCCESS;
863 * Canvas* pCanvas = GetCanvasN();
864 * if (pCanvas != null)
866 * // add your drawing code here
870 * // Do not call Show(). It will be called automatically after OnDraw() callback.
875 Tizen::Graphics::Canvas* GetCanvasN(void) const;
878 * Creates and returns a graphic canvas of the control of the specified position and size.
882 * @return The graphic canvas of the control, @n
883 * else @c null if an exception occurs
884 * @param[in] bounds The bounds of the graphic canvas
885 * @exception E_SUCCESS The method is successful.
886 * @exception E_OUT_OF_RANGE The specified bounds does not intercept with the bounds of the control.
887 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
888 * @remarks Only the graphic canvas of displayable controls can be obtained.
889 * If the specified area is not inside the control,
890 * the graphics canvas of overlapped area between the control and the specified bound is returned. @n
891 * @remarks The method allocates an Tizen::Graphics::Canvas whose bounds are equal to that of the control.
892 * It is the developer's responsibility to deallocate the canvas after use.
893 * The canvas is guaranteed to be valid only if the properties of the parent controls of the canvas remain unchanged.
894 * Therefore, one must delete previously allocated canvas and create a new canvas using the %GetCanvasN() method
895 * if the size or position of the control is changed.
896 * @remarks The specific error code can be accessed using the GetLastResult() method.
897 * @remarks The Frame and Form (and between different Form instances) share a single frame-buffer. Therefore,
898 * if custom drawing is performed on the graphic canvas of Frame and Form
899 * then it will appear on the screen regardless of which control is currently visible on the screen.
900 * @see GetCanvasN(void) const
901 * @see GetCanvasN(int x, int y, int width, int height) const
903 Tizen::Graphics::Canvas* GetCanvasN(const Tizen::Graphics::Rectangle& bounds) const;
906 * Creates and returns a graphic canvas of the specified position and size in the control.
910 * @return The graphic canvas of the control, @n
911 * else @c null if an exception occurs
912 * @param[in] x The x position relative to the top-left corner of the control
913 * @param[in] y The y position relative to the top-left corner of the control
914 * @param[in] width The width of a graphic canvas
915 * @param[in] height The height of a graphic canvas
916 * @exception E_SUCCESS The method is successful.
917 * @exception E_OUT_OF_RANGE The specified bounds does not intercept with the bounds of the control.
918 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
919 * @remarks Only the graphic canvas of displayable controls can be obtained.
920 * If the specified area is not inside the control,
921 * the graphics canvas of the overlapped area between the control and the specified bound is returned. @n
922 * @remarks The method allocates an Tizen::Graphics::Canvas whose bounds are equal to that of the control.
923 * It is the developer's responsibility to deallocate the canvas after use.
924 * The canvas is guaranteed to be valid only if properties of the parent controls of the canvas remain unchanged.
925 * Therefore, one must delete the previously allocated canvas and create a new canvas using the %GetCanvasN() method
926 * if the size or position of the control is changed.
927 * @remarks The specific error code can be accessed using the GetLastResult() method.
928 * @remarks The Frame and Form (and between different Form instances) share a single frame-buffer. Therefore,
929 * if custom drawing is performed on the graphic canvas of Frame and Form
930 * then it will appear on the screen regardless of which control is currently visible on the screen.
931 * @see GetCanvasN(void) const
932 * @see GetCanvasN(const Tizen::Graphics::Rectangle& bounds) const
934 Tizen::Graphics::Canvas* GetCanvasN(int x, int y, int width, int height) const;
937 * Checks whether the control is currently visible on the screen.
941 * @return @c true if the control is currently visible on the screen, @n
943 * @remarks If this method is called before the control is added to a parent, @c false is returned.
944 * @see GetShowState()
945 * @see SetShowState()
947 bool IsVisible(void) const;
950 * Gets the current show state of the control.
954 * @return The show state of the control
955 * @remarks Even if the control's state is "show", the control may not be visible.
956 * @see SetShowState()
959 bool GetShowState(void) const;
962 * Sets the show state of the control.
966 * @return An error code
967 * @param[in] state The new show state
968 * @exception E_SUCCESS The method is successful.
969 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
970 * Note: This control cannot be displayed.
971 * @exception E_SYSTEM A system error has occurred.
972 * @remarks Do not override this method.
973 * @remarks Even if this method is invoked, the control is not drawn or shown. @n
974 * To draw and show the control, use Invalidate() method. @n
975 * Once the control's show state is set to @c false,
976 * the show state needs to be set to @c true again before you draw and show the control.
977 * @see GetShowState()
980 result SetShowState(bool state);
983 * Gets the dedicated %VisualElement instance for this control.
987 * @return An instance of the VisualElement
988 * @remarks If an application developer modifies the state of the returned VisualElement
989 * and the host control is not aware of this change, then the control may behave egregiously.
990 * It is highly recommended to restore the %VisualElement state to avoid such conflicts.
992 Tizen::Ui::Animations::VisualElement* GetVisualElement(void) const;
995 * Gets the parent of the control.
999 * @return The current parent of the control
1001 Container* GetParent(void) const;
1004 * Gets the name of the control.
1008 * @return The name of the control
1010 Tizen::Base::String GetName(void) const;
1013 * Sets the name of the control.
1017 * @param[in] name The name of the control
1019 void SetName(const Tizen::Base::String& name);
1022 * Checks whether the control is focusable.
1026 * @return @c true if control is focusable, @n
1028 * @remarks The focus ability of the container classes like Panel is @c false by default.
1030 bool IsFocusable(void) const;
1033 * Sets the focus ability of the control. @n
1034 * Non-Focusable controls cannot take the key focus.
1038 * @return An error code
1039 * @exception E_SUCCESS The method is successful.
1040 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
1041 * Note: The control does not permit to change its focus ability.
1042 * @exception E_SYSTEM A system error has occurred.
1043 * @remarks The focus ability of the container classes like Panel is @c false by default.
1044 * @remarks The RadioGroup class does not render the UI.
1045 * Therefore, RadioGroup::SetFocusable() returns @c E_SYSTEM.
1047 result SetFocusable(bool focusable);
1050 * Checks whether the control currently has the input focus.
1054 * @return @c true if the control currently has the input focus, @n
1056 * @remarks If this method is called before the control is added to a parent, @c false is returned.
1059 bool HasFocus(void) const;
1062 * Sets the focus to the control. @n
1063 * This method is called if the control needs to listen to user input events such as key pressed.
1067 * @return An error code
1068 * @exception E_SUCCESS The method is successful.
1069 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
1070 * Note: This control cannot be displayed.
1071 * @exception E_INVALID_CONDITION The control is not contained in, or is not the top z-order frame or form.
1072 * @remarks Do not override this method.
1074 result SetFocus(void);
1077 * Checks whether the control is enabled.
1081 * @return @c true if the control is enabled, @n
1083 * @remarks If this method is called before the control is added to a parent, @c false is returned.
1086 bool IsEnabled(void) const;
1089 * Enables or disables the control. @n
1090 * Only an enabled control can respond to the user input. By default, the control is enabled.
1094 * @return An error code
1095 * @param[in] enable The new state of the object
1096 * @exception E_SUCCESS The method is successful.
1097 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation.
1098 * @exception E_SYSTEM A system error has occurred.
1099 * @remarks Do not override this method.
1101 result SetEnabled(bool enable);
1104 * Checks whether the device is in touch mode. @n
1105 * When the user interacts with the device by touching it, the device is in touch mode.
1109 * @return @c true if the device is in touch mode, @n
1111 * @remarks This method returns @c false, for devices with QWERTY keyboard.
1112 * The user can navigate the UI using directional keys.
1114 bool IsInTouchMode(void) const;
1117 * Enables or disables the drag operation in the %Control.
1121 * @param[in] enable Set to @c true to enable the drag operation, @n
1123 * @see SetDropEnabled()
1125 void SetDragEnabled(bool enable);
1128 * Enables or disables the drop operations in the %Control.
1132 * @param[in] enable Set to @c true to enable drop operations, @n
1134 * @remarks To receive drop event, control's drag property has to be enabled.
1135 * @see SetDragEnabled()
1137 void SetDropEnabled(bool enable);
1140 * Sends a user event to the control.
1144 * @param[in] requestId The user-defined event ID
1145 * @param[in] pArgs A pointer to the argument list
1146 * @remarks This method posts a user event in the event queue
1147 * and returns immediately to support asynchronous actions of the framework.
1148 * @see OnUserEventReceived()
1150 void SendUserEvent(RequestId requestId, const Tizen::Base::Collection::IList* pArgs) const;
1153 * Stops the current UI event dispatch sequence by indicating the current input event is consumed.
1157 * @return An error code
1158 * @exception E_SUCCESS The method is successful.
1159 * @exception E_SYSTEM A system error has occurred.
1160 * @remarks If this method is invoked during an UI event (key or touch) propagation sequence,
1161 * the method will stop the propagation and consequently the system will not be notified of the event. @n
1162 * The method will not have any effect if no UI event is being dispatched. @n
1163 * It is recommended that this method is called within IKeyEventListener or
1164 * ITouchEventListener to stop the event from propagating to the next step.
1166 result ConsumeInputEvent(void);
1169 * Gets the control animator of the current instance of %Control
1173 * @return A pointer to ControlAnimator, @n
1174 * else @c null if this instance is not constructed or not added to a parent or non-animatable
1176 Tizen::Ui::Animations::ControlAnimator* GetControlAnimator(void) const;
1179 * Adds the gesture detector to the %Control. @n
1180 * The added gesture detector receives touch events prior to %Control.
1184 * @return An error code
1185 * @param[in] gestureDetector The gesture detector
1186 * @exception E_SUCCESS The method is successful.
1187 * @see RemoveGestureDetector()
1189 result AddGestureDetector(const TouchGestureDetector& gestureDetector);
1192 * Removes the gesture detector from the %Control.
1196 * @return An error code
1197 * @param[in] gestureDetector The gesture detector
1198 * @exception E_SUCCESS The method is successful.
1199 * @see AddGestureDetector()
1201 result RemoveGestureDetector(const TouchGestureDetector& gestureDetector);
1205 * Gets the composite mode for merging with other controls.
1207 * @brief <i> [Deprecated] </i>
1208 * @deprecated This method is deprecated because changing composition mode is not allowed any more.
1211 * @return The composite mode
1212 * @exception E_SUCCESS The method is successful.
1213 * @remarks In Tizen, this method only returns @c COMPOSITE_MODE_ALPHA_BLENDING.
1214 * @remarks The specific error code can be accessed using the GetLastResult() method.
1217 Tizen::Ui::CompositeMode GetCompositeMode(void) const;
1221 * Sets the composite mode for merging with other controls.
1223 * @brief <i> [Deprecated] </i>
1224 * @deprecated This method is deprecated because changing composition mode is not allowed any more.
1227 * @return An error code
1228 * @param[in] compositeMode The composite mode
1229 * @exception E_SUCCESS The method is successful.
1230 * @exception E_UNSUPPORTED_OPERATION The method is not supported.
1231 * @remarks In Tizen, only @c COMPOSITE_MODE_ALPHA_BLENDING is allowed.
1232 * Otherwise, this method returns @c E_UNSUPPORTED_OPERATION.
1235 result SetCompositeMode(Tizen::Ui::CompositeMode compositeMode);
1239 * Gets the chroma key color value that is used for the control composition.
1241 * @brief <i> [Deprecated] </i>
1242 * @deprecated This method is deprecated because chroma key color is not supported any more.
1245 * @return The chroma key color
1246 * @exception E_UNSUPPORTED_OPERATION The method is not supported.
1247 * @remarks In Tizen, this method always fails and returns Tizen::Graphics::Color(0, 0, 0, 0).
1248 * @remarks The specific error code can be accessed using the GetLastResult() method.
1251 Tizen::Graphics::Color GetChromaKeyColor(void) const;
1255 * Sets the chroma key color value that is used for the control composition.
1257 * @brief <i> [Deprecated] </i>
1258 * @deprecated This method is deprecated because chroma key color is not supported any more.
1261 * @return An error code
1262 * @param[in] chromaKeyColor The chroma key color
1263 * @exception E_UNSUPPORTED_OPERATION The method is not supported.
1264 * @remarks In Tizen, this method always fails.
1267 result SetChromaKeyColor(Tizen::Graphics::Color chromaKeyColor);
1270 * Captures the composited scene of the Panel control.
1274 * @return A Tizen::Graphics::Bitmap instance that captures the current composited scene of the Panel control, @n
1275 * else @c null if an error occurs
1276 * @exception E_SUCCESS The method is successful.
1277 * @exception E_UNSUPPORTED_OPERATION This method is not supported.
1278 * @exception E_SYSTEM A system error has occurred.
1279 * @remarks The specific error code can be accessed using the GetLastResult() method.
1280 * @remarks This method is not supported in the following class that is derived from Panel class:
1282 * @remarks The bounds of the %Panel control must be within the client area of the Form control to get a valid composited scene.
1284 Tizen::Graphics::Bitmap* GetCapturedBitmapN(void) const;
1287 * Gets the position and the size of the invalidated bounds.
1291 * @return An instance of Tizen::Graphics::Rectangle that represents the position of top-left corner,
1292 * the width, and the height of the invalidated bounds
1294 Tizen::Graphics::Rectangle GetInvalidatedBounds(void) const;
1297 * Enables or disables the multi-point touch of the %Control.
1301 * @param[in] enable A Boolean flag indicating whether to enable the multi-point touch
1303 * @see IsMultipointTouchEnabled()
1306 void SetMultipointTouchEnabled(bool enable);
1309 * Checks whether the multi-point touch is enabled.
1313 * @return @c true if the multi-point touch is enabled, @n
1315 * @see SetMultipointTouchEnabled()
1317 bool IsMultipointTouchEnabled(void) const;
1320 * Gets the accessibility container.
1324 * @return The accessibilit container of the control, if the control supports accessibility feature. @n
1326 * @see AccessibilityContainer::GetOwner()
1328 const AccessibilityContainer* GetAccessibilityContainer(void) const;
1331 * Gets the accessibility container.
1335 * @return The accessibilit container of the control, if the control supports accessibility feature. @n
1337 * @see AccessibilityContainer::GetOwner()
1339 AccessibilityContainer* GetAccessibilityContainer(void);
1343 * Gets the default key event listener.
1347 * @return The default key event listener, @n
1348 * else @null is returned if listener is not set or a system error has occurred
1349 * @see SetDefaultKeyEventListener()
1351 IKeyEventListener* GetDefaultkeyEventListener(void) const;
1354 * Gets the default touch event listener.
1358 * @return The default touch event listener @n
1359 * If not listener has been set or a system error has occurred @c null is returned.
1360 * @see SetDefaultTouchEventListener()
1362 ITouchEventListener* GetDefaultTouchEventListener(void) const;
1365 * Sets the default key event listener.
1369 * @return An error code
1370 * @param[in] pDefaultListener The default key event listener
1371 * @exception E_SUCCESS The method is successful.
1372 * @exception E_SYSTEM A system error has occurred.
1373 * @remarks The registered listener will be notified to handle the key events
1374 * after all application event listeners have been notified.
1375 * @see GetDefaultkeyEventListener()
1377 result SetDefaultKeyEventListener(IKeyEventListener* pDefaultListener);
1380 * Sets the default touch event listener.
1384 * @return An error code
1385 * @param[in] pDefaultListener The default touch event listener
1386 * @exception E_SUCCESS The method is successful.
1387 * @exception E_SYSTEM A system error has occurred.
1388 * @remarks The registered listener will be notified to handle the touch events
1389 * after all application event listeners have been notified.
1390 * @see GetDefaultTouchEventListener()
1392 result SetDefaultTouchEventListener(ITouchEventListener* pDefaultListener);
1395 * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
1402 * This method is for internal use only. Using this method can cause behavioral, security-related,
1403 * and consistency-related issues in the application.
1405 * Initializes this instance of %Control.
1408 * @return An error code
1409 * @exception E_SUCCESS The method is successful.
1410 * @exception E_SYSTEM A system error has occurred.
1412 result Construct(void);
1415 * Frees the resources allocated by Construct().
1422 _ControlImpl* _pControlImpl;
1425 // This method is for internal use only. Using this method can cause behavioral, security-related,
1426 // and consistency-related issues in the application.
1428 // This method is reserved and may change its name at any time without prior notice.
1430 virtual void Control_Reserved1(void) {}
1433 // This method is for internal use only. Using this method can cause behavioral, security-related,
1434 // and consistency-related issues in the application.
1436 // This method is reserved and may change its name at any time without prior notice.
1438 virtual void Control_Reserved2(void) {}
1441 // This method is for internal use only. Using this method can cause behavioral, security-related,
1442 // and consistency-related issues in the application.
1444 // This method is reserved and may change its name at any time without prior notice.
1446 virtual void Control_Reserved3(void) {}
1449 // This method is for internal use only. Using this method can cause behavioral, security-related,
1450 // and consistency-related issues in the application.
1452 // This method is reserved and may change its name at any time without prior notice.
1454 virtual void Control_Reserved4(void) {}
1457 // This method is for internal use only. Using this method can cause behavioral, security-related,
1458 // and consistency-related issues in the application.
1460 // This method is reserved and may change its name at any time without prior notice.
1462 virtual void Control_Reserved5(void) {}
1465 // This method is for internal use only. Using this method can cause behavioral, security-related,
1466 // and consistency-related issues in the application.
1468 // This method is reserved and may change its name at any time without prior notice.
1470 virtual void Control_Reserved6(void) {}
1474 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
1476 Control(const Control& rhs);
1479 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
1481 Control& operator =(const Control& rhs);
1484 friend class _ControlImpl;
1489 #endif // _FUI_CONTROL_H_