X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FUIComponents%2FButton.cs;h=1cffbcc3e2e3960da80794dfb81d714461e87ea6;hb=5e1c35c38b2bc29eebc484679f7de727b636f744;hp=a67858daadb23950b90a5723c1347af5f04f6234;hpb=09522e322c3272c3d48bdfbec3edd9b22a0822d0;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/public/UIComponents/Button.cs b/src/Tizen.NUI/src/public/UIComponents/Button.cs index a67858d..1cffbcc 100755 --- a/src/Tizen.NUI/src/public/UIComponents/Button.cs +++ b/src/Tizen.NUI/src/public/UIComponents/Button.cs @@ -24,17 +24,17 @@ namespace Tizen.NUI.UIComponents using Tizen.NUI.BaseComponents; /// - /// Button is a base class for different kinds of buttons.
+ /// The Button class is a base class for different kinds of buttons.
/// This class provides the disabled property and the clicked signal.
- /// A Clicked event handler is emitted when the button is touched and the touch point doesn't leave the boundary of the button.
+ /// The clicked event handler is emitted when the button is touched, and the touch point doesn't leave the boundary of the button.
/// When the disabled property is set to true, no signal is emitted.
- /// 'Visual' describes not just traditional images like png, bmp but refers to whatever is used to show the button, it could be a color, gradient or some other kind of renderer.
- /// The button's appearance can be modified by setting properties for the various visuals/images.
- /// It is not mandatory to set all visuals. A button could be defined only by setting its background visual or by setting its background and selected visuals.
+ /// The 'Visual' describes not just traditional images like PNG and BMP, but also refers to whatever is used to show the button. It could be a color, gradient, or some other kind of renderer.
+ /// The button's appearance can be modified by setting properties for the various visuals or images.
+ /// It is not mandatory to set all the visuals. A button could be defined only by setting its background visual, or by setting its background and selected visuals.
/// The button visual is shown over the background visual.
- /// When pressed the unselected visuals are replaced by the selected visual.
+ /// When pressed, the unselected visuals are replaced by the selected visuals.
/// The text label is always placed on the top of all images.
- /// When the button is disabled, background, button and selected visuals are replaced by their disabled visuals.
+ /// When the button is disabled, the background button and the selected visuals are replaced by their disabled visuals.
///
public class Button : View { @@ -51,7 +51,7 @@ namespace Tizen.NUI.UIComponents } /// - /// To make Button instance be disposed. + /// To dispose the button instance. /// protected override void Dispose(DisposeTypes type) { @@ -72,6 +72,8 @@ namespace Tizen.NUI.UIComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + DisConnectFromSignals(); + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -85,6 +87,39 @@ namespace Tizen.NUI.UIComponents base.Dispose(type); } + private void DisConnectFromSignals() + { + // Save current CPtr. + global::System.Runtime.InteropServices.HandleRef currentCPtr = swigCPtr; + + // Use BaseHandle CPtr as current might have been deleted already in derived classes. + swigCPtr = GetBaseHandleCPtrHandleRef; + + if (_stateChangedCallback != null) + { + StateChangedSignal().Disconnect(_stateChangedCallback); + } + + if (_releasedCallback != null) + { + ReleasedSignal().Disconnect(_releasedCallback); + } + + if (_pressedCallback != null) + { + this.PressedSignal().Disconnect(_pressedCallback); + } + + if (_clickedCallback != null) + { + ClickedSignal().Disconnect(_clickedCallback); + } + + // BaseHandle CPtr is used in Registry and there is danger of deletion if we keep using it here. + // Restore current CPtr. + swigCPtr = currentCPtr; + } + private EventHandlerWithReturnType _clickedEventHandler; [UnmanagedFunctionPointer(CallingConvention.StdCall)] @@ -92,7 +127,7 @@ namespace Tizen.NUI.UIComponents private ClickedCallbackType _clickedCallback; /// - /// Clicked will be triggered when the button is touched and the touch point doesn't leave the boundary of the button. + /// The Clicked event will be triggered when the button is touched and the touch point doesn't leave the boundary of the button. /// public event EventHandlerWithReturnType Clicked { @@ -136,7 +171,7 @@ namespace Tizen.NUI.UIComponents private PressedCallbackType _pressedCallback; /// - /// Pressed will be triggered when the button is touched. + /// The Pressed event will be triggered when the button is touched. /// public event EventHandlerWithReturnType Pressed { @@ -179,7 +214,7 @@ namespace Tizen.NUI.UIComponents private ReleasedCallbackType _releasedCallback; /// - /// Released will be triggered when the button is touched and the touch point leaves the boundary of the button. + /// The Released event will be triggered when the button is touched and the touch point leaves the boundary of the button. /// public event EventHandlerWithReturnType Released { @@ -221,7 +256,7 @@ namespace Tizen.NUI.UIComponents private StateChangedCallback _stateChangedCallback; /// - /// StateChanged will be triggered when the button's state is changed. + /// The StateChanged event will be triggered when the button's state is changed. /// public event EventHandlerWithReturnType StateChanged { @@ -258,7 +293,7 @@ namespace Tizen.NUI.UIComponents /// - /// Gets/Sets the unselected button foreground/icon visual + /// Gets or sets the unselected button foreground or icon visual. /// public Tizen.NUI.PropertyMap UnselectedVisual { @@ -275,7 +310,7 @@ namespace Tizen.NUI.UIComponents } /// - /// Gets/Sets the selected button foreground/icon visual + /// Gets or sets the selected button foreground or icon visual. /// public Tizen.NUI.PropertyMap SelectedVisual { @@ -292,7 +327,7 @@ namespace Tizen.NUI.UIComponents } /// - /// Gets/Sets the disabled selected state foreground/icon button visual + /// Gets or sets the disabled selected state foreground or icon button visual. /// public Tizen.NUI.PropertyMap DisabledSelectedVisual { @@ -309,7 +344,7 @@ namespace Tizen.NUI.UIComponents } /// - /// Gets/Sets the disabled unselected state foreground/icon visual + /// Gets or sets the disabled unselected state foreground or icon visual. /// public Tizen.NUI.PropertyMap DisabledUnselectedVisual { @@ -326,7 +361,7 @@ namespace Tizen.NUI.UIComponents } /// - /// Gets/Sets the disabled in the unselected state background, button visual + /// Gets or sets the disabled unselected state background button visual. /// public Tizen.NUI.PropertyMap UnselectedBackgroundVisual { @@ -343,7 +378,7 @@ namespace Tizen.NUI.UIComponents } /// - /// Gets/Sets the selected background button visual + /// Gets or sets the selected background button visual. /// public Tizen.NUI.PropertyMap SelectedBackgroundVisual { @@ -360,7 +395,7 @@ namespace Tizen.NUI.UIComponents } /// - /// Gets/Sets the disabled while unselected background button visual + /// Gets or sets the disabled while unselected background button visual. /// public Tizen.NUI.PropertyMap DisabledUnselectedBackgroundVisual { @@ -377,7 +412,7 @@ namespace Tizen.NUI.UIComponents } /// - /// Gets/Sets the disabled while selected background button visual + /// Gets or sets the disabled while selected background button visual. /// public Tizen.NUI.PropertyMap DisabledSelectedBackgroundVisual { @@ -394,7 +429,7 @@ namespace Tizen.NUI.UIComponents } /// - /// Gets/Sets the position of the the label in relation to the foreground/icon if both present + /// Gets or sets the position of the the label in relation to the foreground or icon, if both present. /// public Align LabelRelativeAlignment { @@ -455,7 +490,7 @@ namespace Tizen.NUI.UIComponents } /// - /// Gets/Sets the padding around the text + /// Gets or sets the padding around the text. /// public Vector4 LabelPadding { @@ -472,7 +507,7 @@ namespace Tizen.NUI.UIComponents } /// - /// Gets/Sets the padding around the foreground visual + /// Gets or sets the padding around the foreground visual. /// public Vector4 ForegroundVisualPadding { @@ -488,7 +523,7 @@ namespace Tizen.NUI.UIComponents } } - internal class Property + internal new class Property { internal static readonly int UNSELECTED_VISUAL = NDalicManualPINVOKE.Button_Property_UNSELECTED_VISUAL_get(); internal static readonly int SELECTED_VISUAL = NDalicManualPINVOKE.Button_Property_SELECTED_VISUAL_get(); @@ -512,8 +547,8 @@ namespace Tizen.NUI.UIComponents } /// - /// Creates an uninitialized Button.
- /// Only derived versions can be instantiated.
+ /// Creates an uninitialized button.
+ /// Only the derived versions can be instantiated.
///
public Button() : this(NDalicPINVOKE.new_Button__SWIG_0(), true) { @@ -549,7 +584,7 @@ namespace Tizen.NUI.UIComponents } /// - /// If the autorepeating property is set to true then the togglable property is set to false. + /// If the autorepeating property is set to true, then the togglable property is set to false. /// public bool AutoRepeating { @@ -566,7 +601,7 @@ namespace Tizen.NUI.UIComponents } /// - /// By default this value is set to 0.15 seconds. + /// By default, this value is set to 0.15 seconds. /// public float InitialAutoRepeatingDelay { @@ -583,7 +618,7 @@ namespace Tizen.NUI.UIComponents } /// - /// default this value is set to 0.05 seconds. + /// By default, this value is set to 0.05 seconds. /// public float NextAutoRepeatingDelay { @@ -617,7 +652,7 @@ namespace Tizen.NUI.UIComponents } /// - /// /Gets/Sets the togglable button as either selected or unselected, togglable property must be set to true. + /// Gets or sets the togglable button as either selected or unselected, togglable property must be set to true. /// public bool Selected { @@ -634,7 +669,7 @@ namespace Tizen.NUI.UIComponents } /// - /// Gets/Sets unselected color. + /// Gets or sets the unselected color. /// public Color UnselectedColor { @@ -651,7 +686,7 @@ namespace Tizen.NUI.UIComponents } /// - /// Gets/Sets selected color. + /// Gets or sets the selected color. /// public Color SelectedColor { @@ -668,7 +703,7 @@ namespace Tizen.NUI.UIComponents } /// - /// Gets/Sets label. + /// Gets or sets the label. /// public Tizen.NUI.PropertyMap Label { @@ -685,7 +720,7 @@ namespace Tizen.NUI.UIComponents } /// - /// Gets/Sets text of label. + /// Gets or sets the text of the label. /// public string LabelText { @@ -705,24 +740,24 @@ namespace Tizen.NUI.UIComponents } /// - /// Enumeration for describing the position the text label can be in relation to the control(and foreground/icon). + /// Enumeration for describing the position, the text label can be, in relation to the control (and foreground/icon). /// public enum Align { /// - /// At the start of the control before the foreground/icon + /// At the start of the control before the foreground or icon. /// Begin, /// - /// At the end of the control after the foreground/icon + /// At the end of the control after the foreground or icon. /// End, /// - /// At the top of the control above the foreground/icon + /// At the top of the control above the foreground or icon. /// Top, /// - /// At the bottom of the control below the foreground/icon + /// At the bottom of the control below the foreground or icon. /// Bottom }