Commit c5d80791 authored by Iban Hatchondo's avatar Iban Hatchondo
Browse files

a very little change in the define-theme syntax. Style parts are now defined in

a list (such as the class slots for example). This allow to have the
:title-bar-position :parts-to-redraw-on-focus potions to be effectively
optional. Plus a :background option has been added. This will be
useful to the one who wants to define a no-decoration style like but
with colored border.

See the documentation.

make-decoration use the theme style-background. (wm.lisp)

- themes has been updated
- doc updated.
parent e6f2dc9c
.TH Eclipse 1 "(c) 2001 Iban HATCHONDO"
.\"$Id: eclipse.1,v 1.12 2004/01/12 11:22:06 ihatchondo Exp $
.\"$Id: eclipse.1,v 1.13 2004/01/15 15:35:34 ihatchondo Exp $
.SH NAME
eclipse - a window manager in Common Lisp
......@@ -360,8 +360,19 @@ themes for more):
.in +3
(:title-bar-position :right)
.br
;; The parts to redraw on focus designator can be:
.br
;; - :all to indicate that all the style parts should be
.br
;; redrawn when focus change.
.br
;; - or null or a list of keywords as follows.
.br
(:parts-to-redraw-on-focus (:close :top-left))
.br
(;; The following are the frame parts for the default style.
.br
.in +1
(:top ("top"))
.br
(:close ("close-normal"
......@@ -386,16 +397,37 @@ themes for more):
.br
(:right ("right"))
.br
(:left ("left")))
(:left ("left"))))
.br
.in -2
.in -3
(:transient-style
.in +2
.in +3
.br
;; a background can be specified. It might be either:
.br
;; - an integer desining a color (e.g: an rgb value)
.br
;; - one of the :NONE :PARENT-RELATIVE keyword
.br
;; - a string that design a pnm file
.br
;; - a (xlib:make-color
.br
;; :red <(real 0 1)>
.br
;; :green <(real 0 1)>
.br
;; :blue <(real 0 1)>)
.br
;; form.
.br
(:background :parent-relative)
.br
.br
;; the rest of the definition
.br
)))
.in -5
.in -6
(defmethod repaint ((widget title-bar) (name (eql "Foo")) (focus t))
"handle repaint WHEN focused."
......
;;; -*- Mode: Lisp; Package: ECLIPSE-INTERNALS -*-
;;; $Id: themer.lisp,v 1.5 2003/09/08 12:58:05 hatchond Exp $
;;; $Id: themer.lisp,v 1.6 2003/09/30 12:18:36 hatchond Exp $
;;;
;;; This file is part of Eclipse.
;;; Copyright (C) 2002 Iban HATCHONDO
......@@ -39,6 +39,11 @@
:type keyword
:initarg :title-bar-position
:reader style-title-bar-position)
(background
:initform :parent-relative
:type (or (member :none :parent-relative) xlib:pixel xlib:pixmap)
:initarg :background
:reader style-background)
(parts-to-redraw-on-focus
:initform nil
:type list
......@@ -247,6 +252,15 @@
(when (probe-file fname)
(xlib:image-pixmap window (ppm:load-ppm-into-clx-image fname window))))
(defun make-background (background window directory)
(let ((screen (car (xlib:display-roots (xlib:drawable-display window)))))
(etypecase background
(string (load-pnm->pixmap directory background window))
((or integer (member :none :parent-relative)) background)
(null :parent-relative)
(xlib:color
(xlib:alloc-color (xlib:screen-default-colormap screen) background)))))
(defun find-decoration-frame-style (theme window)
(with-slots (default-style transient-style) theme
(if (ignore-errors (window-transient-p window))
......@@ -351,48 +365,55 @@
vmargin (+ top-margin bottom-margin))))
(parse-args (args)
(destructuring-bind (style
(&key (title-bar-position :top))
(&key parts-to-redraw-on-focus)
&rest rest)
args
(list style
title-bar-position
(if (eq parts-to-redraw-on-focus :all)
(loop for (key nil) in rest
when (eq key title-bar-position)
do (setq key :title-bar) end
unless (eq key :custom) collect key)
parts-to-redraw-on-focus)
rest))))
(destructuring-bind (style &rest options) args
(let (background title-bar-position parts-to-redraw-on-focus items)
(loop for option in options
if (listp (car option)) do (setf items option)
else do (case (car option)
(:title-bar-position
(setf title-bar-position (cadr option)))
(:parts-to-redraw-on-focus
(setf parts-to-redraw-on-focus (cadr option)))
(:background (setf background (cadr option)))))
(list style
(or title-bar-position :top)
(or background :parent-relative)
(if (eq parts-to-redraw-on-focus :all)
(loop for (key nil) in items
when (eq key title-bar-position)
do (setq key :title-bar) end
unless (eq key :custom) collect key)
parts-to-redraw-on-focus)
items)))))
(destructuring-bind ((style1 title-pos1 parts-to-redraw-on-focus1 items1)
(style2 title-pos2 parts-to-redraw-on-focus2 items2))
(destructuring-bind
((style1 title-pos1 bkgrd1 parts-to-redraw-on-focus1 items1)
(style2 title-pos2 bkgrd2 parts-to-redraw-on-focus2 items2))
(mapcar #'parse-args forms)
(let ((fs1 (gensym))
(fs2 (gensym)))
`(defun initialize-frame (dir window)
(let ((,fs1 ,(and items1 `(make-instance
',(intern (symbol-name style1)
"ECLIPSE-INTERNALS")
:theme-name ,theme-name
:title-bar-position ,title-pos1
:parts-to-redraw-on-focus
',parts-to-redraw-on-focus1)))
(,fs2 ,(and items2 `(make-instance
',(intern (symbol-name style2)
"ECLIPSE-INTERNALS")
:theme-name ,theme-name
:title-bar-position ,title-pos2
:parts-to-redraw-on-focus
',parts-to-redraw-on-focus2))))
,(unless items2 `(declare (ignorable ,fs2)))
,(when items1 (define-style fs1 items1 `dir `window))
,(when items2 (define-style fs2 items2 `dir `window fs1))
(setf (gethash ,theme-name eclipse::*themes*)
(make-instance 'eclipse::theme
:name ,theme-name
,@(and style1 `(,style1 ,fs1))
,@(and style2 `(,style2 ,fs2))))))))))
`(defun initialize-frame (dir window)
(let ((fs1 ,(and items1
`(make-instance
',(intern (symbol-name style1) "ECLIPSE-INTERNALS")
:theme-name ,theme-name
:title-bar-position ,title-pos1
:background (make-background ,bkgrd1 window dir)
:parts-to-redraw-on-focus
',parts-to-redraw-on-focus1)))
(fs2 ,(and items2
`(make-instance
',(intern (symbol-name style2) "ECLIPSE-INTERNALS")
:theme-name ,theme-name
:title-bar-position ,title-pos2
:background (make-background ,bkgrd2 window dir)
:parts-to-redraw-on-focus
',parts-to-redraw-on-focus2))))
,(unless items2 `(declare (ignorable fs2)))
,(when items1 (define-style `fs1 items1 `dir `window))
,(when items2 (define-style `fs2 items2 `dir `window `fs1))
(setf (gethash ,theme-name eclipse::*themes*)
(make-instance 'eclipse::theme
:name ,theme-name
,@(and style1 `(,style1 fs1))
,@(and style2 `(,style2 fs2)))))))))
......@@ -10,44 +10,41 @@
(define-theme ("CoolClean")
((:default-style
()
(:parts-to-redraw-on-focus (:title-bar))
(:top ("top-inactive" "top-active"))
(:top-right ("top-right"))
(:menu-button ("menu-button-active"))
(:close ("close-active"
"close-active"
"close-active-clicked"
"close-active-clicked"))
(:icon-b ("minimize-active"
"minimize-active"
"minimize-active-clicked"
"minimize-active-clicked"))
(:maximize ("maximize-active"
"maximize-active"
"maximize-active-clicked"
"maximize-active-clicked"))
(:bottom ("bottom"))
(:bottom-right ("bottom-right"))
(:bottom-left ("bottom-left"))
(:right ("right"))
(:left ("left"))
)
((:top ("top-inactive" "top-active"))
(:top-right ("top-right"))
(:menu-button ("menu-button-active"))
(:close ("close-active"
"close-active"
"close-active-clicked"
"close-active-clicked"))
(:icon-b ("minimize-active"
"minimize-active"
"minimize-active-clicked"
"minimize-active-clicked"))
(:maximize ("maximize-active"
"maximize-active"
"maximize-active-clicked"
"maximize-active-clicked"))
(:bottom ("bottom"))
(:bottom-right ("bottom-right"))
(:bottom-left ("bottom-left"))
(:right ("right"))
(:left ("left"))))
(:transient-style
()
(:parts-to-redraw-on-focus (:title-bar))
(:top ("top-inactive" "top-active"))
(:close ("t-close-active"
"t-close-active"
"t-close-active-clicked"
"t-close-active-clicked"))
(:menu-button ("menu-button-active"))
(:top-right ("top-right"))
(:bottom ("bottom"))
(:bottom-right ("bottom-right"))
(:bottom-left ("bottom-left"))
(:right ("right"))
(:left ("left")))))
((:top ("top-inactive" "top-active"))
(:close ("t-close-active"
"t-close-active"
"t-close-active-clicked"
"t-close-active-clicked"))
(:menu-button ("menu-button-active"))
(:top-right ("top-right"))
(:bottom ("bottom"))
(:bottom-right ("bottom-right"))
(:bottom-left ("bottom-left"))
(:right ("right"))
(:left ("left"))))))
(defmethod repaint ((widget title-bar) (name (eql "CoolClean")) (focus t))
(declare (ignorable name focus))
......
......@@ -10,37 +10,34 @@
(define-theme ("Step")
((:default-style
()
(:parts-to-redraw-on-focus (:close :title-bar :menu-button))
(:top ("top-inactive" "top-active"))
(:menu-button ("menu-button-inactive"
"menu-button-active"
"menu-button-inactive-clicked"
"menu-button-active-clicked"))
(:close ("close-inactive"
"close-active"
"close-inactive-clicked"
"close-active-clicked"))
(:bottom ("bottom"))
(:bottom-right ("bottom-right"))
(:bottom-left ("bottom-left"))
(:right ("side"))
(:left ("side"))
)
((:top ("top-inactive" "top-active"))
(:menu-button ("menu-button-inactive"
"menu-button-active"
"menu-button-inactive-clicked"
"menu-button-active-clicked"))
(:close ("close-inactive"
"close-active"
"close-inactive-clicked"
"close-active-clicked"))
(:bottom ("bottom"))
(:bottom-right ("bottom-right"))
(:bottom-left ("bottom-left"))
(:right ("side"))
(:left ("side"))))
(:transient-style
()
(:parts-to-redraw-on-focus (:close :title-bar :top-left))
(:close ("close-inactive"
"close-active"
"close-inactive-clicked"
"close-active-clicked"))
(:top ("top-inactive" "top-active"))
(:top-left ("t-top-left-i" "t-top-left-a"))
(:bottom ("bottom"))
(:bottom-right ("bottom-right"))
(:bottom-left ("bottom-left"))
(:right ("side"))
(:left ("side")))))
((:close ("close-inactive"
"close-active"
"close-inactive-clicked"
"close-active-clicked"))
(:top ("top-inactive" "top-active"))
(:top-left ("t-top-left-i" "t-top-left-a"))
(:bottom ("bottom"))
(:bottom-right ("bottom-right"))
(:bottom-left ("bottom-left"))
(:right ("side"))
(:left ("side"))))))
(defmethod repaint ((widget title-bar) (name (eql "Step")) (focus t))
(declare (ignorable name focus))
......
......@@ -10,46 +10,44 @@
(define-theme ("brushed-metal")
((:default-style
()
(:parts-to-redraw-on-focus :all)
(:top ("top-i" "top-a"))
(:top-left ("top-left-i" "top-left-a"))
(:top-right ("top-right-i" "top-right-a"))
(:menu-button ("menu-button-i"
"menu-button-a"
"menu-button-i-clicked"
"menu-button-a-clicked"))
(:close ("close-i"
"close-a"
"close-i-clicked"
"close-a-clicked"))
(:icon-b ("minimize-i"
"minimize-a"
"minimize-i-clicked"
"minimize-a-clicked"))
(:maximize ("maximize-i"
"maximize-a"
"maximize-i-clicked"
"maximize-a-clicked"))
(:bottom ("bottom-i" "bottom-a"))
(:bottom-right ("bottom-right-i" "bottom-right-a"))
(:bottom-left ("bottom-left-i" "bottom-left-a"))
(:right ("right-i" "right-a"))
(:left ("left-i" "left-a"))
(:custom ("title-left-i" "title-left-a" "title-right-i" "title-right-a"))
)
((:top ("top-i" "top-a"))
(:top-left ("top-left-i" "top-left-a"))
(:top-right ("top-right-i" "top-right-a"))
(:menu-button ("menu-button-i"
"menu-button-a"
"menu-button-i-clicked"
"menu-button-a-clicked"))
(:close ("close-i"
"close-a"
"close-i-clicked"
"close-a-clicked"))
(:icon-b ("minimize-i"
"minimize-a"
"minimize-i-clicked"
"minimize-a-clicked"))
(:maximize ("maximize-i"
"maximize-a"
"maximize-i-clicked"
"maximize-a-clicked"))
(:bottom ("bottom-i" "bottom-a"))
(:bottom-right ("bottom-right-i" "bottom-right-a"))
(:bottom-left ("bottom-left-i" "bottom-left-a"))
(:right ("right-i" "right-a"))
(:left ("left-i" "left-a"))
(:custom ("title-left-i" "title-left-a" "title-right-i" "title-right-a"))
))
(:transient-style
()
(:parts-to-redraw-on-focus :all)
(:top ("t-top-i" "t-top-a"))
(:top-left ("t-top-left-i" "t-top-left-a"))
(:top-right ("t-top-right-i" "t-top-right-a"))
(:bottom ("t-bottom-i" "t-bottom-a"))
(:bottom-right ("t-bottom-right-i" "t-bottom-right-a"))
(:bottom-left ("t-bottom-left-i" "t-bottom-left-a"))
(:right ("t-right-i" "t-right-a"))
(:left ("t-left-i" "t-left-a")))))
((:top ("t-top-i" "t-top-a"))
(:top-left ("t-top-left-i" "t-top-left-a"))
(:top-right ("t-top-right-i" "t-top-right-a"))
(:bottom ("t-bottom-i" "t-bottom-a"))
(:bottom-right ("t-bottom-right-i" "t-bottom-right-a"))
(:bottom-left ("t-bottom-left-i" "t-bottom-left-a"))
(:right ("t-right-i" "t-right-a"))
(:left ("t-left-i" "t-left-a"))))))
(defun default-draw-on-focus-in (title-bar frame-style)
(with-slots ((window eclipse::window)
(item-to-draw eclipse::item-to-draw)
......
......@@ -10,54 +10,51 @@
(eclipse:define-theme ("microGUI")
((:default-style
()
(:parts-to-redraw-on-focus
(:close :icon-b :maximize
:title-bar :top-left :menu-button))
(:top ("center"))
(:menu-button ("menu-normal"
"menu-active"
"menu-normal-clicked"
"menu-active-clicked"))
(:icon-b ("iconify-normal"
"iconify-active"
"iconify-normal-clicked"
"iconify-active-clicked"))
(:maximize ("maximize-normal"
"maximize-active"
"maximize-normal-clicked"
"maximize-active-clicked"))
(:close ("close-normal"
"close-active"
"close-normal-clicked"
"close-active-clicked"))
(:top-left ("top-left-inactive" "top-left"))
(:top-right ("top-right"))
(:bottom ("bottom"))
(:bottom-right ("bottom-right"))
(:bottom-left ("bottom-left"))
(:right ("right"))
(:left ("left"))
(:custom ("top-curves-inactive"
"top-curves"
"top-blue"
"top-blue-inactive"))
)
(:close :icon-b :maximize :title-bar :top-left :menu-button))
((:top ("center"))
(:menu-button ("menu-normal"
"menu-active"
"menu-normal-clicked"
"menu-active-clicked"))
(:icon-b ("iconify-normal"
"iconify-active"
"iconify-normal-clicked"
"iconify-active-clicked"))
(:maximize ("maximize-normal"
"maximize-active"
"maximize-normal-clicked"
"maximize-active-clicked"))
(:close ("close-normal"
"close-active"
"close-normal-clicked"
"close-active-clicked"))
(:top-left ("top-left-inactive" "top-left"))
(:top-right ("top-right"))
(:bottom ("bottom"))
(:bottom-right ("bottom-right"))
(:bottom-left ("bottom-left"))
(:right ("right"))
(:left ("left"))
(:custom ("top-curves-inactive"
"top-curves"
"top-blue"
"top-blue-inactive"))))
(:transient-style
(:title-bar-position :right)
(:parts-to-redraw-on-focus (:close))
(:top ("t-top"))
(:close ("t-close-normal"
"t-close-active"
"t-close-normal-clicked"
"t-close-active-clicked"))
(:top-left ("t-top-left"))
(:top-right ("t-top-right"))
(:bottom ("t-bottom"))
(:bottom-right ("t-bottom-right"))
(:bottom-left ("t-bottom-left"))
(:right ("t-right"))
(:left ("t-left")))))
((:top ("t-top"))
(:close ("t-close-normal"
"t-close-active"
"t-close-normal-clicked"
"t-close-active-clicked"))
(:top-left ("t-top-left"))
(:top-right ("t-top-right"))
(:bottom ("t-bottom"))
(:bottom-right ("t-bottom-right"))
(:bottom-left ("t-bottom-left"))
(:right ("t-right"))
(:left ("t-left"))))))
(defun redraw-title-bar (button top-pix curv-pix)
(with-slots ((window eclipse::window)
......
;;; -*- Mode: Lisp; Package: ECLIPSE-INTERNALS -*-
;;; $Id: wm.lisp,v 1.31 2004/01/15 15:35:34 ihatchondo Exp $
;;; $Id: wm.lisp,v 1.32 2004/01/20 16:10:00 ihatchondo Exp $
;;;
;;; ECLIPSE. The Common Lisp Window Manager.
;;; Copyright (C) 2000, 2001, 2002 Iban HATCHONDO
......@@ -376,7 +376,7 @@
(defun make-decoration (application-window application)
(let* ((theme (root-decoration-theme *root*))
(style (find-decoration-frame-style theme application-window)))
(with-slots (hmargin vmargin left-margin top-margin) style
(with-slots (hmargin vmargin left-margin top-margin background) style
(multiple-value-bind (wm-sizes gravity)
(recompute-wm-normal-hints application-window hmargin vmargin)
(multiple-value-bind (x y width height)
......@@ -385,7 +385,7 @@
:parent (xlib:drawable-root application-window)
:width (+ width hmargin)
:height (+ height vmargin)
:background :parent-relative
:background background
:event-mask +decoration-event-mask+
:x (max 0 (- x left-margin))
:y (max 0 (- y top-margin))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment