[go: up one dir, main page]

Menu

[1aafb6]: / src / menu.h  Maximize  Restore  History

Download this file

133 lines (108 with data), 3.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/* $Id$
* menu.h
* By Greg J. Badros, 11/14/97
*
*/
#ifndef MENU_H
#define MENU_H
#ifdef HAVE_CONFIG_H
#include "scwmconfig.h"
#endif
#include <X11/Intrinsic.h>
#include "image.h"
#include "menuitem.h"
#include "font.h"
#undef EXTERN
#undef EXTERN_SET
#ifdef MENU_IMPLEMENTATION
#define EXTERN
#define EXTERN_SET(x,y) x = y
#else
#define EXTERN extern
#define EXTERN_SET(x,y) extern x
#endif
extern scm_t_bits scm_tc16_scwm_menu;
extern XContext MenuContext;
typedef struct DynamicMenu_tag DynamicMenu;
typedef struct MenuDrawingInfo_tag MenuDrawingInfo;
typedef struct MenuDrawingVtable_tag MenuDrawingVtable;
/* If you add an SCM object to the below, you need to be sure
to modify mark_menu */
typedef struct Menu_tag
{
SCM self; /* pointer back to the scheme object */
SCM scmMenuTitle; /* Menu title */
SCM scmMenuItems; /* list of menu items */
SCM scmImgSide; /* side image */
SCM scmSideAlign; /* side image alignment */
SCM scmSideBGColor; /* side image background color */
SCM scmBGColor; /* background color */
SCM scmTextColor; /* text color */
SCM scmHLBGColor; /* highlight background color */
SCM scmHLTextColor; /* highlight text color */
SCM scmStippleColor; /* stipple color */
SCM scmImgBackground; /* background image */
SCM scmFont; /* font for labels */
SCM scmExtraOptions; /* extra list of options for the drawing code */
SCM scmMenuLook; /* menu look */
char *pchUsedShortcutKeys; /* list of characters that are shortcut keys */
int cmsPopupDelay; /* delay in ms before submenu popup */
int cmsHoverDelay; /* delay in ms before hover action is invoked */
Bool fHighlightRelief; /* should we draw a relief when we highlight the item */
} Menu;
struct DynamicMenu_tag
{
Menu *pmenu; /* this menu */
MenuItemInMenu * pmiimTitle; /* the menu title */
MenuItemInMenu **rgpmiim; /* the menu item dynamic information */
int cmiim; /* size of above array */
int ipmiimSelected; /* the index of the selected item */
struct DynamicMenu_tag *pmdNext; /* the next-popped up menu */
struct DynamicMenu_tag *pmdPrior; /* the menu that popped this up */
MenuDrawingInfo *pmdi; /* extra info needed by the drawing/hit detection code */
Bool fPinned; /* is it not a popup? */
Bool fHoverActionInvoked; /* have we done the hover action */
MenuDrawingVtable * pmdv; /* functions to implement drawing */
Window w; /* The X window of the drawn menu */
int x; /* x offset from root origin */
int y; /* y offset from root origin */
int cpixHeight; /* the height of the window */
int cpixWidth; /* the width of the window */
};
#define MENU_P(X) (SCM_SMOB_PREDICATE(scm_tc16_scwm_menu, X))
#define MENU(X) ((Menu *)SCM_SMOB_DATA(X))
#define MENU_OR_SYMBOL_P(X) (MENU_P(X) || scm_is_symbol(X))
#define SAFE_MENU(X) (MENU_P(X)? MENU(X): NULL)
// Was scm_symbol_bound_p instead of scm_defined_p
#define DYNAMIC_MENU_P(X) \
(scm_is_symbol(X)? (\
scm_is_true(scm_defined_p(X, SCM_UNDEFINED))? \
MENU_P(scm_variable_ref(scm_lookup(X))) : \
False ) : \
MENU_P(X))
#define DYNAMIC_SAFE_MENU(X) \
(scm_is_symbol(X)? (\
scm_is_true(scm_defined_p(X, SCM_UNDEFINED))? \
SAFE_MENU(scm_variable_ref(scm_lookup(X))) : \
NULL) : \
SAFE_MENU(X))
#define VALIDATE_ARG_MENU(pos,scm) \
do { \
if (!MENU_P(scm)) scm_wrong_type_arg(FUNC_NAME,pos,scm); \
} while (0)
#define VALIDATE_ARG_MENU_COPY(pos,scm,cvar) \
do { \
if (!MENU_P(scm)) scm_wrong_type_arg(FUNC_NAME,pos,scm); \
cvar = MENU(scm); \
} while (0)
#define VALIDATE_ARG_MENU_OR_SYM(pos,scm) \
do { \
if (!MENU_P(scm)) scm_wrong_type_arg(FUNC_NAME,pos,scm); \
} while (0)
#endif
/* Local Variables: */
/* tab-width: 8 */
/* c-basic-offset: 2 */
/* End: */
/* vim:ts=8:sw=2:sta
*/