diff --git a/basis/ui/gadgets/buttons/buttons.factor b/basis/ui/gadgets/buttons/buttons.factor index 5304565486..b600352c9b 100644 --- a/basis/ui/gadgets/buttons/buttons.factor +++ b/basis/ui/gadgets/buttons/buttons.factor @@ -231,13 +231,6 @@ PRIVATE> [ ] { 5 5 } >>gap ; -: ( value model label -- gadget ) - border-button-theme ; - -: ( model assoc -- gadget ) - - [ ] ; - : ( target gesture command -- button ) [ command-string swap ] keep '[ _ _ invoke-command drop ] ; @@ -246,8 +239,9 @@ PRIVATE> 1 >>fill { 5 5 } >>gap swap - [ [ "toolbar" ] dip class command-map commands>> ] keep - '[ [ _ ] 2dip add-gadget ] assoc-each ; + [ [ "toolbar" ] dip class command-map commands>> ] + [ '[ [ _ ] 2dip add-gadget ] ] + bi assoc-each ; : add-toolbar ( track -- track ) dup { 3 3 } align-left f track-add ; diff --git a/basis/ui/gadgets/tabbed/tabbed.factor b/basis/ui/gadgets/tabbed/tabbed.factor index 07c33bd796..15402149fc 100644 --- a/basis/ui/gadgets/tabbed/tabbed.factor +++ b/basis/ui/gadgets/tabbed/tabbed.factor @@ -1,25 +1,61 @@ -! Copyright (C) 2008 Slava Pestov. +! Copyright (C) 2008, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: ui.gadgets.tracks ui.gadgets.buttons ui.gadgets.books -ui.gadgets.packs ui.gadgets sequences models accessors kernel ; +USING: ui.pens ui.gadgets.tracks ui.gadgets.buttons +ui.gadgets.buttons.private ui.gadgets.books ui.gadgets.packs +ui.gadgets.borders ui.gadgets.icons ui.gadgets.theme ui.gadgets +sequences models accessors kernel colors colors.constants ; IN: ui.gadgets.tabbed TUPLE: tabbed-gadget < track tabs book ; -: ( -- gadget ) - vertical tabbed-gadget new-track - 0 >>model - >>tabs - dup tabs>> f track-add - dup model>> >>book - dup book>> 1 track-add ; + ( -- gadget ) + "active-tab-lip" theme-image + dup interior>> t >>fill? drop ; + +CONSTANT: active-tab-background + T{ rgba + f + 0.6745098039215687 + 0.6549019607843137 + 0.5764705882352941 + 1.0 + } + +: ( -- pen ) + "inactive-tab" button-background f dup dup + "active-tab" active-tab-background f dup + ; + +: tab-theme ( gadget -- gadget ) + horizontal >>orientation + >>interior + dup dup interior>> pen-pref-dim >>min-dim + { 30 0 } >>size ; inline + +: ( value model label -- gadget ) + tab-theme ; : add-tab/book ( tabbed child -- tabbed ) [ dup book>> ] dip add-gadget drop ; : add-tab/button ( tabbed label -- tabbed ) [ [ dup tabs>> dup children>> length ] [ model>> ] bi ] dip - add-gadget drop ; + add-gadget drop ; + +PRIVATE> + +: ( -- gadget ) + vertical tabbed-gadget new-track + 0 >>model + >>tabs + horizontal + over tabs>> f track-add + 1 track-add + f track-add + dup model>> >>book + dup book>> { 3 3 } 1 track-add ; : add-tab ( tabbed child label -- tabbed ) [ add-tab/book ] [ add-tab/button ] bi* ; diff --git a/basis/ui/pens/image/image.factor b/basis/ui/pens/image/image.factor index 217265a81f..6d0e5c1d0c 100644 --- a/basis/ui/pens/image/image.factor +++ b/basis/ui/pens/image/image.factor @@ -12,7 +12,7 @@ TUPLE: image-pen image fill? ; M: image-pen draw-interior [ dim>> ] [ [ image>> ] [ fill?>> ] bi ] bi* [ draw-scaled-image ] [ - [ image-dim [ - 2/ ] 2map ] keep + [ image-dim [ - 2 /i ] 2map ] keep '[ _ draw-image ] with-translation ] if ; diff --git a/basis/ui/tools/profiler/profiler.factor b/basis/ui/tools/profiler/profiler.factor index 50ac702fcb..3c4ce6470b 100644 --- a/basis/ui/tools/profiler/profiler.factor +++ b/basis/ui/tools/profiler/profiler.factor @@ -8,7 +8,7 @@ ui.gadgets.panes ui.gadgets.scrollers ui.gadgets.tracks ui.gestures ui.gadgets.buttons ui.gadgets.tables ui.gadgets.search-tables ui.gadgets.labeled ui.gadgets.buttons ui.gadgets.packs ui.gadgets.labels ui.gadgets.tabbed ui.gadgets.status-bar -ui.tools.browser ui.tools.common ; +ui.gadgets.borders ui.tools.browser ui.tools.common ; FROM: models.filter => ; FROM: models.compose => ; IN: ui.tools.profiler @@ -98,18 +98,23 @@ M: method-renderer row-value drop first ; } ; : ( model -- gadget ) - sort-options horizontal >>orientation ; - -: ( profiler -- gadget ) +baseline+ >>align { 5 5 } >>gap - over add-gadget "Sort by:"