749N/A/* $XConsortium: Toggle.c,v 1.28 94/04/17 20:13:17 kaleb Exp $ */ 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 * Author: Chris D. Peterson 749N/A * Date: January 12, 1989 749N/A/**************************************************************** 749N/A * Full class record constant 749N/A ****************************************************************/ 749N/A * The order of toggle and notify are important, as the state has 749N/A * to be set when we call the notify proc. 749N/A "<EnterWindow>: highlight(Always) \n\ 749N/A <LeaveWindow>: unhighlight() \n\ 749N/A <Btn1Down>,<Btn1Up>: toggle() notify()";
749N/A/* Functions for handling the Radio Group. */ 749N/A "Toggle",
/* class_name */ 749N/A },
/* CoreClass fields initialization */ 749N/A },
/* SimpleClass fields initialization */ 749N/A },
/* LabelClass fields initialization */ 749N/A },
/* CommandClass fields initialization */ 749N/A }
/* ToggleClass fields initialization */ 749N/A /* for public consumption */ 749N/A/**************************************************************** 749N/A ****************************************************************/ 749N/A * Find the set and unset actions in the command widget's action table. 749N/A/* We should never get here. */ 749N/A XtError(
"Aborting, due to errors resolving bindings in the Toggle widget.");
749N/A * Command widget assumes that the widget is unset, so we only 749N/A * have to handle the case where it needs to be set. 749N/A * If this widget is in a radio group then it may cause another 749N/A * widget to be unset, thus calling the notify proceedure. 749N/A * I want to set the toggle if the user set the state to "On" in 749N/A * the resource group, reguardless of what my ancestors did. 749N/A/************************************************************ 749N/A ************************************************************/ 749N/A/************************************************************ 749N/A * Set specified arguments into widget 749N/A ***********************************************************/ 749N/A/* Function Name: ToggleDestroy 749N/A * Description: Destroy Callback for toggle widget. 749N/A * Arguments: w - the toggle widget that is being destroyed. 749N/A * junk, grabage - not used. 749N/A/************************************************************ 749N/A * Below are all the private procedures that handle 749N/A * radio toggle buttons. 749N/A ************************************************************/ 749N/A/* Function Name: GetRadioGroup 749N/A * Description: Gets the radio group associated with a give toggle 749N/A * Arguments: w - the toggle widget who's radio group we are getting. 749N/A * Returns: the radio group associated with this toggle group. 749N/A/* Function Name: CreateRadioGroup 749N/A * Description: Creates a radio group. give two widgets. 749N/A * Arguments: w1, w2 - the toggle widgets to add to the radio group. 749N/A * NOTE: A pointer to the group is added to each widget's radio_group 749N/A "to create a new toggle group, when one already exists.");
749N/A/* Function Name: AddToRadioGroup 749N/A * Description: Adds a toggle to the radio group. 749N/A * Arguments: group - any element of the radio group the we are adding to. 749N/A * w - the new toggle widget to add to the group. 749N/A/* Function Name: TurnOffRadioSiblings 749N/A * Description: Deactivates all radio siblings. 749N/A * Arguments: widget - a toggle widget. 749N/A /* Go to the top of the group. */ 749N/A/* Function Name: RemoveFromRadioGroup 749N/A * Description: Removes a toggle from a RadioGroup. 749N/A * Arguments: w - the toggle widget to remove. 749N/A/************************************************************ 749N/A ************************************************************/ 749N/A/* Function Name: XawToggleChangeRadioGroup 749N/A * Description: Allows a toggle widget to change radio groups. 749N/A * Arguments: w - The toggle widget to change groups. 749N/A * radio_group - any widget in the new group. 749N/A * If the toggle that we are about to add is set then we will 749N/A * unset all toggles in the new radio group. 749N/A/* Function Name: XawToggleGetCurrent 749N/A * Description: Returns the RadioData associated with the toggle 749N/A * widget that is currently active in a toggle group. 749N/A * Arguments: w - any toggle widget in the toggle group. 749N/A * Returns: The XtNradioData associated with the toggle widget. 749N/A/* Function Name: XawToggleSetCurrent 749N/A * Description: Sets the Toggle widget associated with the 749N/A * radio_data specified. 749N/A * Arguments: radio_group - any toggle widget in the toggle group. 749N/A * radio_data - radio data of the toggle widget to set. 749N/A/* Special case of no radio group. */ 749N/A * find top of radio_roup 749N/A * search for matching radio data. 749N/A return;
/* found it, done */ 749N/A/* Function Name: XawToggleUnsetCurrent 749N/A * Description: Unsets all Toggles in the radio_group specified. 749N/A * Arguments: radio_group - any toggle widget in the toggle group. 749N/A /* Special Case no radio group. */