Kill ui.gadgets.theme

db4
Slava Pestov 2009-02-14 19:50:22 -06:00
parent 6bbb4630f3
commit 9ebc487f44
18 changed files with 44 additions and 102 deletions

View File

@ -17,13 +17,13 @@ HELP: <roll-button>
{ $values { "label" "a label specifier" } { "quot" { $quotation "( button -- )" } } { "button" button } }
{ $description "Creates a new " { $link button } " which is displayed with a solid border when it is under the mouse, informing the user that the gadget is clickable." } ;
HELP: <bevel-button>
HELP: <border-button>
{ $values { "label" "a label specifier" } { "quot" { $quotation "( button -- )" } } { "button" button } }
{ $description "Creates a new " { $link button } " with a shaded border which is always visible. The button appearance changes in response to mouse gestures using a " { $link button-pen } "." } ;
{ $description "Creates a new " { $link button } " with a border which is always visible. The button appearance changes in response to mouse gestures using a " { $link button-pen } "." } ;
HELP: <repeat-button>
{ $values { "label" object } { "quot" { $quotation "( button -- )" } } { "button" repeat-button } }
{ $description "Creates a new " { $link button } " derived from a " { $link <bevel-button> } " which calls the quotation every 100 milliseconds as long as the mouse button is held down." } ;
{ $description "Creates a new " { $link button } " derived from a " { $link <border-button> } " which calls the quotation every 100 milliseconds as long as the mouse button is held down." } ;
HELP: button-pen
{ $class-description "A class implementing the " { $link draw-boundary } " and " { $link draw-interior } " gneeric words by delegating to an object in one of four slots which depend on the state of the button being drawn:"
@ -33,12 +33,12 @@ HELP: button-pen
{ { $snippet "pressed" } " - the button is under the mouse and a mouse button is held down" }
{ { $snippet "selected" } " - the button is selected (see " { $link <toggle-buttons> } }
}
"The " { $link <roll-button> } " and " { $link <bevel-button> } " words create " { $link button } " instances with specific " { $link button-pen } "." } ;
"The " { $link <roll-button> } " and " { $link <border-button> } " words create " { $link button } " instances with specific " { $link button-pen } "." } ;
HELP: <toggle-button>
{ $values { "model" model } { "value" object } { "label" "a label specifier" } { "gadget" gadget } }
{ $description
"Creates a " { $link <bevel-button> } " which sets the model's value to " { $snippet "value" } " when pressed. After being pressed, the button becomes selected until the value of the model changes again."
"Creates a " { $link <border-button> } " which sets the model's value to " { $snippet "value" } " when pressed. After being pressed, the button becomes selected until the value of the model changes again."
}
{ $notes "Typically a row of radio controls should be built together using " { $link <toggle-buttons> } "." } ;
@ -48,7 +48,7 @@ HELP: <toggle-buttons>
HELP: <command-button>
{ $values { "target" object } { "gesture" "a gesture" } { "command" "a command" } { "button" "a new " { $link button } } }
{ $description "Creates a " { $link <bevel-button> } " which invokes the command on " { $snippet "target" } " when clicked." } ;
{ $description "Creates a " { $link <border-button> } " which invokes the command on " { $snippet "target" } " when clicked." } ;
HELP: <toolbar>
{ $values { "target" object } { "toolbar" gadget } }
@ -60,7 +60,7 @@ ARTICLE: "ui.gadgets.buttons" "Button gadgets"
"There are many ways to create a new button:"
{ $subsection <button> }
{ $subsection <roll-button> }
{ $subsection <bevel-button> }
{ $subsection <border-button> }
{ $subsection <repeat-button> }
"Gadgets for invoking commands:"
{ $subsection <command-button> }

View File

@ -3,7 +3,7 @@
USING: accessors arrays kernel math models namespaces sequences
strings quotations assocs combinators classes colors colors.constants
classes.tuple opengl opengl.gl math.vectors ui.commands ui.gadgets
ui.gadgets.borders ui.gadgets.labels ui.gadgets.theme
ui.gadgets.borders ui.gadgets.labels
ui.gadgets.tracks ui.gadgets.packs ui.gadgets.worlds ui.gestures
ui.pens ui.pens.solid ui.pens.image math.rectangles locals
fry combinators.smart ;
@ -90,7 +90,7 @@ M: button-pen pen-pref-dim
: <roll-button> ( label quot -- button )
<button> roll-button-theme ;
: <bevel-button-paint> ( -- paint )
: <border-button-pen> ( -- paint )
plain-gradient
rollover-gradient
pressed-gradient
@ -98,13 +98,13 @@ M: button-pen pen-pref-dim
selected-gradient
<button-pen> ;
: bevel-button-theme ( gadget -- gadget )
<bevel-button-paint> >>interior
: border-button-theme ( gadget -- gadget )
<border-button-pen> >>interior
{ 5 5 } >>size
faint-boundary ; inline
: <bevel-button> ( label quot -- button )
<button> bevel-button-theme ;
: <border-button> ( label quot -- button )
<button> border-button-theme ;
TUPLE: repeat-button < button ;
@ -117,7 +117,7 @@ repeat-button H{
: <repeat-button> ( label quot -- button )
#! Button that calls the quotation every 100ms as long as
#! the mouse is held down.
repeat-button new-button bevel-button-theme ;
repeat-button new-button border-button-theme ;
: <checkmark-paint> ( -- pen )
"checkbox" theme-image <image-pen>
@ -184,7 +184,7 @@ M: radio-control model-changed
{ 5 5 } >>gap ;
: <toggle-button> ( value model label -- gadget )
<radio-control> bevel-button-theme ;
<radio-control> border-button-theme ;
: <toggle-buttons> ( model assoc -- gadget )
<shelf>
@ -194,7 +194,7 @@ M: radio-control model-changed
'[ _ _ invoke-command drop ] ;
: <command-button> ( target gesture command -- button )
[ command-string swap ] keep command-button-quot <bevel-button> ;
[ command-string swap ] keep command-button-quot <border-button> ;
: <toolbar> ( target -- toolbar )
<shelf>

View File

@ -1,6 +1,6 @@
! Copyright (C) 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: ui.backend ui.gadgets ui.gadgets.theme
USING: ui.backend ui.gadgets
ui.gadgets.worlds ui.render opengl opengl.gl kernel namespaces
classes.tuple colors accessors ;
IN: ui.gadgets.canvas
@ -8,7 +8,7 @@ IN: ui.gadgets.canvas
TUPLE: canvas < gadget dlist ;
: new-canvas ( class -- canvas )
new-gadget black solid-interior ; inline
new-gadget black <solid> >>interior ; inline
: delete-canvas-dlist ( canvas -- )
[ find-gl-context ]

View File

@ -18,7 +18,7 @@ M: baseline-gadget baseline baseline>> ;
: <bad-button> ( -- button )
"Click me if you dare"
[ "Haha" throw ]
<bevel-button> ;
<border-button> ;
TUPLE: bad-gadget < gadget ;

View File

@ -6,7 +6,7 @@ opengl.gl sequences strings math.vectors math.functions sorting colors
colors.constants combinators assocs math.order fry calendar alarms
continuations ui.clipboards ui.commands ui.gadgets ui.gadgets.borders
ui.gadgets.buttons ui.gadgets.labels ui.gadgets.scrollers
ui.gadgets.theme ui.gadgets.menus ui.gadgets.wrappers ui.render
ui.gadgets.menus ui.gadgets.wrappers ui.render
ui.pens.solid ui.gadgets.line-support ui.text ui.gestures
math.rectangles splitting unicode.categories fonts grouping ;
IN: ui.gadgets.editors

View File

@ -2,7 +2,7 @@
! 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.theme ui.gadgets.borders ui.pens.image ;
ui.gadgets.borders ui.pens.image ;
IN: ui.gadgets.labeled
TUPLE: labeled-gadget < frame content ;
@ -15,7 +15,6 @@ TUPLE: labeled-gadget < frame content ;
: labeled-icon ( name -- icon )
labeled-image <icon> dup interior>> t >>fill? drop ;
CONSTANT: labeled-title-background
T{ rgba f
0.7843137254901961

View File

@ -3,7 +3,7 @@
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.theme ui.gadgets.worlds ui.gestures ui.operations ;
ui.gadgets.worlds ui.gestures ui.operations ;
IN: ui.gadgets.menus
: show-menu ( owner menu -- )
@ -17,8 +17,7 @@ IN: ui.gadgets.menus
] <roll-button> ;
: menu-theme ( gadget -- gadget )
COLOR: light-gray solid-interior
faint-boundary ;
COLOR: light-gray <solid> >>interior ;
: <commands-menu> ( target hook commands -- menu )
[ <filled-pile> ] 3dip

View File

@ -6,7 +6,7 @@ sorting splitting assocs classes.tuple models continuations
destructors accessors math.rectangles fry fonts ui.images ui.gadgets
ui.gadgets.private ui.gadgets.borders ui.gadgets.buttons
ui.gadgets.labels ui.gadgets.scrollers ui.gadgets.paragraphs
ui.gadgets.incremental ui.gadgets.packs ui.gadgets.theme
ui.gadgets.incremental ui.gadgets.packs
ui.gadgets.menus ui.clipboards ui.gestures ui.traverse ui.render
ui.text ui.gadgets.presentations ui.gadgets.grids ui.gadgets.tracks
ui.gadgets.icons ui.gadgets.grid-lines colors call ;
@ -231,10 +231,10 @@ MEMO: specified-font ( assoc -- font )
] apply-style ;
: apply-border-color-style ( style gadget -- style gadget )
border-color [ solid-boundary ] apply-style ;
border-color [ <solid> >>boundary ] apply-style ;
: apply-page-color-style ( style gadget -- style gadget )
page-color [ solid-interior ] apply-style ;
page-color [ <solid> >>interior ] apply-style ;
: apply-border-width-style ( style gadget -- style gadget )
border-width [ dup 2array <border> ] apply-style ;

