/* * @OPENGROUP_COPYRIGHT@ * COPYRIGHT NOTICE * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc. * Copyright (c) 1996, 1997, 1998, 1999, 2000 The Open Group * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for * the full copyright text. * * This software is subject to an open license. It may only be * used on, with or for operating systems which are themselves open * source systems. You must contact The Open Group for a license * allowing distribution and sublicensing of this software on, with, * or for operating systems which are not Open Source programs. * * See http://www.opengroup.org/openmotif/license for full * details of the license agreement. Any use, reproduction, or * distribution of the program constitutes recipient's acceptance of * this agreement. * * EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS * PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY * WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY * OR FITNESS FOR A PARTICULAR PURPOSE * * EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT * NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE * EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. */ /* * HISTORY */ #ifdef REV_INFO #ifndef lint static char rcsid[] = "$XConsortium: ToggleBGad1.c /main/8 1995/07/13 17:30:51 drk $" #endif #endif /* * (c) Copyright 1989, HEWLETT-PACKARD COMPANY */ /**************************************************************************** * * This program tests a toggle pixmap, and the XmNindicatorOn resource. * ****************************************************************************/ #include #include #include #include #include char smileRaster[] = { 0xff, 0xff, 0xff, 0x01, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xc1, 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0x7f, 0xfc, 0x1f, 0xfe, 0x7f, 0xf8, 0x3f, 0xff, 0x7f, 0xfe, 0xe7, 0xf9, 0x9f, 0xe7, 0x3f, 0xff, 0x3f, 0xff, 0xfb, 0xf7, 0xef, 0xdf, 0x7f, 0xfe, 0x3f, 0xff, 0xfd, 0xef, 0xf7, 0xbf, 0x7f, 0xfe, 0x3f, 0xff, 0xfd, 0xef, 0xf7, 0xbf, 0xff, 0xfc, 0x9f, 0xff, 0xfe, 0xdf, 0xfb, 0x7f, 0xff, 0xfc, 0x9f, 0xff, 0xfe, 0xdf, 0xfb, 0x7f, 0xff, 0xf9, 0x9f, 0xff, 0xfe, 0xc1, 0xfb, 0x07, 0xff, 0xf9, 0xcf, 0xff, 0xfe, 0xc0, 0xfb, 0x03, 0xff, 0xf9, 0xcf, 0xff, 0x7d, 0xe0, 0xf7, 0x81, 0xff, 0xf3, 0xcf, 0xff, 0x3d, 0xe0, 0xf7, 0x80, 0xff, 0xf3, 0xcf, 0xff, 0x3b, 0xf0, 0xef, 0xc0, 0xff, 0xf3, 0xcf, 0xff, 0x27, 0xf8, 0x9f, 0xe0, 0xff, 0xf3, 0xcf, 0xff, 0x1f, 0xfe, 0x7f, 0xf8, 0xff, 0xf3, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xcf, 0xef, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xf3, 0xcf, 0xef, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xf3, 0xcf, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xf3, 0xcf, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xf3, 0xcf, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfb, 0xdf, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xfb, 0x9f, 0xff, 0xfc, 0xff, 0xff, 0x9f, 0xff, 0xf9, 0x9f, 0xff, 0xfb, 0xff, 0xff, 0xcf, 0xff, 0xf9, 0x3f, 0xff, 0xef, 0xff, 0xff, 0xf3, 0xff, 0xfc, 0x3f, 0xff, 0x1f, 0xff, 0x7f, 0xf8, 0xff, 0xfc, 0x3f, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xfe, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xc7, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, }; #include "smiley.bmp" #define XBMs_BITS smiley_bits #define XBMs_WIDTH smiley_width #define XBMs_HEIGHT smiley_height Pixmap select_pixmap; void main (argc, argv) unsigned int argc; char **argv; { int n; XImage *pic; Widget toggle, bb, label ; Arg args[10]; Pixmap pixOn, pixOff; GC gc; Screen *screen; XGCValues values; XtGCMask valueMask; Pixel foreground, background; Drawable drawable; Window win; /* initialize toolkit */ CommonTestInit(argc, argv); n = 0; bb = XmCreateBulletinBoard(Shell1, "bb", args, n); foreground = XBlackPixel(display, 0); background = XWhitePixel(display, 0); pixOn = XCreatePixmapFromBitmapData(display, rootWindow, smileRaster, 64, 64, foreground, background, DefaultDepthOfScreen(XtScreen(Shell1))); pixOff = XCreatePixmapFromBitmapData(display, rootWindow, smileRaster, 64, 64, background, foreground, DefaultDepthOfScreen(XtScreen(Shell1))); n = 0; XtSetArg(args[n], XmNlabelType, XmPIXMAP); n++; XtSetArg(args[n], XmNlabelPixmap, pixOff); n++; XtSetArg(args[n], XmNlabelInsensitivePixmap, pixOn); n++; XtSetArg(args[n], XmNselectInsensitivePixmap, pixOff); n++; XtSetArg(args[n], XmNset, True); n++; XtSetArg(args[n], XmNselectColor, CommonGetColor("red")); n++; toggle = XmCreateToggleButtonGadget(bb, "toggle", args, n); XtManageChild (bb); XtManageChild (toggle); XtRealizeWidget (Shell1); CommonPause(); XtSetSensitive (toggle, False); CommonPause(); n = 0; XtSetArg(args[n], XmNselectColor, CommonGetColor("green")); n++; XtSetValues( toggle, args, n ); XtSetSensitive (toggle, True); CommonPause(); n = 0; XtSetArg(args[n], XmNmarginWidth, 2); n++; XtSetArg(args[n], XmNmarginHeight, 2); n++; XtSetValues(toggle, args, n); CommonPause(); n = 0; XtSetArg (args[n], XmNlabelType, XmPIXMAP); n++; XtSetArg (args[n], XmNy, 250); n++; /* actual pixmaps are specified via .Xdefaults */ label = XmCreateLabel (bb, "label", args, n); XtManageChild (label); CommonPause(); XtSetSensitive (label, False); CommonPause(); CommonPause(); /* exit */ XtAppMainLoop(app_context); XtDestroyWidget(toggle); XtDestroyWidget(bb); }