-
Notifications
You must be signed in to change notification settings - Fork 1
/
ltk-tile.lisp
76 lines (60 loc) · 2.06 KB
/
ltk-tile.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#|
This software is Copyright (c) 2005 Peter Herth <[email protected]>
Peter Herth grants you the rights to distribute
and use this software as governed by the terms
of the Lisp Lesser GNU Public License
(http://opensource.franz.com/preamble.html),
known as the LLGPL.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
|#
(defpackage :ltk-tile
(:use :common-lisp
:ltk
)
(:export
#:activate-tile
#:style-default
#:style-element-names
#:theme-names
#:use-theme
#:tile-test
))
(in-package :ltk-tile)
(defparameter *tile-widgets* '(button check-button entry label radio-button scrollbar ))
;;; checkbutton combobox dialog notebook paned progressbar treeview menubutton separator
(defun require-tile ()
(send-wish "package require tile"))
(defun activate-tile ()
(pushnew #'require-tile *init-wish-hook*)
(dolist (widget *tile-widgets*)
(let ((w (make-instance widget)))
(unless (search "ttk::" (widget-class-name w))
(setf (widget-class-name w) (concatenate 'string "ttk::" (widget-class-name w)))))))
(defun theme-names ()
(send-wish "senddatastrings [style theme names]")
(ltk::read-data))
(defun use-theme(name)
(format-wish "style theme use ~a" name))
(defun style-element-names ()
(send-wish "senddatastrings [style element names]")
(ltk::read-data))
(defun style-default (style &rest params)
(format-wish "style default ~A ~{ -~(~a~) {~a}~}" style params))
(defun tile-test ()
(activate-tile)
(with-ltk ()
(let* ((mb (make-menubar))
(mtheme (make-menu mb "Theme" ))
(b (make-instance 'button :text "a button"))
(l (make-instance 'label :text "a label"))
(e (make-instance 'entry :text "an entry"))
)
(pack (list l e b) :side :left)
(dolist (theme (theme-names))
(let ((theme theme))
(make-menubutton mtheme theme (lambda ()
(use-theme theme)))))
)))