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 ;; NOTE: This add-on doesn't support XEmacs yet.
29 ;; To use, add the following line to your ~/.riece/init.el:
30 ;; (add-to-list 'riece-addons 'riece-toolbar)
36 (defvar riece-toolbar-item-list
37 '((riece-command-quit "riece-command-quit")
38 (riece-command-join "riece-command-join")
39 (riece-command-part "riece-command-part")
40 (riece-command-next-channel "riece-command-next-channel")
41 (riece-command-previous-channel "riece-command-previous-channel")
42 (riece-command-change-window-layout "riece-command-change-window-layout")))
44 (if (fboundp 'tool-bar-local-item-from-menu)
45 (defalias 'riece-tool-bar-local-item-from-menu
46 'tool-bar-local-item-from-menu)
47 (if (fboundp 'tool-bar-add-item-from-menu)
48 (defun riece-tool-bar-local-item-from-menu (command icon in-map
51 "Define tool bar binding for COMMAND using the given ICON in \
53 (let ((tool-bar-map in-map))
54 (apply #'tool-bar-add-item-from-menu command icon from-map props)))
55 (defalias 'riece-tool-bar-local-item-from-menu 'ignore)))
57 (defvar riece-command-mode-map)
58 (defun riece-toolbar-insinuate-in-command-buffer ()
59 (when (boundp 'tool-bar-map)
60 (make-local-variable 'tool-bar-map)
62 (let ((map (make-sparse-keymap))
63 (pointer riece-toolbar-item-list))
65 (riece-tool-bar-local-item-from-menu (car (car pointer))
67 map riece-command-mode-map)
68 (setq pointer (cdr pointer)))
71 (defun riece-toolbar-requires ()
74 (defun riece-toolbar-insinuate ()
75 (add-hook 'riece-command-mode-hook
77 (riece-toolbar-insinuate-in-command-buffer))
80 (provide 'riece-toolbar)
82 ;;; riece-toolbar.el ends here