Back to index

plt-scheme  4.2.1
xwMenu.h
Go to the documentation of this file.
00001 /***********************************************************
00002 Copyright 2004-2009 PLT Scheme Inc.
00003 Copyright 1995 by Markus Holzem
00004 
00005                         All Rights Reserved
00006 
00007 Permission to use, copy, modify, and distribute this software and its 
00008 documentation for any purpose and without fee is hereby granted, 
00009 provided that the above copyright notice appear in all copies and that
00010 both that copyright notice and this permission notice appear in 
00011 supporting documentation, and that the names of Digital or MIT not be
00012 used in advertising or publicity pertaining to distribution of the
00013 software without specific, written prior permission.  
00014 
00015 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
00016 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
00017 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
00018 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
00019 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
00020 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
00021 SOFTWARE.
00022 
00023 ******************************************************************/
00024 
00025 #ifndef _Menu_h
00026 #define _Menu_h
00027 
00028 #include <X11/Xmu/Converters.h>
00029 #include <X11/Core.h>
00030 #ifdef WX_USE_XFT
00031 # include <X11/Xft/Xft.h>
00032 #endif
00033 
00034 /****************************************************************
00035  *
00036  * Menu widgets
00037  *
00038  ****************************************************************/
00039 
00040 /* Resources:
00041 
00042  Name              Class           RepType              Default Value
00043  ----              -----           -------              -------------
00044 
00045  cursor                   Cursor          Cursor        right_ptr
00046  font                Font               XFontStruct*    XtDefaultFont
00047  foreground          Foreground         Pixel           XtDefaultForeground
00048  hMargin             HMargin            Dimension       1
00049  horizontal          Horizontal         Boolean         True
00050  forChoice           ForChoice          Boolean         False
00051  forPopup            ForPopup           Boolean         False
00052  menu                Menu               Pointer         NULL
00053  onNewItem           Callback           XtCallbackList  NULL
00054  onSelect            Callback           XtCallbackList  NULL
00055  indicatorPixel      IndicatorPixel     Pixel           dynamic
00056  indicatorContrast   IndicatorContrast  Int             85%
00057  indicatorSize       IndicatorSize      Dimension       dynamic
00058 
00059  * Resources extracted from ThreeD
00060 
00061  shadowWidth        ShadowWidth          Dimension    2
00062  beNiceToColormap     BeNiceToColormap     Boolean      False
00063  topShadowPixel       TopShadowPixel       Pixel        dynamic
00064  bottomShadowPixel    BottomShadowPixel    Pixel        dynamic
00065  topShadowContrast    TopShadowContrast    Int          120%
00066  bottomShadowContrast BottomShadowContrast Int          60%
00067 
00068 */
00069 
00070 #define XtCMenuXftFont          "XftFont"
00071 #define XtNmenuXftFont          "xftFont"
00072 
00073 #define XtNhMargin              "hMargin"
00074 #define XtCHMargin              "HMargin"
00075 #define XtNhorizontal           "horizontal"
00076 #define XtCHorizontal           "Horizontal"
00077 #define XtNforChoice            "forChoice"
00078 #define XtCForChoice            "ForChoice"
00079 #define XtNforPopup             "forPopup"
00080 #define XtCForPopup             "ForPopup"
00081 #define XtNmenu                 "menu"
00082 #define XtCMenu                 "Menu"
00083 #define XtNrefresh              "refresh"
00084 #define XtCRefresh              "Refresh"
00085 #define XtNonNewItem            "onNewItem"
00086 #define XtNonSelect             "onSelect"
00087 #define XtNonNoSelect           "onNoSelect"
00088 #define XtNonMDestroy           "onMDestroy"
00089 
00090 #define XtNindicatorPixel       "indicatorPixel"
00091 #define XtCIndicatorPixel       "IndicatorPixel"
00092 #define XtNindicatorContrast    "indicatorContrast"
00093 #define XtCIndicatorContrast    "IndicatorContrast"
00094 #define XtNindicatorSize        "indicatorSize"
00095 #define XtCIndicatorSize        "IndicatorSize"
00096 
00097 #define XtNextraLeft            "extraLeft"
00098 #define XtCExtraLeft            "ExtraLeft"
00099 #define XtNextraTop             "extraRight"
00100 #define XtCExtraTop             "ExtraRight"
00101 #define XtNextraRight           "extraTop"
00102 #define XtCExtraRight           "ExtraTop"
00103 #define XtNextraBottom          "extraBottom"
00104 #define XtCExtraBottom          "ExtraBottom"
00105 
00106 #define XtNhighlightPixel       "highlightPixel"
00107 #define XtCHighlightPixel       "HighlightPixel"
00108 
00109 #define XtNhighlightShadowPixel "highlightShadowPixel"
00110 #define XtCHighlightShadowPixel "HighlightShadowPixel"
00111 
00112 #define XtNcursor               "cursor"
00113 
00114 #define XtNshadowWidth          "shadowWidth"
00115 #define XtCShadowWidth          "ShadowWidth"
00116 #define XtNrequestedWidth       "requestedWidth"
00117 #define XtCRequestedWidth       "RequestedWidth"
00118 #define XtNbeNiceToColormap     "beNiceToColormap"
00119 #define XtCBeNiceToColormap     "BeNiceToColormap"
00120 #define XtNtopShadowPixel       "topShadowPixel"
00121 #define XtCTopShadowPixel       "TopShadowPixel"
00122 #define XtNtopShadowContrast    "topShadowContrast"
00123 #define XtCTopShadowContrast    "TopShadowContrast"
00124 #define XtNbottomShadowPixel    "bottomShadowPixel"
00125 #define XtCBottomShadowPixel    "BottomShadowPixel"
00126 #define XtNbottomShadowContrast "bottomShadowContrast"
00127 #define XtCBottomShadowContrast "BottomShadowContrast"
00128 
00129 typedef struct _MenuClassRec  *MenuWidgetClass;
00130 typedef struct _MenuRec           *MenuWidget;
00131 
00132 extern WidgetClass menuWidgetClass;
00133 
00134 /* Data Types for Menu Structure */
00135 
00136 typedef enum _e_menu_item_type {
00137     MENU_TEXT      = 0,            /* Label item */
00138     MENU_BUTTON    = 1,            /* selectable item */
00139     MENU_RADIO     = 2,            /* radio item (diamond decoration) */
00140     MENU_TOGGLE    = 3,            /* toggle item (square decoration) */
00141     MENU_CASCADE   = 4,            /* submenu item */
00142     MENU_SEPARATOR = 5,            /* separator item */
00143     MENU_PUSHRIGHT = 6,            /* if in menubar, pushright follonwing items */
00144     MENU_HELP      = 7          /* CASCADE + PUSHRIGHT */
00145 } menu_item_type;
00146 
00147 typedef enum _e_Subresource {
00148     SUBRESOURCE_LABEL = 0,
00149     SUBRESOURCE_HELP = 1,
00150     SUBRESOURCE_KEY = 2
00151 } Subresource;
00152 
00153 /* one menu item */
00154 typedef struct _menu_item {
00155     /* public data */
00156     char              *label;
00157     char              *key_binding;
00158     char              *help_text;
00159     long              ID;
00160     menu_item_type    type;
00161     Boolean           enabled;
00162     Boolean           set;    /* used for toggles and radios */
00163     struct _menu_item *contents;  /* pointer to submenu */
00164     struct _menu_item *next;         /* pointer to next menu item same level */
00165     struct _menu_item *prev;         /* pointer to prev menu item same level */
00166     void              *user_data; /* data associated with menu item */
00167     /* private data */
00168     Position          start, end;       /* start and end of item in window */
00169 } menu_item;
00170 
00171 _XFUNCPROTOBEGIN
00172 
00173 void Xaw3dPopupMenu(
00174 #if NeedFunctionPrototypes
00175     MenuWidget,                    /* Menu widget to pop up*/
00176     Widget                  /* Widget calling Xaw3dPopupMenu */
00177 #endif
00178 );
00179 
00180 void Xaw3dPopupMenuAtPos(
00181 #if NeedFunctionPrototypes
00182     MenuWidget,                    /* Menu widget to pop up*/
00183     int, int                /* root position of popup menu */
00184 #endif
00185 );
00186 
00187 char *ResourcedText(
00188 #if NeedFunctionPrototypes
00189     MenuWidget,                    /* Menu Widget */
00190     menu_item*,                    /* selected item */
00191     Subresource                    /* wanted subresource */
00192 #endif
00193 );
00194 
00195 _XFUNCPROTOEND
00196 
00197 #endif /* _Menu_h */