#ifndef lint
#endif /* lint */
/*
* Copyright 1989 Massachusetts Institute of Technology
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/*
* Toggle.c - Toggle button widget
*
* Author: Chris D. Peterson
* MIT X Consortium
* kit@expo.lcs.mit.edu
*
* Date: January 12, 1989
*
*/
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <./Xaw3_1XawInit.h>
#include <./Xaw3_1ToggleP.h>
/****************************************************************
*
* Full class record constant
*
****************************************************************/
/* Private Data */
/* This is a hack, see the comments in ClassInit(). */
extern XtActionList xaw_command_actions_list;
/*
* The order of toggle and notify are important, as the state has
* to be set when we call the notify proc.
*/
static char defaultTranslations[] =
"<EnterWindow>: highlight(Always) \n\
<LeaveWindow>: unhighlight() \n\
<Btn1Down>,<Btn1Up>: toggle() notify()";
};
/* Action proceedures retrieved from the command widget */
static void ToggleDestroy(), ClassInit();
/* Functions for handling the Radio Group. */
static RadioGroup * GetRadioGroup();
static void RemoveFromRadioGroup();
{
{"toggle", Toggle},
{"notify", Notify},
{"set", ToggleSet},
};
{
"Toggle", /* class_name */
sizeof(ToggleRec), /* size */
ClassInit, /* class_initialize */
NULL, /* class_part_initialize */
FALSE, /* class_inited */
Initialize, /* initialize */
NULL, /* initialize_hook */
XtInheritRealize, /* realize */
actionsList, /* actions */
resources, /* resources */
NULLQUARK, /* xrm_class */
FALSE, /* compress_motion */
TRUE, /* compress_exposure */
TRUE, /* compress_enterleave */
FALSE, /* visible_interest */
NULL, /* destroy */
XtInheritResize, /* resize */
XtInheritExpose, /* expose */
SetValues, /* set_values */
NULL, /* set_values_hook */
XtInheritSetValuesAlmost, /* set_values_almost */
NULL, /* get_values_hook */
NULL, /* accept_focus */
XtVersion, /* version */
NULL, /* callback_private */
defaultTranslations, /* tm_table */
XtInheritQueryGeometry, /* query_geometry */
XtInheritDisplayAccelerator, /* display_accelerator */
NULL /* extension */
}, /* CoreClass fields initialization */
{
XtInheritChangeSensitive /* change_sensitive */
}, /* SimpleClass fields initialization */
{
0 /* field not used */
}, /* LabelClass fields initialization */
{
0 /* field not used */
}, /* CommmandClass fields initialization */
{
NULL, /* Set Proceedure. */
NULL, /* Unset Proceedure. */
NULL /* extension. */
} /* ToggleClass fields initialization */
};
/* for public consumption */
/****************************************************************
*
* Private Procedures
*
****************************************************************/
static void
{
Cardinal i;
/* 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
* as a global variable.
*
* 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.");
}
{
else
}
/*
* 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.
*/
}
/************************************************************
*
* Action Procedures
*
************************************************************/
/* ARGSUSED */
static void
Widget w;
{
}
/* ARGSUSED */
static void
Widget w;
{
else
}
/* ARGSUSED */
Widget w;
{
}
/************************************************************
*
* Set specified arguments into widget
*
***********************************************************/
/* ARGSUSED */
static Boolean
{
}
return(FALSE);
}
/* Function Name: ToggleDestroy
* Description: Destroy Callback for toggle widget.
* Arguments: w - the toggle widget that is being destroyed.
* junk, grabage - not used.
* Returns: none.
*/
/* ARGSUSED */
static void
Widget w;
{
}
/************************************************************
*
* Below are all the private proceedures that handle
* radio toggle buttons.
*
************************************************************/
/* Function Name: GetRadioGroup
* Description: Gets the radio group associated with a give toggle
* widget.
* Arguments: w - the toggle widget who's radio group we are getting.
* Returns: the radio group associated with this toggle group.
*/
static RadioGroup *
Widget w;
{
}
/* Function Name: CreateRadioGroup
* Description: Creates a radio group. give two widgets.
* Arguments: w1, w2 - the toggle widgets to add to the radio group.
* Returns: none.
*
* NOTE: A pointer to the group is added to each widget's radio_group
* field.
*/
static void
{
"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.
* Returns: none.
*/
static void
RadioGroup * group;
Widget w;
{
return;
}
}
/* Function Name: TurnOffRadioSiblings
* Description: Deactivates all radio siblings.
* Arguments: widget - a toggle widget.
* Returns: none.
*/
static void
Widget w;
{
return;
/* Go to the top of the group. */
}
}
}
/* Function Name: RemoveFromRadioGroup
* Description: Removes a toggle from a RadioGroup.
* Arguments: w - the toggle widget to remove.
* Returns: none.
*/
static void
Widget w;
{
}
}
/************************************************************
*
* Public Routines
*
************************************************************/
/* 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.
* Returns: none.
*/
void
Widget w, radio_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.
*/
Widget w;
{
}
return(NULL);
}
/* Function Name: XawToggleSetCurrent
* Description: Sets the Toggle widget associated with the
* radio_data specified.
* Arguments: radio_group - any toggle widget in the toggle group.
* radio_data - radio data of the toggle widget to set.
* Returns: none.
*/
void
{
/* Special case case of no radio group. */
}
return;
}
/*
* find top of radio_roup
*/
/*
* 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.
* Returns: none.
*/
void
{
/* Special Case no radio group. */
}
}