View File

@ -33,7 +33,7 @@ HELP: <presentation>
{ $description "Creates a new " { $link presentation } " derived from " { $link <roll-button> } "." }
{ $see-also "presentations" } ;
{ <button> <bevel-button> <command-button> <roll-button> <presentation> } related-words
{ <button> <border-button> <command-button> <roll-button> <presentation> } related-words
{ <status-bar> show-mouse-help show-status show-summary hide-status } related-words

View File

@ -88,7 +88,7 @@ dup layout
[ f ] [ "s" get @right grid-child find-scroller* ] unit-test
[ ] [
"Click Me" [ [ scroll>gadget ] [ unparent ] bi ] <bevel-button>
"Click Me" [ [ scroll>gadget ] [ unparent ] bi ] <border-button>
[ <pile> swap add-gadget <scroller> ] keep
dup quot>> call
layout
@ -96,7 +96,7 @@ dup layout
[ t ] [
<gadget> { 200 200 } >>dim
[ [ scroll>gadget ] [ unparent ] bi ] <bevel-button>
[ [ scroll>gadget ] [ unparent ] bi ] <border-button>
dup
<pile> swap add-gadget <scroller> { 100 100 } >>dim dup layout
swap dup quot>> call

View File

@ -1,7 +1,7 @@
! Copyright (C) 2005, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays ui.gadgets ui.gadgets.viewports
ui.gadgets.frames ui.gadgets.grids ui.gadgets.theme
ui.gadgets.frames ui.gadgets.grids
ui.gadgets.sliders ui.gestures kernel math namespaces sequences
models models.range models.compose combinators math.vectors
classes.tuple math.rectangles combinators.short-circuit ;

View File

@ -4,7 +4,7 @@ USING: accessors arrays assocs kernel math namespaces sequences
vectors models models.range math.vectors math.functions quotations
colors colors.constants math.rectangles fry combinators ui.gestures
ui.pens ui.gadgets ui.gadgets.buttons ui.gadgets.tracks math.order
ui.gadgets.theme ui.gadgets.icons ui.pens.tile ui.pens.image ;
ui.gadgets.icons ui.pens.tile ui.pens.image ;
IN: ui.gadgets.sliders
TUPLE: slider < track elevator thumb saved line ;

View File

@ -3,7 +3,7 @@
USING: accessors arrays colors colors.constants fry kernel math
math.rectangles math.order math.vectors namespaces opengl sequences
ui.gadgets ui.gadgets.scrollers ui.gadgets.status-bar
ui.gadgets.worlds ui.gadgets.theme ui.gestures ui.render ui.text
ui.gadgets.worlds ui.gestures ui.render ui.text
ui.images ui.gadgets.menus ui.gadgets.line-support math.rectangles
models math.ranges sequences combinators fonts locals strings ;
IN: ui.gadgets.tables

View File

@ -1,63 +0,0 @@
! Copyright (C) 2005, 2009 Slava Pestov.
! Copyright (C) 2006, 2007 Alex Chapman.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays kernel sequences ui.gadgets ui.pens.solid
ui.pens.gradient ui.text ui.images colors colors.gray
colors.constants accessors io.pathnames ;
QUALIFIED: colors
IN: ui.gadgets.theme
: theme-image ( name -- image-name )
"resource:basis/ui/gadgets/theme/" prepend-path ".tiff" append <image-name> ;
: solid-interior ( gadget color -- gadget )
<solid> >>interior ; inline
: solid-boundary ( gadget color -- gadget )
<solid> >>boundary ; inline
: faint-boundary ( gadget -- gadget )
COLOR: gray solid-boundary ; inline
: selection-color ( -- color ) T{ rgba f 0.8 0.8 1.0 1.0 } ; inline
: focus-border-color ( -- color ) COLOR: dark-gray ; inline
: plain-gradient ( -- gradient )
{
T{ gray f 0.94 1.0 }
T{ gray f 0.83 1.0 }
T{ gray f 0.83 1.0 }
T{ gray f 0.62 1.0 }
} <gradient> ;
: rollover-gradient ( -- gradient )
{
T{ gray f 1.0 1.0 }
T{ gray f 0.9 1.0 }
T{ gray f 0.9 1.0 }
T{ gray f 0.75 1.0 }
} <gradient> ;
: pressed-gradient ( -- gradient )
{
T{ gray f 0.75 1.0 }
T{ gray f 0.9 1.0 }
T{ gray f 0.9 1.0 }
T{ gray f 1.0 1.0 }
} <gradient> ;
: selected-gradient ( -- gradient )
{
T{ gray f 0.65 1.0 }
T{ gray f 0.8 1.0 }
T{ gray f 0.8 1.0 }
T{ gray f 1.0 1.0 }
} <gradient> ;
: lowered-gradient ( -- gradient )
{
T{ gray f 0.37 1.0 }
T{ gray f 0.43 1.0 }
T{ gray f 0.5 1.0 }
} <gradient> ;

View File

@ -1,7 +1,7 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel accessors sequences fry math
opengl ui.pens ui.images ;
opengl ui.pens ui.images io.pathnames ;
IN: ui.pens.image
! Image pen
@ -16,4 +16,7 @@ M: image-pen draw-interior
'[ _ draw-image ] with-translation
] if ;
M: image-pen pen-pref-dim nip image>> image-dim ;
M: image-pen pen-pref-dim nip image>> image-dim ;
: theme-image ( name -- image-name )
"resource:basis/ui/gadgets/theme/" prepend-path ".tiff" append <image-name> ;

View File

@ -86,4 +86,8 @@ DEFER: draw-gadget
{ [ dup visible?>> not ] [ drop ] }
{ [ dup clipped?>> not ] [ (draw-gadget) ] }
[ [ (draw-gadget) ] with-clipping ]
} cond ;
} cond ;
CONSTANT: selection-color T{ rgba f 0.8 0.8 1.0 1.0 }
CONSTANT: focus-border-color COLOR: dark-gray

View File

@ -6,7 +6,7 @@ io io.styles arrays hashtables math.order sorting refs fonts
ui.tools.browser ui.commands ui.operations ui.gadgets ui.gadgets.panes
ui.gadgets.scrollers ui.gadgets.slots ui.gadgets.tracks
ui.gestures ui.gadgets.buttons ui.gadgets.tables
ui.gadgets.status-bar ui.gadgets.theme ui.gadgets.labeled
ui.gadgets.status-bar ui.gadgets.labeled
ui.tools.common ui ;
IN: ui.tools.inspector

View File

@ -7,7 +7,7 @@ parser present sequences tools.completion tools.vocabs.browser generic
generic.standard.engines.tuple fonts definitions.icons ui.images
ui.commands ui.operations ui.gadgets ui.gadgets.editors
ui.gadgets.glass ui.gadgets.scrollers ui.gadgets.tables
ui.gadgets.tracks ui.gadgets.labeled ui.gadgets.theme
ui.gadgets.tracks ui.gadgets.labeled
ui.gadgets.worlds ui.gadgets.wrappers ui.gestures ui.pens.solid
ui.tools.listener.history combinators vocabs ui.tools.listener.popups ;
IN: ui.tools.listener.completion