From a5cc32ed15e4a120259f01f5d0c1dae6937b82b6 Mon Sep 17 00:00:00 2001 From: slava Date: Sat, 17 Jun 2006 07:51:06 +0000 Subject: [PATCH] Tabs gadget improved --- TODO.FACTOR.txt | 2 - contrib/httpd/browser-responder.factor | 2 +- library/ui/gadgets/buttons.factor | 5 +- library/ui/gadgets/tabs.factor | 63 +++++++++++++++++++------- library/ui/gadgets/theme.factor | 19 ++++++-- library/ui/tools/help.factor | 5 +- 6 files changed, 67 insertions(+), 29 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 8928f2ff2c..48a2fa2aac 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -23,7 +23,6 @@ + ui: -- help viewer in ui: show title - x11 title bars are funny - cocoa: starting the UI with +foo switches opens them as files - if the listener is running a command when the image is saved, it @@ -43,7 +42,6 @@ - need actions for reloading the source file and opening word in jEdit - highlight showing panes in originating list - single set of tabs across the top -- toggle/radio buttons/tabs or something - make-frame should compile - speed up ideas: - only do clipping for certain gadgets diff --git a/contrib/httpd/browser-responder.factor b/contrib/httpd/browser-responder.factor index 3d460fa4d7..f495147c92 100644 --- a/contrib/httpd/browser-responder.factor +++ b/contrib/httpd/browser-responder.factor @@ -33,7 +33,7 @@ prettyprint sequences words xml ; : word-source ( -- ) #! Write the source for the given word from the vocab as HTML. - current-word [ [ word-help ] with-html-stream ] when* ; + current-word [ [ see-help ] with-html-stream ] when* ; : browser-body ( -- ) #! Write out the HTML for the body of the main browser page. diff --git a/library/ui/gadgets/buttons.factor b/library/ui/gadgets/buttons.factor index 7c4fc451fa..ee908aafa7 100644 --- a/library/ui/gadgets/buttons.factor +++ b/library/ui/gadgets/buttons.factor @@ -4,7 +4,7 @@ IN: gadgets-buttons USING: gadgets gadgets-borders gadgets-theme generic io kernel math namespaces sequences styles threads ; -TUPLE: button rollover? pressed? quot ; +TUPLE: button rollover? pressed? selected? quot ; : buttons-down? ( -- ? ) hand-buttons get-global empty? not ; @@ -71,11 +71,12 @@ C: repeat-button ( gadget quot -- button ) M: repeat-button tick ( ms object -- ) nip button-clicked ; -TUPLE: button-paint plain rollover pressed ; +TUPLE: button-paint plain rollover pressed selected ; : button-paint ( button paint -- button paint ) { { [ over button-pressed? ] [ button-paint-pressed ] } + { [ over button-selected? ] [ button-paint-selected ] } { [ over button-rollover? ] [ button-paint-rollover ] } { [ t ] [ button-paint-plain ] } } cond ; diff --git a/library/ui/gadgets/tabs.factor b/library/ui/gadgets/tabs.factor index 2c3e7712af..8281b8791f 100644 --- a/library/ui/gadgets/tabs.factor +++ b/library/ui/gadgets/tabs.factor @@ -7,42 +7,71 @@ gadgets-theme kernel sequences ; TUPLE: book page pages ; -: show-page ( n book -- ) - dup book-page unparent - [ book-pages nth ] keep - [ set-book-page ] 2keep - add-gadget ; +: show-page ( gadget book -- ) + dup book-page unparent [ set-book-page ] 2keep add-gadget ; C: book ( pages -- book ) dup delegate>gadget [ set-book-pages ] keep - 0 over show-page ; + dup book-pages first over show-page ; M: book pref-dim* ( book -- dim ) book-page pref-dim ; M: book layout* ( book -- ) dup rect-dim swap book-page set-gadget-dim ; -: ( name n book -- button ) - [ show-page drop ] curry curry - >r