1 USING: accessors arrays fonts kernel math.rectangles
2 models.arrow models.combinators namespaces sequences ui.gadgets
3 ui.gadgets.controls ui.gadgets.glass ui.gadgets.labels
4 ui.gestures ui.pens.solid ui.tools.common ui.gadgets.borders ;
5 QUALIFIED-WITH: ui.gadgets.tables tbl
6 IN: ui.gadgets.comboboxes
8 TUPLE: combo-table < table spawner ;
10 : disp-string ( str -- str' ) " ▾ " append " " swap append ;
12 M: combo-table handle-gesture
13 [ call-next-method drop ] 2keep swap T{ button-down } = [
15 [ tbl:selected-row [ disp-string swap set-control-value ] [ 2drop ] if ]
19 TUPLE: combobox < label-control table ;
22 { T{ button-up } [ dup table>> over >>spawner <zero-rect> show-glass ] }
25 : <combobox> ( options -- combobox )
26 [ first [ combobox new-label ] [ disp-string <basic> ] bi >>model ] keep
27 <basic> combo-table new-table white-interior [ 1array ] >>quot >>table
28 default-font-foreground-color get <solid> >>boundary ;