From 38181af1c7954edae62726da0bdce612796554f9 Mon Sep 17 00:00:00 2001 From: razetime Date: Sat, 4 Nov 2023 12:11:58 +0800 Subject: [PATCH] comboboxes: improve presentation --- extra/ui/gadgets/comboboxes/comboboxes.factor | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/extra/ui/gadgets/comboboxes/comboboxes.factor b/extra/ui/gadgets/comboboxes/comboboxes.factor index b0a185834c..4675ef5f62 100644 --- a/extra/ui/gadgets/comboboxes/comboboxes.factor +++ b/extra/ui/gadgets/comboboxes/comboboxes.factor @@ -1,15 +1,18 @@ -USING: accessors arrays kernel math.rectangles sequences -ui.gadgets.controls models.combinators ui.gadgets ui.gadgets.glass -ui.gadgets.labels ui.gestures ui.tools.common ; +USING: accessors arrays fonts kernel math.rectangles +models.arrow models.combinators namespaces sequences ui.gadgets +ui.gadgets.controls ui.gadgets.glass ui.gadgets.labels +ui.gestures ui.pens.solid ui.tools.common ui.gadgets.borders ; QUALIFIED-WITH: ui.gadgets.tables tbl IN: ui.gadgets.comboboxes TUPLE: combo-table < table spawner ; +: disp-string ( str -- str' ) " ▾ " append " " swap append ; + M: combo-table handle-gesture [ call-next-method drop ] 2keep swap T{ button-down } = [ [ spawner>> ] - [ tbl:selected-row [ swap set-control-value ] [ 2drop ] if ] + [ tbl:selected-row [ disp-string swap set-control-value ] [ 2drop ] if ] [ hide-glass ] tri ] [ drop ] if t ; @@ -20,5 +23,6 @@ combobox H{ } set-gestures : ( options -- combobox ) - [ first [ combobox new-label ] keep >>model ] keep - combo-table new-table white-interior [ 1array ] >>quot >>table ; + [ first [ combobox new-label ] [ disp-string ] bi >>model ] keep + combo-table new-table white-interior [ 1array ] >>quot >>table + default-font-foreground-color get >>boundary ; -- 2.34.1