561N/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 919N/A * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 561N/A * Author: Chris D. Peterson 911N/A * Date: January 12, 1989 /**************************************************************** * Full class record constant ****************************************************************/ /* This is a hack, see the comments in ClassInit(). */ * The order of toggle and notify are important, as the state has * to be set when we call the notify proc. "<EnterWindow>: highlight(Always) \n\ <LeaveWindow>: unhighlight() \n\ <Btn1Down>,<Btn1Up>: toggle() notify()";
/* Action proceedures retrieved from the command widget */ /* Functions for handling the Radio Group. */ "Toggle",
/* class_name */ NULL,
/* class_part_initialize */ FALSE,
/* class_inited */ NULL,
/* initialize_hook */ FALSE,
/* compress_motion */ TRUE,
/* compress_exposure */ TRUE,
/* compress_enterleave */ FALSE,
/* visible_interest */ NULL,
/* set_values_hook */ NULL,
/* get_values_hook */ NULL,
/* callback_private */ },
/* CoreClass fields initialization */ },
/* SimpleClass fields initialization */ },
/* LabelClass fields initialization */ },
/* CommmandClass fields initialization */ NULL,
/* Set Proceedure. */ NULL,
/* Unset Proceedure. */ }
/* ToggleClass fields initialization */ /* for public consumption */ /**************************************************************** ****************************************************************/ /* actions = SuperClass->core_class.actions; */ /* The actions table should really be retrieved from the toggle widget's * Superclass, but this information is munged by the R3 intrinsics so the * I have hacked the Athena command widget to export its action table * Chris D. Peterson 12/28/88. * Find the set and unset actions in the command widget's action table. /* We should never get here. */ "Toggle could not find action Proceedure Set() in the Command Widget.");
"Toggle could not find action Proceedure Unset() in the Command Widget.");
XtError(
"Aborting, due to errors in Toggle widget.");
* Command widget assumes that the widget is unset, so we only * have to handle the case where it needs to be set. * If this widget is in a radio group then it may cause another * widget to be unset, thus calling the notify proceedure. * I want to set the toggle if the user set the state to "On" in * the resource group, reguardless of what my ancestors did. /************************************************************ ************************************************************/ /************************************************************ * Set specified arguments into widget ***********************************************************/ /* Function Name: ToggleDestroy * Description: Destroy Callback for toggle widget. * Arguments: w - the toggle widget that is being destroyed. * junk, grabage - not used. /************************************************************ * Below are all the private proceedures that handle ************************************************************/ /* Function Name: GetRadioGroup * Description: Gets the radio group associated with a give toggle * Arguments: w - the toggle widget who's radio group we are getting. * Returns: the radio group associated with this toggle group. /* Function Name: CreateRadioGroup * Description: Creates a radio group. give two widgets. * Arguments: w1, w2 - the toggle widgets to add to the radio group. * NOTE: A pointer to the group is added to each widget's radio_group "to create a new toggle group, when one already exists.");
/* Function Name: AddToRadioGroup * Description: Adds a toggle to the radio group. * Arguments: group - any element of the radio group the we are adding to. * w - the new toggle widget to add to the group. if (
group ==
NULL) {
/* Creating new group. */ /* Function Name: TurnOffRadioSiblings * Description: Deactivates all radio siblings. * Arguments: widget - a toggle widget. /* Go to the top of the group. */ /* Function Name: RemoveFromRadioGroup * Description: Removes a toggle from a RadioGroup. * Arguments: w - the toggle widget to remove. /************************************************************ ************************************************************/ /* Function Name: XawToggleChangeRadioGroup * Description: Allows a toggle widget to change radio groups. * Arguments: w - The toggle widget to change groups. * radio_group - any widget in the new group. * If the toggle that we are about to add is set then we will * unset all toggles in the new radio group. /* Function Name: XawToggleGetCurrent * Description: Returns the RadioData associated with the toggle * widget that is currently active in a toggle group. * Arguments: w - any toggle widget in the toggle group. * Returns: The XtNradioData associated with the toggle widget. /* Function Name: XawToggleSetCurrent * Description: Sets the Toggle widget associated with the * Arguments: radio_group - any toggle widget in the toggle group. * radio_data - radio data of the toggle widget to set. /* Special case case of no radio group. */ * search for matching radio data. return;
/* found it, done */ /* Function Name: XawToggleUnsetCurrent * Description: Unsets all Toggles in the radio_group specified. * Arguments: radio_group - any toggle widget in the toggle group. /* Special Case no radio group. */