namespace ElmSharp
{
+ /// <summary>
+ /// Enumeration for the popup orientation type.
+ /// </summary>
public enum PopupOrientation
{
+ /// <summary>
+ /// Appears in the top of parent, default.
+ /// </summary>
Top,
+ /// <summary>
+ /// Appears in the center of parent.
+ /// </summary>
Center,
+ /// <summary>
+ /// Appears in the bottom of parent.
+ /// </summary>
Bottom,
+ /// <summary>
+ /// Appears in the left of parent.
+ /// </summary>
Left,
+ /// <summary>
+ /// Appears in the right of parent.
+ /// </summary>
Right,
+ /// <summary>
+ /// Appears in the top left of parent.
+ /// </summary>
TopLeft,
+ /// <summary>
+ /// Appears in the top right of parent.
+ /// </summary>
TopRight,
+ /// <summary>
+ /// Appears in the bottom left of parent.
+ /// </summary>
BottomLeft,
+ /// <summary>
+ /// Appears in the bottom right of parent.
+ /// </summary>
BottomRight
}
+ /// <summary>
+ /// The Popup is a widget that is an enhancement of Notify.
+ /// In addition to content area, there are two optional sections, namely title area and action area.
+ /// </summary>
public class Popup : Layout
{
HashSet<PopupItem> _children = new HashSet<PopupItem>();
- Interop.SmartEvent _dismissed;
- Interop.SmartEvent _blockClicked;
- Interop.SmartEvent _timeout;
- Interop.SmartEvent _showFinished;
+ SmartEvent _dismissed;
+ SmartEvent _blockClicked;
+ SmartEvent _timeout;
+ SmartEvent _showFinished;
+ /// <summary>
+ /// Creates and initializes a new instance of the Popup class.
+ /// </summary>
+ /// <param name="parent">The EvasObject to which the new Popup will be attached as a child.</param>
public Popup(EvasObject parent) : base(parent)
{
- _dismissed = new Interop.SmartEvent(this, Handle, "dismissed");
+ _dismissed = new SmartEvent(this, "dismissed");
_dismissed.On += (sender, e) =>
{
Dismissed?.Invoke(this, EventArgs.Empty);
};
- _blockClicked = new Interop.SmartEvent(this, Handle, "block,clicked");
+ _blockClicked = new SmartEvent(this, "block,clicked");
_blockClicked.On += (sender, e) =>
{
OutsideClicked?.Invoke(this, EventArgs.Empty);
};
- _timeout = new Interop.SmartEvent(this, Handle, "timeout");
+ _timeout = new SmartEvent(this, "timeout");
_timeout.On += (sender, e) =>
{
TimedOut?.Invoke(this, EventArgs.Empty);
};
- _showFinished = new Interop.SmartEvent(this, Handle, "show,finished");
+ _showFinished = new SmartEvent(this, "show,finished");
_showFinished.On += (sender, e) =>
{
ShowAnimationFinished?.Invoke(this, EventArgs.Empty);
};
-
}
+ /// <summary>
+ /// Dismissed will be triggered when Popup have been dismissed.
+ /// </summary>
public event EventHandler Dismissed;
+ /// <summary>
+ /// OutsideClicked will be triggered when users taps on the outside of Popup.
+ /// </summary>
public event EventHandler OutsideClicked;
+ /// <summary>
+ /// OutsideClicked will be triggered when Popup is closed as a result of timeout.
+ /// </summary>
public event EventHandler TimedOut;
+ /// <summary>
+ /// OutsideClicked will be triggered when the Popup transition is finished in showing.
+ /// </summary>
public event EventHandler ShowAnimationFinished;
+ /// <summary>
+ /// Sets or gets the position in which Popup will appear in its parent.
+ /// </summary>
public PopupOrientation Orientation
{
get
{
Interop.Elementary.elm_popup_orient_set(Handle, (int)value);
}
-
}
+ /// <summary>
+ /// Sets or gets the wrapping type of content text packed in content area of Popup widget.
+ /// </summary>
public WrapType ContentTextWrapType
{
get
}
}
+ /// <summary>
+ /// Sets or gets the timeout value set to the Popup(in seconds).
+ /// </summary>
+ /// <remarks>
+ /// Since calling Show() on a popup restarts the timer controlling when it is hidden,
+ /// setting this before the popup is shown will in effect mean starting the timer when the popup is shown.
+ /// TimedOut is called afterwards which can be handled if needed.
+ /// Set a value <= 0.0 to disable a running timer.If the value > 0.0 and the popup is previously visible,
+ /// the timer will be started with this value, canceling any running timer.
+ /// </remarks>
public double Timeout
{
get
}
}
+ /// <summary>
+ /// Sets or gets whether events should be passed to event blocked area by a click outside.
+ /// </summary>
+ /// <remarks>
+ /// The visible region of popup is surrounded by a translucent region called Blocked Event area.
+ /// </remarks>
+ public bool AllowEvents
+ {
+ get
+ {
+ return Interop.Elementary.elm_popup_allow_events_get(Handle);
+ }
+ set
+ {
+ Interop.Elementary.elm_popup_allow_events_set(Handle, value);
+ }
+ }
+
+ /// <summary>
+ /// Sets or gets the AlignmentX in which the popup will appear in its parent.
+ /// </summary>
public override double AlignmentX
{
get
}
}
+ /// <summary>
+ /// Sets or gets the AlignmentY in which the popup will appear in its parent.
+ /// </summary>
public override double AlignmentY
{
get
}
}
+ /// <summary>
+ /// Gets the Opacity value of the Popup.
+ /// </summary>
+ public override int Opacity
+ {
+ get
+ {
+ return Color.Default.A;
+ }
+
+ set
+ {
+ Console.WriteLine("Popup instance doesn't support to set Opacity.");
+ }
+ }
+
+ /// <summary>
+ /// Adds label to a Popup widget.
+ /// </summary>
+ /// <param name="label"></param>
+ /// <returns>The new PopupItem which contains label .</returns>
public PopupItem Append(string label)
{
return Append(label, null);
}
+ /// <summary>
+ /// Adds Label and icon to a Popup widget.
+ /// </summary>
+ /// <param name="label">The Label which will be added into a new PopupItem. </param>
+ /// <param name="icon">The icon which will be added into a new PopupItem. </param>
+ /// <returns>The new PopupItem which contains label and icon.</returns>
public PopupItem Append(string label, EvasObject icon)
{
PopupItem item = new PopupItem(label, icon);
return item;
}
+ /// <summary>
+ /// Uses this function to dismiss the popup in hide effect.
+ /// when the Popup is dismissed, the "dismissed" signal will be emitted.
+ /// </summary>
public void Dismiss()
{
Interop.Elementary.elm_popup_dismiss(Handle);
{
return Interop.Elementary.elm_popup_add(parent.Handle);
}
-
void AddInternal(PopupItem item)
{
_children.Add(item);
item.Deleted += Item_Deleted;
}
-
void Item_Deleted(object sender, EventArgs e)
{
_children.Remove((PopupItem)sender);
}
}
-}
+}
\ No newline at end of file