]> gitweb.factorcode.org Git - factor.git/commitdiff
comboboxes vocab + ui authors, summaries
authorSam Anklesaria <sam@Tintin.local>
Wed, 29 Apr 2009 19:19:30 +0000 (14:19 -0500)
committerSam Anklesaria <sam@Tintin.local>
Wed, 29 Apr 2009 19:19:30 +0000 (14:19 -0500)
basis/ui/gadgets/tables/tables.factor
extra/ui/frp/frp.factor
extra/ui/gadgets/alerts/authors.txt [new file with mode: 0644]
extra/ui/gadgets/alerts/summary.txt [new file with mode: 0644]
extra/ui/gadgets/book-extras/authors.txt [new file with mode: 0644]
extra/ui/gadgets/book-extras/summary.txt [new file with mode: 0644]
extra/ui/gadgets/comboboxes/authors.txt [new file with mode: 0644]
extra/ui/gadgets/comboboxes/comboboxes.factor [new file with mode: 0644]
extra/ui/gadgets/comboboxes/summary.txt [new file with mode: 0644]

index d390b1e49b097cf7ab1bb7319b5e12460535082c..c726b7e9f189a6c7689a5f43fc6e56f940774d11 100644 (file)
@@ -46,14 +46,13 @@ mouse-index
 { takes-focus? initial: t }
 focused? ;
 
-: <table> ( rows renderer -- table )
-    table new-line-gadget
-        swap >>renderer
-        swap >>model
-        f <model> >>selected-value
-        sans-serif-font >>font
-        focus-border-color >>focus-border-color
-        transparent >>column-line-color ;
+: new-table ( rows renderer class -- table )
+   new-line-gadget swap >>renderer swap >>model
+    f <model> >>selected-value sans-serif-font >>font
+    focus-border-color >>focus-border-color
+    transparent >>column-line-color ;
+
+: <table> ( rows renderer -- table ) table new-table ;
 
 <PRIVATE
 
index 964865278436c8006d4a5ce490b9fe8d46949e2e..f5c0f1bd107a2ddc023b5b6711cbe2072b686571 100644 (file)
@@ -36,11 +36,11 @@ M: gadget -> dup make:, output-model ;
 M: model -> dup , ;
 M: table -> dup , selected-value>> ;
 
-: <box> ( models type -- track )
-   [ { } make:make ] dip <track> swap dup [ model>> ] map <product>
-   [ [ f track-add ] each ] dip >>model ; inline
-: <hbox> ( models -- track ) horizontal <box> ; inline
-: <vbox> ( models -- track ) vertical <box> ; inline
+: <box> ( gadgets type -- track )
+   [ { } make:make ] dip <track> swap [ f track-add ] each ; inline
+: <box*> ( gadgets type -- track ) [ <box> ] [ [ model>> ] map <product> ] bi >>model ; inline
+: <hbox> ( gadgets -- track ) horizontal <box> ; inline
+: <vbox> ( gadgets -- track ) vertical <box> ; inline
 
 ! Model utilities
 TUPLE: multi-model < model ;
diff --git a/extra/ui/gadgets/alerts/authors.txt b/extra/ui/gadgets/alerts/authors.txt
new file mode 100644 (file)
index 0000000..ce0899f
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
\ No newline at end of file
diff --git a/extra/ui/gadgets/alerts/summary.txt b/extra/ui/gadgets/alerts/summary.txt
new file mode 100644 (file)
index 0000000..f1cd420
--- /dev/null
@@ -0,0 +1 @@
+Really simple dialog boxes
\ No newline at end of file
diff --git a/extra/ui/gadgets/book-extras/authors.txt b/extra/ui/gadgets/book-extras/authors.txt
new file mode 100644 (file)
index 0000000..ce0899f
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
\ No newline at end of file
diff --git a/extra/ui/gadgets/book-extras/summary.txt b/extra/ui/gadgets/book-extras/summary.txt
new file mode 100644 (file)
index 0000000..5a221ab
--- /dev/null
@@ -0,0 +1 @@
+Easily switch between pages of book views
\ No newline at end of file
diff --git a/extra/ui/gadgets/comboboxes/authors.txt b/extra/ui/gadgets/comboboxes/authors.txt
new file mode 100644 (file)
index 0000000..ce0899f
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
\ No newline at end of file
diff --git a/extra/ui/gadgets/comboboxes/comboboxes.factor b/extra/ui/gadgets/comboboxes/comboboxes.factor
new file mode 100644 (file)
index 0000000..b0dbe34
--- /dev/null
@@ -0,0 +1,22 @@
+USING: accessors arrays kernel math.rectangles models sequences
+ui.frp ui.gadgets ui.gadgets.glass ui.gadgets.labels
+ui.gadgets.tables ui.gestures ;
+IN: ui.gadgets.comboboxes
+
+TUPLE: combo-table < table spawner ;
+
+M: combo-table handle-gesture [ call-next-method ] 2keep swap
+   T{ button-up } = [
+      [ spawner>> ]
+      [ selected-value>> value>> [ swap set-control-value ] [ drop ] if* ]
+      [ hide-glass ] tri drop t
+   ] [ drop ] if ;
+
+TUPLE: combobox < label-control table ;
+combobox H{
+   { T{ button-down } [ dup table>> over >>spawner <zero-rect> show-glass ] }
+} set-gestures
+
+: <combobox> ( options -- combobox ) [ first [ combobox new-label ] keep <model> >>model ] keep
+   [ 1array ] map <model> trivial-renderer combo-table new-table
+   >>table ;
\ No newline at end of file
diff --git a/extra/ui/gadgets/comboboxes/summary.txt b/extra/ui/gadgets/comboboxes/summary.txt
new file mode 100644 (file)
index 0000000..dcba8da
--- /dev/null
@@ -0,0 +1 @@
+Comboxes have a model choosen from a list of options
\ No newline at end of file