|
Revision 112, 1.7 kB
(checked in by ashley, 9 months ago)
|
|
Added pill.r
Scroller fixes
Major color / theme management changes (in progress)
|
| Line | |
|---|
| 1 | password: make field [
|
|---|
| 2 | tip: {
|
|---|
| 3 | USAGE:
|
|---|
| 4 | password
|
|---|
| 5 | password "Secret"
|
|---|
| 6 |
|
|---|
| 7 | DESCRIPTION:
|
|---|
| 8 | Editable password field with text displayed as a series of large dots.
|
|---|
| 9 | }
|
|---|
| 10 | size: 50x5
|
|---|
| 11 | color: colors/page
|
|---|
| 12 | font: make default-font [size: to integer! sizes/font * 1.5 name: font-fixed]
|
|---|
| 13 | rebind: make function! [] [
|
|---|
| 14 | color: colors/page
|
|---|
| 15 | font/size: to integer! sizes/font * 1.5
|
|---|
| 16 | ]
|
|---|
| 17 | init: make function! [/local p char-width radius] [
|
|---|
| 18 | p: self
|
|---|
| 19 | para: make para []
|
|---|
| 20 | pane: make subface [
|
|---|
| 21 | color: colors/page
|
|---|
| 22 | effect: [draw [pen black fill-pen black]]
|
|---|
| 23 | feel: make default-feel []
|
|---|
| 24 | span: all [p/span find p/span #W #W]
|
|---|
| 25 | ]
|
|---|
| 26 | char-width: first size-text make rebface [
|
|---|
| 27 | text: "M" font: make default-font [
|
|---|
| 28 | size: to integer! sizes/font * 1.5 name: font-fixed
|
|---|
| 29 | ]
|
|---|
| 30 | ]
|
|---|
| 31 | radius: to integer! char-width + 1 / 3
|
|---|
| 32 | pane/size: size
|
|---|
| 33 | pane/feel/redraw: make function! [face act pos /local offset] compose/deep [
|
|---|
| 34 | if act = 'show [
|
|---|
| 35 | ; clear previous mask
|
|---|
| 36 | clear skip face/effect/draw 4
|
|---|
| 37 | either all [view*/focal-face = face/parent-face face/parent-face/text = head view*/caret] [
|
|---|
| 38 | ; append new mask
|
|---|
| 39 | repeat i length? head view*/caret [
|
|---|
| 40 | insert tail face/effect/draw reduce ['circle i * (as-pair char-width 0) + (as-pair 1 - radius sizes/line / 2) (radius)]
|
|---|
| 41 | ]
|
|---|
| 42 | ; add cursor
|
|---|
| 43 | offset: (as-pair char-width 0) * index? view*/caret
|
|---|
| 44 | offset/x: offset/x - (char-width)
|
|---|
| 45 | insert tail face/effect/draw reduce [
|
|---|
| 46 | 'box offset + (as-pair 2 2) offset + (as-pair 3 sizes/line - 4)
|
|---|
| 47 | ]
|
|---|
| 48 | ][
|
|---|
| 49 | repeat i length? face/parent-face/text [
|
|---|
| 50 | insert tail face/effect/draw reduce ['circle i * (as-pair char-width 0) + (as-pair 1 - radius sizes/line / 2) (radius)]
|
|---|
| 51 | ]
|
|---|
| 52 | ]
|
|---|
| 53 | ]
|
|---|
| 54 | ]
|
|---|
| 55 | ]
|
|---|
| 56 | ] |
|---|