comparison src/toolbar.c @ 5133:444a448b2f53

Merge branch ben-lisp-object into default branch
author Ben Wing <ben@xemacs.org>
date Sun, 07 Mar 2010 06:47:37 -0600
parents 7be849cb8828
children 308d34e9f07d
comparison
equal deleted inserted replaced
5113:b2dcf6a6d8ab 5133:444a448b2f53
69 { XD_LISP_OBJECT, offsetof (struct toolbar_button, enabled_p) }, 69 { XD_LISP_OBJECT, offsetof (struct toolbar_button, enabled_p) },
70 { XD_LISP_OBJECT, offsetof (struct toolbar_button, help_string) }, 70 { XD_LISP_OBJECT, offsetof (struct toolbar_button, help_string) },
71 { XD_END } 71 { XD_END }
72 }; 72 };
73 73
74
75 static Lisp_Object
76 allocate_toolbar_button (struct frame *f, int pushright)
77 {
78 struct toolbar_button *tb;
79
80 tb = XTOOLBAR_BUTTON (ALLOC_NORMAL_LISP_OBJECT (toolbar_button));
81 tb->next = Qnil;
82 tb->frame = wrap_frame (f);
83 tb->up_glyph = Qnil;
84 tb->down_glyph = Qnil;
85 tb->disabled_glyph = Qnil;
86 tb->cap_up_glyph = Qnil;
87 tb->cap_down_glyph = Qnil;
88 tb->cap_disabled_glyph = Qnil;
89 tb->callback = Qnil;
90 tb->enabled_p = Qnil;
91 tb->help_string = Qnil;
92
93 tb->pushright = pushright;
94 tb->x = tb->y = tb->width = tb->height = -1;
95 tb->dirty = 1;
96
97 return wrap_toolbar_button (tb);
98 }
99
100
74 static Lisp_Object 101 static Lisp_Object
75 mark_toolbar_button (Lisp_Object obj) 102 mark_toolbar_button (Lisp_Object obj)
76 { 103 {
77 struct toolbar_button *data = XTOOLBAR_BUTTON (obj); 104 struct toolbar_button *data = XTOOLBAR_BUTTON (obj);
78 mark_object (data->next); 105 mark_object (data->next);
86 mark_object (data->callback); 113 mark_object (data->callback);
87 mark_object (data->enabled_p); 114 mark_object (data->enabled_p);
88 return data->help_string; 115 return data->help_string;
89 } 116 }
90 117
91 DEFINE_LRECORD_IMPLEMENTATION ("toolbar-button", toolbar_button, 118 DEFINE_NODUMP_INTERNAL_LISP_OBJECT ("toolbar-button", toolbar_button,
92 0, /*dumpable-flag*/ 119 mark_toolbar_button,
93 mark_toolbar_button, 120 toolbar_button_description,
94 default_object_printer, 121 struct toolbar_button);
95 0, 0, 0,
96 toolbar_button_description,
97 struct toolbar_button);
98 122
99 DEFUN ("toolbar-button-p", Ftoolbar_button_p, 1, 1, 0, /* 123 DEFUN ("toolbar-button-p", Ftoolbar_button_p, 1, 1, 0, /*
100 Return non-nil if OBJECT is a toolbar button. 124 Return non-nil if OBJECT is a toolbar button.
101 */ 125 */
102 (object)) 126 (object))
302 326
303 elt = XVECTOR_DATA (desc); 327 elt = XVECTOR_DATA (desc);
304 buffer = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f))->buffer; 328 buffer = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f))->buffer;
305 329
306 if (!tb) 330 if (!tb)
307 { 331 tb = XTOOLBAR_BUTTON (allocate_toolbar_button (f, pushright));
308 tb = ALLOC_LCRECORD_TYPE (struct toolbar_button, &lrecord_toolbar_button);
309 tb->next = Qnil;
310 tb->frame = wrap_frame (f);
311 tb->up_glyph = Qnil;
312 tb->down_glyph = Qnil;
313 tb->disabled_glyph = Qnil;
314 tb->cap_up_glyph = Qnil;
315 tb->cap_down_glyph = Qnil;
316 tb->cap_disabled_glyph = Qnil;
317 tb->callback = Qnil;
318 tb->enabled_p = Qnil;
319 tb->help_string = Qnil;
320
321 tb->enabled = 0;
322 tb->down = 0;
323 tb->pushright = pushright;
324 tb->blank = 0;
325 tb->x = tb->y = tb->width = tb->height = -1;
326 tb->dirty = 1;
327 }
328 retval = wrap_toolbar_button (tb); 332 retval = wrap_toolbar_button (tb);
329 333
330 /* Let's make sure nothing gets mucked up by the potential call to 334 /* Let's make sure nothing gets mucked up by the potential call to
331 eval farther down. */ 335 eval farther down. */
332 GCPRO2 (retval, desc); 336 GCPRO2 (retval, desc);
1342 1346
1343 1347
1344 void 1348 void
1345 syms_of_toolbar (void) 1349 syms_of_toolbar (void)
1346 { 1350 {
1347 INIT_LRECORD_IMPLEMENTATION (toolbar_button); 1351 INIT_LISP_OBJECT (toolbar_button);
1348 1352
1349 DEFSYMBOL_MULTIWORD_PREDICATE (Qtoolbar_buttonp); 1353 DEFSYMBOL_MULTIWORD_PREDICATE (Qtoolbar_buttonp);
1350 DEFSYMBOL (Q2D); 1354 DEFSYMBOL (Q2D);
1351 DEFSYMBOL (Q3D); 1355 DEFSYMBOL (Q3D);
1352 DEFSYMBOL (Q2d); 1356 DEFSYMBOL (Q2d);