Mercurial > hg > indyvon
changeset 43:7d67064f0880
More layers.
| author | Mikhail Kryshen <mikhail@kryshen.net> |
|---|---|
| date | Mon, 12 Jul 2010 03:52:21 +0400 |
| parents | d3e3c43df1cd |
| children | 064b21604f74 |
| files | src/kryshen/indyvon/core.clj src/kryshen/indyvon/graph.clj src/kryshen/indyvon/layers.clj |
| diffstat | 3 files changed, 81 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/src/kryshen/indyvon/core.clj Sun Jul 11 06:34:36 2010 +0400 +++ b/src/kryshen/indyvon/core.clj Mon Jul 12 03:52:21 2010 +0400 @@ -18,10 +18,11 @@ (def *update*) (def *event-dispatcher*) -(defrecord Theme [fore-color back-color border-color font]) +(defrecord Theme [fore-color back-color alt-back-color border-color font]) (defn default-theme [] - (Theme. Color/BLACK Color/WHITE Color/BLUE (Font. "Sans" Font/PLAIN 12))) + (Theme. Color/BLACK Color/LIGHT_GRAY Color/WHITE + Color/BLUE (Font. "Sans" Font/PLAIN 12))) (def *theme* (default-theme)) @@ -135,6 +136,21 @@ specs) (fn [] ~form))) +(defn with-theme* [theme f & args] + (apply with-bindings* {#'*theme* (merge *theme* theme)} + f args)) + +(defmacro with-theme [theme & body] + `(with-theme* ~theme (fn [] ~@body))) + +(defmacro with-color [color & body] + `(let [color# (.getColor *graphics*)] + (try + (.setColor *graphics* ~color)
