annotate tests/gtk/gnome-test.el @ 462:0784d089fdc9 r21-2-46

Import from CVS: tag r21-2-46
author cvs
date Mon, 13 Aug 2007 11:44:37 +0200
parents
children db7068430402
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1 (require 'gnome)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
2
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
3 (gtk-define-test
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
4 "GNOME Stock Pixmaps" gnome gnome-pixmaps nil
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
5 (let ((hbox nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
6 (vbox nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
7 (widget nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
8 (label nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
9 (i 0))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
10 (mapc (lambda (b)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
11 (if (= (% i 5) 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
12 (progn
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
13 (setq hbox (gtk-hbutton-box-new))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
14 (gtk-box-set-spacing hbox 5)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
15 (gtk-container-add window hbox)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
16
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
17 (setq widget (gnome-stock-pixmap-widget-new window (car b))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
18 vbox (gtk-vbox-new t 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
19 label (gtk-label-new (cdr b)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
20 (gtk-container-add hbox vbox)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
21 (gtk-container-add vbox widget)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
22 (gtk-container-add vbox label)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
23 (gtk-widget-show-all vbox)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
24 (setq i (1+ i)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
25 gnome-stock-pixmaps)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
26
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
27 (gtk-define-test
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
28 "GNOME Stock Buttons" gnome gnome-buttons nil
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
29 (let ((hbbox nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
30 (button nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
31 (i 0))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
32 (mapc (lambda (b)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
33 (setq button (gnome-stock-button (car b)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
34 (gtk-signal-connect button 'clicked (lambda (obj data)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
35 (message "Stock GNOME Button: %s" data))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
36 (cdr b))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
37 (if (= (% i 3) 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
38 (progn
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
39 (setq hbbox (gtk-hbutton-box-new))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
40 (gtk-button-box-set-spacing hbbox 5)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
41 (gtk-container-add window hbbox)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
42
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
43 (gtk-container-add hbbox button)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
44 (gtk-widget-show button)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
45 (setq i (1+ i)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
46 gnome-stock-buttons)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
47
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
48 (gtk-define-test
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
49 "GNOME About" gnome gnome-about t
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
50 (setq window (gnome-about-new "XEmacs/GTK Test Application"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
51 "1.0a"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
52 "Copyright (C) 2000 Free Software Foundation"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
53 '("William M. Perry <wmperry@gnu.org>"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
54 "Ichabod Crane")
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
55 "This is a comment string... what wonderful commentary you have my dear!"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
56 "")))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
57
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
58 (gtk-define-test
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
59 "GNOME File Entry" gnome gnome-file-entry nil
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
60 (let ((button (gnome-file-entry-new nil "Test browse dialog...")))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
61 (gtk-container-add window button)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
62
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
63 (gtk-define-test
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
64 "GNOME Color Picker" gnome gnome-color-picker nil
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
65 (let ((picker (gnome-color-picker-new))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
66 (hbox (gtk-hbox-new nil 0))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
67 (label (gtk-label-new "Please choose a color: ")))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
68
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
69 (gtk-box-pack-start hbox label nil nil 2)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
70 (gtk-box-pack-start hbox picker t t 2)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
71 (gtk-container-add window hbox)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
72 (gtk-widget-show-all hbox)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
73
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
74 (gtk-define-test
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
75 "GNOME Desktop Entry Editor" gnome gnome-dentry-edit nil
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
76 (let* ((notebook (gtk-notebook-new)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
77 (gnome-dentry-edit-new-notebook notebook)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
78 (gtk-container-add window notebook)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
79
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
80 (gtk-define-test
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
81 "GNOME Date Edit" gnome gnome-date-entry nil
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
82 (let ((date (gnome-date-edit-new 0 t t))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
83 button)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
84 (gtk-box-pack-start window date t t 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
85
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
86 (setq button (gtk-check-button-new-with-label "Show time"))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
87 (gtk-signal-connect button 'clicked
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
88 (lambda (button date)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
89 (let ((flags (gnome-date-edit-get-flags date)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
90 (if (gtk-toggle-button-get-active button)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
91 (push 'show-time flags)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
92 (setq flags (delq 'show-time flags)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
93 (gnome-date-edit-set-flags date flags))) date)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
94 (gtk-toggle-button-set-active button t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
95 (gtk-box-pack-start window button nil nil 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
96
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
97 (setq button (gtk-check-button-new-with-label "24 Hour format"))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
98 (gtk-signal-connect button 'clicked
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
99 (lambda (button date)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
100 (let ((flags (gnome-date-edit-get-flags date)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
101 (if (gtk-toggle-button-get-active button)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
102 (push '24-hr flags)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
103 (setq flags (delq '24-hr flags)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
104 (gnome-date-edit-set-flags date flags))) date)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
105 (gtk-toggle-button-set-active button t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
106 (gtk-box-pack-start window button nil nil 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
107
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
108 (setq button (gtk-check-button-new-with-label "Week starts on monday"))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
109 (gtk-signal-connect button 'clicked
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
110 (lambda (button date)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
111 (let ((flags (gnome-date-edit-get-flags date)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
112 (if (gtk-toggle-button-get-active button)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
113 (push 'week-starts-on-monday flags)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
114 (setq flags (delq 'week-starts-on-monday flags)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
115 (gnome-date-edit-set-flags date flags))) date)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
116 (gtk-toggle-button-set-active button t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
117 (gtk-box-pack-start window button nil nil 0)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
118
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
119 (gtk-define-test
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
120 "GNOME Font Picker" gnome gnome-font-picker nil
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
121 (let ((hbox (gtk-hbox-new nil 5))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
122 (fp (gnome-font-picker-new))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
123 (label (gtk-label-new "Choose a font: "))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
124 (button nil))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
125 (gtk-box-pack-start hbox label t t 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
126 (gtk-box-pack-start hbox fp nil nil 2)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
127 (gnome-font-picker-set-title fp "Select a font...")
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
128 (gnome-font-picker-set-mode fp 'font-info)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
129 (gtk-box-pack-start window hbox t t 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
130
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
131 (setq button (gtk-check-button-new-with-label "Use font in label"))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
132 (gtk-signal-connect button 'clicked
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
133 (lambda (button fp)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
134 (gnome-font-picker-fi-set-use-font-in-label
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
135 fp (gtk-toggle-button-get-active button) 14))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
136 fp)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
137 (gtk-box-pack-start window button nil nil 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
138
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
139 (setq button (gtk-check-button-new-with-label "Show size"))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
140 (gtk-signal-connect button 'clicked
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
141 (lambda (button fp)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
142 (gnome-font-picker-fi-set-show-size
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
143 fp (gtk-toggle-button-get-active button)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
144 fp)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
145 (gtk-box-pack-start window button nil nil 0)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
146
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
147 (gtk-define-test
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
148 "GNOME Application" gnome gnome-app t
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
149 (setq window (gnome-app-new "XEmacs" "XEmacs/GNOME"))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
150 (let ((menubar (gtk-menu-bar-new))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
151 (contents nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
152 ;(toolbar-instance (specifier-instance top-toolbar))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
153 (toolbar nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
154 (item nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
155 (flushright nil))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
156 (mapc (lambda (node)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
157 (if (not node)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
158 (setq flushright t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
159 (setq item (gtk-build-xemacs-menu node))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
160 (gtk-widget-show item)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
161 (if flushright (gtk-menu-item-right-justify item))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
162 (gtk-menu-append menubar item)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
163 current-menubar)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
164
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
165 (setq toolbar (gtk-toolbar-new 'horizontal 'both))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
166 (mapc (lambda (x)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
167 (let ((button (gtk-button-new))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
168 (pixmap (gnome-stock-pixmap-widget-new toolbar x)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
169 (gtk-container-add button pixmap)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
170 (gtk-toolbar-append-widget toolbar button (symbol-name x) nil)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
171 '(open save print cut copy paste undo spellcheck srchrpl mail help))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
172
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
173 (setq contents (gtk-hbox-new nil 5))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
174 (let ((hbox contents)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
175 (vbox (gtk-vbox-new nil 5))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
176 (frame nil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
177 (label nil))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
178 (gtk-box-pack-start hbox vbox nil nil 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
179
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
180 (setq frame (gtk-frame-new "Normal Label")
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
181 label (gtk-label-new "This is a Normal label"))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
182 (gtk-container-add frame label)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
183 (gtk-box-pack-start vbox frame nil nil 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
184
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
185 (setq frame (gtk-frame-new "Multi-line Label")
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
186 label (gtk-label-new "This is a multi-line label.\nSecond line\nThird line"))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
187 (gtk-container-add frame label)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
188 (gtk-box-pack-start vbox frame nil nil 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
189
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
190 (setq frame (gtk-frame-new "Left Justified Label")
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
191 label (gtk-label-new "This is a Left-Justified\nMulti-line label.\nThird line"))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
192 (gtk-label-set-justify label 'left)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
193 (gtk-container-add frame label)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
194 (gtk-box-pack-start vbox frame nil nil 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
195
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
196 (setq frame (gtk-frame-new "Right Justified Label")
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
197 label (gtk-label-new "This is a Right-Justified\nMulti-line label.\nFourth line, (j/k)"))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
198 (gtk-label-set-justify label 'right)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
199 (gtk-container-add frame label)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
200 (gtk-box-pack-start vbox frame nil nil 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
201
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
202 ;; Start a second row so that we don't make a ridiculously tall window
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
203 (setq vbox (gtk-vbox-new nil 5))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
204 (gtk-box-pack-start hbox vbox nil nil 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
205
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
206 (setq frame (gtk-frame-new "Line wrapped label")
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
207 label (gtk-label-new
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
208 (concat "This is an example of a line-wrapped label. It should not be taking "
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
209 "up the entire " ;;; big space to test spacing
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
210 "width allocated to it, but automatically wraps the words to fit. "
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
211 "The time has come, for all good men, to come to the aid of their party. "
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
212 "The sixth sheik's six sheep's sick.\n"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
213 " It supports multiple paragraphs correctly, and correctly adds "
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
214 "many extra spaces. ")))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
215 (gtk-label-set-line-wrap label t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
216 (gtk-container-add frame label)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
217 (gtk-box-pack-start vbox frame nil nil 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
218
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
219 (setq frame (gtk-frame-new "Filled, wrapped label")
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
220 label (gtk-label-new
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
221 (concat
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
222 "This is an example of a line-wrapped, filled label. It should be taking "
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
223 "up the entire width allocated to it. Here is a seneance to prove "
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
224 "my point. Here is another sentence. "
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
225 "Here comes the sun, do de do de do.\n"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
226 " This is a new paragraph.\n"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
227 " This is another newer, longer, better paragraph. It is coming to an end, "
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
228 "unfortunately.")))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
229 (gtk-label-set-justify label 'fill)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
230 (gtk-label-set-line-wrap label t)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
231 (gtk-container-add frame label)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
232 (gtk-box-pack-start vbox frame nil nil 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
233
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
234 (setq frame (gtk-frame-new "Underlined label")
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
235 label (gtk-label-new (concat "This label is underlined!\n"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
236 "This one is underlined in 日本語の入用quite a funky fashion")))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
237 (gtk-label-set-justify label 'left)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
238 (gtk-label-set-pattern label "_________________________ _ _________ _ _____ _ __ __ ___ ____ _____")
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
239 (gtk-container-add frame label)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
240 (gtk-box-pack-start vbox frame nil nil 0))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
241
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
242 (gtk-widget-show-all toolbar)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
243 (gtk-widget-show-all menubar)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
244 (gtk-widget-show-all contents)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
245 (gnome-app-set-menus window menubar)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
246 (gnome-app-set-toolbar window toolbar)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
247 (gnome-app-set-contents window contents)))