diff --git a/basis/ui/gadgets/corners/authors.txt b/basis/ui/gadgets/corners/authors.txt new file mode 100644 index 0000000000..d4f5d6b3ae --- /dev/null +++ b/basis/ui/gadgets/corners/authors.txt @@ -0,0 +1 @@ +Slava Pestov \ No newline at end of file diff --git a/basis/ui/gadgets/corners/corners.factor b/basis/ui/gadgets/corners/corners.factor new file mode 100644 index 0000000000..7f558fca19 --- /dev/null +++ b/basis/ui/gadgets/corners/corners.factor @@ -0,0 +1,43 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors kernel sequences namespaces ui.gadgets.frames +ui.pens.image ui.gadgets.icons ui.gadgets.grids ; +IN: ui.gadgets.corners + +CONSTANT: @center { 1 1 } +CONSTANT: @left { 0 1 } +CONSTANT: @right { 2 1 } +CONSTANT: @top { 1 0 } +CONSTANT: @bottom { 1 2 } + +CONSTANT: @top-left { 0 0 } +CONSTANT: @top-right { 2 0 } +CONSTANT: @bottom-left { 0 2 } +CONSTANT: @bottom-right { 2 2 } + +SYMBOL: name + +: corner-image ( name -- image ) + [ name get "-" ] dip 3append theme-image ; + +: corner-icon ( name -- icon ) + corner-image ; + +: /-----\ ( corner -- corner ) + "top-left" corner-icon @top-left grid-add + "top-middle" corner-icon @top grid-add + "top-right" corner-icon @top-right grid-add ; + +: |-----| ( gadget corner -- corner ) + "left-edge" corner-icon @left grid-add + swap @center grid-add + "right-edge" corner-icon @right grid-add ; + +: \-----/ ( corner -- corner ) + "bottom-left" corner-icon @bottom-left grid-add + "bottom-middle" corner-icon @bottom grid-add + "bottom-right" corner-icon @bottom-right grid-add ; + +: make-corners ( class name quot -- corners ) + [ [ [ 3 3 ] dip new-frame { 1 1 } >>filled-cell ] dip name ] dip + with-variable ; inline \ No newline at end of file diff --git a/basis/ui/gadgets/labeled/labeled.factor b/basis/ui/gadgets/labeled/labeled.factor index 319fd8cf70..7f98e1170b 100644 --- a/basis/ui/gadgets/labeled/labeled.factor +++ b/basis/ui/gadgets/labeled/labeled.factor @@ -2,67 +2,33 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors kernel sequences colors fonts ui.gadgets ui.gadgets.frames ui.gadgets.grids ui.gadgets.icons ui.gadgets.labels -ui.gadgets.borders ui.pens.image ; +ui.gadgets.borders ui.pens.image ui.gadgets.corners ui.render ; IN: ui.gadgets.labeled TUPLE: labeled-gadget < frame content ; ; - -CONSTANT: labeled-title-background - T{ rgba f - 0.7843137254901961 - 0.7686274509803922 - 0.7176470588235294 - 1.0 - } - : ( gadget -- label ) >label - [ labeled-title-background font-with-background ] change-font + [ panel-background-color font-with-background ] change-font { 0 2 } - "title-middle" labeled-image + "title-middle" corner-image t >>fill? >>interior ; : /-FOO-\ ( title labeled -- labeled ) - "title-left" labeled-icon @top-left grid-add + "title-left" corner-icon @top-left grid-add swap @top grid-add - "title-right" labeled-icon @top-right grid-add ; - -: |-----| ( gadget labeled -- labeled ) - "left-edge" labeled-icon @left grid-add - swap [ >>content ] [ @center grid-add ] bi - "right-edge" labeled-icon @right grid-add ; - -: \-----/ ( labeled -- labeled ) - "bottom-left" labeled-icon @bottom-left grid-add - "bottom-middle" labeled-icon @bottom grid-add - "bottom-right" labeled-icon @bottom-right grid-add ; + "title-right" corner-icon @top-right grid-add ; M: labeled-gadget focusable-child* content>> ; PRIVATE> : ( gadget title -- newgadget ) - 3 3 labeled-gadget new-frame - { 1 1 } >>filled-cell + labeled-gadget "labeled-block" [ + over >>content /-FOO-\ |-----| - \-----/ ; + \-----/ + ] make-corners ; diff --git a/basis/ui/gadgets/menus/menus.factor b/basis/ui/gadgets/menus/menus.factor index a0038b55e5..734190e7e7 100644 --- a/basis/ui/gadgets/menus/menus.factor +++ b/basis/ui/gadgets/menus/menus.factor @@ -1,10 +1,11 @@ ! Copyright (C) 2005, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: colors.constants kernel locals math.rectangles -namespaces sequences ui.commands ui.gadgets ui.gadgets.borders -ui.gadgets.buttons ui.gadgets.glass ui.gadgets.packs -ui.gadgets.worlds ui.gestures ui.operations ui.pens ui.pens.solid -opengl math.vectors words accessors math math.order sorting ; +USING: colors.constants kernel locals math.rectangles namespaces +sequences ui.commands ui.gadgets ui.gadgets.borders ui.gadgets.buttons +ui.gadgets.glass ui.gadgets.packs ui.gadgets.frames ui.gadgets.worlds +ui.gadgets.frames ui.gadgets.corners ui.gestures ui.operations +ui.render ui.pens ui.pens.solid opengl math.vectors words accessors +math math.order sorting ; IN: ui.gadgets.menus : show-menu ( owner menu -- ) @@ -30,6 +31,10 @@ M: separator-pen draw-interior dim>> [ { 0 0.5 } v* ] [ { 1 0.5 } v* ] bi [ [ >integer ] map ] bi@ gl-line ; +: ( items -- gadget ) + [ ] dip add-gadgets + panel-background-color >>interior ; + PRIVATE> SINGLETON: ---- @@ -43,10 +48,16 @@ M: ---- : menu-theme ( gadget -- gadget ) COLOR: light-gray >>interior ; +: ( gadgets -- menu ) + + frame "menu-background" [ + /-----\ + |-----| + \-----/ + ] make-corners ; + : ( target hook commands -- menu ) - [ ] 3dip - [ add-gadget ] with with each - { 5 5 } menu-theme ; + [ ] with with map ; : show-commands-menu ( target commands -- ) [ dup [ ] ] dip show-menu ; diff --git a/basis/ui/gadgets/theme/menu-background-bottom-left.tiff b/basis/ui/gadgets/theme/menu-background-bottom-left.tiff new file mode 100644 index 0000000000..7052039059 Binary files /dev/null and b/basis/ui/gadgets/theme/menu-background-bottom-left.tiff differ diff --git a/basis/ui/gadgets/theme/menu-background-bottom-middle.tiff b/basis/ui/gadgets/theme/menu-background-bottom-middle.tiff new file mode 100644 index 0000000000..a004654a63 Binary files /dev/null and b/basis/ui/gadgets/theme/menu-background-bottom-middle.tiff differ diff --git a/basis/ui/gadgets/theme/menu-background-bottom-right.tiff b/basis/ui/gadgets/theme/menu-background-bottom-right.tiff new file mode 100644 index 0000000000..07658beed6 Binary files /dev/null and b/basis/ui/gadgets/theme/menu-background-bottom-right.tiff differ diff --git a/basis/ui/gadgets/theme/menu-background-left-edge.tiff b/basis/ui/gadgets/theme/menu-background-left-edge.tiff new file mode 100644 index 0000000000..81d582090d Binary files /dev/null and b/basis/ui/gadgets/theme/menu-background-left-edge.tiff differ diff --git a/basis/ui/gadgets/theme/menu-background-right-edge.tiff b/basis/ui/gadgets/theme/menu-background-right-edge.tiff new file mode 100644 index 0000000000..61a70be789 Binary files /dev/null and b/basis/ui/gadgets/theme/menu-background-right-edge.tiff differ diff --git a/basis/ui/gadgets/theme/menu-background-top-left.tiff b/basis/ui/gadgets/theme/menu-background-top-left.tiff new file mode 100644 index 0000000000..78ead4d1f0 Binary files /dev/null and b/basis/ui/gadgets/theme/menu-background-top-left.tiff differ diff --git a/basis/ui/gadgets/theme/menu-background-top-middle.tiff b/basis/ui/gadgets/theme/menu-background-top-middle.tiff new file mode 100644 index 0000000000..ba5fffe42f Binary files /dev/null and b/basis/ui/gadgets/theme/menu-background-top-middle.tiff differ diff --git a/basis/ui/gadgets/theme/menu-background-top-right.tiff b/basis/ui/gadgets/theme/menu-background-top-right.tiff new file mode 100644 index 0000000000..1831a32145 Binary files /dev/null and b/basis/ui/gadgets/theme/menu-background-top-right.tiff differ diff --git a/basis/ui/gadgets/theme/selected-menu-item-background-bottom-left.tiff b/basis/ui/gadgets/theme/selected-menu-item-background-bottom-left.tiff new file mode 100644 index 0000000000..eca211b038 Binary files /dev/null and b/basis/ui/gadgets/theme/selected-menu-item-background-bottom-left.tiff differ diff --git a/basis/ui/gadgets/theme/selected-menu-item-background-bottom-middle.tiff b/basis/ui/gadgets/theme/selected-menu-item-background-bottom-middle.tiff new file mode 100644 index 0000000000..b666be1be0 Binary files /dev/null and b/basis/ui/gadgets/theme/selected-menu-item-background-bottom-middle.tiff differ diff --git a/basis/ui/gadgets/theme/selected-menu-item-background-bottom-right.tiff b/basis/ui/gadgets/theme/selected-menu-item-background-bottom-right.tiff new file mode 100644 index 0000000000..788781bb9e Binary files /dev/null and b/basis/ui/gadgets/theme/selected-menu-item-background-bottom-right.tiff differ diff --git a/basis/ui/gadgets/theme/selected-menu-item-background-left-edge.tiff b/basis/ui/gadgets/theme/selected-menu-item-background-left-edge.tiff new file mode 100644 index 0000000000..61371da228 Binary files /dev/null and b/basis/ui/gadgets/theme/selected-menu-item-background-left-edge.tiff differ diff --git a/basis/ui/gadgets/theme/selected-menu-item-background-right-edge.tiff b/basis/ui/gadgets/theme/selected-menu-item-background-right-edge.tiff new file mode 100644 index 0000000000..51bda474a1 Binary files /dev/null and b/basis/ui/gadgets/theme/selected-menu-item-background-right-edge.tiff differ diff --git a/basis/ui/gadgets/theme/selected-menu-item-background-top-left.tiff b/basis/ui/gadgets/theme/selected-menu-item-background-top-left.tiff new file mode 100644 index 0000000000..f86aafb04d Binary files /dev/null and b/basis/ui/gadgets/theme/selected-menu-item-background-top-left.tiff differ diff --git a/basis/ui/gadgets/theme/selected-menu-item-background-top-middle.tiff b/basis/ui/gadgets/theme/selected-menu-item-background-top-middle.tiff new file mode 100644 index 0000000000..8beab3c8a2 Binary files /dev/null and b/basis/ui/gadgets/theme/selected-menu-item-background-top-middle.tiff differ diff --git a/basis/ui/gadgets/theme/selected-menu-item-background-top-right.tiff b/basis/ui/gadgets/theme/selected-menu-item-background-top-right.tiff new file mode 100644 index 0000000000..dacb50d121 Binary files /dev/null and b/basis/ui/gadgets/theme/selected-menu-item-background-top-right.tiff differ diff --git a/basis/ui/render/render.factor b/basis/ui/render/render.factor index d083b70908..e41bfa5345 100755 --- a/basis/ui/render/render.factor +++ b/basis/ui/render/render.factor @@ -112,4 +112,12 @@ M: gadget draw-children CONSTANT: selection-color T{ rgba f 0.8 0.8 1.0 1.0 } +CONSTANT: panel-background-color + T{ rgba f + 0.7843137254901961 + 0.7686274509803922 + 0.7176470588235294 + 1.0 + } + CONSTANT: focus-border-color COLOR: dark-gray