"""
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 25, 2017
@author: jrm
"""
from atom.api import Typed
from enamlnative.widgets.compound_button import ProxyCompoundButton
from .bridge import ObjcMethod, ObjcProperty, ObjcCallback
from .uikit_text_view import UITextView, UiKitTextView
[docs]class UIControl(UITextView):
#: Properties
enabled = ObjcProperty('bool')
selected = ObjcProperty('bool')
highlighted = ObjcProperty('bool')
contentVerticalAlignment = ObjcProperty(
'UIControlContentVerticalAlignment')
contentHorizontalAlignment = ObjcProperty(
'UIControlContentHorizontalAlignment')
#setProgress = ObjcMethod('float', dict(animated='bool'))
addTarget = ObjcMethod('id',
dict(action="SEL"),
dict(forControlEvents="enum"))#""UIControlEvents"))
onClicked = ObjcCallback()
#: UIControlEvents enum
UIControlEventTouchDown = 1 << 0
UIControlEventTouchDownRepeat = 1 << 1
UIControlEventTouchDragInside = 1 << 2
UIControlEventTouchDragOutside = 1 << 3
UIControlEventTouchDragEnter = 1 << 4
UIControlEventTouchDragExit = 1 << 5
UIControlEventTouchUpInside = 1 << 6
UIControlEventTouchUpOutside = 1 << 7
UIControlEventTouchCancel = 1 << 8
UIControlEventValueChanged = 1 << 12
UIControlEventPrimaryActionTriggered = 1 << 13
UIControlEventEditingDidBegin = 1 << 16
UIControlEventEditingChanged = 1 << 17
UIControlEventEditingDidEnd = 1 << 18
UIControlEventEditingDidEndOnExit = 1 << 19
UIControlEventAllTouchEvents = 0x00000FFF
UIControlEventAllEditingEvents = 0x000F0000
UIControlEventApplicationReserved = 0x0F000000
UIControlEventSystemReserved = 0xF0000000
UIControlEventAllEvents = 0xFFFFFFFF
UIControlStateNormal = 0
UIControlStateHighlighted = 1 << 0
UIControlStateDisabled = 1 << 1
UIControlStateSelected = 1 << 2
UIControlStateFocused = 1 << 3
UIControlStateApplication = 0x00FF0000
UIControlStateReserved = 0xFF000000
[docs]class UiKitControl(UiKitTextView, ProxyCompoundButton):
""" A UiKitControl helper class.
"""
#: A reference to the toolkit widget created by the proxy.
widget = Typed(UIControl)
# -------------------------------------------------------------------------
# Initialization API
# -------------------------------------------------------------------------
self.widget = UIControl()
self.widget.onClicked.connect(self.on_clicked)
# -------------------------------------------------------------------------
# Clicked API
# -------------------------------------------------------------------------
[docs] def on_clicked(self):
d = self.declaration
d.clicked()