919N/A * Copyright 1989 Massachusetts Institute of Technology 919N/A * Permission to use, copy, modify, distribute, and sell this software and its 919N/A * documentation for any purpose is hereby granted without fee, provided that 919N/A * the above copyright notice appear in all copies and that both that 919N/A * copyright notice and this permission notice appear in supporting 919N/A * documentation, and that the name of M.I.T. not be used in advertising or 919N/A * publicity pertaining to distribution of the software without specific, 919N/A * written prior permission. M.I.T. makes no representations about the 919N/A * suitability of this software for any purpose. It is provided "as is" 919N/A * without express or implied warranty. 919N/A * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 919N/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. 919N/A * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 919N/A * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 919N/A * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 32N/A * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 32N/A * Date: April 3, 1989 32N/A * By: Chris D. Peterson "<EnterWindow>: highlight() \n\ <LeaveWindow>: unhighlight() \n\ <BtnMotion>: highlight() \n\ <BtnUp>: MenuPopdown() notify() unhighlight()";
* Semi Public function definitions. * Action Routine Definitions * Private Function Definitions. /* next_extension */ NULL,
/* accepts_objects */ TRUE,
/* class_name */ "SimpleMenu",
/* Class init'ed */ FALSE,
/* initialize_hook */ NULL,
/* compress_motion */ TRUE,
/* compress_exposure */ TRUE,
/* compress_enterleave*/ TRUE,
/* visible_interest */ FALSE,
/* get_values_hook */ NULL,
/* callback offsets */ NULL,
/* query_geometry */ NULL,
/* display_accelerator*/ NULL,
/* Shell extension */ NULL /* Override extension */ NULL /* Simple Menu extension*/ NULL /************************************************************ ************************************************************/ /* Function Name: ClassInitialize * Description: Class Initialize routine, called only once. /* Function Name: ClassInitialize * Description: Class Part Initialize routine, called for every * subclass. Makes sure that the subclasses pick up * Arguments: wc - the widget class of the subclass. * Make sure that our subclass gets the extension rec too. /* Function Name: Initialize * Description: Initializes the simple menu widget * Arguments: request - the widget requested by the argument list. * new - the new widget with both resource and non * Add a popup_callback routine for changing the cursor. /* Function Name: Redisplay * Description: Redisplays the contents of the widget. * Arguments: w - the simple menu widget. * event - the X event that caused this redisplay. * region - the region the needs to be repainted. * Check and Paint each of the entries - including the label. /* Function Name: Realize * Description: Realizes the widget. * Arguments: w - the simple menu widget. * mask - value mask for the window to create. * attrs - attributes for the window to create. * Description: Handle the menu being resized bigger. * Arguments: w - the simple menu widget. /* Function Name: SetValues * Description: Relayout the menu when one of the resources is changed. * Arguments: current - current state of the widget. * request - what was requested. * new - what the widget will become. "No Dynamic class change of the SimpleMenu Label.");
/* Function Name: SetValuesHook * Description: To handle a special case, this is passed the * Arguments: w - the menu widget. * arglist - the argument list passed to XtSetValues. * num_args - the number of args. * If the user actually passed a width and height to the widget * then this MUST be used, rather than our newly calculated width and /************************************************************ * Geometry Management routines. ************************************************************/ /* Function Name: GeometryManager * Description: This is the SimpleMenu Widget's Geometry Manager. * Arguments: w - the Menu Entry making the request. * request - requested new geometry. * reply - the allowed geometry. * Returns: XtGeometry{Yes, No, Almost}. * Since we are an override shell and have no parent there is no one to * ask to see if this geom change is okay, so I am just going to assume * we can do whatever we want. If you subclass be very careful with this * assumption, it could bite you. * Chris D. Peterson - Sept. 1989. /* Function Name: ChangeManaged * Description: called whenever a new child is managed. * Arguments: w - the simple menu widget. /************************************************************ * Global Action Routines. * These actions routines will be added to the application's ************************************************************/ /* Function Name: PositionMenuAction * Description: Positions the simple menu widget. * Arguments: w - a widget (no the simple menu widget.) * event - the event that caused this action. * params, num_params - parameters passed to the routine. * we expect the name of the menu here. "Xaw - SimpleMenuWidget: position menu action expects only one",
"parameter which is the name of the menu.");
"Xaw - SimpleMenuWidget: could not find menu named: ",
params[0]);
/************************************************************ * Widget Action Routines. ************************************************************/ /* Function Name: Unhighlight * Description: Unhighlights current entry. * Arguments: w - the simple menu widget. * event - the event that caused this action. * params, num_params - ** NOT USED ** /* Function Name: Highlight * Description: Highlights current entry. * Arguments: w - the simple menu widget. * event - the event that caused this action. * params, num_params - ** NOT USED ** * Description: Notify user of current entry. * Arguments: w - the simple menu widget. * event - the event that caused this action. * params, num_params - ** NOT USED ** /************************************************************ ************************************************************/ /* Function Name: XawSimpleMenuAddGlobalActions * Description: adds the global actions to the simple menu widget. * Arguments: app_con - the appcontext. /* Function Name: XawSimpleMenuGetActiveEntry * Description: Gets the currently active (set) entry. * Arguments: w - the smw widget. * Returns: the currently set entry or NULL if none is set. /* Function Name: XawSimpleMenuClearActiveEntry * Description: Unsets the currently active (set) entry. * Arguments: w - the smw widget. /************************************************************ ************************************************************/ /* Function Name: CreateLabel * Description: Creates a the menu label. * Arguments: w - the smw widget. * Creates the label object and makes sure it is the first child in "label string is NULL",
"label already exists",
"no label is being created.");
* Description: lays the menu entries out all nice and neat. * Arguments: w - See below (+++) * width_ret, height_ret - The returned width and * if width == NULL || height == NULL then it assumes the you do not care * about the return values, and just want a relayout. * if this is not the case then it will set width_ret and height_ret * to be width and height that the child would get if it were layed out * +++ "w" can be the simple menu widget or any of its object children. /* Function Name: AddPositionAction * Description: Adds the XawPositionSimpleMenu action to the global * action list for this appcon. * Arguments: app_con - the application context for this app. /* Function Name: FindMenu * Description: Find the menu give a name and reference widget. * Arguments: widget - reference widget. * name - the menu widget's name. * Returns: the menu widget or NULL. /* Function Name: PositionMenu * Description: Places the menu * Arguments: w - the simple menu widget. * location - a pointer the the position or NULL. "Could not find location of mouse pointer");
* The width will not be correct unless it is realized. /* Function Name: MoveMenu * Description: Actually moves the menu, may force it to * to be fully visable if menu_on_screen is TRUE. * Arguments: w - the simple menu widget. * x, y - the current location of the widget. /* Function Name: ChangeCursorOnGrab * Description: Changes the cursor on the active grab to the one * specified in out resource list. * Arguments: w - the widget. * junk, garbage - ** NOT USED **. * The event mask here is what is currently in the MIT implementation. * There really needs to be a way to get the value of the mask out * of the toolkit (CDP 5/26/89). /* Function Name: MakeSetValuesRequest * Description: Makes a (possibly recursive) call to SetValues, * I take great pains to not go into an infinite loop. * Arguments: w - the simple menu widget. * width, height - the size of the ask for. /* Function Name: GetMenuWidth * Description: Sets the length of the widest entry in pixels. * Arguments: w - the simple menu widget. * Returns: width of menu. /* Function Name: GetMenuHeight * Description: Sets the length of the widest entry in pixels. * Arguments: w - the simple menu widget. * Returns: width of menu. /* Function Name: GetEventEntry * Description: Gets an entry given an event that has X and Y coords. * Arguments: w - the simple menu widget. * Returns: the entry that this point is in. "Unknown event type in GetEventEntry().");
return(
NULL);
/* cannot select the label. */