Permalink
Browse files

mail-ui: Add support for "tabbing" between UI elements.

  • Loading branch information...
mrjbq7 committed Apr 17, 2011
1 parent 9b6f6e5 commit c56a0f1ec072e2171336016b0be224e8278e883a
Showing with 40 additions and 5 deletions.
  1. +40 −5 mail-ui/mail-ui.factor
View
@@ -1,13 +1,40 @@
! Copyright (C) 2011 John Benediktsson
! See http://factorcode.org/license.txt for BSD license
USING: accessors arrays colors colors.constants kernel smtp ui
USING: accessors arrays colors.constants kernel smtp ui
ui.commands ui.gadgets ui.gadgets.borders ui.gadgets.buttons
ui.gadgets.editors ui.gadgets.labels ui.gadgets.scrollers
ui.gadgets.tracks ui.pens.solid ;
ui.gadgets.tracks ui.gestures ui.pens.solid ;
IN: mail-ui
<PRIVATE
TUPLE: tabbing-editor < editor next-editor prev-editor ;
: <tabbing-editor> ( -- editor )
tabbing-editor new-editor ;
TUPLE: tabbing-multiline-editor < multiline-editor next-editor prev-editor ;
: <tabbing-multiline-editor> ( -- editor )
tabbing-multiline-editor new-editor ;
: com-prev ( editor -- )
prev-editor>> [ request-focus ] when* ;
: com-next ( editor -- )
next-editor>> [ request-focus ] when* ;
tabbing-editor tabbing-multiline-editor [
"editing" f {
{ T{ key-down f f "TAB" } com-next }
{ T{ key-down f { S+ } "TAB" } com-prev }
} define-command-map
] bi@
PRIVATE>
TUPLE: mail-gadget < track to subject body ;
M: mail-gadget focusable-child* to>> ;
@@ -41,13 +68,21 @@ mail-gadget "toolbar" f {
1 >>fill
{ 10 10 } >>gap
<editor> >>to
<editor> >>subject
<multiline-editor>
<tabbing-editor> >>to
<tabbing-editor> >>subject
<tabbing-multiline-editor>
10 >>min-rows
60 >>min-cols
>>body
dup to>> over subject>> >>next-editor drop
dup to>> over body>> >>prev-editor drop
dup subject>> over body>> >>next-editor drop
dup subject>> over to>> >>prev-editor drop
dup body>> over subject>> >>prev-editor drop
dup <to> f track-add
dup <subject> f track-add
dup <body> 1 track-add

0 comments on commit c56a0f1

Please sign in to comment.