Source code for enamlnative.ios.uikit_flexbox
"""
Copyright (c) 2017, CodeLV.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on Aug 3, 2017
@author: jrm
"""
from atom.api import Typed, set_default
from enamlnative.widgets.flexbox import ProxyFlexbox
from .uikit_view import UIView, UiKitView
from .yoga import Yoga
__nativeclass__ = set_default("UIView")
[docs]class UiKitFlexbox(UiKitView, ProxyFlexbox):
""" An UiKit implementation of an Enaml ProxyToolkitObject.
"""
#: A reference to the toolkit layout created by the proxy.
widget = Typed(UIFlexbox)
# -------------------------------------------------------------------------
# Initialization API
# -------------------------------------------------------------------------
self.widget = UIFlexbox()
self.widget.yoga.applyLayoutPreservingOrigin(True)
# -------------------------------------------------------------------------
# ProxyFlexbox API
# -------------------------------------------------------------------------
self.widget.yoga.alignContent = Yoga.ALIGN_CONTENT[alignment]
self.widget.yoga.alignItems = Yoga.ALIGN_ITEMS[alignment]
self.widget.yoga.flexDirection = Yoga.FLEX_DIRECTION[direction]
self.widget.flexWrap = Yoga.FLEX_WRAP[wrap]
self.widget.yoga.justifyContent = Yoga.JUSTIFY_CONTENT[justify]