2005-03-12 23:38:43 +00:00
|
|
|
/* Interface of a lightweight menubar widget.
|
2011-01-26 08:36:39 +00:00
|
|
|
|
|
|
|
Copyright (C) 2002-2011 Free Software Foundation, Inc.
|
2007-02-27 03:10:29 +00:00
|
|
|
Copyright (C) 1992 Lucid, Inc.
|
2005-03-12 23:38:43 +00:00
|
|
|
|
|
|
|
This file is part of the Lucid Widget Library.
|
|
|
|
|
|
|
|
The Lucid Widget Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License as published by
|
2007-02-28 03:59:36 +00:00
|
|
|
the Free Software Foundation; either version 1, or (at your option)
|
2005-03-12 23:38:43 +00:00
|
|
|
any later version.
|
|
|
|
|
|
|
|
The Lucid Widget Library 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 GNU Emacs; see the file COPYING. If not, write to the
|
2005-07-04 15:47:28 +00:00
|
|
|
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA. */
|
2005-03-12 23:38:43 +00:00
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
#ifndef _XlwMenu_h
|
|
|
|
#define _XlwMenu_h
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* XlwMenu Widget
|
|
|
|
*
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
#include "lwlib.h"
|
|
|
|
|
|
|
|
/* Resource names used by the XlwMenu widget */
|
2002-05-06 18:54:56 +00:00
|
|
|
#define XtNdisabledForeground "disabledForeground"
|
|
|
|
#define XtCDisabledForeground "DisabledForeground"
|
1994-01-18 23:47:41 +00:00
|
|
|
#define XtNbuttonForeground "buttonForeground"
|
|
|
|
#define XtCButtonForeground "ButtonForeground"
|
|
|
|
#define XtNmargin "margin"
|
|
|
|
#define XtNhorizontalSpacing "horizontalSpacing"
|
|
|
|
#define XtNverticalSpacing "verticalSpacing"
|
|
|
|
#define XtNarrowSpacing "arrowSpacing"
|
|
|
|
#define XtNmenu "menu"
|
|
|
|
#define XtCMenu "Menu"
|
|
|
|
#define XtNopen "open"
|
|
|
|
#define XtNselect "select"
|
2000-01-17 09:11:11 +00:00
|
|
|
#define XtNhighlightCallback "highlightCallback"
|
2007-01-01 15:19:46 +00:00
|
|
|
#define XtNenterCallback "enterCallback"
|
|
|
|
#define XtNleaveCallback "leaveCallback"
|
1994-01-18 23:47:41 +00:00
|
|
|
#define XtNmenuBorderWidth "menuBorderWidth"
|
|
|
|
#define XtNhorizontal "horizontal"
|
|
|
|
#define XtCHorizontal "Horizontal"
|
|
|
|
#define XtNcursor "cursor"
|
|
|
|
#define XtNCursor "Cursor"
|
1994-09-16 18:39:54 +00:00
|
|
|
#define XtNshowGrip "showGrip"
|
|
|
|
#define XtCShowGrip "ShowGrip"
|
|
|
|
#define XtNresizeToPreferred "resizeToPreferred"
|
|
|
|
#define XtCResizeToPreferred "ResizeToPreferred"
|
|
|
|
#define XtNallowResize "allowResize"
|
|
|
|
#define XtCAllowResize "AllowResize"
|
Lucid menus can now use Xft for fonts.
* xsettings.c (current_font, SYSTEM_FONT, XSETTINGS_FONT_NAME): New.
(parse_xft_settings): Also check for XSETTINGS_FONT_NAME and save that
in current_font.
(init_gconf): Read value of SYSTEM_FONT and save it in current_font.
(Ffont_get_system_normal_font, xsettings_get_system_normal_font): New
functions.
(syms_of_xsettings): Initialize current_font. defsubr
Sfont_get_system_normal_font.
* xsettings.h (Ffont_get_system_normal_font,
xsettings_get_system_normal_font): Declare.
* xfns.c (extern xlwmenu_default_font): Remove.
(Fx_create_frame): Remove setting of xlwmenu_default_font, moved
to xlwmenu.c.
* menu.c (digest_single_submenu): If USE_LUCID and HAVE_XFT, encode
menu items in UTF-8.
* xmenu.c: include xsettings.h and xlwmenu.h if USE_LUCID.
(apply_systemfont_to_menu): New function.
(set_frame_menubar, create_and_show_popup_menu): Call
apply_systemfont_to_menu.
* xlwmenu.c (xlwmenu_default_font): Make static.
(xlwMenuResources): Add XtNfaceName and XtNdefaultFace.
(string_width): Use XftTextExtentsUtf8 if HAVE_XFT.
(MENU_FONT_HEIGHT, MENU_FONT_ASCENT): Add versions for
HAVE_XFT.
(size_menu): Set max_rest_width in window_state structure.
(display_menu_item): If HAVE_XFT and xft_draw is set, use
XftDrawRect and XftDrawStringUtf8 to draw text.
(make_windows_if_needed): Set max_rest_width and xft_draw
in windows[i].
(openXftFont): New.
(XlwMenuInitialize): Call openXftFont if HAVE_XFT. If mw->menu.font
is not set, load font fixed and save it in xlwmenu_default_font.
(XlwMenuInitialize): Set max_rest_width and xft_draw in windows[0].
(XlwMenuClassInitialize): Initialize xlwmenu_default_font.
(XlwMenuRealize): Set xft_fg, xft_bg, xft_disabled_fg and
windows[0].xft_draw if xft_font is set.
(XlwMenuDestroy): Destroy all xft_draw and close xft_font.
(facename_changed): New.
(XlwMenuSetValues): Call facename_changed. If face name did change,
close old fonts and destroy xft_draw:s. Then create new ones.
* xlwmenu.h (XtNfaceName, XtCFaceName, XtNdefaultFace,
XtCDefaultFace): New.
* xlwmenuP.h (_window_state): Add max_rest_width and xft_draw.
(_XlwMenu_part): Add faceName,xft_fg, xft_bg, xft_disabled_fg and
xft_font.
* xresources.texi (Lucid Resources): Mention faceName to set Xft fonts.
2010-04-08 16:20:32 +00:00
|
|
|
#define XtNfaceName "faceName"
|
|
|
|
#define XtCFaceName "FaceName"
|
|
|
|
#define XtNdefaultFace "defaultFace"
|
|
|
|
#define XtCDefaultFace "DefaultFace"
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
|
|
/* Motif-compatible resource names */
|
|
|
|
#define XmNshadowThickness "shadowThickness"
|
|
|
|
#define XmCShadowThickness "ShadowThickness"
|
|
|
|
#define XmNtopShadowColor "topShadowColor"
|
|
|
|
#define XmCTopShadowColor "TopShadowColor"
|
|
|
|
#define XmNbottomShadowColor "bottomShadowColor"
|
|
|
|
#define XmCBottomShadowColor "BottomShadowColor"
|
|
|
|
#define XmNtopShadowPixmap "topShadowPixmap"
|
|
|
|
#define XmCTopShadowPixmap "TopShadowPixmap"
|
|
|
|
#define XmNbottomShadowPixmap "bottomShadowPixmap"
|
|
|
|
#define XmCBottomShadowPixmap "BottomShadowPixmap"
|
|
|
|
#define XmRHorizontalDimension "HorizontalDimension"
|
|
|
|
|
|
|
|
typedef struct _XlwMenuRec *XlwMenuWidget;
|
|
|
|
typedef struct _XlwMenuClassRec *XlwMenuWidgetClass;
|
|
|
|
|
|
|
|
extern WidgetClass xlwMenuWidgetClass;
|
|
|
|
|
2010-07-26 06:22:32 +00:00
|
|
|
extern int xlwmenu_window_p (Widget w, Window window);
|
|
|
|
extern void xlwmenu_redisplay (Widget);
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
#endif /* _XlwMenu_h */
|
2003-09-01 15:45:59 +00:00
|
|
|
|