xemacs-beta / src / toolbar.h

/* Define general toolbar support.
   Copyright (C) 1995 Board of Trustees, University of Illinois.
   Copyright (C) 1995, 1996 Ben Wing.
   Copyright (C) 1996 Chuck Thompson.

This file is part of XEmacs.

XEmacs is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.

XEmacs is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with XEmacs; see the file COPYING.  If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.  */

/* Synched up with: Not in FSF. */

#ifndef _XEMACS_TOOLBAR_H_
#define _XEMACS_TOOLBAR_H_

#include "specifier.h"

#ifdef HAVE_TOOLBARS

/* There are 4 of these per frame.  They don't really need to be an
   lrecord (they're not lisp-accessible) but it makes marking slightly
   more modular.  */
struct toolbar_data
{
  struct lcrecord_header header;

  /* The last buffer for which the toolbars were displayed. */
  Lisp_Object last_toolbar_buffer;

  /* The actual buttons are chained through this. */
  Lisp_Object toolbar_buttons;
};

DECLARE_LRECORD (toolbar_data, struct toolbar_data);
#define XTOOLBAR_DATA(x) XRECORD (x, toolbar_data, struct toolbar_data)
#define XSETTOOLBAR_DATA(x, p) XSETRECORD (x, p, toolbar_data)
#define TOOLBAR_DATAP(x) RECORDP (x, toolbar_data)
#define GC_TOOLBAR_DATAP(x) GC_RECORDP (x, toolbar_data)
#define CHECK_TOOLBAR_DATA(x) CHECK_RECORD (x, toolbar_data)
#define CONCHECK_TOOLBAR_DATA(x) CONCHECK_RECORD (x, toolbar_data)

#define FRAME_TOOLBAR_DATA(frame, position)				\
  (XTOOLBAR_DATA ((frame)->toolbar_data[position]))
#define FRAME_TOOLBAR_BUFFER(frame, position)				 \
  (XTOOLBAR_DATA ((frame)->toolbar_data[position])->last_toolbar_buffer)

/* These are chained together through toolbar_buttons in struct
   toolbar_data.  These don't need to be an lrecord either, but again,
   it makes marking easier. */
struct toolbar_button
{
  struct lcrecord_header header;

  Lisp_Object next;
  Lisp_Object frame;

  Lisp_Object up_glyph;
  Lisp_Object down_glyph;
  Lisp_Object disabled_glyph;

  Lisp_Object cap_up_glyph;
  Lisp_Object cap_down_glyph;
  Lisp_Object cap_disabled_glyph;

  Lisp_Object callback;
  Lisp_Object enabled_p;
  Lisp_Object help_string;

  char enabled;
  char down;
  char pushright;
  char blank;

  int x, y;
  int width, height;
  int dirty;
};

DECLARE_LRECORD (toolbar_button, struct toolbar_button);
#define XTOOLBAR_BUTTON(x) XRECORD (x, toolbar_button, struct toolbar_button)
#define XSETTOOLBAR_BUTTON(x, p) XSETRECORD (x, p, toolbar_button)
#define TOOLBAR_BUTTONP(x) RECORDP (x, toolbar_button)
#define GC_TOOLBAR_BUTTONP(x) GC_RECORDP (x, toolbar_button)
#define CHECK_TOOLBAR_BUTTON(x) CHECK_RECORD (x, toolbar_button)
#define CONCHECK_TOOLBAR_BUTTON(x) CONCHECK_RECORD (x, toolbar_button)

extern void get_toolbar_coords (struct frame *f, enum toolbar_pos pos, int *x,
				int *y, int *width, int *height, int *vert,
				int for_layout);
extern Lisp_Object toolbar_button_at_pixpos (struct frame *f, int x_coord,
					     int y_coord);
DECLARE_SPECIFIER_TYPE (toolbar);
#define XTOOLBAR_SPECIFIER(x) XSPECIFIER_TYPE (x, toolbar)
#define XSETTOOLBAR_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, toolbar)
#define TOOLBAR_SPECIFIERP(x) SPECIFIER_TYPEP (x, toolbar)
#define CHECK_TOOLBAR_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, toolbar)
#define CONCHECK_TOOLBAR_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, toolbar)

#define DEFAULT_TOOLBAR_HEIGHT	37
#define DEFAULT_TOOLBAR_WIDTH	40
#define DEFAULT_TOOLBAR_BLANK_SIZE	8
#define MINIMUM_SHADOW_THICKNESS	2

extern Lisp_Object Vtoolbar_size[4];
void update_frame_toolbars (struct frame *f);
void init_frame_toolbars (struct frame *f);
void init_device_toolbars (struct device *d);
void init_global_toolbars (struct device *d);
void free_frame_toolbars (struct frame *f);
Lisp_Object get_toolbar_button_glyph (struct window *w,
				      struct toolbar_button *tb);

#endif /* HAVE_TOOLBARS */

#endif /* _XEMACS_TOOLBAR_H_ */
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.