changeset 171:d9bdf08211df

Added some docstrings.
author Mikhail Kryshen <mikhail@kryshen.net>
date Tue, 09 Dec 2014 16:45:22 +0300
parents 0be55d38fe53
children 0394465ce1e2
files src/indyvon/component.clj src/indyvon/core.clj src/indyvon/views.clj
diffstat 3 files changed, 18 insertions(+), 7 deletions(-) [+]
line diff
     1.1 --- a/src/indyvon/component.clj	Mon Dec 01 21:43:39 2014 +0300
     1.2 +++ b/src/indyvon/component.clj	Tue Dec 09 16:45:22 2014 +0300
     1.3 @@ -38,6 +38,7 @@
     1.4      (Dimension. (width geom) (height geom))))
     1.5  
     1.6  (defn ^JPanel make-jpanel
     1.7 +  "Creates a JPanel to display the specified View."
     1.8    ([view]
     1.9       (make-jpanel view (root-event-dispatcher)))
    1.10    ([view event-dispatcher]
    1.11 @@ -60,12 +61,15 @@
    1.12         (listen! event-dispatcher panel)
    1.13         panel)))
    1.14  
    1.15 -(defn ^JFrame make-jframe [^String title view]
    1.16 +(defn ^JFrame make-jframe
    1.17 +  "Creates a JFrame to display the specified View."
    1.18 +  [^String title view]
    1.19    (doto (JFrame. title)
    1.20      (.. (getContentPane) (add (make-jpanel view)))
    1.21      (.pack)))
    1.22  
    1.23  (defn ^JFrame show-view!
    1.24 +  "Creates and shows a JFrame with the specified View."
    1.25    ([view]
    1.26       (show-view! "Indyvon" view))
    1.27    ([title view]
     2.1 --- a/src/indyvon/core.clj	Mon Dec 01 21:43:39 2014 +0300
     2.2 +++ b/src/indyvon/core.clj	Tue Dec 09 16:45:22 2014 +0300
     2.3 @@ -32,7 +32,8 @@
     2.4  ;; View context
     2.5  ;;
     2.6  
     2.7 -(def ^:dynamic ^Graphics2D *graphics*)
     2.8 +(def ^:dynamic ^Graphics2D *graphics*
     2.9 +  "The graphics context, an instance of java.awt.Graphics2D.")
    2.10  
    2.11  (def ^:dynamic ^FontRenderContext *font-context*
    2.12    "FontRenderContext to use when Graphics2D is not available."
    2.13 @@ -47,11 +48,13 @@
    2.14  (def ^:dynamic *height*
    2.15    "Height of the rendering area.")
    2.16  
    2.17 -(def ^:dynamic ^Shape *clip*)
    2.18 +(def ^:dynamic ^Shape *clip*
    2.19 +  "The View context's clipping area. Does not account for partial
    2.20 +  repaints, may differ from (.getClip *graphics*).")
    2.21  
    2.22  (def ^:dynamic ^Shape *input-clip*
    2.23 -  "Clipping area used for dispatching pointer events (intersected with
    2.24 -  *clip*). If nil, *clip* will be used.")
    2.25 +  "Clipping area used for dispatching pointer events (after
    2.26 +  intersecting with *clip*). If nil, *clip* is used.")
    2.27  
    2.28  (def ^:dynamic *time*
    2.29    "Timestamp of the current frame (in nanoseconds).")
     3.1 --- a/src/indyvon/views.clj	Mon Dec 01 21:43:39 2014 +0300
     3.2 +++ b/src/indyvon/views.clj	Tue Dec 09 16:45:22 2014 +0300
     3.3 @@ -153,7 +153,9 @@
     3.4    [& contents]
     3.5    (hbox* false contents))
     3.6  
     3.7 -(defn hbox-proportional [& contents]
     3.8 +(defn hbox-proportional
     3.9 +  "Like hbox, but proportionally distributes the available space."
    3.10 +  [& contents]
    3.11    (hbox* true contents))
    3.12  
    3.13  (defn vbox
    3.14 @@ -162,7 +164,9 @@
    3.15    [& contents]
    3.16    (vbox* false contents))
    3.17  
    3.18 -(defn vbox-proportional [& contents]
    3.19 +(defn vbox-proportional
    3.20 +  "Like vbox, but proportionally distributes the available space."
    3.21 +  [& contents]
    3.22    (vbox* true contents))
    3.23  
    3.24  (defrecord BorderBox [north west south east center]