comboboxes vocab + ui authors, summaries
parent
4c8c1f9626
commit
3cf4f45416
|
@ -46,15 +46,14 @@ mouse-index
|
||||||
{ takes-focus? initial: t }
|
{ takes-focus? initial: t }
|
||||||
focused? ;
|
focused? ;
|
||||||
|
|
||||||
: <table> ( rows renderer -- table )
|
: new-table ( rows renderer class -- table )
|
||||||
table new-line-gadget
|
new-line-gadget swap >>renderer swap >>model
|
||||||
swap >>renderer
|
f <model> >>selected-value sans-serif-font >>font
|
||||||
swap >>model
|
|
||||||
f <model> >>selected-value
|
|
||||||
sans-serif-font >>font
|
|
||||||
focus-border-color >>focus-border-color
|
focus-border-color >>focus-border-color
|
||||||
transparent >>column-line-color ;
|
transparent >>column-line-color ;
|
||||||
|
|
||||||
|
: <table> ( rows renderer -- table ) table new-table ;
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
GENERIC: cell-width ( font cell -- x )
|
GENERIC: cell-width ( font cell -- x )
|
||||||
|
|
|
@ -36,11 +36,11 @@ M: gadget -> dup make:, output-model ;
|
||||||
M: model -> dup , ;
|
M: model -> dup , ;
|
||||||
M: table -> dup , selected-value>> ;
|
M: table -> dup , selected-value>> ;
|
||||||
|
|
||||||
: <box> ( models type -- track )
|
: <box> ( gadgets type -- track )
|
||||||
[ { } make:make ] dip <track> swap dup [ model>> ] map <product>
|
[ { } make:make ] dip <track> swap [ f track-add ] each ; inline
|
||||||
[ [ f track-add ] each ] dip >>model ; inline
|
: <box*> ( gadgets type -- track ) [ <box> ] [ [ model>> ] map <product> ] bi >>model ; inline
|
||||||
: <hbox> ( models -- track ) horizontal <box> ; inline
|
: <hbox> ( gadgets -- track ) horizontal <box> ; inline
|
||||||
: <vbox> ( models -- track ) vertical <box> ; inline
|
: <vbox> ( gadgets -- track ) vertical <box> ; inline
|
||||||
|
|
||||||
! Model utilities
|
! Model utilities
|
||||||
TUPLE: multi-model < model ;
|
TUPLE: multi-model < model ;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Sam Anklesaria
|
|
@ -0,0 +1 @@
|
||||||
|
Really simple dialog boxes
|
|
@ -0,0 +1 @@
|
||||||
|
Sam Anklesaria
|
|
@ -0,0 +1 @@
|
||||||
|
Easily switch between pages of book views
|
|
@ -0,0 +1 @@
|
||||||
|
Sam Anklesaria
|
|
@ -0,0 +1,22 @@
|
||||||
|
USING: accessors arrays kernel math.rectangles models sequences
|
||||||
|
ui.frp ui.gadgets ui.gadgets.glass ui.gadgets.labels
|
||||||
|
ui.gadgets.tables ui.gestures ;
|
||||||
|
IN: ui.gadgets.comboboxes
|
||||||
|
|
||||||
|
TUPLE: combo-table < table spawner ;
|
||||||
|
|
||||||
|
M: combo-table handle-gesture [ call-next-method ] 2keep swap
|
||||||
|
T{ button-up } = [
|
||||||
|
[ spawner>> ]
|
||||||
|
[ selected-value>> value>> [ swap set-control-value ] [ drop ] if* ]
|
||||||
|
[ hide-glass ] tri drop t
|
||||||
|
] [ drop ] if ;
|
||||||
|
|
||||||
|
TUPLE: combobox < label-control table ;
|
||||||
|
combobox H{
|
||||||
|
{ T{ button-down } [ dup table>> over >>spawner <zero-rect> show-glass ] }
|
||||||
|
} set-gestures
|
||||||
|
|
||||||
|
: <combobox> ( options -- combobox ) [ first [ combobox new-label ] keep <model> >>model ] keep
|
||||||
|
[ 1array ] map <model> trivial-renderer combo-table new-table
|
||||||
|
>>table ;
|
|
@ -0,0 +1 @@
|
||||||
|
Comboxes have a model choosen from a list of options
|
Loading…
Reference in New Issue