/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
namespace ElmSharp
{
///
/// The FloatingButton is a widget that to add floating area for buttons.
///
public class FloatingButton : Layout
{
///
/// Creates and initializes a new instance of the FloatingButton class.
///
/// Created on this parent container..
public FloatingButton(EvasObject parent) : base(parent)
{
}
///
/// Sets or gets floatingbutton mode.
///
public FloatingButtonMode Mode
{
get
{
return (FloatingButtonMode)Interop.Eext.eext_floatingbutton_mode_get(Handle);
}
set
{
Interop.Eext.eext_floatingbutton_mode_set(Handle, (int)value);
}
}
///
/// Gets floatingbutton Position.
///
public FloatingButtonPosition Position
{
get
{
return (FloatingButtonPosition)Interop.Eext.eext_floatingbutton_pos_get(Handle);
}
}
///
/// Sets or gets movability for a given floatingbutton widget.
///
public bool MovementBlock
{
get
{
return Interop.Eext.eext_floatingbutton_movement_block_get(Handle);
}
set
{
Interop.Eext.eext_floatingbutton_movement_block_set(Handle, value);
}
}
///
/// Get Opacity's value of the given FloatingButton.
///
public override int Opacity
{
get
{
return Color.Default.A;
}
set
{
Console.WriteLine("FloatingButton instance doesn't support to set Opacity.");
}
}
///
/// Set the floatingbutton position with animation or not.
///
/// Button position
/// Animat flag
public void SetPosition(FloatingButtonPosition position, bool animated)
{
if (animated)
{
Interop.Eext.eext_floatingbutton_pos_bring_in(Handle, (int)position);
}
else
{
Interop.Eext.eext_floatingbutton_pos_set(Handle, (int)position);
}
}
protected override IntPtr CreateHandle(EvasObject parent)
{
return Interop.Eext.eext_floatingbutton_add(parent.Handle);
}
}
///
/// Enumeration for FloatingButtonMode
///
public enum FloatingButtonMode
{
///
/// Allows all positions
///
All,
///
/// Allows LEFT and RIGHT positions only
///
LeftRightOnly,
}
///
/// Enumeration for FloatingButtonPosition
///
public enum FloatingButtonPosition
{
///
/// Hides in the left, but small handler will show only
///
LeftOut,
///
/// Shows all of buttons, but lies on the left
///
Left,
///
/// Shows all of buttons, but lies on the center
///
Center,
///
/// Shows all of buttons, but lies on the right
///
Right,
///
/// Hides in the right, but small handler will show only
///
RightOut,
}
}