annotate tests/glyph-test.el @ 420:41dbb7a9d5f2 r21-2-18

Import from CVS: tag r21-2-18
author cvs
date Mon, 13 Aug 2007 11:24:09 +0200
parents e804706bfb8c
children 95016f13131a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
1 (set-extent-begin-glyph
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
2 (make-extent (point) (point))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
3 (setq icon (make-glyph [xpm :file "../etc/xemacs-icon.xpm"])))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
4
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
5 (defun foo ()
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
6 (interactive)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
7 (setq ok-select (not ok-select)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
8
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
9 ;; button in a group
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
10 (setq ok-select nil)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
11 (set-extent-begin-glyph
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
12 (make-extent (point) (point))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
13 (make-glyph [button :descriptor ["ok " (setq ok-select t)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
14 :style radio :selected ok-select]]))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
15 ;; button in a group
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
16 (set-extent-begin-glyph
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
17 (make-extent (point) (point))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
18 (make-glyph [button :descriptor ["ok" (setq ok-select nil) :style radio
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
19 :selected (not ok-select)]]))
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
20 ;; toggle button
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
21 (set-extent-begin-glyph
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
22 (make-extent (point) (point))
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
23 (setq tbutton
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
24 (make-glyph [button :descriptor ["ok" (setq ok-select nil)
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
25 :style toggle
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
26 :selected (not ok-select)]])))
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
27 (set-extent-begin-glyph
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
28 (make-extent (point) (point))
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
29 (make-glyph [button :descriptor ["ok" :style toggle
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
30 :callback
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
31 (setq ok-select (not ok-select))
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
32 :selected ok-select]]))
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
33
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
34 ;; normal pushbutton
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
35 (set-extent-begin-glyph
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
36 (make-extent (point) (point))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
37 (setq pbutton (make-glyph
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
38 [button :width 10 :height 2
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
39 :face modeline-mousable
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
40 :descriptor "ok" :callback foo
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
41 :selected t])))
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
42 ;; tree view
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
43 (set-extent-begin-glyph
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
44 (make-extent (point) (point))
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
45 (setq tree (make-glyph
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
46 [tree-view :width 10
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
47 :descriptor "My Tree"
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
48 :properties (:items (["One" foo]
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
49 (["Two" foo]
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
50 ["Four" foo]
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
51 "Six")
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
52 "Three"))])))
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
53
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
54 ;; tab control
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
55 (set-extent-begin-glyph
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
56 (make-extent (point) (point))
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
57 (setq tab (make-glyph
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
58 [tab-control :descriptor "My Tab"
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
59 :face default
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
60 :properties (:items (["One" foo]
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
61 ["Two" foo]
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
62 ["Three" foo]))])))
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
63
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
64 ;; progress gauge
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
65 (set-extent-begin-glyph
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
66 (make-extent (point) (point))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
67 (setq pgauge (make-glyph
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
68 [progress-gauge :width 10 :height 2
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
69 :descriptor "ok"])))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
70 ;; progress the progress ...
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
71 (let ((x 0))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
72 (while (<= x 100)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
73 (set-image-instance-property (glyph-image-instance pgauge) :percent x)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
74 (setq x (+ x 5))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
75 (sit-for 0.1)))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
76
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
77 ;; progress gauge in the modeline
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
78 (setq global-mode-string
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
79 (cons (make-extent nil nil)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
80 (setq pg (make-glyph
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
81 [progress-gauge :width 5 :pixel-height 16
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
82 :descriptor "ok"]))))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
83 ;; progress the progress ...
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
84 (let ((x 0))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
85 (while (<= x 100)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
86 (set-image-instance-property (glyph-image-instance pg) :percent x)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
87 (setq x (+ x 5))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
88 (sit-for 0.1)))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
89
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
90 (set-extent-begin-glyph
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
91 (make-extent (point) (point))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
92 (make-glyph
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
93 [button :face modeline-mousable
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
94 :descriptor "ok" :callback foo
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
95 :image (make-glyph
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
96 [xpm :file "../etc/xemacs-icon.xpm"])]))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
97
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
98 ;; normal pushbutton
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
99 (set-extent-begin-glyph
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
100 (make-extent (point) (point))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
101 (make-glyph [button :descriptor ["A Big Button" foo ]]))
418
e804706bfb8c Import from CVS: tag r21-2-17
cvs
parents: 412
diff changeset
102
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
103 ;; edit box
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
104 (set-extent-begin-glyph
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
105 (make-extent (point) (point))
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
106 (setq hedit (make-glyph [edit-field :pixel-width 50 :pixel-height 30
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
107 :face bold-italic
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
108 :descriptor ["Hello"]])))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
109 ;; combo box
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
110 (set-extent-begin-glyph
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
111 (make-extent (point) (point))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
112 (setq hcombo (make-glyph
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
113 [combo-box :width 10 :height 3 :descriptor ["Hello"]
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
114 :properties (:items ("One" "Two" "Three"))])))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
115
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
116 ;; line
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
117 (set-extent-begin-glyph
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
118 (make-extent (point) (point))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 408
diff changeset
119 (make-glyph [label :pixel-width 150 :descriptor "Hello"]))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
120
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
121 ;; scrollbar
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
122 ;(set-extent-begin-glyph
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
123 ; (make-extent (point) (point))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
124 ; (make-glyph [scrollbar :width 50 :height 20 :descriptor ["Hello"]]))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
125
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
126 ;; generic subwindow
420
41dbb7a9d5f2 Import from CVS: tag r21-2-18
cvs
parents: 418
diff changeset
127 (setq sw (make-glyph [subwindow :pixel-width 50 :pixel-height 70]))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
128 (set-extent-begin-glyph (make-extent (point) (point)) sw)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents:
diff changeset
129