Update SDL driver: Enlarge char, attr to 32 bits, 64 bits per terminal cell. Colors and attributes are complete, only blink does not work.
# -*- coding: utf-8 -*-
from tuikit.container import Container
from tuikit.editfield import EditField
from tuikit.button import Button
from tuikit.menu import Menu
class ComboBox(Container):
def __init__(self, width=15, value='', items=[]):
Container.__init__(self, width, 1)
self.allow_focus = True
self.colorprefix = 'combo:'
self._edit = EditField(width - 3, value)
self.add(self._edit)
self._btn = Button('v')
self._btn.prefix = ''
self._btn.suffix = ''
self._btn.x = width - 3
self._btn.width = 3
self._btn.add_handler('click', self._on_btn_click)
self.add(self._btn)
self._menu = Menu(items)
self._menu.hide()
self._menu.allow_layout = False
def _set_top(self, value):
Container._set_top(self, value)
self.top.add(self._menu)
def _on_btn_click(self, ev):
self._menu.show()