Skip to content
This repository has been archived by the owner on Nov 26, 2022. It is now read-only.

Commit

Permalink
Added support for custom special properties when cascading styles.
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonrw committed May 16, 2011
1 parent f7f90c5 commit 9febcf9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
10 changes: 9 additions & 1 deletion src/guiftw/special.clj
@@ -1,7 +1,15 @@
(ns guiftw.special)

(defn special-spec? [spec]
(defn special-spec?
"Returns :special if spec is of an special property."
[spec]
(if (some #{\*} (name spec))
:special))

(defn special-merge
"Inherit id and groups only from the other one.
Because when reducing styles, the last one will
be always private object's style, only id and
groups stored in there will be in final style."
[specials other-specials]
(merge (dissoc specials :*id :*groups) other-specials))
11 changes: 1 addition & 10 deletions src/guiftw/styles.clj
Expand Up @@ -45,16 +45,7 @@
output)))]
(Style. new-props
(concat events other-events)
{;; Inherit id and groups only from the other one.
;; Because when reducing styles, the last one will
;; be always private object's style, only id and
;; groups stored in there will be in final style.
:*id (:*id other-specials)
:*groups (:*groups other-specials)
:*cons (or (:*cons other-specials)
(:*cons specials))
:*lay (or (:*lay other-specials)
(:*lay specials))}
(special/special-merge specials other-specials)
#{}))) ; Applicants are rather meta-information, so
; they're not inherited.
(applies-to? [this symbols]
Expand Down

0 comments on commit 9febcf9

Please sign in to comment.