comboboxes vocab + ui authors, summaries

db4
Sam Anklesaria 2009-04-29 14:19:30 -05:00
parent 4c8c1f9626
commit 3cf4f45416
9 changed files with 40 additions and 13 deletions

View File

@ -46,14 +46,13 @@ mouse-index
{ takes-focus? initial: t }
focused? ;
: <table> ( rows renderer -- table )
table new-line-gadget
swap >>renderer
swap >>model
f <model> >>selected-value
sans-serif-font >>font
focus-border-color >>focus-border-color
transparent >>column-line-color ;
: new-table ( rows renderer class -- table )
new-line-gadget swap >>renderer swap >>model
f <model> >>selected-value sans-serif-font >>font
focus-border-color >>focus-border-color
transparent >>column-line-color ;
: <table> ( rows renderer -- table ) table new-table ;
<PRIVATE

View File

@ -36,11 +36,11 @@ M: gadget -> dup make:, output-model ;
M: model -> dup , ;
M: table -> dup , selected-value>> ;
: <box> ( models type -- track )
[ { } make:make ] dip <track> swap dup [ model>> ] map <product>
[ [ f track-add ] each ] dip >>model ; inline
: <hbox> ( models -- track ) horizontal <box> ; inline
: <vbox> ( models -- track ) vertical <box> ; inline
: <box> ( gadgets type -- track )
[ { } make:make ] dip <track> swap [ f track-add ] each ; inline
: <box*> ( gadgets type -- track ) [ <box> ] [ [ model>> ] map <product> ] bi >>model ; inline
: <hbox> ( gadgets -- track ) horizontal <box> ; inline
: <vbox> ( gadgets -- track ) vertical <box> ; inline
! Model utilities
TUPLE: multi-model < model ;

View File

@ -0,0 +1 @@
Sam Anklesaria

View File

@ -0,0 +1 @@
Really simple dialog boxes

View File

@ -0,0 +1 @@
Sam Anklesaria

View File

@ -0,0 +1 @@
Easily switch between pages of book views

View File

@ -0,0 +1 @@
Sam Anklesaria

View File

@ -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 ;

View File

@ -0,0 +1 @@
Comboxes have a model choosen from a list of options