diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-02-07 22:01:03 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-02-07 22:01:03 +0000 |
commit | 7c62692d430af7313d52257895cfa8298676b6f6 (patch) | |
tree | e29d1348de49aa33b8423ed2290002e39c7a0d1c /src/gui_motif.c | |
parent | f97ca8f0665f4604f7778ea709573d920ab83240 (diff) | |
download | vim-git-7c62692d430af7313d52257895cfa8298676b6f6.tar.gz |
updated for version 7.0049
Diffstat (limited to 'src/gui_motif.c')
-rw-r--r-- | src/gui_motif.c | 79 |
1 files changed, 57 insertions, 22 deletions
diff --git a/src/gui_motif.c b/src/gui_motif.c index acb9d81fa..a1da3d0af 100644 --- a/src/gui_motif.c +++ b/src/gui_motif.c @@ -886,7 +886,8 @@ gui_mch_compute_menu_height(id) #include "gui_x11_pm.h" static int check_xpm __ARGS((char_u *path)); -static char **get_toolbar_pixmap __ARGS((vimmenu_T *menu)); +static char **get_toolbar_pixmap __ARGS((vimmenu_T *menu, char **fname)); +static int add_pixmap_args __ARGS((vimmenu_T *menu, Arg *args, int n)); /* * Read an Xpm file. Return OK or FAIL. @@ -916,16 +917,20 @@ check_xpm(path) /* * Allocated a pixmap for toolbar menu "menu". + * When it's to be read from a file, "fname" is set to the file name + * (in allocated memory). * Return a blank pixmap if it fails. */ static char ** -get_toolbar_pixmap(menu) +get_toolbar_pixmap(menu, fname) vimmenu_T *menu; + char **fname; { char_u buf[MAXPATHL]; /* buffer storing expanded pathname */ char **xpm = NULL; /* xpm array */ int res; + *fname = NULL; buf[0] = NUL; /* start with NULL path */ if (menu->iconfile != NULL) @@ -938,7 +943,10 @@ get_toolbar_pixmap(menu) if (res == FAIL && gui_find_bitmap(menu->name, buf, "xpm") == OK) res = check_xpm(buf); if (res == OK) + { + *fname = (char *)vim_strsave(buf); return tb_blank_xpm; + } } if (menu->icon_builtin || gui_find_bitmap(menu->name, buf, "xpm") == FAIL) @@ -952,6 +960,33 @@ get_toolbar_pixmap(menu) return xpm; } + +/* + * Add arguments for the toolbar pixmap to a menu item. + */ + static int +add_pixmap_args(menu, args, n) + vimmenu_T *menu; + Arg *args; + int n; +{ + vim_free(menu->xpm_fname); + menu->xpm = get_toolbar_pixmap(menu, &menu->xpm_fname); + if (menu->xpm == NULL) + { + XtSetArg(args[n], XmNlabelType, XmSTRING); n++; + } + else + { + if (menu->xpm_fname != NULL) + { + XtSetArg(args[n], XmNpixmapFile, menu->xpm_fname); n++; + } + XtSetArg(args[n], XmNpixmapData, menu->xpm); n++; + XtSetArg(args[n], XmNlabelLocation, XmBOTTOM); n++; + } + return n; +} #endif /* FEAT_TOOLBAR */ void @@ -1025,16 +1060,8 @@ gui_mch_add_menu_item(menu, idx) xms = XmStringCreate((char *)menu->dname, STRING_TAG); XtSetArg(args[n], XmNlabelString, xms); n++; - menu->xpm = get_toolbar_pixmap(menu); - if (menu->xpm == NULL) - { - XtSetArg(args[n], XmNlabelType, XmSTRING); n++; - } - else - { - XtSetArg(args[n], XmNpixmapData, menu->xpm); n++; - XtSetArg(args[n], XmNlabelLocation, XmBOTTOM); n++; - } + n = add_pixmap_args(menu, args, n); + type = xmEnhancedButtonWidgetClass; } @@ -1264,16 +1291,7 @@ submenu_change(menu, colors) int n = 0; Arg args[18]; - mp->xpm = get_toolbar_pixmap(mp); - if (menu->xpm == NULL) - { - XtSetArg(args[n], XmNlabelType, XmSTRING); n++; - } - else - { - XtSetArg(args[n], XmNpixmapData, menu->xpm); n++; - XtSetArg(args[n], XmNlabelLocation, XmBOTTOM); n++; - } + n = add_pixmap_args(mp, args, n); XtSetValues(mp->id, args, n); } # ifdef FEAT_BEVAL @@ -2846,6 +2864,23 @@ gui_mch_compute_toolbar_height() return (int)(height + (borders << 1)); } + void +motif_get_toolbar_colors(bgp, fgp, bsp, tsp, hsp) + Pixel *bgp; + Pixel *fgp; + Pixel *bsp; + Pixel *tsp; + Pixel *hsp; +{ + XtVaGetValues(toolBar, + XmNbackground, bgp, + XmNforeground, fgp, + XmNbottomShadowColor, bsp, + XmNtopShadowColor, tsp, + XmNhighlightColor, hsp, + NULL); +} + # ifdef FEAT_FOOTER /* * The next toolbar enter/leave callbacks should really do balloon help. But |