X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fgui.el;h=4d2e3d9287530bf7b45e599b0618945dc306c3ed;hb=4f9f80ecf7b7c7a9dd3ee4c988813f28291825d3;hp=893efe51b57eea425decd525f639c70f356af24e;hpb=6883ee56ec887c2c48abe5b06b5e66aa74031910;p=chise%2Fxemacs-chise.git.1 diff --git a/lisp/gui.el b/lisp/gui.el index 893efe5..4d2e3d9 100644 --- a/lisp/gui.el +++ b/lisp/gui.el @@ -64,6 +64,7 @@ Normally it also has no modelines, menubars, or toolbars." menubar-visible-p nil has-modeline-p nil default-toolbar-visible-p nil + default-gutter-visible-p nil modeline-shadow-thickness 0 left ,(+ fleft (- (/ fwidth 2) (/ (* dfwidth fontw) @@ -82,7 +83,7 @@ Normally it also has no modelines, menubars, or toolbars." "True if OBJECT is a GUI button." (and (vectorp object) (> (length object) 0) - (eq 'gui-button (aref object 0)))) + (eq 'button (aref object 0)))) (make-face 'gui-button-face "Face used for gui buttons") (if (not (face-differs-from-default-p 'gui-button-face)) @@ -93,30 +94,30 @@ Normally it also has no modelines, menubars, or toolbars." (set-face-foreground 'gui-button-face '(((x color) . "black") ((mswindows color) . "black"))))) + +(defun gui-button-action (instance action user-data) + (let ((domain (image-instance-domain instance))) + (with-current-buffer (if (windowp domain) + (window-buffer domain) nil) + (funcall action user-data)))) + (defun make-gui-button (string &optional action user-data) "Make a GUI button whose label is STRING and whose action is ACTION. If the button is inserted in a buffer and then clicked on, and ACTION -is non-nil, ACTION will be called with one argument, USER-DATA." - (vector 'gui-button - (if (featurep 'xpm) - (xpm-button-create - string gui-button-shadow-thickness - (color-instance-name (face-foreground-instance 'gui-button-face)) - (color-instance-name (face-background-instance 'gui-button-face))) - (xbm-button-create string gui-button-shadow-thickness)) - action user-data)) +is non-nil, ACTION will be called with one argument, USER-DATA. +When ACTION is called, the buffer containing the button is made current." + (vector 'button + :descriptor string + :face 'gui-button-face + :callback-ex `(lambda (image-instance event) + (gui-button-action image-instance + (quote ,action) + (quote ,user-data))))) (defun insert-gui-button (button &optional pos buffer) "Insert GUI button BUTTON at POS in BUFFER." (check-argument-type 'gui-button-p button) - (let ((annotation - (make-annotation (make-glyph (car (aref button 1))) - pos 'text buffer nil - (make-glyph (cadr (aref button 1))))) - (action (aref button 2))) - (and action - (progn - (set-annotation-action annotation action) - (set-annotation-data annotation (aref button 3)))))) + (make-annotation (make-glyph button) + pos 'text buffer nil)) ;;; gui.el ends here