Paste: Call from <border-button>

Author: tgunr
Mode: factor
Date: Fri, 1 Jan 2021 20:27:05
Plain Text |
! Copyright (C) 2021 Dave Carlton.
! See http://factorcode.org/license.txt for BSD license.

USING: accessors assocs io kernel namespaces sequences splitting
ui ui.gadgets ui.gadgets.borders ui.gadgets.buttons
ui.gadgets.labels ui.gadgets.packs ui.gadgets.scrollers
ui.tools.listener vocabs vocabs.loader ;
IN: theme-edit

SYMBOL: all-themes

: get-themes ( -- seq )
    "ui.theme" >vocab-link all-themes set
    all-themes get words>> keys
    [ "-" split  dup length 2 =
      [ last "theme" = ]
      [ drop f ]
      if
    ] filter
;

: edit-theme ( x -- )
    drop "HERE" print
    ! get-themes 
;

: <run-theme-button> ( theme-name -- button )
    dup '[ [ _ edit-theme ] ] <border-button> ;

: <theme-runner> ( -- gadget )
    <filled-pile> { 2 2 } >>gap
    "Select theme" <label> add-gadget
    "pmn-theme"  <run-theme-button>  add-gadget ;
    ! [ <run-theme-button> add-gadget ] each ;

MAIN-WINDOW: themes { { title "Themes" } }
    <theme-runner> { 2 2 } <border> <scroller> >>gadgets ;

New Annotation

Summary:
Author:
Mode:
Body: