1 ;;; riece-toolbar.el --- show toolbar icons
2 ;; Copyright (C) 1998-2004 Daiki Ueno
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
6 ;; Keywords: IRC, riece
8 ;; This file is part of Riece.
10 ;; This program is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; This program is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
27 ;; To use, add the following line to your ~/.riece/init.el:
28 ;; (add-to-list 'riece-addons 'riece-toolbar)
34 (defconst riece-toolbar-description
35 "Show toolbar icons.")
37 (defvar riece-toolbar-items
41 riece-command-previous-channel
42 riece-command-next-channel
43 riece-command-change-layout
44 riece-submit-bug-report))
46 (defun riece-toolbar-find-menu-item (command)
47 (let ((pointer riece-menu-items)
50 (if (and (not (stringp (car pointer)))
51 (vectorp (car pointer))
52 (eq (aref (car pointer) 1) command))
53 (setq item (car pointer)
55 (setq pointer (cdr pointer))))
58 (if (featurep 'xemacs)
59 (if (featurep 'toolbar)
61 (defun riece-make-toolbar-from-menu (items menu-items map)
66 (riece-data-directory (locate-data-directory "riece")))
68 (setq file (locate-file (symbol-name (car pointer))
69 (if riece-data-directory
70 (cons riece-data-directory
73 '(".xpm" ".pbm" ".xbm"))
74 menu-item (riece-toolbar-find-menu-item (car pointer)))
75 (if (and file (file-exists-p file))
84 (symbol-name (car pointer)))))))
85 (setq pointer (cdr pointer)))
87 (defun riece-set-toolbar (toolbar)
88 (set-specifier default-toolbar toolbar (current-buffer))))
89 (defalias 'riece-make-toolbar-from-menu 'ignore)
90 (defalias 'riece-set-toolbar 'ignore))
91 (defun riece-make-toolbar-from-menu (items menu-items map)
93 (tool-bar-map (make-sparse-keymap)))
95 (tool-bar-add-item-from-menu (car pointer)
96 (symbol-name (car pointer))
98 (setq pointer (cdr pointer)))
100 (defun riece-set-toolbar (toolbar)
101 (make-local-variable 'tool-bar-map)
102 (setq tool-bar-map toolbar)))
104 (defvar riece-command-mode-map)
105 (defun riece-toolbar-insinuate-in-command-buffer ()
107 (riece-make-toolbar-from-menu
110 riece-command-mode-map)))
112 (defun riece-toolbar-requires ()
115 (defun riece-toolbar-insinuate ()
116 (add-hook 'riece-command-mode-hook
117 'riece-toolbar-insinuate-in-command-buffer
120 (provide 'riece-toolbar)
122 ;;; riece-toolbar.el ends here