SetSens.c revision a3bd7f05
1444c061aSmrg/*********************************************************** 2249c3046SmrgCopyright (c) 1993, Oracle and/or its affiliates. All rights reserved. 31477040fSmrg 41477040fSmrgPermission is hereby granted, free of charge, to any person obtaining a 51477040fSmrgcopy of this software and associated documentation files (the "Software"), 61477040fSmrgto deal in the Software without restriction, including without limitation 71477040fSmrgthe rights to use, copy, modify, merge, publish, distribute, sublicense, 81477040fSmrgand/or sell copies of the Software, and to permit persons to whom the 91477040fSmrgSoftware is furnished to do so, subject to the following conditions: 101477040fSmrg 111477040fSmrgThe above copyright notice and this permission notice (including the next 121477040fSmrgparagraph) shall be included in all copies or substantial portions of the 131477040fSmrgSoftware. 141477040fSmrg 151477040fSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 161477040fSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 171477040fSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 181477040fSmrgTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 191477040fSmrgLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 201477040fSmrgFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 211477040fSmrgDEALINGS IN THE SOFTWARE. 221477040fSmrg 231477040fSmrgCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. 24444c061aSmrg 25444c061aSmrg All Rights Reserved 26444c061aSmrg 271477040fSmrgPermission to use, copy, modify, and distribute this software and its 281477040fSmrgdocumentation for any purpose and without fee is hereby granted, 29444c061aSmrgprovided that the above copyright notice appear in all copies and that 301477040fSmrgboth that copyright notice and this permission notice appear in 311477040fSmrgsupporting documentation, and that the name of Digital not be 32444c061aSmrgused in advertising or publicity pertaining to distribution of the 331477040fSmrgsoftware without specific, written prior permission. 34444c061aSmrg 35444c061aSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 36444c061aSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 37444c061aSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 38444c061aSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 39444c061aSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 40444c061aSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 41444c061aSmrgSOFTWARE. 42444c061aSmrg 43444c061aSmrg******************************************************************/ 44444c061aSmrg 45444c061aSmrg/* 46444c061aSmrg 47444c061aSmrgCopyright 1987, 1988, 1998 The Open Group 48444c061aSmrg 49444c061aSmrgPermission to use, copy, modify, distribute, and sell this software and its 50444c061aSmrgdocumentation for any purpose is hereby granted without fee, provided that 51444c061aSmrgthe above copyright notice appear in all copies and that both that 52444c061aSmrgcopyright notice and this permission notice appear in supporting 53444c061aSmrgdocumentation. 54444c061aSmrg 55444c061aSmrgThe above copyright notice and this permission notice shall be included in 56444c061aSmrgall copies or substantial portions of the Software. 57444c061aSmrg 58444c061aSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 59444c061aSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 60444c061aSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 61444c061aSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 62444c061aSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 63444c061aSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 64444c061aSmrg 65444c061aSmrgExcept as contained in this notice, the name of The Open Group shall not be 66444c061aSmrgused in advertising or otherwise to promote the sale, use or other dealings 67444c061aSmrgin this Software without prior written authorization from The Open Group. 68444c061aSmrg 69444c061aSmrg*/ 70444c061aSmrg 71444c061aSmrg#ifdef HAVE_CONFIG_H 72444c061aSmrg#include <config.h> 73444c061aSmrg#endif 74444c061aSmrg#include "IntrinsicI.h" 75444c061aSmrg#include "StringDefs.h" 76444c061aSmrg 77444c061aSmrg/* 78a3bd7f05Smrg * XtSetSensitive() 79444c061aSmrg */ 80444c061aSmrg 81a3bd7f05Smrgstatic void 82a3bd7f05SmrgSetAncestorSensitive(register Widget widget, Boolean ancestor_sensitive) 83444c061aSmrg{ 840568f49bSmrg Arg args[1]; 85444c061aSmrg 86a3bd7f05Smrg if (widget->core.ancestor_sensitive == ancestor_sensitive) 87a3bd7f05Smrg return; 88444c061aSmrg 89444c061aSmrg XtSetArg(args[0], XtNancestorSensitive, ancestor_sensitive); 90444c061aSmrg XtSetValues(widget, args, XtNumber(args)); 91444c061aSmrg 92444c061aSmrg /* If widget's sensitive is TRUE, propagate new ancestor_sensitive to 93444c061aSmrg children's ancestor_sensitive; else do nothing as children's 94444c061aSmrg ancestor_sensitive is already FALSE */ 959e7bcd65Smrg 96444c061aSmrg if (widget->core.sensitive && XtIsComposite(widget)) { 97a3bd7f05Smrg Cardinal i; 98a3bd7f05Smrg WidgetList children; 990568f49bSmrg 100a3bd7f05Smrg children = ((CompositeWidget) widget)->composite.children; 101a3bd7f05Smrg for (i = 0; i < ((CompositeWidget) widget)->composite.num_children; i++) { 102a3bd7f05Smrg SetAncestorSensitive(children[i], ancestor_sensitive); 103a3bd7f05Smrg } 104444c061aSmrg } 105a3bd7f05Smrg} /* SetAncestorSensitive */ 106444c061aSmrg 107a3bd7f05Smrgvoid 108a3bd7f05SmrgXtSetSensitive(register Widget widget, _XtBoolean sensitive) 109444c061aSmrg{ 110a3bd7f05Smrg Arg args[1]; 111a3bd7f05Smrg 112444c061aSmrg WIDGET_TO_APPCON(widget); 113444c061aSmrg 114444c061aSmrg LOCK_APP(app); 115444c061aSmrg if (widget->core.sensitive == sensitive) { 116a3bd7f05Smrg UNLOCK_APP(app); 117a3bd7f05Smrg return; 118444c061aSmrg } 119444c061aSmrg 120444c061aSmrg XtSetArg(args[0], XtNsensitive, sensitive); 121444c061aSmrg XtSetValues(widget, args, XtNumber(args)); 122444c061aSmrg 123444c061aSmrg /* If widget's ancestor_sensitive is TRUE, propagate new sensitive to 124444c061aSmrg children's ancestor_sensitive; else do nothing as children's 125444c061aSmrg ancestor_sensitive is already FALSE */ 1269e7bcd65Smrg 127a3bd7f05Smrg if (widget->core.ancestor_sensitive && XtIsComposite(widget)) { 128a3bd7f05Smrg Cardinal i; 129a3bd7f05Smrg WidgetList children; 1300568f49bSmrg 131a3bd7f05Smrg children = ((CompositeWidget) widget)->composite.children; 132a3bd7f05Smrg for (i = 0; i < ((CompositeWidget) widget)->composite.num_children; i++) { 133a3bd7f05Smrg SetAncestorSensitive(children[i], (Boolean) sensitive); 134a3bd7f05Smrg } 135444c061aSmrg } 136444c061aSmrg UNLOCK_APP(app); 137a3bd7f05Smrg} /* XtSetSensitive */ 138