Source code for enamlnative.ios.uikit_activity_indicator
"""
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
from enamlnative.widgets.activity_indicator import ProxyActivityIndicator
from .bridge import ObjcMethod, ObjcProperty
from .uikit_view import UIView, UiKitView
[docs]class UIActivityIndicatorView(UIView):
#: Properties
color = ObjcProperty('UIColor')
activityIndicatorViewStyle = ObjcProperty('UIActivityIndicatorViewStyle')
startAnimating = ObjcMethod()
stopAnimating = ObjcMethod()
[docs]class UiKitActivityIndicator(UiKitView, ProxyActivityIndicator):
""" An UiKit implementation of an Enaml ProxyToolkitObject.
"""
#: A reference to the toolkit widget created by the proxy.
widget = Typed(UIActivityIndicatorView)
# -------------------------------------------------------------------------
# Initialization API
# -------------------------------------------------------------------------
self.widget = UIActivityIndicatorView()
[docs] def init_widget(self):
""" Initialize the state of the toolkit widget.
This method is called during the top-down pass, just after the
'create_widget()' method is called. This method should init the
state of the widget. The child widgets will not yet be created.
"""
super(UiKitActivityIndicator, self).init_widget()
d = self.declaration
if d.size != 'normal':
self.set_size(d.size)
if d.color:
self.set_color(d.color)
#: Why would you want to stop an activity indicator?
self.widget.startAnimating()
# -------------------------------------------------------------------------
# ProxyActivityIndicator API
# -------------------------------------------------------------------------
pass
#self.widget.activityIndicatorViewStyle = style
self.widget.color = color