mirror of https://github.com/kivy/kivy.git
TextInput: introduce background_normal and background_active properties
used to reffer to the background images depending on state
This commit is contained in:
parent
8530458c99
commit
b0b172aeaa
|
@ -119,10 +119,10 @@
|
|||
Color:
|
||||
rgba: self.background_color
|
||||
BorderImage:
|
||||
border: (16, 16, 16, 16)
|
||||
border: self.border
|
||||
pos: self.pos
|
||||
size: self.size
|
||||
source: 'atlas://data/images/defaulttheme/textinput%s' % ('_active' if self.focus else '')
|
||||
source: self.background_active if self.focus else self.background_normal
|
||||
Color:
|
||||
rgba: (1, 0, 0, 1 if self.focus and not self.cursor_blink else 0)
|
||||
Rectangle:
|
||||
|
|
|
@ -1472,6 +1472,38 @@ class TextInput(Widget):
|
|||
to [0.1843, 0.6549, 0.8313, .5]
|
||||
'''
|
||||
|
||||
border = ListProperty([16, 16, 16, 16])
|
||||
'''Border used for :class:`~kivy.graphics.vertex_instructions.BorderImage`
|
||||
graphics instruction. Used with :data:`background_normal` and
|
||||
:data:`background_active`. Can be used for a custom background.
|
||||
|
||||
It must be a list of four values: (top, right, bottom, left). Read the
|
||||
BorderImage instruction for more information about how to use it.
|
||||
|
||||
:data:`border` is a :class:`~kivy.properties.ListProperty`, default to (16,
|
||||
16, 16, 16)
|
||||
'''
|
||||
|
||||
background_normal = StringProperty(
|
||||
'atlas://data/images/defaulttheme/textinput')
|
||||
'''Background image of the TextInput when it's not in focus'.
|
||||
|
||||
.. versionadded:: 1.4.1
|
||||
|
||||
:data:`background_normal` is a :class:`~kivy.properties.StringProperty`,
|
||||
default to 'atlas://data/images/defaulttheme/textinput'
|
||||
'''
|
||||
|
||||
background_active = StringProperty(
|
||||
'atlas://data/images/defaulttheme/textinput_active')
|
||||
'''Background image of the TextInput when it's in focus'.
|
||||
|
||||
.. versionadded:: 1.4.1
|
||||
|
||||
:data:`background_active` is a :class:`~kivy.properties.StringProperty`,
|
||||
default to 'atlas://data/images/defaulttheme/textinput_active'
|
||||
'''
|
||||
|
||||
background_color = ListProperty([1, 1, 1, 1])
|
||||
'''Current color of the background, in (r, g, b, a) format.
|
||||
|
||||
|
|
Loading…
Reference in New Issue