Mercurial > hg > xemacs-beta
annotate src/ui-byhand.c @ 5925:08cfc8f77fb6 cygwin
make space for long ptr, and store as such, for frame in WINDOW data,
add a bit more debugging to debug-mswindow,
Vin Shelton patch to fix M-x shell
| author | Henry Thompson <ht@markup.co.uk> |
|---|---|
| date | Fri, 27 Feb 2015 17:41:20 +0000 |
| parents | 56144c8593a8 |
| children |
| rev | line source |
|---|---|
|
5287
cd167465bf69
More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5231
diff
changeset
|
1 /* ui-byhand.c --- hand-coded GTK functions |
|
cd167465bf69
More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5231
diff
changeset
|
2 |
|
cd167465bf69
More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5231
diff
changeset
|
3 Copyright (C) 2000, 2001 William M. Perry |
|
cd167465bf69
More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5231
diff
changeset
|
4 |
|
cd167465bf69
More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5231
diff
changeset
|
5 I really wish this entire file could go away, but there is |
| 462 | 6 currently no way to do the following in the Foreign Function |
| 7 Interface: | |
| 8 | |
| 9 1) Deal with return values in the parameter list (ie: int *foo) | |
| 10 | |
| 11 So we have to code a few functions by hand. Ick. | |
| 12 | |
| 13 William M. Perry 5/8/00 | |
|
4709
db7068430402
Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents:
2367
diff
changeset
|
14 |
|
db7068430402
Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents:
2367
diff
changeset
|
15 This file is part of XEmacs. |
|
db7068430402
Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents:
2367
diff
changeset
|
16 |
|
5405
2aa9cd456ae7
Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
5231
diff
changeset
|
17 XEmacs is free software: you can redistribute it and/or modify it |
|
4709
db7068430402
Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents:
2367
diff
changeset
|
18 under the terms of the GNU General Public License as published by the |
|
5405
2aa9cd456ae7
Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
5231
diff
changeset
|
19 Free Software Foundation, either version 3 of the License, or (at your |
|
2aa9cd456ae7
Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
5231
diff
changeset
|
20 option) any later version. |
|
4709
db7068430402
Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents:
2367
diff
changeset
|
21 |
|
db7068430402
Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents:
2367
diff
changeset
|
22 XEmacs is distributed in the hope that it will be useful, but WITHOUT |
|
db7068430402
Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents:
2367
diff
changeset
|
23 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
db7068430402
Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents:
2367
diff
changeset
|
24 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
db7068430402
Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents:
2367
diff
changeset
|
25 for more details. |
|
db7068430402
Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents:
2367
diff
changeset
|
26 |
|
db7068430402
Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents:
2367
diff
changeset
|
27 You should have received a copy of the GNU General Public License |
|
5405
2aa9cd456ae7
Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
5231
diff
changeset
|
28 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 462 | 29 |
| 30 #include "gui.h" | |
| 31 | |
| 32 DEFUN ("gtk-box-query-child-packing", Fgtk_box_query_child_packing, 2, 2,0, /* | |
| 33 Returns information about how CHILD is packed into BOX. | |
| 34 Return value is a list of (EXPAND FILL PADDING PACK_TYPE). | |
| 35 */ | |
| 36 (box, child)) | |
| 37 { | |
| 38 gboolean expand, fill; | |
| 39 guint padding; | |
| 40 GtkPackType pack_type; | |
| 41 Lisp_Object result = Qnil; | |
| 42 | |
| 43 CHECK_GTK_OBJECT (box); | |
| 44 CHECK_GTK_OBJECT (child); | |
| 45 | |
| 46 if (!GTK_IS_BOX (XGTK_OBJECT (box)->object)) | |
| 47 { | |
| 563 | 48 wtaerror ("Object is not a GtkBox", box); |
| 462 | 49 } |
| 50 | |
| 51 if (!GTK_IS_WIDGET (XGTK_OBJECT (child)->object)) | |
| 52 { | |
| 563 | 53 wtaerror ("Child is not a GtkWidget", child); |
| 462 | 54 } |
| 55 | |
| 56 gtk_box_query_child_packing (GTK_BOX (XGTK_OBJECT (box)->object), | |
| 57 GTK_WIDGET (XGTK_OBJECT (child)->object), | |
| 58 &expand, &fill, &padding, &pack_type); | |
| 59 | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
60 result = Fcons (make_fixnum (pack_type), result); |
|
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
61 result = Fcons (make_fixnum (padding), result); |
| 462 | 62 result = Fcons (fill ? Qt : Qnil, result); |
| 63 result = Fcons (expand ? Qt : Qnil, result); | |
| 64 | |
| 65 return (result); | |
| 66 } | |
| 67 | |
| 68 /* void gtk_button_box_get_child_size_default (gint *min_width, gint *min_height); */ | |
| 69 DEFUN ("gtk-button-box-get-child-size-default", | |
| 70 Fgtk_button_box_get_child_size_default, 0, 0, 0, /* | |
| 71 Return a cons cell (WIDTH . HEIGHT) of the default button box child size. | |
| 72 */ | |
| 73 ()) | |
| 74 { | |
| 75 gint width, height; | |
| 76 | |
| 77 gtk_button_box_get_child_size_default (&width, &height); | |
| 78 | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
79 return (Fcons (make_fixnum (width), make_fixnum (height))); |
| 462 | 80 } |
| 81 | |
| 82 /* void gtk_button_box_get_child_ipadding_default (gint *ipad_x, gint *ipad_y); */ | |
| 83 DEFUN ("gtk-button-box-get-child-ipadding-default", | |
| 84 Fgtk_button_box_get_child_ipadding_default, 0, 0, 0, /* | |
| 85 Return a cons cell (X . Y) of the default button box ipadding. | |
| 86 */ | |
| 87 ()) | |
| 88 { | |
| 89 gint x, y; | |
| 90 | |
| 91 gtk_button_box_get_child_ipadding_default (&x, &y); | |
| 92 | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
93 return (Fcons (make_fixnum (x), make_fixnum (y))); |
| 462 | 94 } |
| 95 | |
| 96 /* void gtk_button_box_get_child_size (GtkButtonBox *widget, | |
| 97 gint *min_width, gint *min_height); */ | |
| 98 DEFUN ("gtk-button-box-get-child-size", Fgtk_button_box_get_child_size, 1, 1, 0, /* | |
| 99 Get the current size of a child in the buttonbox BOX. | |
| 100 */ | |
| 101 (box)) | |
| 102 { | |
| 103 gint width, height; | |
| 104 | |
| 105 CHECK_GTK_OBJECT (box); | |
| 106 | |
| 107 if (!GTK_IS_BUTTON_BOX (XGTK_OBJECT (box)->object)) | |
| 108 { | |
| 563 | 109 wtaerror ("Not a GtkBox object", box); |
| 462 | 110 } |
| 111 | |
| 112 gtk_button_box_get_child_size (GTK_BUTTON_BOX (XGTK_OBJECT (box)->object), | |
| 113 &width, &height); | |
| 114 | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
115 return (Fcons (make_fixnum (width), make_fixnum (height))); |
| 462 | 116 } |
| 117 | |
| 118 /* void gtk_button_box_get_child_ipadding (GtkButtonBox *widget, gint *ipad_x, gint *ipad_y); */ | |
| 119 DEFUN ("gtk-button-box-get-child-ipadding", | |
| 120 Fgtk_button_box_get_child_ipadding, 1, 1, 0, /* | |
| 121 Return a cons cell (X . Y) of the current buttonbox BOX ipadding. | |
| 122 */ | |
| 123 (box)) | |
| 124 { | |
| 125 gint x, y; | |
| 126 | |
| 127 CHECK_GTK_OBJECT (box); | |
| 128 | |
| 129 if (!GTK_IS_BUTTON_BOX (XGTK_OBJECT (box)->object)) | |
| 130 { | |
| 563 | 131 wtaerror ("Not a GtkBox object", box); |
| 462 | 132 } |
| 133 | |
| 134 gtk_button_box_get_child_ipadding (GTK_BUTTON_BOX (XGTK_OBJECT (box)->object), | |
| 135 &x, &y); | |
| 136 | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
137 return (Fcons (make_fixnum (x), make_fixnum (y))); |
| 462 | 138 } |
| 139 | |
| 140 /*void gtk_calendar_get_date (GtkCalendar *calendar, | |
| 141 guint *year, | |
| 142 guint *month, | |
| 143 guint *day); | |
| 144 */ | |
| 145 DEFUN ("gtk-calendar-get-date", Fgtk_calendar_get_date, 1, 1, 0, /* | |
| 146 Return a list of (YEAR MONTH DAY) from the CALENDAR object. | |
| 147 */ | |
| 148 (calendar)) | |
| 149 { | |
| 150 guint year, month, day; | |
| 151 | |
| 152 CHECK_GTK_OBJECT (calendar); | |
| 153 | |
| 154 if (!GTK_IS_CALENDAR (XGTK_OBJECT (calendar)->object)) | |
| 155 { | |
| 563 | 156 wtaerror ("Not a GtkCalendar object", calendar); |
| 462 | 157 } |
| 158 | |
| 159 gtk_calendar_get_date (GTK_CALENDAR (XGTK_OBJECT (calendar)->object), | |
| 160 &year, &month, &day); | |
| 161 | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
162 return (list3 (make_fixnum (year), make_fixnum (month), make_fixnum (day))); |
| 462 | 163 } |
| 164 | |
| 165 /* gint gtk_clist_get_text (GtkCList *clist, | |
| 166 gint row, | |
| 167 gint column, | |
| 168 gchar **text); | |
| 169 */ | |
| 170 DEFUN ("gtk-clist-get-text", Fgtk_clist_get_text, 3, 3, 0, /* | |
| 171 Returns the text from GtkCList OBJ cell at coordinates ROW, COLUMN. | |
| 172 */ | |
| 173 (obj, row, column)) | |
| 174 { | |
| 175 gchar *text = NULL; | |
| 176 Lisp_Object rval = Qnil; | |
| 177 | |
| 178 CHECK_GTK_OBJECT (obj); | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
179 CHECK_FIXNUM (row); |
|
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
180 CHECK_FIXNUM (column); |
| 462 | 181 |
| 182 if (!GTK_IS_CLIST (XGTK_OBJECT (obj)->object)) | |
| 183 { | |
| 563 | 184 wtaerror ("Object is not a GtkCList", obj); |
| 462 | 185 } |
| 186 | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
187 gtk_clist_get_text (GTK_CLIST (XGTK_OBJECT (obj)->object), XFIXNUM (row), XFIXNUM (column), &text); |
| 462 | 188 |
| 189 if (text) | |
| 190 { | |
|
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
191 rval = build_cistring (text); |
| 462 | 192 /* NOTE: This is NOT a memory leak. GtkCList returns a pointer |
| 193 to internally used memory, not a copy of it. | |
| 194 g_free (text); | |
| 195 */ | |
| 196 } | |
| 197 | |
| 198 return (rval); | |
| 199 } | |
| 200 | |
| 201 /* gint gtk_clist_get_selection_info (GtkCList *clist, | |
| 202 gint x, | |
| 203 gint y, | |
| 204 gint *row, | |
| 205 gint *column); */ | |
| 206 DEFUN ("gtk-clist-get-selection-info", Fgtk_clist_get_selection, 3, 3, 0, /* | |
| 207 Returns a cons cell of (ROW . COLUMN) of the GtkCList OBJ at coordinates X, Y. | |
| 208 */ | |
| 209 (obj, x, y)) | |
| 210 { | |
| 211 gint row, column; | |
| 212 | |
| 213 CHECK_GTK_OBJECT (obj); | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
214 CHECK_FIXNUM (x); |
|
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
215 CHECK_FIXNUM (y); |
| 462 | 216 |
| 217 if (!GTK_IS_CLIST (XGTK_OBJECT (obj)->object)) | |
| 218 { | |
| 563 | 219 wtaerror ("Object is not a GtkCList", obj); |
| 462 | 220 } |
| 221 | |
| 222 gtk_clist_get_selection_info (GTK_CLIST (XGTK_OBJECT (obj)->object), | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
223 XFIXNUM (x), XFIXNUM (y), &row, &column); |
| 462 | 224 |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
225 return (Fcons (make_fixnum (row), make_fixnum (column))); |
| 462 | 226 } |
| 227 | |
| 228 DEFUN ("gtk-clist-get-pixmap", Fgtk_clist_get_pixmap, 3, 3, 0, /* | |
| 229 Return a cons of (pixmap . mask) at ROW,COLUMN in CLIST. | |
| 230 */ | |
| 231 (clist, row, column)) | |
| 232 { | |
| 233 GdkPixmap *pixmap = NULL; | |
| 234 GdkBitmap *mask = NULL; | |
| 235 | |
| 236 CHECK_GTK_OBJECT (clist); | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
237 CHECK_FIXNUM (row); |
|
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
238 CHECK_FIXNUM (column); |
| 462 | 239 |
| 240 if (!GTK_IS_CLIST (XGTK_OBJECT (clist)->object)) | |
| 241 { | |
| 563 | 242 wtaerror ("Object is not a GtkCList", clist); |
| 462 | 243 } |
| 244 | |
| 245 gtk_clist_get_pixmap (GTK_CLIST (XGTK_OBJECT (clist)->object), | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
246 XFIXNUM (row), XFIXNUM (column), |
| 462 | 247 &pixmap, &mask); |
| 248 | |
| 249 return (Fcons (pixmap ? build_gtk_boxed (pixmap, GTK_TYPE_GDK_WINDOW) : Qnil, | |
| 250 mask ? build_gtk_boxed (mask, GTK_TYPE_GDK_WINDOW) : Qnil)); | |
| 251 } | |
| 252 | |
| 253 DEFUN ("gtk-clist-get-pixtext", Fgtk_clist_get_pixtext, 3, 3, 0, /* | |
| 254 Return a list of (pixmap mask text) at ROW,COLUMN in CLIST. | |
| 255 */ | |
| 256 (clist, row, column)) | |
| 257 { | |
| 258 GdkPixmap *pixmap = NULL; | |
| 259 GdkBitmap *mask = NULL; | |
| 260 char *text = NULL; | |
| 261 guint8 spacing; | |
| 262 | |
| 263 CHECK_GTK_OBJECT (clist); | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
264 CHECK_FIXNUM (row); |
|
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
265 CHECK_FIXNUM (column); |
| 462 | 266 |
| 267 if (!GTK_IS_CLIST (XGTK_OBJECT (clist)->object)) | |
| 268 { | |
| 563 | 269 wtaerror ("Object is not a GtkCList", clist); |
| 462 | 270 } |
| 271 | |
| 272 gtk_clist_get_pixtext (GTK_CLIST (XGTK_OBJECT (clist)->object), | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
273 XFIXNUM (row), XFIXNUM (column), &text, &spacing, |
| 462 | 274 &pixmap, &mask); |
| 275 | |
| 276 return (list3 (pixmap ? build_gtk_boxed (pixmap, GTK_TYPE_GDK_WINDOW) : Qnil, | |
| 277 mask ? build_gtk_boxed (mask, GTK_TYPE_GDK_WINDOW) : Qnil, | |
|
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
278 (text && text[0]) ? build_cistring (text) : Qnil)); |
| 462 | 279 } |
| 280 | |
| 281 /* void gtk_color_selection_get_color(GtkColorSelection *colorsel, gdouble *color); */ | |
| 282 DEFUN ("gtk-color-selection-get-color", Fgtk_color_selection_get_color, 1, 1, 0, /* | |
| 283 Return a list of (RED GREEN BLUE ALPHA) from the GtkColorSelection OBJECT. | |
| 284 */ | |
| 285 (object)) | |
| 286 { | |
| 287 gdouble rgba[4]; | |
| 288 | |
| 289 CHECK_GTK_OBJECT (object); | |
| 290 | |
| 291 if (!GTK_IS_COLOR_SELECTION (XGTK_OBJECT (object)->object)) | |
| 292 { | |
| 563 | 293 wtaerror ("Object is not a GtkColorSelection", object); |
| 462 | 294 } |
| 295 | |
| 296 gtk_color_selection_get_color (GTK_COLOR_SELECTION (XGTK_OBJECT (object)), rgba); | |
| 297 | |
| 298 return (list4 (make_float (rgba[0]), | |
| 299 make_float (rgba[1]), | |
| 300 make_float (rgba[2]), | |
| 301 make_float (rgba[3]))); | |
| 302 } | |
| 303 | |
| 304 /* (gtk-import-function nil "gtk_editable_insert_text" 'GtkEditable 'GtkString 'gint 'pointer-to-gint) */ | |
| 305 DEFUN ("gtk-editable-insert-text", Fgtk_editable_insert_text, 3, 3, 0, /* | |
| 306 Insert text STRINT at POS in GtkEditable widget OBJ. | |
| 307 Returns the new position of the cursor in the widget. | |
| 308 */ | |
| 309 (obj, string, pos)) | |
| 310 { | |
| 311 gint the_pos; | |
| 312 | |
| 313 CHECK_GTK_OBJECT (obj); | |
| 314 CHECK_STRING (string); | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
315 CHECK_FIXNUM (pos); |
| 462 | 316 |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
317 the_pos = XFIXNUM (pos); |
| 462 | 318 |
| 319 if (!GTK_IS_EDITABLE (XGTK_OBJECT (obj)->object)) | |
| 320 { | |
| 563 | 321 wtaerror ("Object is not a GtkEditable", obj); |
| 462 | 322 } |
| 323 | |
| 324 gtk_editable_insert_text (GTK_EDITABLE (XGTK_OBJECT (obj)->object), | |
| 325 (char *) XSTRING_DATA (string), | |
| 326 XSTRING_LENGTH (string), | |
| 327 &the_pos); | |
| 328 | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
329 return (make_fixnum (the_pos)); |
| 462 | 330 } |
| 331 | |
| 332 DEFUN ("gtk-pixmap-get", Fgtk_pixmap_get, 1, 1, 0, /* | |
| 333 Return a cons cell of (PIXMAP . MASK) from GtkPixmap OBJECT. | |
| 334 */ | |
| 335 (object)) | |
| 336 { | |
| 337 GdkPixmap *pixmap, *mask; | |
| 338 | |
| 339 CHECK_GTK_OBJECT (object); | |
| 340 | |
| 341 if (!GTK_IS_PIXMAP (XGTK_OBJECT (object)->object)) | |
| 342 { | |
| 563 | 343 wtaerror ("Object is not a GtkPixmap", object); |
| 462 | 344 } |
| 345 | |
| 346 gtk_pixmap_get (GTK_PIXMAP (XGTK_OBJECT (object)->object), &pixmap, &mask); | |
| 347 | |
| 348 return (Fcons (pixmap ? build_gtk_object (GTK_OBJECT (pixmap)) : Qnil, | |
| 349 mask ? build_gtk_object (GTK_OBJECT (mask)) : Qnil)); | |
| 350 } | |
| 351 | |
| 352 DEFUN ("gtk-curve-get-vector", Fgtk_curve_get_vector, 2, 2, 0, /* | |
| 353 Returns a vector of LENGTH points representing the curve of CURVE. | |
| 354 */ | |
| 355 (curve, length)) | |
| 356 { | |
| 357 gfloat *vector = NULL; | |
| 358 Lisp_Object lisp_vector = Qnil; | |
| 359 int i; | |
| 360 | |
| 361 CHECK_GTK_OBJECT (curve); | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
362 CHECK_FIXNUM (length); |
| 462 | 363 |
| 364 if (!GTK_IS_CURVE (XGTK_OBJECT (curve)->object)) | |
| 365 { | |
| 563 | 366 wtaerror ("Object is not a GtkCurve", curve); |
| 462 | 367 } |
| 368 | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
369 vector = alloca_array (gfloat, XFIXNUM (length)); |
| 462 | 370 |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
371 gtk_curve_get_vector (GTK_CURVE (XGTK_OBJECT (curve)->object), XFIXNUM (length), vector); |
|
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
372 lisp_vector = make_vector (XFIXNUM (length), Qnil); |
| 462 | 373 |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
374 for (i = 0; i < XFIXNUM (length); i++) |
| 462 | 375 { |
| 376 XVECTOR_DATA (lisp_vector)[i] = make_float (vector[i]); | |
| 377 } | |
| 378 | |
| 379 return (lisp_vector); | |
| 380 } | |
| 381 | |
| 382 DEFUN ("gtk-curve-set-vector", Fgtk_curve_set_vector, 2, 2, 0, /* | |
| 383 Set the vector of points on CURVE to VECTOR. | |
| 384 */ | |
| 385 (curve, vector)) | |
| 386 { | |
| 387 gfloat *c_vector = NULL; | |
| 388 int vec_length = 0; | |
| 389 int i; | |
| 390 | |
| 391 CHECK_GTK_OBJECT (curve); | |
| 392 CHECK_VECTOR (vector); | |
| 393 | |
| 394 vec_length = XVECTOR_LENGTH (vector); | |
| 395 | |
| 396 if (!GTK_IS_CURVE (XGTK_OBJECT (curve)->object)) | |
| 397 { | |
| 563 | 398 wtaerror ("Object is not a GtkCurve", curve); |
| 462 | 399 } |
| 400 | |
| 2367 | 401 c_vector = alloca_array (gfloat, vec_length); |
| 462 | 402 |
| 403 for (i = 0; i < vec_length; i++) | |
| 404 { | |
| 405 CHECK_FLOAT (XVECTOR_DATA (vector)[i]); | |
| 406 c_vector[i] = extract_float (XVECTOR_DATA (vector)[i]); | |
| 407 } | |
| 408 | |
| 409 gtk_curve_set_vector (GTK_CURVE (XGTK_OBJECT (curve)->object), vec_length, c_vector); | |
| 410 return (Qt); | |
| 411 } | |
| 412 | |
| 413 DEFUN ("gtk-label-get", Fgtk_label_get, 1, 1, 0, /* | |
| 414 Return the text of LABEL. | |
| 415 */ | |
| 416 (label)) | |
| 417 { | |
| 418 gchar *string; | |
| 419 | |
| 420 CHECK_GTK_OBJECT (label); | |
| 421 | |
| 422 if (!GTK_IS_LABEL (XGTK_OBJECT (label)->object)) | |
| 423 { | |
| 563 | 424 wtaerror ("Object is not a GtkLabel", label); |
| 462 | 425 } |
| 426 | |
| 427 gtk_label_get (GTK_LABEL (XGTK_OBJECT (label)->object), &string); | |
| 428 | |
|
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
429 return (build_cistring (string)); |
| 462 | 430 } |
| 431 | |
| 432 DEFUN ("gtk-notebook-query-tab-label-packing", Fgtk_notebook_query_tab_label_packing, 2, 2, 0, /* | |
| 433 Return a list of packing information (EXPAND FILL PACK_TYPE) for CHILD in NOTEBOOK. | |
| 434 */ | |
| 435 (notebook, child)) | |
| 436 { | |
| 437 gboolean expand, fill; | |
| 438 GtkPackType pack_type; | |
| 439 | |
| 440 CHECK_GTK_OBJECT (notebook); | |
| 441 CHECK_GTK_OBJECT (child); | |
| 442 | |
| 443 if (!GTK_IS_NOTEBOOK (XGTK_OBJECT (notebook)->object)) | |
| 444 { | |
| 563 | 445 wtaerror ("Object is not a GtkLabel", notebook); |
| 462 | 446 } |
| 447 | |
| 448 if (!GTK_IS_WIDGET (XGTK_OBJECT (child)->object)) | |
| 449 { | |
| 563 | 450 wtaerror ("Object is not a GtkWidget", child); |
| 462 | 451 } |
| 452 | |
| 453 gtk_notebook_query_tab_label_packing (GTK_NOTEBOOK (XGTK_OBJECT (notebook)->object), | |
| 454 GTK_WIDGET (XGTK_OBJECT (child)->object), | |
| 455 &expand, &fill, &pack_type); | |
| 456 | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
457 return (list3 (expand ? Qt : Qnil, fill ? Qt : Qnil, make_fixnum (pack_type))); |
| 462 | 458 } |
| 459 | |
| 460 DEFUN ("gtk-widget-get-pointer", Fgtk_widget_get_pointer, 1, 1, 0, /* | |
| 461 Return the pointer position relative to WIDGET as a cons of (X . Y). | |
| 462 */ | |
| 463 (widget)) | |
| 464 { | |
| 465 gint x,y; | |
| 466 CHECK_GTK_OBJECT (widget); | |
| 467 | |
| 468 if (!GTK_IS_WIDGET (XGTK_OBJECT (widget)->object)) | |
| 469 { | |
| 563 | 470 wtaerror ("Object is not a GtkWidget", widget); |
| 462 | 471 } |
| 472 | |
| 473 gtk_widget_get_pointer (GTK_WIDGET (XGTK_OBJECT (widget)->object), &x, &y); | |
| 474 | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
475 return (Fcons (make_fixnum (x), make_fixnum (y))); |
| 462 | 476 } |
| 477 | |
| 478 /* This is called whenever an item with a GUI_ID associated with it is | |
| 479 destroyed. This allows us to remove the references in gui-gtk.c | |
| 480 that made sure callbacks and such were GCPRO-ed | |
| 481 */ | |
| 482 static void | |
| 483 __remove_gcpro_by_id (gpointer user_data) | |
| 484 { | |
| 485 ungcpro_popup_callbacks ((GUI_ID) user_data); | |
| 486 } | |
| 487 | |
| 488 static void | |
| 2286 | 489 __generic_toolbar_callback (GtkWidget *UNUSED (item), gpointer user_data) |
| 462 | 490 { |
| 491 Lisp_Object callback; | |
| 492 Lisp_Object lisp_user_data; | |
| 493 | |
| 5013 | 494 callback = GET_LISP_FROM_VOID (user_data); |
| 462 | 495 |
| 496 lisp_user_data = XCAR (callback); | |
| 497 callback = XCDR (callback); | |
| 498 | |
| 499 signal_special_gtk_user_event (Qnil, callback, lisp_user_data); | |
| 500 } | |
| 501 | |
| 502 static Lisp_Object | |
| 503 generic_toolbar_insert_item (Lisp_Object toolbar, | |
| 504 Lisp_Object text, | |
| 505 Lisp_Object tooltip_text, | |
| 506 Lisp_Object tooltip_private_text, | |
| 507 Lisp_Object icon, | |
| 508 Lisp_Object callback, | |
| 509 Lisp_Object data, | |
| 510 Lisp_Object prepend_p, | |
| 511 Lisp_Object position) | |
| 512 { | |
| 513 GUI_ID id; | |
| 514 GtkWidget *w = NULL; | |
| 515 | |
| 516 CHECK_GTK_OBJECT (toolbar); | |
| 517 CHECK_GTK_OBJECT (icon); | |
| 518 CHECK_STRING (text); | |
| 519 CHECK_STRING (tooltip_text); | |
| 520 CHECK_STRING (tooltip_private_text); | |
| 521 | |
| 522 if (!SYMBOLP (callback) && !LISTP (callback)) | |
| 523 { | |
| 563 | 524 wtaerror ("Callback must be symbol or eval-able form", callback); |
| 462 | 525 } |
| 526 | |
| 527 if (!GTK_IS_TOOLBAR (XGTK_OBJECT (toolbar)->object)) | |
| 528 { | |
| 563 | 529 wtaerror ("Object is not a GtkToolbar", toolbar); |
| 462 | 530 } |
| 531 | |
| 532 if (!GTK_IS_WIDGET (XGTK_OBJECT (icon)->object)) | |
| 533 { | |
| 563 | 534 wtaerror ("Object is not a GtkWidget", icon); |
| 462 | 535 } |
| 536 | |
| 537 callback = Fcons (data, callback); | |
| 538 | |
| 539 id = new_gui_id (); | |
| 540 gcpro_popup_callbacks (id, callback); | |
| 541 gtk_object_weakref (XGTK_OBJECT (toolbar)->object, __remove_gcpro_by_id, | |
| 542 (gpointer) id); | |
| 543 | |
| 544 if (NILP (position)) | |
| 545 { | |
| 546 w = (NILP (prepend_p) ? gtk_toolbar_append_item : gtk_toolbar_prepend_item) | |
| 547 (GTK_TOOLBAR (XGTK_OBJECT (toolbar)->object), | |
| 2054 | 548 (char*) XSTRING_DATA (text), |
| 549 (char*) XSTRING_DATA (tooltip_text), | |
| 550 (char*) XSTRING_DATA (tooltip_private_text), | |
| 462 | 551 GTK_WIDGET (XGTK_OBJECT (icon)->object), |
| 552 GTK_SIGNAL_FUNC (__generic_toolbar_callback), | |
| 5013 | 553 STORE_LISP_IN_VOID (callback)); |
| 462 | 554 } |
| 555 else | |
| 556 { | |
| 557 w = gtk_toolbar_insert_item (GTK_TOOLBAR (XGTK_OBJECT (toolbar)->object), | |
| 2054 | 558 (char*) XSTRING_DATA (text), |
| 559 (char*) XSTRING_DATA (tooltip_text), | |
| 560 (char*) XSTRING_DATA (tooltip_private_text), | |
| 462 | 561 GTK_WIDGET (XGTK_OBJECT (icon)->object), |
| 562 GTK_SIGNAL_FUNC (__generic_toolbar_callback), | |
| 5013 | 563 STORE_LISP_IN_VOID (callback), |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
564 XFIXNUM (position)); |
| 462 | 565 } |
| 566 | |
| 567 | |
| 568 return (w ? build_gtk_object (GTK_OBJECT (w)) : Qnil); | |
| 569 } | |
| 570 | |
| 571 DEFUN ("gtk-toolbar-append-item", Fgtk_toolbar_append_item, 6, 7, 0, /* | |
| 572 Appends a new button to the given toolbar. | |
| 573 */ | |
| 574 (toolbar, text, tooltip_text, tooltip_private_text, icon, callback, data)) | |
| 575 { | |
| 576 return (generic_toolbar_insert_item (toolbar,text,tooltip_text,tooltip_private_text,icon,callback,data,Qnil,Qnil)); | |
| 577 } | |
| 578 | |
| 579 DEFUN ("gtk-toolbar-prepend-item", Fgtk_toolbar_prepend_item, 6, 7, 0, /* | |
| 580 Adds a new button to the beginning (left or top edges) of the given toolbar. | |
| 581 */ | |
| 582 (toolbar, text, tooltip_text, tooltip_private_text, icon, callback, data)) | |
| 583 { | |
| 584 return (generic_toolbar_insert_item (toolbar,text,tooltip_text,tooltip_private_text,icon,callback,data,Qt,Qnil)); | |
| 585 } | |
| 586 | |
| 587 DEFUN ("gtk-toolbar-insert-item", Fgtk_toolbar_insert_item, 7, 8, 0, /* | |
| 588 Adds a new button to the beginning (left or top edges) of the given toolbar. | |
| 589 */ | |
| 590 (toolbar, text, tooltip_text, tooltip_private_text, icon, callback, position, data)) | |
| 591 { | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
592 CHECK_FIXNUM (position); |
| 462 | 593 |
| 594 return (generic_toolbar_insert_item (toolbar,text,tooltip_text,tooltip_private_text,icon,callback,data,Qnil,position)); | |
| 595 } | |
| 596 | |
| 597 /* GtkCTree is an abomination in the eyes of the object system. */ | |
| 598 static void | |
| 599 __emacs_gtk_ctree_recurse_internal (GtkCTree *ctree, GtkCTreeNode *node, gpointer user_data) | |
| 600 { | |
| 601 Lisp_Object closure; | |
| 602 | |
| 5013 | 603 closure = GET_LISP_FROM_VOID (user_data); |
| 462 | 604 |
| 605 call3 (XCAR (closure), | |
| 606 build_gtk_object (GTK_OBJECT (ctree)), | |
| 607 build_gtk_boxed (node, GTK_TYPE_CTREE_NODE), | |
| 608 XCDR (closure)); | |
| 609 } | |
| 610 | |
| 611 DEFUN ("gtk-ctree-recurse", Fgtk_ctree_recurse, 3, 6, 0, /* | |
| 612 Recursively apply FUNC to all nodes of CTREE at or below NODE. | |
| 613 FUNC is called with three arguments: CTREE, a GtkCTreeNode, and DATA. | |
| 614 The return value of FUNC is ignored. | |
| 615 | |
| 616 If optional 5th argument CHILDFIRSTP is non-nil, then | |
| 617 the function is called for each node after it has been | |
| 618 called for that node's children. | |
| 619 | |
| 620 Optional 6th argument DEPTH limits how deeply to recurse. | |
| 621 | |
| 622 This function encompasses all the following Gtk functions: | |
| 623 | |
| 624 void gtk_ctree_post_recursive (GtkCTree *ctree, | |
| 625 GtkCTreeNode *node, | |
| 626 GtkCTreeFunc func, | |
| 627 gpointer data); | |
| 628 void gtk_ctree_post_recursive_to_depth (GtkCTree *ctree, | |
| 629 GtkCTreeNode *node, | |
| 630 gint depth, | |
| 631 GtkCTreeFunc func, | |
| 632 gpointer data); | |
| 633 void gtk_ctree_pre_recursive (GtkCTree *ctree, | |
| 634 GtkCTreeNode *node, | |
| 635 GtkCTreeFunc func, | |
| 636 gpointer data); | |
| 637 void gtk_ctree_pre_recursive_to_depth (GtkCTree *ctree, | |
| 638 GtkCTreeNode *node, | |
| 639 gint depth, | |
| 640 GtkCTreeFunc func, | |
| 641 gpointer data); | |
| 642 */ | |
| 643 (ctree, node, func, data, childfirstp, depth)) | |
| 644 { | |
| 645 struct gcpro gcpro1, gcpro2, gcpro3; | |
| 646 Lisp_Object closure = Qnil; | |
| 647 | |
| 648 CHECK_GTK_OBJECT (ctree); | |
| 649 | |
| 650 if (!NILP (node)) | |
| 651 { | |
| 652 CHECK_GTK_BOXED (node); | |
| 653 } | |
| 654 | |
| 655 if (!NILP (depth)) | |
| 656 { | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
657 CHECK_FIXNUM (depth); |
| 462 | 658 } |
| 659 | |
| 660 closure = Fcons (func, data); | |
| 661 | |
| 662 GCPRO3 (ctree, node, closure); | |
| 663 | |
| 664 if (NILP (depth)) | |
| 665 { | |
| 666 (NILP (childfirstp) ? gtk_ctree_post_recursive : gtk_ctree_pre_recursive) | |
| 667 (GTK_CTREE (XGTK_OBJECT (ctree)->object), | |
| 668 NILP (node) ? NULL : (GtkCTreeNode *) XGTK_BOXED (node)->object, | |
| 669 __emacs_gtk_ctree_recurse_internal, | |
| 5013 | 670 STORE_LISP_IN_VOID (closure)); |
| 462 | 671 } |
| 672 else | |
| 673 { | |
| 674 (NILP (childfirstp) ? gtk_ctree_post_recursive_to_depth : gtk_ctree_pre_recursive_to_depth) | |
| 675 (GTK_CTREE (XGTK_OBJECT (ctree)->object), | |
| 676 NILP (node) ? NULL : (GtkCTreeNode *) XGTK_BOXED (node)->object, | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
677 XFIXNUM (depth), |
| 462 | 678 __emacs_gtk_ctree_recurse_internal, |
| 5013 | 679 STORE_LISP_IN_VOID (closure)); |
| 462 | 680 } |
| 681 | |
| 682 UNGCPRO; | |
| 683 return (Qnil); | |
| 684 } | |
| 685 | |
| 686 void syms_of_ui_byhand (void) | |
| 687 { | |
| 688 DEFSUBR (Fgtk_toolbar_append_item); | |
| 689 DEFSUBR (Fgtk_toolbar_insert_item); | |
| 690 DEFSUBR (Fgtk_toolbar_prepend_item); | |
| 691 DEFSUBR (Fgtk_box_query_child_packing); | |
| 692 DEFSUBR (Fgtk_button_box_get_child_size_default); | |
| 693 DEFSUBR (Fgtk_button_box_get_child_ipadding_default); | |
| 694 DEFSUBR (Fgtk_button_box_get_child_size); | |
| 695 DEFSUBR (Fgtk_button_box_get_child_ipadding); | |
| 696 DEFSUBR (Fgtk_calendar_get_date); | |
| 697 DEFSUBR (Fgtk_clist_get_text); | |
| 698 DEFSUBR (Fgtk_clist_get_selection); | |
| 699 DEFSUBR (Fgtk_clist_get_pixmap); | |
| 700 DEFSUBR (Fgtk_clist_get_pixtext); | |
| 701 DEFSUBR (Fgtk_color_selection_get_color); | |
| 702 DEFSUBR (Fgtk_editable_insert_text); | |
| 703 DEFSUBR (Fgtk_pixmap_get); | |
| 704 DEFSUBR (Fgtk_curve_get_vector); | |
| 705 DEFSUBR (Fgtk_curve_set_vector); | |
| 706 DEFSUBR (Fgtk_label_get); | |
| 707 DEFSUBR (Fgtk_notebook_query_tab_label_packing); | |
| 708 DEFSUBR (Fgtk_widget_get_pointer); | |
| 709 DEFSUBR (Fgtk_ctree_recurse); | |
| 710 } |
