Merge branch 'master' of git://factorcode.org/git/factor
commit
19f1621862
|
@ -50,7 +50,7 @@ IN: slides
|
|||
<gadget>
|
||||
T{ gradient f { { 0.25 0.25 0.25 1.0 } { 1.0 1.0 1.0 0.0 } } }
|
||||
over set-gadget-interior
|
||||
{ 800 10 } over set-gadget-dim
|
||||
{ 800 10 } over (>>dim)
|
||||
{ 1 0 } over set-gadget-orientation
|
||||
gadget.
|
||||
] ($block) ;
|
||||
|
|
|
@ -338,7 +338,7 @@ CLASS: {
|
|||
{ "updateFactorGadgetSize:" "void" { "id" "SEL" "id" }
|
||||
[
|
||||
[
|
||||
2drop dup view-dim swap window set-gadget-dim yield
|
||||
2drop dup view-dim swap window (>>dim) yield
|
||||
] ui-try
|
||||
]
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ M: checkmark-paint draw-interior
|
|||
: <checkmark> ( -- gadget )
|
||||
<gadget>
|
||||
dup checkmark-theme
|
||||
{ 14 14 } over set-gadget-dim ;
|
||||
{ 14 14 } over (>>dim) ;
|
||||
|
||||
: toggle-model ( model -- )
|
||||
[ not ] change-model ;
|
||||
|
@ -172,7 +172,7 @@ M: radio-paint draw-boundary
|
|||
: <radio-knob> ( -- gadget )
|
||||
<gadget>
|
||||
dup radio-knob-theme
|
||||
{ 16 16 } over set-gadget-dim ;
|
||||
{ 16 16 } over (>>dim) ;
|
||||
|
||||
TUPLE: radio-control < button value ;
|
||||
|
||||
|
|
|
@ -65,10 +65,6 @@ HELP: relayout-1
|
|||
|
||||
{ relayout relayout-1 } related-words
|
||||
|
||||
HELP: set-gadget-dim
|
||||
{ $values { "dim" "a pair of integers" } { "gadget" gadget } }
|
||||
{ $description "Resizes and relayouts a gadget before the next iteration of the event loop." } ;
|
||||
|
||||
HELP: pref-dim*
|
||||
{ $values { "gadget" gadget } { "dim" "a pair of integers" } }
|
||||
{ $contract "Outputs the preferred dimensions of the gadget, possibly computing them from the preferred dimensions of the gadget's children." }
|
||||
|
|
|
@ -176,8 +176,6 @@ M: gadget (>>dim) ( dim gadget -- )
|
|||
[ tuck call-next-method do-invalidate drop ]
|
||||
if ;
|
||||
|
||||
: set-gadget-dim ( dim gadget -- ) (>>dim) ;
|
||||
|
||||
GENERIC: pref-dim* ( gadget -- dim )
|
||||
|
||||
: ?set-gadget-pref-dim ( dim gadget -- )
|
||||
|
|
|
@ -236,8 +236,7 @@ $nl
|
|||
|
||||
ARTICLE: "ui-null-layout" "Manual layouts"
|
||||
"When automatic layout is not appropriate, gadgets can be added to a parent with no layout policy, and then positioned and sized manually:"
|
||||
{ $subsection set-rect-loc }
|
||||
{ $subsection set-gadget-dim } ;
|
||||
{ $subsection set-rect-loc } ;
|
||||
|
||||
ARTICLE: "ui-layout-impl" "Implementing layout gadgets"
|
||||
"The relayout process proceeds top-down, with parents laying out their children, which in turn lay out their children. Custom layout policy is implemented by defining a method on a generic word:"
|
||||
|
|
|
@ -4,7 +4,7 @@ USING: arrays assocs io kernel math models namespaces
|
|||
prettyprint dlists dequeues sequences threads sequences words
|
||||
debugger ui.gadgets ui.gadgets.worlds ui.gadgets.tracks
|
||||
ui.gestures ui.backend ui.render continuations init combinators
|
||||
hashtables concurrency.flags sets ;
|
||||
hashtables concurrency.flags sets accessors ;
|
||||
IN: ui
|
||||
|
||||
! Assoc mapping aliens to gadgets
|
||||
|
@ -172,7 +172,7 @@ SYMBOL: ui-thread
|
|||
"UI update" spawn drop ;
|
||||
|
||||
: open-world-window ( world -- )
|
||||
dup pref-dim over set-gadget-dim dup relayout graft ;
|
||||
dup pref-dim over (>>dim) dup relayout graft ;
|
||||
|
||||
: open-window ( gadget title -- )
|
||||
f <world> open-world-window ;
|
||||
|
|
|
@ -93,7 +93,7 @@ SYMBOLS: msg-obj class-name-ptr mouse-captured ;
|
|||
: handle-wm-size ( hWnd uMsg wParam lParam -- )
|
||||
2nip
|
||||
[ lo-word ] keep hi-word 2array
|
||||
dup { 0 0 } = [ 2drop ] [ swap window set-gadget-dim ] if ;
|
||||
dup { 0 0 } = [ 2drop ] [ swap window (>>dim) ] if ;
|
||||
|
||||
: handle-wm-move ( hWnd uMsg wParam lParam -- )
|
||||
2nip
|
||||
|
|
|
@ -22,7 +22,7 @@ M: world expose-event nip relayout ;
|
|||
|
||||
M: world configure-event
|
||||
over configured-loc over (>>window-loc)
|
||||
swap configured-dim over set-gadget-dim
|
||||
swap configured-dim over (>>dim)
|
||||
! In case dimensions didn't change
|
||||
relayout-1 ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue