749N/ACopyright (c) 1989, 1994 X Consortium 749N/APermission is hereby granted, free of charge, to any person obtaining a copy 749N/Aof this software and associated documentation files (the "Software"), to deal 749N/Ain the Software without restriction, including without limitation the rights 749N/Ato use, copy, modify, merge, publish, distribute, sublicense, and/or sell 749N/Acopies of the Software, and to permit persons to whom the Software is 749N/Afurnished to do so, subject to the following conditions: 749N/AThe above copyright notice and this permission notice shall be included in 749N/Aall copies or substantial portions of the Software. 749N/ATHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 749N/AIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 749N/AFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 749N/AX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 749N/AAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 749N/ACONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 749N/AExcept as contained in this notice, the name of the X Consortium shall not be 749N/Aused in advertising or otherwise to promote the sale, use or other dealings 749N/Ain this Software without prior written authorization from the X Consortium. 749N/A * By: Chris D. Peterson 749N/A "<EnterWindow>: highlight() \n\ 749N/A <LeaveWindow>: unhighlight() \n\ 749N/A <BtnMotion>: highlight() \n\ 749N/A <BtnUp>: MenuPopdown() notify() unhighlight()";
749N/A * Semi Public function definitions. 749N/A * Action Routine Definitions 749N/A * Private Function Definitions. 749N/A /* class_name */ "SimpleMenu",
749N/A/************************************************************ 749N/A * Semi-Public Functions. 749N/A ************************************************************/ 749N/A/* Function Name: ClassInitialize 749N/A * Description: Class Initialize routine, called only once. 749N/A/* Function Name: ClassInitialize 749N/A * Description: Class Part Initialize routine, called for every 749N/A * subclass. Makes sure that the subclasses pick up 749N/A * the extension record. 749N/A * Arguments: wc - the widget class of the subclass. 749N/A * Make sure that our subclass gets the extension rec too. 749N/A/* Function Name: Initialize 749N/A * Description: Initializes the simple menu widget 749N/A * Arguments: request - the widget requested by the argument list. 749N/A * new - the new widget with both resource and non 749N/A * Add a popup_callback routine for changing the cursor. 749N/A/* Function Name: Redisplay 749N/A * Description: Redisplays the contents of the widget. 749N/A * Arguments: w - the simple menu widget. 749N/A * event - the X event that caused this redisplay. 749N/A * region - the region the needs to be repainted. 749N/A * Check and Paint each of the entries - including the label. 749N/A/* Function Name: Realize 749N/A * Description: Realizes the widget. 749N/A * Arguments: w - the simple menu widget. 749N/A * mask - value mask for the window to create. 749N/A * attrs - attributes for the window to create. 749N/A/* Function Name: Resize 749N/A * Description: Handle the menu being resized bigger. 749N/A * Arguments: w - the simple menu widget. 749N/A/* Function Name: SetValues 749N/A * Description: Relayout the menu when one of the resources is changed. 749N/A * Arguments: current - current state of the widget. 749N/A * request - what was requested. 749N/A * new - what the widget will become. 749N/A "No Dynamic class change of the SimpleMenu Label.");
749N/A/* Function Name: SetValuesHook 749N/A * Description: To handle a special case, this is passed the 749N/A * Arguments: w - the menu widget. 749N/A * arglist - the argument list passed to XtSetValues. 749N/A * num_args - the number of args. 749N/A * If the user actually passed a width and height to the widget 749N/A * then this MUST be used, rather than our newly calculated width and 749N/A/************************************************************ 749N/A * Geometry Management routines. 749N/A ************************************************************/ 749N/A/* Function Name: GeometryManager 749N/A * Description: This is the SimpleMenu Widget's Geometry Manager. 749N/A * Arguments: w - the Menu Entry making the request. 749N/A * request - requested new geometry. 749N/A * reply - the allowed geometry. 749N/A * Returns: XtGeometry{Yes, No, Almost}. 749N/A * Since we are an override shell and have no parent there is no one to 749N/A * ask to see if this geom change is okay, so I am just going to assume 749N/A * we can do whatever we want. If you subclass be very careful with this 749N/A * assumption, it could bite you. 749N/A * Chris D. Peterson - Sept. 1989. 749N/A/* Function Name: ChangeManaged 749N/A * Description: called whenever a new child is managed. 749N/A * Arguments: w - the simple menu widget. 749N/A/************************************************************ 749N/A * Global Action Routines. 749N/A * These actions routines will be added to the application's 749N/A ************************************************************/ 749N/A/* Function Name: PositionMenuAction 749N/A * Description: Positions the simple menu widget. 749N/A * Arguments: w - a widget (no the simple menu widget.) 749N/A * event - the event that caused this action. 749N/A * params, num_params - parameters passed to the routine. 749N/A * we expect the name of the menu here. 749N/A char*
fmt =
"Xaw SimpleMenuWidget: could not find menu named: \"%s\"";
749N/A "Xaw - SimpleMenuWidget: position menu action expects only one",
749N/A "parameter which is the name of the menu.");
749N/A "Xaw - SimpleMenuWidget: position menu action expects only one parameter which is the name of the menu.");
749N/A/************************************************************ 749N/A * Widget Action Routines. 749N/A ************************************************************/ 749N/A/* Function Name: Unhighlight 749N/A * Description: Unhighlights current entry. 749N/A * Arguments: w - the simple menu widget. 749N/A * event - the event that caused this action. 749N/A * params, num_params - ** NOT USED ** 749N/A/* Function Name: Highlight 749N/A * Description: Highlights current entry. 749N/A * Arguments: w - the simple menu widget. 749N/A * event - the event that caused this action. 749N/A * params, num_params - ** NOT USED ** 749N/A/* Function Name: Notify 749N/A * Description: Notify user of current entry. 749N/A * Arguments: w - the simple menu widget. 749N/A * event - the event that caused this action. 749N/A * params, num_params - ** NOT USED ** 749N/A/************************************************************ 749N/A ************************************************************/ 749N/A/* Function Name: XawSimpleMenuAddGlobalActions 749N/A * Description: adds the global actions to the simple menu widget. 749N/A * Arguments: app_con - the appcontext. 749N/A/* Function Name: XawSimpleMenuGetActiveEntry 749N/A * Description: Gets the currently active (set) entry. 749N/A * Arguments: w - the smw widget. 749N/A * Returns: the currently set entry or NULL if none is set. 749N/A/* Function Name: XawSimpleMenuClearActiveEntry 749N/A * Description: Unsets the currently active (set) entry. 749N/A * Arguments: w - the smw widget. 749N/A/************************************************************ 749N/A ************************************************************/ 749N/A/* Function Name: CreateLabel 749N/A * Description: Creates a the menu label. 749N/A * Arguments: w - the smw widget. 749N/A * Creates the label object and makes sure it is the first child in 749N/A "label string is NULL",
"label already exists",
749N/A "no label is being created.");
749N/A/* Function Name: Layout 749N/A * Description: lays the menu entries out all nice and neat. 749N/A * Arguments: w - See below (+++) 749N/A * width_ret, height_ret - The returned width and 749N/A * if width == NULL || height == NULL then it assumes the you do not care 749N/A * about the return values, and just want a relayout. 749N/A * if this is not the case then it will set width_ret and height_ret 749N/A * to be width and height that the child would get if it were layed out 749N/A * +++ "w" can be the simple menu widget or any of its object children. 749N/A/* Function Name: AddPositionAction 749N/A * Description: Adds the XawPositionSimpleMenu action to the global 749N/A * action list for this appcon. 749N/A * Arguments: app_con - the application context for this app. 749N/A/* Function Name: FindMenu 749N/A * Description: Find the menu give a name and reference widget. 749N/A * Arguments: widget - reference widget. 749N/A * name - the menu widget's name. 749N/A * Returns: the menu widget or NULL. 749N/A/* Function Name: PositionMenu 749N/A * Description: Places the menu 749N/A * Arguments: w - the simple menu widget. 749N/A * location - a pointer the the position or NULL. 749N/A "Could not find location of mouse pointer");
749N/A * The width will not be correct unless it is realized. 749N/A/* Function Name: MoveMenu 749N/A * Description: Actually moves the menu, may force it to 749N/A * to be fully visable if menu_on_screen is TRUE. 749N/A * Arguments: w - the simple menu widget. 749N/A * x, y - the current location of the widget. 749N/A/* Function Name: ChangeCursorOnGrab 749N/A * Description: Changes the cursor on the active grab to the one 749N/A * specified in out resource list. 749N/A * Arguments: w - the widget. 749N/A * junk, garbage - ** NOT USED **. 749N/A * The event mask here is what is currently in the MIT implementation. 749N/A * There really needs to be a way to get the value of the mask out 749N/A * of the toolkit (CDP 5/26/89). 749N/A/* Function Name: MakeSetValuesRequest 749N/A * Description: Makes a (possibly recursive) call to SetValues, 749N/A * I take great pains to not go into an infinite loop. 749N/A * Arguments: w - the simple menu widget. 749N/A * width, height - the size of the ask for. 749N/A/* Function Name: GetMenuWidth 749N/A * Description: Sets the length of the widest entry in pixels. 749N/A * Arguments: w - the simple menu widget. 749N/A * Returns: width of menu. 749N/A/* Function Name: GetMenuHeight 749N/A * Description: Sets the length of the widest entry in pixels. 749N/A * Arguments: w - the simple menu widget. 749N/A * Returns: width of menu. 749N/A/* Function Name: GetEventEntry 749N/A * Description: Gets an entry given an event that has X and Y coords. 749N/A * Arguments: w - the simple menu widget. 749N/A * Returns: the entry that this point is in. 749N/A "Unknown event type in GetEventEntry().");
749N/A return(
NULL);
/* cannot select the label. */