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 wrap: on
line diff
--- a/src/indyvon/component.clj	Mon Dec 01 21:43:39 2014 +0300
+++ b/src/indyvon/component.clj	Tue Dec 09 16:45:22 2014 +0300
@@ -38,6 +38,7 @@
     (Dimension. (width geom) (height geom))))
 
 (defn ^JPanel make-jpanel
+  "Creates a JPanel to display the specified View."
   ([view]
      (make-jpanel view (root-event-dispatcher)))
   ([view event-dispatcher]
@@ -60,12 +61,15 @@
        (listen! event-dispatcher panel)
        panel)))
 
-(defn ^JFrame make-jframe [^String title view]
+(defn ^JFrame make-jframe
+  "Creates a JFrame to display the specified View."
+  [^String title view]
   (doto (JFrame. title)
     (.. (getContentPane) (add (make-jpanel view)))
     (.pack)))
 
 (defn ^JFrame show-view!
+  "Creates and shows a JFrame with the specified View."
   ([view]
      (show-view! "Indyvon" view))
   ([title view]
--- a/src/indyvon/core.clj	Mon Dec 01 21:43:39 2014 +0300
+++ b/src/indyvon/core.clj	Tue Dec 09 16:45:22 2014 +0300
@@ -32,7 +32,8 @@
 ;; View context
 ;;
 
-(def ^:dynamic ^Graphics2D *graphics*)
+(def ^:dynamic ^Graphics2D *graphics*
+  "The graphics context, an instance of java.awt.Graphics2D.")
 
 (def ^:dynamic ^FontRenderContext *font-context*
   "FontRenderContext to use when Graphics2D is not available."
@@ -47,11 +48,13 @@
 (def ^:dynamic *height*
   "Height of the rendering area.")
 
-(def ^:dynamic ^Shape *clip*)
+(def ^:dynamic ^Shape *clip*
+  "The View context's clipping area. Does not account for partial
+  repaints, may differ from (.getClip *graphics*).")
 
 (def ^:dynamic ^Shape *input-clip*
-  "Clipping area used for dispatching pointer events (intersected with
-  *clip*). If nil, *clip* will be used.")
+  "Clipping area used for dispatching pointer events (after
+  intersecting with *clip*). If nil, *clip* is used.")
 
 (def ^:dynamic *time*
   "Timestamp of the current frame (in nanoseconds).")
--- a/src/indyvon/views.clj	Mon Dec 01 21:43:39 2014 +0300
+++ b/src/indyvon/views.clj	Tue Dec 09 16:45:22 2014 +0300
@@ -153,7 +153,9 @@
   [& contents]
   (hbox* false contents))
 
-(defn hbox-proportional [& contents]
+(defn hbox-proportional
+  "Like hbox, but proportionally distributes the available space."
+  [& contents]
   (hbox* true contents))
 
 (defn vbox
@@ -162,7 +164,9 @@
   [& contents]
   (vbox* false contents))
 
-(defn vbox-proportional [& contents]
+(defn vbox-proportional
+  "Like vbox, but proportionally distributes the available space."
+  [& contents]
   (vbox* true contents))
 
 (defrecord BorderBox [north west south east center]