Changeset 112 for widgets/button.r

Show
Ignore:
Timestamp:
12/31/07 22:18:08 (11 months ago)
Author:
ashley
Message:

Added pill.r
Scroller fixes
Major color / theme management changes (in progress)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • widgets/button.r

    r111 r112  
    1 button: make rebface [ 
     1button: make pill [ 
    22        tip:    { 
    33                USAGE: 
     
    1212                        'info specifies read-only 
    1313        } 
    14         size:   15x6 
     14        size:   15x5 
    1515        text:   "" 
    16         color:  colors/button 
    17         effect: [draw [pen 0.0.0.128 line-width 1 fill-pen linear 0x0 normal -4 0 90 1 1 none none none box 2x2 0x0 2 translate 2x2 pen 255.255.255.255 fill-pen none line-width 3 box 1x1 0x0 1]] 
    18         font:   make default-font [align: 'center] 
    19         feel:   make default-feel [ 
    20                 redraw: make function! [face act pos] [ 
    21                         if act = 'show  [ 
    22                                 ;       handle color change 
    23                                 all [ 
    24                                         face/color 
    25                                         poke face/effect/draw 14 face/color 
    26                                         poke face/effect/draw 15 face/color * 0.9 
    27                                         poke face/effect/draw 16 face/color * 0.7 
    28                                         face/color: none 
    29                                 ] 
    30                                 ;       handle info 
    31                                 all [ 
    32                                         find face/options 'info 
    33                                         poke face/effect/draw 24 255.255.255.100 
    34                                 ] 
    35                         ] 
    36                 ] 
     16        color:  colors/theme-dark 
     17        font:   make default-font-heading [size: sizes/font - 2] 
     18        feel:   make feel [ 
    3719                over: make function! [face act pos] [ 
    38                         poke face/effect/draw 24 either all [act not find face/options 'info] [colors/over] [255.255.255.255] 
    39                         show face 
     20                        set-color face either all [act not find face/options 'info] [colors/theme-light] [colors/theme-dark] 
    4021                ] 
    4122                engage: make function! [face act event /local f] [ 
    4223                        unless find face/options 'info [ 
    4324                                do select [ 
    44                                         down [ 
    45                                                 poke face/effect/draw 24 0.0.0.180 
    46                                                 poke face/effect/draw 26 0.0.0.200 
    47                                                 show face 
    48                                         ] 
    49                                         alt-down [ 
    50                                                 poke face/effect/draw 24 0.0.0.140 
    51                                                 poke face/effect/draw 26 0.0.0.160 
    52                                                 show face 
    53                                         ] 
    54                                         up [ 
    55                                                 poke face/effect/draw 24 255.255.255.255 
    56                                                 poke face/effect/draw 26 none 
    57                                                 show face 
    58                                                 face/action/on-click face 
    59                                         ] 
    60                                         alt-up [ 
    61                                                 poke face/effect/draw 24 255.255.255.255 
    62                                                 poke face/effect/draw 26 none 
    63                                                 show face 
    64                                                 face/action/on-alt-click face 
    65                                         ] 
    66                                         away [ 
    67                                                 poke face/effect/draw 24 255.255.255.255 
    68                                                 poke face/effect/draw 26 none 
    69                                                 show face 
    70                                         ] 
     25                                        down            [set-color face colors/theme-light] 
     26                                        alt-down        [set-color face colors/theme-light] 
     27                                        up                      [set-color face colors/theme-dark face/action/on-click face] 
     28                                        alt-up          [set-color face colors/theme-dark face/action/on-alt-click face] 
     29                                        away            [set-color face colors/theme-dark] 
    7130                                ] act 
    7231                        ] 
    7332                ] 
    7433        ] 
    75         action: make default-action [ 
    76                 on-resize: make function! [face] [ 
    77                         poke face/effect/draw 10 face/size/y 
    78                         poke face/effect/draw 18 face/size - 2x2 
    79                         poke face/effect/draw 30 face/size - 6x6 
    80                 ] 
    81         ] 
    8234        rebind: make function! [] [ 
    83                 color: colors/button 
    84                 font/name: effects/font 
    85                 font/size: sizes/font 
     35                color: colors/theme-dark 
     36                font/size: sizes/font - 2 
    8637        ] 
    8738        init:   make function! [] [ 
    8839                all [negative? size/x size/x: 10000 size/x: 8 + first size-text self] 
     40                all [find options 'info color = colors/theme-dark color: colors/outline-light] 
    8941                action/on-resize self 
    9042        ]