コード例 #1
0
/*********************************************************
    popdownProductDescriptionShell
*********************************************************/
static void popdownProductDescriptionShell(XtPointer xtPointer)
{
	Arg args[3];
	Widget widget;
	Atom WM_DELETE_WINDOW;

	widget = (Widget) xtPointer;
	XtPopdown(widget);

	XtSetArg(args[0],XmNmwmDecorations,MWM_DECOR_ALL);
	XtSetArg(args[1],XmNdeleteResponse,XmDO_NOTHING);
	XtSetValues(widget,args,2);

	WM_DELETE_WINDOW = XmInternAtom(XtDisplay(widget),
	    "WM_DELETE_WINDOW",False);
	XmAddWMProtocolCallback(widget,WM_DELETE_WINDOW,
	    (XtCallbackProc)closeProductDescriptionCallback,(XtPointer)widget);

	/* Next time up the OK button will show */
	XtManageChild(okButton);
}
コード例 #2
0
static void
InstallClose(
        ChangeDirRec *change_dir_rec,
        XtCallbackProc callback,
        XtPointer client_data )
{
   Widget close_widget;
   Atom delete_window_atom;

   close_widget =
      XmSelectionBoxGetChild (change_dir_rec->change_dir,
                                             XmDIALOG_CANCEL_BUTTON);

   XtAddCallback (close_widget, XmNactivateCallback, callback, client_data);

   delete_window_atom = XmInternAtom (XtDisplay(change_dir_rec->shell),
                                      "WM_DELETE_WINDOW", True);
   XmRemoveWMProtocols( change_dir_rec->shell, &delete_window_atom, 1 );
   XmAddWMProtocolCallback( change_dir_rec->shell, delete_window_atom, callback,
                            (XtPointer)client_data );
}
コード例 #3
0
ファイル: DragBS.c プロジェクト: att/uwin
/*
 * get the drag proxy window.  XmDisplay uses this to initialize
 * the proxy instance variable.
 */
Window
_XmGetDragProxyWindow(Display *display)
{
    Window win = None;
    Atom pw, atype;
    int aformat;
    unsigned long nitems, bafter;
    unsigned char *prop = NULL;

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:_XmGetDragProxyWindow(%d)\n",
		      __FILE__, __LINE__));

    if ((win = read_drag_window(display)) == None)
    {
	return None;
    }

    pw = XmInternAtom(display, _XA_MOTIF_DRAG_PROXY_WINDOW, False);

    begin_protection(display, win);
    if (XGetWindowProperty(display, win, pw, 0L, PROP_LENGTH,
			   False, AnyPropertyType,
			   &atype, &aformat, &nitems, &bafter, &prop)
	== Success && atype == XA_WINDOW && aformat == 32 && nitems == 1)
    {
        DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:_XmGetDragProxyWindow(%d) - bafter=%i\n",
		      __FILE__, __LINE__, bafter));
	win = *((Window *)prop);
    }
    end_protection(display);
    if (prop)
    {
	XFree((XPointer)prop);
    }

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:_XmGetDragProxyWindow(%d) - %p\n",
		      __FILE__, __LINE__, win));

    return win;
}
コード例 #4
0
ファイル: Dialog.C プロジェクト: BackupTheBerlios/opendx2
void Dialog::post()
{
    theApplication->setBusyCursor(TRUE);
    if (this->getRootWidget() == NULL)
    {
	this->initialize();
	this->setRootWidget(this->createDialog(this->parent));

	Widget shell = XtParent(this->getRootWidget());
	XtVaSetValues(shell, XmNdeleteResponse, XmDO_NOTHING, NULL);
	Atom WM_DELETE_WINDOW = XmInternAtom(XtDisplay(shell),
					    "WM_DELETE_WINDOW", False);
	XmAddWMProtocolCallback(shell, WM_DELETE_WINDOW,
				    (XtCallbackProc)Dialog_CancelCB,
				    (void *)(this));


	if (this->ok != NULL)
	    XtAddCallback(this->ok,
			  XmNactivateCallback,
			  (XtCallbackProc)Dialog_OkCB,
			  (XtPointer)this);
	if (this->help != NULL)
	    XtAddCallback(this->help,
			  XmNactivateCallback,
			  (XtCallbackProc)Dialog_HelpCB,
			  (XtPointer)this);
	if (this->cancel != NULL)
	    XtAddCallback(this->cancel,
			  XmNactivateCallback,
			  (XtCallbackProc)Dialog_CancelCB,
			  (XtPointer)this);
    }

    this->manage();
    theApplication->setBusyCursor(FALSE);

    XmUpdateDisplay(this->getRootWidget());
}
コード例 #5
0
ファイル: DialogShell.C プロジェクト: juddy/edcde
void
DialogShell::initialize()
{
    _w = XtVaCreatePopupShell(
             _name, _widgetClass, _parent->baseWidget(),
             XmNdefaultPosition, False,
             NULL, NULL );
#ifdef USE_EDITRES
    XtAddEventHandler(
        _w, (EventMask) 0, True,
        (XtEventHandler) _XEditResCheckMessages, NULL);
#endif

    installDestroyHandler();
    _workArea = createWorkArea ( _w );
    assert ( _workArea != NULL );

    XtVaSetValues( _w, XmNdefaultPosition, False, NULL );
    XtAddCallback( _w,
                   XmNpopupCallback,
                   ( XtCallbackProc ) &DialogShell::popupCallback,
                   XtPointer( this ) );
    XtAddCallback( _w,
                   XmNpopdownCallback,
                   ( XtCallbackProc ) &DialogShell::popdownCallback,
                   XtPointer( this ) );

    Atom WM_DELETE_WINDOW=XmInternAtom( XtDisplay( _w ),
                                        "WM_DELETE_WINDOW",
                                        False );

    XmAddWMProtocolCallback( _w,
                             WM_DELETE_WINDOW,
                             ( XtCallbackProc ) quitCallback,
                             this );

//  if (!XtIsManaged(_workArea)) XtManageChild(_workArea);
}
コード例 #6
0
/*----------------------------------------------------------------------*/
/* extern */ void
XfeShellAddCloseCallback(Widget			shell,
						 XtCallbackProc	callback,
						 XtPointer		data)
{
	static Atom wm_delete_window = None;

    assert( XtIsShell(shell) );

	if (!_XfeIsAlive(shell))
	{
		return;
	}

	if (wm_delete_window == None)
	{
		wm_delete_window = XmInternAtom(XtDisplay(shell),
										"WM_DELETE_WINDOW",
										False);
	}
		
	XmAddWMProtocolCallback(shell,wm_delete_window,callback,data);
}
コード例 #7
0
ファイル: test6.c プロジェクト: melanj/lesstif
void
cb(Widget w, XtPointer data, XtPointer cbs)
{
    Atom XA_MWM_MENU;
    int actual_format;
    Atom actual_type;
    unsigned long nitems, bytesafter;
    unsigned char *buf;

    XA_MWM_MENU = XmInternAtom(XtDisplay(toplevel), _XA_MWM_MENU, False);

    if (XGetWindowProperty(XtDisplay(toplevel), XtWindow(toplevel),
                           XA_MWM_MENU, 0L, 64L, False, AnyPropertyType,
                           &actual_type, &actual_format, &nitems,
                           &bytesafter, &buf) == Success)
    {
        printf("XA_MWM_MENU: %ld\n", XA_MWM_MENU);
        printf("Actual_type: %ld Actual_format: %d nitems: %ld\n",
               actual_type, actual_format, nitems);
        printf("BytesAfter: %ld buf:\n'\n%s'\n", bytesafter, buf);
    }
    else
        printf("Property not found\n");
}
コード例 #8
0
/*
 * ApptConvertCB
 *
 * Fills in data object with calendar appointment string based on which
 * appointment in the list was under the pointer when the drag started.
 */
static void
ApptConvertCB(
        Widget          dragContext,
        XtPointer       clientData,
        XtPointer       callData)
{
        DtDndConvertCallbackStruct *convertInfo 
					= (DtDndConvertCallbackStruct*)callData;
        DtDndBuffer 	*data		= &(convertInfo->dragData->data.buffers[0]);
        DragContext     *context        = (DragContext *)clientData;
        Display         *display        = XtDisplay(dragContext);
        Atom            CMAPPOINTMENT 	
			= XmInternAtom(display, "CalendarAppointment", False);
	Calendar	*c = context->calendar;

	if (convertInfo->reason != DtCR_DND_CONVERT_DATA)
		return;

        /* REMIND: Need to check convertInfo->reason, handle DELETE, etc */

        data->bp   = XtNewString(context->data);
        data->size = strlen(data->bp);
        data->name = XtNewString(catgets(c->DT_catd, 1, 236, "CalendarAppointment"));
}
コード例 #9
0
ファイル: DragBS.c プロジェクト: att/uwin
static Boolean
read_targets_table(Display *display, XmDndTargetsTable tbl)
{
    Atom ta, atype;
    Window win;
    int aformat, i;
    unsigned long nitems, bafter;
    XmDndTargets *targets = NULL;
    Boolean got_it = False;
    XmDndBufMgrRec bmgr;
    CARD16 nents;

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:read_targets_table(%d)\n",
		      __FILE__, __LINE__));

    ta = XmInternAtom(display, _XA_MOTIF_DRAG_TARGETS, False);

    win = get_drag_window(display);

    begin_protection(display, win);

    if (XGetWindowProperty(display, win, ta, 0L, PROP_LENGTH,
			   False, ta,
			   &atype, &aformat, &nitems, &bafter,
			   (unsigned char **)&targets) == Success &&
	nitems >= 8)
    {
        DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:read_targets_table(%d) bafter=%i\n",
		      __FILE__, __LINE__, bafter));

	got_it = True;
    }

    end_protection(display);

    if (bad_window)
    {
	_XmWarning((Widget)XmGetXmDisplay(display),
		   "Invalid DRAG WINDOW fetching DRAG_ATOMS.");
    }

    if (!got_it)
    {
	if (targets)
	{
	    XFree((XPointer)targets);
	}

	DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:read_targets_table(%d) - False\n",
		      __FILE__, __LINE__));

	return False;
    }

    if (targets->protocol_version != DND_PROTOCOL_VERSION)
    {
	_XmWarning((Widget)XmGetXmDisplay(display),
		   "DND Protocol version mismatch.");
    }

    if (targets->byte_order != _XmByteOrder())
    {
	SWAP2BYTES(targets->num_target_lists);
	SWAP4BYTES(targets->data_size);
    }

    if (!tbl)
    {
	tbl = (XmDndTargetsTable)XtMalloc(sizeof(XmDndTargetsTableRec));

	tbl->num_entries = 0;
	tbl->entries = NULL;

	set_targets_table(display, tbl);
    }

    if (tbl->num_entries < targets->num_target_lists)
    {
	tbl->num_entries = targets->num_target_lists;
	tbl->entries =
	    (XmDndTargetsTableEntry)XtRealloc((char *)tbl->entries,
					      targets->num_target_lists *
					    sizeof(XmDndTargetsTableEntryRec));
    }

    if (targets->num_target_lists > 0)
    {

	bmgr.atoms = (char *)targets;
	bmgr.atom_start = (char *)(targets + 1);
	bmgr.atom_size = targets->data_size;

	for (i = 0; i < targets->num_target_lists; i++)
	{

	    _XmReadDragBuffer(&bmgr, False, (char *)&nents,
			      sizeof(CARD16));

	    if (targets->byte_order != _XmByteOrder())
	    {
		SWAP2BYTES(nents);
	    }

	    tbl->entries[i].num_targets = nents;
	    tbl->entries[i].targets = (Atom *)XtMalloc(nents * sizeof(Atom));

            read_atoms_from_drag_buffer(&bmgr, tbl->entries[i].num_targets,
                                        targets->byte_order != _XmByteOrder(),
                                        tbl->entries[i].targets);
	}
    }

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:read_targets_table(%d) - True %p\n",
		      __FILE__, __LINE__, tbl));

    if (targets)
     {
         XFree((XPointer)targets);
     }
    return True;
}
コード例 #10
0
ファイル: DragBS.c プロジェクト: att/uwin
/*
 * write the atoms table out to the drag window
 */
static void
write_atoms_table(Display *display, XmDndAtomsTable tbl)
{
    char atoms[1000];
    XmDndAtoms atoms_rec;
    XmDndBufMgrRec bmgr;
    Atom pa;
    int i;
    Window win;

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:write_atoms_table(%d)\n",
		      __FILE__, __LINE__));

    if (tbl == NULL)
    {
	_XmWarning((Widget)XmGetXmDisplay(display),
		   "No DRAG_ATOMS to write to DRAG_WINDOW.");

	return;
    }

    atoms_rec.byte_order = _XmByteOrder();
    atoms_rec.protocol_version = DND_PROTOCOL_VERSION;
    atoms_rec.num_atoms = tbl->num_entries;

    bmgr.atoms = atoms;
    bmgr.atom_ptr = atoms;
    bmgr.atom_start = NULL;
    bmgr.atom_size = 0;
    bmgr.atom_avail = 1000;

    _XmWriteDragBuffer(&bmgr, False, (char *)&atoms_rec, sizeof(XmDndAtoms));

    for (i = 0; i < tbl->num_entries; i++)
    {
	_XmWriteDragBuffer(&bmgr, False, (char *)&tbl->entries[i],
			   sizeof(XmDndAtomsTableEntryRec));

    }

    ((XmDndAtoms *) (bmgr.atoms))->data_size = bmgr.atom_size;

    pa = XmInternAtom(display, _XA_MOTIF_DRAG_ATOMS, False);

    win = get_drag_window(display);

    begin_protection(display, win);

    XChangeProperty(display, win, pa, pa, 8, PropModeReplace,
		    (unsigned char *)bmgr.atoms, bmgr.atom_size);

    if (bmgr.atoms != bmgr.atom_ptr)
    {
	XtFree(bmgr.atoms);
    }

    end_protection(display);

    if (bad_window)
    {
	_XmWarning((Widget)XmGetXmDisplay(display),
		   "Bad window writing DRAG_ATOMS on DRAG_WINDOW.");
    }
}
コード例 #11
0
ファイル: DragBS.c プロジェクト: att/uwin
static Boolean
read_atoms_table(Display *display, XmDndAtomsTable tbl)
{
    Atom da, atype;
    Window win;
    int aformat, i;
    unsigned long nitems, bafter;
    XmDndAtoms *atoms = NULL;
    Boolean got_it = False;
    XmDndAtomsTableEntryRec atom_ent;
    XmDndBufMgrRec bmgr;

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:read_atoms_table(%d)\n",
		      __FILE__, __LINE__));

    da = XmInternAtom(display, _XA_MOTIF_DRAG_ATOMS, False);

    win = get_drag_window(display);

    begin_protection(display, win);

    if (XGetWindowProperty(display, win, da, 0L, PROP_LENGTH,
			   False, da,
			   &atype, &aformat, &nitems, &bafter,
			   (unsigned char **)&atoms) == Success &&
	nitems >= 8)
    {
        DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:read_atom_pairs(%d) - got property, bafter=%i\n",
		      __FILE__, __LINE__, bafter));    
	got_it = True;
    }

    end_protection(display);

    if (bad_window)
    {
	_XmWarning((Widget)XmGetXmDisplay(display),
		   "Invalid DRAG WINDOW fetching DRAG_ATOMS.");
    }

    if (!got_it)
    {
	if (atoms)
	{
	    XFree((XPointer)atoms);
	}

	return False;
    }

    if (atoms->protocol_version != DND_PROTOCOL_VERSION)
    {
	_XmWarning((Widget)XmGetXmDisplay(display),
		   "DND Protocol version mismatch.");
    }

    if (atoms->byte_order != _XmByteOrder())
    {
	SWAP2BYTES(atoms->num_atoms);
	SWAP4BYTES(atoms->data_size);
    }

    if (!tbl)
    {
	tbl = (XmDndAtomsTable) XtMalloc(sizeof(XmDndAtomsTableRec));

	tbl->num_entries = 0;
	tbl->entries = NULL;

	set_atoms_table(display, tbl);
    }

    if (tbl->num_entries < atoms->num_atoms)
    {
	tbl->entries = (XmDndAtomsTableEntry) XtRealloc((char *)tbl->entries,
							atoms->num_atoms *
					      sizeof(XmDndAtomsTableEntryRec));
    }

    if (atoms->num_atoms > 0)
    {

	bmgr.atoms = (char *)atoms;
	bmgr.atom_start = (char *)(atoms + 1);
	bmgr.atom_size = atoms->data_size;

	for (i = 0; i < atoms->num_atoms; i++)
	{
	    _XmReadDragBuffer(&bmgr, False, (char *)&atom_ent,
			      sizeof(XmDndAtomsTableEntryRec));

	    if (atoms->byte_order != _XmByteOrder())
	    {
		SWAP4BYTES(atom_ent.atom);
		SWAP4BYTES(atom_ent.time);
	    }

	    tbl->entries[i].atom = atom_ent.atom;
	    tbl->entries[i].time = atom_ent.time;
	}
    }

    return True;
}
コード例 #12
0
ファイル: DragBS.c プロジェクト: att/uwin
/*
 * if the ATOM_PAIRS didn't exist, put them on the drag window
 */
static void
write_atom_pairs(Display *display)
{
    char pairs[1000];
    char names[1000];
    XmDndAtomPairs pair_rec;
    XmDndBufMgrRec bmgr;
    XmDndAtomPair pair;
    Atom pa;
    int i;
    Window win;

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:write_atom_pairs(%d)\n",
		      __FILE__, __LINE__));

    pair_rec.byte_order = _XmByteOrder();
    pair_rec.protocol_version = DND_PROTOCOL_VERSION;
    pair_rec.num_pairs = XtNumber(motifAtoms);

    bmgr.atoms = pairs;
    bmgr.atom_ptr = pairs;
    bmgr.atom_start = NULL;
    bmgr.atom_size = 0;
    bmgr.atom_avail = 1000;
    bmgr.names = names;
    bmgr.name_ptr = names;
    bmgr.name_start = NULL;
    bmgr.name_size = 0;
    bmgr.name_avail = 1000;

    _XmWriteDragBuffer(&bmgr, False, (char *)&pair_rec, sizeof(XmDndAtomPairs));

    for (i = 0; i < XtNumber(motifAtoms); i++)
    {
	pair.atom = XmInternAtom(display, motifAtoms[i], False);

	pair.namelen = strlen(motifAtoms[i]) + 1;

	_XmWriteDragBuffer(&bmgr, True, motifAtoms[i], pair.namelen);

	_XmWriteDragBuffer(&bmgr, False, (char *)&pair, sizeof(XmDndAtomPair));

    }

    ((XmDndAtomPairs *) (bmgr.atoms))->data_size = bmgr.atom_size;

    pa = XmInternAtom(display, _XA_MOTIF_DRAG_ATOM_PAIRS, False);

    win = get_drag_window(display);

    begin_protection(display, win);

    XChangeProperty(display, win, pa, pa, 8, PropModeReplace,
		    (unsigned char *)bmgr.atoms, bmgr.atom_size);

    if (bmgr.atoms != bmgr.atom_ptr)
    {
	XtFree(bmgr.atoms);
    }

    if (bmgr.name_size)
    {
	XChangeProperty(display, win, pa, pa, 8, PropModeAppend,
			(unsigned char *)bmgr.names, bmgr.name_size);

	if (bmgr.names != bmgr.name_ptr)
	{
	    XtFree(bmgr.names);
	}
    }

    end_protection(display);

    if (bad_window)
    {
	_XmWarning((Widget)XmGetXmDisplay(display),
		   "Bad window writing ATOM_PAIRS property on DRAG_WINDOW.");
    }
}
コード例 #13
0
ファイル: mask.c プロジェクト: epicsdeb/alh
/******************************************************
  maskCreateDialog
******************************************************/
static void maskCreateDialog(ALINK *area)
{
	struct maskWindow *maskWindow;

	Widget maskDialogShell, maskDialog;
	Widget form;
	Widget nameLabelW, nameTextW;
	Widget labelW, pushButtonW, prev;
	int    i,j;
	static ActionAreaItem buttonItems[] = {
		         { "Dismiss", maskDismissCallback, NULL    },
		         { "Help",    maskHelpCallback,    NULL    },
		     	};
	static maskItem maskItem[] = {
		         { "Add/Cancel Alarms",         {{"Add",    0},{"Cancel",  1},{"Reset", 2}}},
		         { "Enable/Disable Alarms",     {{"Enable",10},{"Disable",11},{"Reset",12}}},
		         { "Ack/NoAck Alarms",          {{"Ack",   20},{"NoAck",  21},{"Reset",22}}},
		         { "Ack/NoAck Transient Alarms",{{"AckT",  30},{"NoAckT", 31},{"Reset",32}}},
		         { "Log/NoLog Alarms",          {{"Log",   40},{"NoLog",  41},{"Reset",42}}},
		     	};
	int num_buttons = 3;
	int num_rows = 5;

	if (!area) return;

	maskWindow = (struct maskWindow *)area->maskWindow;

	if (maskWindow && maskWindow->maskDialog){
		if (XtIsManaged(maskWindow->maskDialog)) return;
		else XtManageChild(maskWindow->maskDialog);
	}

	maskWindow = (struct maskWindow *)calloc(1,sizeof(struct maskWindow));
	area->maskWindow = (void *)maskWindow;
	maskWindow->area = (void *)area;

	maskDialogShell = XtVaCreatePopupShell("Modify Mask Settings",
	    transientShellWidgetClass, area->toplevel, 
	    XmNallowShellResize, TRUE,
	    NULL);

	/* Modify the window manager menu "close" callback */
	{
		Atom         WM_DELETE_WINDOW;
		XtVaSetValues(maskDialogShell,
		    XmNdeleteResponse, XmDO_NOTHING, NULL);
		WM_DELETE_WINDOW = XmInternAtom(XtDisplay(maskDialogShell),
		    "WM_DELETE_WINDOW", False);
		XmAddWMProtocolCallback(maskDialogShell,WM_DELETE_WINDOW,
		    (XtCallbackProc)maskDismissCallback, (XtPointer)maskWindow);
	}

	maskDialog = XtVaCreateWidget("maskDialog",
	    xmPanedWindowWidgetClass, maskDialogShell,
	    XmNallowResize,      TRUE,
	    XmNsashWidth,        1,
	    XmNsashHeight,       1,
	    XmNuserData,         area,
	    NULL);

	form = XtVaCreateWidget("control_area",
	    xmFormWidgetClass, maskDialog,
	    XmNfractionBase,    TIGHTNESS*(num_buttons+3) - 1,
	    XmNallowResize,     TRUE,
	    NULL);

	/* ---------------------------------
	     Group/Channel Name 
	     --------------------------------- */
	nameLabelW = XtVaCreateManagedWidget("nameLabelW",
	    xmLabelGadgetClass, form,
	    XmNalignment,       XmALIGNMENT_END,
	    XmNtopAttachment,   XmATTACH_FORM,
	    XmNrightAttachment, XmATTACH_POSITION,
	    XmNrightPosition,   (TIGHTNESS*(num_buttons+3) - 1)/2,
	    XmNrecomputeSize,   True,
	    (XtPointer)NULL);

	nameTextW = XtVaCreateManagedWidget("nameTextW",
	    xmLabelGadgetClass, form,
	    XmNalignment,       XmALIGNMENT_BEGINNING,
	    XmNleftAttachment,  XmATTACH_WIDGET,
	    XmNleftWidget,      nameLabelW,
	    XmNrightAttachment, XmATTACH_NONE,
	    XmNrecomputeSize,   True,
	    NULL);


	prev = nameLabelW;
	for (i = 0; i < num_rows; i++){
		labelW = XtVaCreateManagedWidget(maskItem[i].label,
		    xmLabelGadgetClass,  form,
		    XmNleftAttachment,   XmATTACH_FORM,
		    XmNtopAttachment,    XmATTACH_WIDGET,
		    XmNtopWidget,        prev,
		    XmNtopOffset,        10,
		    NULL);
		for (j = 0; j < num_buttons; j++){
			long index=maskItem[i].choice[j].index;
			pushButtonW = XtVaCreateManagedWidget(
			    maskItem[i].choice[j].label,
			    xmPushButtonWidgetClass, form,
			    XmNuserData,             (XtPointer)area,
			    XmNleftAttachment,       XmATTACH_POSITION,
			    XmNleftPosition,         TIGHTNESS*(j+3),
			    XmNtopAttachment,        XmATTACH_WIDGET,
			    XmNtopWidget,            prev,
			    XmNtopOffset,       5,
			    XmNrightAttachment,
			    j != num_buttons-1? XmATTACH_POSITION : XmATTACH_FORM,
			    XmNrightPosition,        TIGHTNESS*(j+3) + (TIGHTNESS-1),
			    NULL);
			XtAddCallback(pushButtonW, XmNactivateCallback,
			    (XtCallbackProc)maskActivateCallback,
			    (XtPointer)index);
			if (_passive_flag && i == ALARMACKT ) { /* ACKT */
				XtVaSetValues(pushButtonW, XmNsensitive, FALSE, NULL);
			}
		}
		prev=labelW;
	}

	XtManageChild(form);

	/* Set the client data "Dismiss" and "Help" button's callbacks. */
	buttonItems[0].data = (XtPointer)maskWindow;
	buttonItems[1].data = (XtPointer)maskWindow;

	(void)createActionButtons(maskDialog, buttonItems, XtNumber(buttonItems));

	XtManageChild(maskDialog);

	maskWindow->maskDialog = maskDialog;
	maskWindow->nameLabelW = nameLabelW;
	maskWindow->nameTextW = nameTextW;

	XtRealizeWidget(maskDialogShell);
}
コード例 #14
0
ファイル: main.c プロジェクト: fjardon/motif
int 
main(int argc, char *argv[])
{
#define MAIN_CHILDREN		3
#define FORM_CHILDREN		3
#define PLANE_CHILDREN		6
#define TRAFFIC_CHILDREN	3
#define SetMenuEntry(k,l,p,d) labels[k]=l;procs[k]=p;private[k]=d;

   Pixmap flying;
   Pixmap parked;
   Pixmap mask;
   Widget theWidgetRoot;
   Widget main_tab[MAIN_CHILDREN];
   Widget from_tab[PLANE_CHILDREN];
   Widget to_tab[TRAFFIC_CHILDREN];
   Widget form_tab[FORM_CHILDREN];
   Widget framed[2];
   Widget entry;
   static char myClass[] = "XmdAirport";
   Arg args[10];
   int n ;
   String labels[4];
   XtCallbackProc procs[4];
   XtPointer private[4];
   XGCValues gcv;
   Airport this;


/*
 * Initialize
 */
   this = (Airport) XtCalloc(sizeof(AirportRec), 1);

   XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); 

   theWidgetRoot = XtVaOpenApplication( &this->context, 
                                        myClass, 
				        NULL, 
                                        0, 
                                        &argc, 
                                        argv, 
                                        NULL,
                                        sessionShellWidgetClass, 
				        XmNallowShellResize, True,
                                        NULL);
   
   this->display = XtDisplay(theWidgetRoot);
   FlightAtom = XmInternAtom(this->display, "FLIGHT", False);
   DeleteAtom = XmInternAtom(this->display, "DELETE", False);

   XtGetApplicationResources(theWidgetRoot, &AirportResources,
			     AirportResourcesSpecs, 
			     XtNumber(AirportResourcesSpecs),
			     (ArgList) NULL, 0);

/*
 * Create the Main Window, the menubar and the pulldown menus
 */
   n = 0;
   this->main = XmCreateMainWindow(theWidgetRoot, "main", args, n);

   n = 0;
   main_tab[0] = XmCreateMenuBar(this->main, "menubar", args, n);
   n = 0;
   SetMenuEntry(n, "Exit", 
		(XtCallbackProc) ExitCallback, (XtPointer) this ); n++;
   entry = MenuBarEntry(main_tab[0], "File", labels, procs, private, n);
   n = 0;
   SetMenuEntry(0, "Tutorial",
		(XtCallbackProc) HelpCallback, (XtPointer) this); n++;
   entry = MenuBarEntry(main_tab[0], "Help", labels, procs, private, n);
   n = 0;
   XtSetArg(args[n], XmNmenuHelpWidget, entry); n++;
   XtSetValues(main_tab[0], args, n);

/*
 * Create the Airport widget structure.
 * Two framed radio boxes show state. 
 * A drawing area in the middle show track and planes
 */

   n = 0;
   this->screen_width = WidthOfScreen(XtScreenOfObject(this->main));
   this->screen_height = HeightOfScreen(XtScreenOfObject(this->main));
   XtSetArg(args[n], XmNwidth, this->screen_width*3/7); n++;
   XtSetArg(args[n], XmNresizePolicy, XmRESIZE_NONE); n++;
   main_tab[1] = XmCreateForm(this->main, "airport", args, n);

   n = 0;
   XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; 
   XtSetArg(args[n], XmNbottomAttachment,XmATTACH_FORM); n++; 
   XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM) ; n++;
   form_tab[0] = XmCreateFrame(main_tab[1], "flight", args, n);

   n = 0;
   XtSetArg(args[n], XmNchildType, XmFRAME_TITLE_CHILD); n++;
   framed[0] = XmCreateLabel(form_tab[0], "title", args, n);
   
   n = 0;
   XtSetArg(args[n], XmNchildType, XmFRAME_WORKAREA_CHILD); n++;
   XtSetArg(args[n], XmNresizePolicy, XmRESIZE_GROW); n++;
   XtSetArg(args[n], XmNradioBehavior, True); n++;
   framed[1] = XmCreateRadioBox(form_tab[0], "panel", args, n);
 
   n = 0;
   XtSetArg(args[n], XmNset, True); n++;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->from.departure =
     from_tab[0] = XmCreateToggleButton(framed[1], 
					       "departure", args, n);
   n = 0;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->from.over_ocean =
     from_tab[1] = XmCreateToggleButton(framed[1], 
					       "over_ocean", args, n);
   n = 0;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->from.over_land =
     from_tab[2] = XmCreateToggleButton(framed[1], 
					       "over_land", args, n);
   n = 0;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->from.over_site =     
     from_tab[3] = XmCreateToggleButton(framed[1],
					       "radar", args, n);
   n = 0;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->from.landing =   
     from_tab[4] = XmCreateToggleButton(framed[1], "landing", args, n);

   n = 0;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->from.landed =     
     from_tab[5] = XmCreateToggleButton(framed[1], "landed", args, n);
   XtManageChildren(from_tab, PLANE_CHILDREN);
   XtManageChildren(framed, 2);

/*
 * Create the Airport Traffic control state
 */

   n = 0;
   XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; 
   XtSetArg(args[n], XmNbottomAttachment,XmATTACH_FORM); n++; 
   XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM) ; n++;
   form_tab[1] = XmCreateFrame(main_tab[1], "traffic", args, n);

   n = 0;
   XtSetArg(args[n], XmNchildType, XmFRAME_TITLE_CHILD); n++;
   framed[0] = XmCreateLabel(form_tab[1], "title", args, n);
   
   n = 0;
   XtSetArg(args[n], XmNchildType, XmFRAME_WORKAREA_CHILD); n++;
   XtSetArg(args[n], XmNradioBehavior, True); n++;
   framed[1] = XmCreateRadioBox(form_tab[1], "traffic_box", args, n);
 
   n = 0;
   XtSetArg(args[n], XmNset, True); n++;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->to.leave =     
     to_tab[1] = XmCreateToggleButton(framed[1],
				      "no_traffic", args, n);
   n = 0;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->to.enter =     
     to_tab[0] = XmCreateToggleButton(framed[1],
				      "radar_echo", args, n);
   n = 0;
   XtSetArg(args[n], XmNvisibleWhenOff, False); n++;
   this->to.landing =   
     to_tab[2] = XmCreateToggleButton(framed[1],
				      "landing", args, n);

   XtManageChildren(to_tab, TRAFFIC_CHILDREN);
   XtManageChildren(framed, 2);

/*
 * Create the Airport picture
 */
   n = 0;
   XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; 
   XtSetArg(args[n], XmNbottomAttachment,XmATTACH_FORM); n++; 
   XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET) ; n++;
   XtSetArg(args[n], XmNleftWidget, form_tab[0]) ; n++;
   XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET) ; n++;
   XtSetArg(args[n], XmNrightWidget, form_tab[1]) ; n++;
   this->airport = 
     form_tab[2] = XmCreateDrawingArea(main_tab[1], "da", args, n);
   XtAddCallback(this->airport, XmNexposeCallback,
		 (XtCallbackProc) ShowAirport, (XtPointer) this);
   XtAddCallback(this->airport, XmNresizeCallback,
		 (XtCallbackProc) ResizeAirport, (XtPointer) this);
   XtAddCallback(this->airport, XmNinputCallback,
		 (XtCallbackProc) AirportInput, (XtPointer) this);
/*
 * Create the Airport Message area
 */
	
   n = 0;
   main_tab[2] = XmCreateFrame(this->main, "message", args, n);

   n = 0;
   XtSetArg(args[n], XmNchildType, XmFRAME_TITLE_CHILD); n++;
   framed[0] = XmCreateLabel(main_tab[2], "title", args, n);
   
   n = 0;
   XtSetArg(args[n], XmNchildType, XmFRAME_WORKAREA_CHILD); n++;
   XtSetArg(args[n], XmNvisibleItemCount, 4); n++;
   this->msg_area = XmCreateScrolledList(main_tab[2], "msg_list", args, n);
   XtManageChild(this->msg_area);
   framed[1] = XtParent(this->msg_area);
   XtManageChildren(framed, 2);

   n = 0;
   XtSetArg(args[n], XmNmenuBar, main_tab[0]); n++;
   XtSetArg(args[n], XmNworkWindow, main_tab[1]); n++;
   XtSetArg(args[n], XmNmessageWindow, main_tab[2]); n++;
   XtSetValues(this->main, args, n);
   XtManageChildren(form_tab, FORM_CHILDREN);
   XtManageChildren(main_tab, MAIN_CHILDREN);
   XtManageChild(this->main);

   XtRealizeWidget(theWidgetRoot);
   
/* 
 * Create the drag icon
 */

   parked = XCreateBitmapFromData(this->display,
			   XtWindow(this->main), (char*)plane_bits,
			   plane_width, plane_height);

   flying = XCreateBitmapFromData(this->display,
				  XtWindow(this->main), (char*)flying_bits, 
				  flying_icon_width, flying_icon_height);

   mask = XCreateBitmapFromData(this->display, 
				XtWindow(this->main), (char*)flying_mask_bits, 
				flying_mask_width, flying_mask_height);
   n = 0;
   XtSetArg(args[n], XmNpixmap, flying); n++;
   XtSetArg(args[n], XmNdepth, 1); n++;
   XtSetArg(args[n], XmNmask, mask); n++; 
   XtSetArg(args[n], XmNwidth, flying_icon_width); n++;
   XtSetArg(args[n], XmNheight, flying_icon_height) ; n++;
   this->dragIcon = XmCreateDragIcon(form_tab[2], "drag", args, n);
   if (this->dragIcon  == NULL) {
      printf("cannot create drag icon\n");
      exit(0);
   }
  /* Create GC for drawing planes */
   gcv.function = GXcopy;
   gcv.fill_style = FillOpaqueStippled;
   gcv.stipple = parked;
   gcv.foreground = AirportResources.spot_foreground; 
   gcv.background = AirportResources.spot_background; 
   this->park.gc = XCreateGC(this->display, XtWindow(this->main), 
			     GCFunction|GCStipple|GCFillStyle
			     |GCForeground|GCBackground,
			     &gcv);
   
   gcv.line_style = LineDoubleDash;
   gcv.line_width = AirportResources.track_border_width;
   gcv.fill_style = FillSolid;
   gcv.foreground = AirportResources.track_foreground; 
   gcv.background = AirportResources.track_background; 
   this->track.gc = XCreateGC(this->display, XtWindow(this->main), 
			      GCFunction|GCLineWidth|GCLineStyle
			      |GCFillStyle|GCForeground|GCBackground,
			      &gcv);
   XtAppMainLoop(this->context);

   return 0;    /* make compiler happy */
}
コード例 #15
0
ファイル: iupmot_dialog.c プロジェクト: svn2github/iup-iup
int iupdrvDialogSetPlacement(Ihandle* ih, int x, int y)
{
  char* placement;

  if (iupAttribGetInt(ih, "FULLSCREEN"))
    return 1;
  
  placement = iupAttribGet(ih, "PLACEMENT");
  if (!placement)
    return 0;

  if (iupStrEqualNoCase(placement, "MINIMIZED"))
  {
    if (iupdrvDialogIsVisible(ih))
      XIconifyWindow(iupmot_display, XtWindow(ih->handle), iupmot_screen);
    else
    {
      /* TODO: This is not working, so force a minimize after visible.  */
      /*XWMHints wm_hints;                                               */
      /*wm_hints.flags = StateHint;                                      */
      /*wm_hints.initial_state = IconicState;                            */
      /*XSetWMHints(iupmot_display, XtWindow(ih->handle), &wm_hints);  */

      XtMapWidget(ih->handle);
      XIconifyWindow(iupmot_display, XtWindow(ih->handle), iupmot_screen);
    }
  }
  else if (iupStrEqualNoCase(placement, "MAXIMIZED"))
  {
    static Atom maxatoms[2] = {0, 0};
    if (!(maxatoms[0]))
    {
      maxatoms[0] = XmInternAtom(iupmot_display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
      maxatoms[1] = XmInternAtom(iupmot_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
    }

    motDialogChangeWMState(ih, maxatoms[0], maxatoms[1], 1);
  }
  else if (iupStrEqualNoCase(placement, "FULL"))
  {
    int width, height;
    int border, caption, menu;
    iupdrvDialogGetDecoration(ih, &border, &caption, &menu);

    /* position the decoration outside the screen */
    x = -(border);
    y = -(border+caption+menu);

    /* the dialog client area will cover the task bar */
    iupdrvGetFullSize(&width, &height);

    height += menu; /* the menu is included in the client area size in Motif. */

    /* set the new size and position */
    /* The resize event will update the layout */
    XtVaSetValues(ih->handle,
      XmNx, (XtArgVal)x,  /* outside border */
      XmNy, (XtArgVal)y,
      XmNwidth, (XtArgVal)width,  /* client size */
      XmNheight, (XtArgVal)height,
      NULL);
  }

  iupAttribSetStr(ih, "PLACEMENT", NULL); /* reset to NORMAL */

  return 1;
}
コード例 #16
0
/*
** Create a new event display window
*/
SpaceWindow *CreatePanelSp(Display *display, int setsEventNum,
    int canOpenFiles, int canExit, char *windowTitle, char *eventSelectorText)
{
    Widget appShell, main, menuBar, form;
    SpaceWindow *window;
    static Atom wmpAtom, dwAtom = NULL;
    Arg al[20];
    int type, ac;
    XGCValues values;

    /* Allocate some memory for the new window data structure */
    window = (SpaceWindow *)XtMalloc(sizeof(SpaceWindow));
    
    /* Create an toplevel shell to hold the window */
    ac = 0;
    XtSetArg(al[ac], XmNtitle, windowTitle); ac++;
    XtSetArg(al[ac], XmNdeleteResponse, XmDO_NOTHING); ac++;
    XtSetArg(al[ac], XmNiconName, windowTitle); ac++;
    /* Keep the phase name here, to same valid XDefaults.. */
    appShell = XtAppCreateShell ("phase", "Space",
		applicationShellWidgetClass, display, al, ac);
    	    
    /*
    ** create a main window holding a menu bar and a form with the rest of
    ** the window contents.
    */
    main = XmCreateMainWindow(appShell, "main", NULL, 0);
    XtManageChild(main);
    type = STDHEP_SPACE;
    menuBar = CreateMenuBar(main, (StdHepWindow *) window,
                                   canOpenFiles, canExit, type);
    XtManageChild(menuBar);
    form = createContents(main, window, setsEventNum, eventSelectorText);
    XtManageChild(form);

    /* add the window to the global window list */
    AddToWindowList((StdHepWindow *) window);
    
    /* realize all of the widgets in the new window */
    XtRealizeWidget(appShell);

    /* set up closeCB to be called when the user selects close from the
       window menu.  The close menu item usually activates f.kill which
       sends a WM_DELETE_WINDOW protocol request for the window. */
    if (dwAtom == NULL) {
    	wmpAtom = XmInternAtom(display, "WM_PROTOCOLS", TRUE);
    	dwAtom = XmInternAtom(display, "WM_DELETE_WINDOW", TRUE);
    }
    XmAddProtocolCallback(appShell, wmpAtom, dwAtom, closeCB, window);

    /* initialize window structure, including a read-only graphics contexts
       for drawing in scale area and highlighting in spin widget */
    window->shell = appShell;
    window->selectedTrack = NO_TRACK;
    window->trackWindowShell = NULL;
    window->btnRotationPanel = NULL;
    window->absRotationPanel = NULL;
    window->buttonRotateDegrees = INITIAL_ROT_INCR;
    window->event.nParticles = 0;
    window->event.particles = NULL;
    window->colorcode.nParticles = 0;
    window->colorcode.particles = NULL;
    window->nDetectorSegments = 0;
    window->detectorSegments = NULL;
    ac = 0;
    XtSetArg(al[ac], XmNbackground, &values.background); ac++;
    XtSetArg(al[ac], XmNforeground, &values.foreground); ac++;
    XtGetValues(window->scaleArea, al, ac);
    window->scaleGC =
    	XtGetGC(window->scaleArea, GCForeground|GCBackground, &values);
    window->highlightGC = SpinCopyGC(window->spin);
    XSetLineAttributes(display, window->highlightGC, 5, LineSolid,
    		       CapRound, JoinMiter);
    return window;
}
コード例 #17
0
ファイル: UIAttribView.C プロジェクト: amiara/RGIS
UIAttribView::UIAttribView (DBObjData *data) : DBObject (data->Name (),sizeof (UIAttribView))

	{
	DBObjTableField *field;
	DBObjectLIST<DBObjTableField> *fields;
	Widget mainForm, scrolledW, rowCol, label;
	XmString string;
	Atom deleteWindowAtom = XmInternAtom(XtDisplay(UITopLevel ()),(char *) "WM_DELETE_WINDOW",FALSE);

	DataPTR = data;
	ItemTable = DataPTR->Table (DBrNItems);
	Name (UIAttribViewSTR);
	DShellWGT = XtVaCreatePopupShell ("UIAttribView",xmDialogShellWidgetClass,UITopLevel (),
								XmNkeyboardFocusPolicy, XmPOINTER,
								XmNtitle,               data->Name (),
								XmNtransient,           False,
								XmNminWidth,            400,
								XmNminHeight,           300,
								NULL);
	XmAddWMProtocolCallback (DShellWGT,deleteWindowAtom,(XtCallbackProc) _UIAttribViewDeleteCBK,(XtPointer) this);
	mainForm = XtVaCreateWidget ("UIAttribViewForm",xmFormWidgetClass,DShellWGT,
								XmNshadowThickness,			0,
								NULL);
	string = XmStringCreate ((char *) "Item:",UICharSetBold);
	label = XtVaCreateManagedWidget ("UIAttribViewNameLabel",xmLabelWidgetClass,mainForm,
								XmNtopAttachment,       XmATTACH_FORM,
								XmNtopOffset,           5,
								XmNleftAttachment,		XmATTACH_FORM,
								XmNleftOffset,          10,
								XmNlabelString,         string,
								XmNrecomputeSize,       False,
								NULL);
	XmStringFree (string);
	string = XmStringCreate ((char *) "",UICharSetNormal);
	ItemNameWGT = XtVaCreateManagedWidget ("UIAttribViewNameText",xmLabelWidgetClass,mainForm,
								XmNtopAttachment,       XmATTACH_FORM,
								XmNtopOffset,           5,
								XmNleftAttachment,      XmATTACH_WIDGET,
								XmNleftWidget,          label,
								XmNleftOffset,          5,
								XmNlabelString,         string,
								NULL);
	XmStringFree (string);
	scrolledW = XtVaCreateManagedWidget ("UIAttribViewScrolledW",xmScrolledWindowWidgetClass,mainForm,
								XmNtopAttachment,       XmATTACH_WIDGET,
								XmNtopWidget,           label,
								XmNtopOffset,           5,
								XmNleftAttachment,      XmATTACH_FORM,
								XmNleftOffset,          5,
								XmNrightAttachment,     XmATTACH_FORM,
								XmNrightOffset,         5,
								XmNbottomAttachment,    XmATTACH_FORM,
								XmNbottomOffset,        5,
								XmNheight,              150,
								XmNvisualPolicy,        XmCONSTANT,
								XmNscrollingPolicy,     XmAUTOMATIC,
								NULL);
	rowCol = XtVaCreateManagedWidget ("UIAttribViewRowColumn",xmRowColumnWidgetClass,scrolledW,
								XmNnumColumns,          2,
								XmNorientation,         XmHORIZONTAL,
								XmNrowColumnType,       XmWORK_AREA,
								NULL);
	NamesRowCol = XtVaCreateManagedWidget ("UIAttribViewNamesRowColumn",xmRowColumnWidgetClass,rowCol,
								XmNorientation,         XmVERTICAL,
								XmNrowColumnType,       XmWORK_AREA,
								XmNpacking,             XmPACK_COLUMN,
								XmNspacing,             0,
								NULL);
	FieldsRowCol = XtVaCreateManagedWidget ("UIAttribViewNamesRowColumn",xmRowColumnWidgetClass,rowCol,
								XmNorientation,         XmVERTICAL,
								XmNrowColumnType,       XmWORK_AREA,
								XmNspacing,             0,
								NULL);

	switch (DataPTR->Type ())
		{
		case DBTypeVectorPoint:
		case DBTypeVectorLine:
		case DBTypeVectorPolygon:
		case DBTypeGridDiscrete:
			fields = ItemTable->Fields ();
			for (field = fields->First ();field != (DBObjTableField *) NULL;field = fields->Next ())
				if (DBTableFieldIsVisible (field) == true)	NewField (field->Name (),field->Format ());
			break;
		case DBTypeGridContinuous:
			{
			DBObjRecord *record;
			DBGridIF *gridIF = new DBGridIF (DataPTR);
			ItemTable = DataPTR->Table (DBrNLayers);
			for (record = ItemTable->First ();record != (DBObjRecord *) NULL;record = ItemTable->Next ())
				NewField (record->Name (),gridIF->ValueFormat ());
			delete gridIF;
			} break;
		case DBTypeNetwork:
			{
			DBObjTable *cellTable = DataPTR->Table (DBrNCells);

			NewField ((char *) "Basin Name",(char *) "%s");
			fields = ItemTable->Fields ();
			for (field = fields->First ();field != (DBObjTableField *) NULL;field = fields->Next ())
				if (DBTableFieldIsVisible (field) == true)	NewField (field->Name (),field->Format ());

			fields =  cellTable->Fields ();
			for (field = fields->First ();field != (DBObjTableField *) NULL;field = fields->Next ())
				if (DBTableFieldIsVisible (field) == true)	NewField (field->Name (),field->Format ());
			} break;
		default:	break;
		}
	XtManageChild (mainForm);
	UILoop ();
	}
コード例 #18
0
ファイル: snd-xfind.c プロジェクト: OS2World/MM-SOUND-Snd
static void make_edit_find_dialog(bool managed)
{
  if (!edit_find_dialog)
    {
      Widget dl, rc;
      Arg args[20];
      int n;
      XmString xmstr1, xmstr3, titlestr;

      n = 0;
      XtSetArg(args[n], XmNbackground, ss->basic_color); n++;
      xmstr1 = XmStringCreateLocalized((char *)"Go Away");
      xmstr3 = XmStringCreateLocalized((char *)"Previous");
      titlestr = XmStringCreateLocalized((char *)"Find");
      XtSetArg(args[n], XmNokLabelString, xmstr1); n++;
      XtSetArg(args[n], XmNcancelLabelString, xmstr3); n++;
      XtSetArg(args[n], XmNautoUnmanage, false); n++;
      XtSetArg(args[n], XmNdialogTitle, titlestr); n++;
      XtSetArg(args[n], XmNresizePolicy, XmRESIZE_GROW); n++;
      XtSetArg(args[n], XmNnoResize, false); n++;
      XtSetArg(args[n], XmNtransient, false); n++;
      edit_find_dialog = XmCreateMessageDialog(MAIN_SHELL(ss), (char *)"find", args, n);
      
      XmStringFree(xmstr1);
      XmStringFree(xmstr3);
      XmStringFree(titlestr);
      
      XtUnmanageChild(XmMessageBoxGetChild(edit_find_dialog, XmDIALOG_SYMBOL_LABEL));
      XtUnmanageChild(XmMessageBoxGetChild(edit_find_dialog, XmDIALOG_MESSAGE_LABEL));
      
      XtAddCallback(edit_find_dialog, XmNhelpCallback, edit_find_help_callback, NULL);
      XtAddCallback(edit_find_dialog, XmNcancelCallback, edit_find_previous_callback, NULL);
      XtAddCallback(edit_find_dialog, XmNokCallback, edit_find_cancel_callback, NULL);
      
      n = 0;
      XtSetArg(args[n], XmNbackground, ss->highlight_color); n++;
      XtSetArg(args[n], XmNarmColor, ss->selection_color); n++;
      findnextB = XtCreateManagedWidget("Next", xmPushButtonGadgetClass, edit_find_dialog, args, n);
      XtAddCallback(findnextB, XmNactivateCallback, edit_find_next_callback, NULL);
      
      rc = XtCreateManagedWidget("row", xmFormWidgetClass, edit_find_dialog, NULL, 0);
      
      n = 0;
      XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
      XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
      XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
      XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
      dl = XtCreateManagedWidget("find:", xmLabelWidgetClass, rc, args, n);
      
      n = 0;
      XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
      XtSetArg(args[n], XmNleftWidget, dl); n++;
      XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
      XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
      XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
      edit_find_text = make_textfield_widget("text", rc, args, n, ACTIVATABLE, add_completer_func(expression_completer, NULL));
      
      n = 0;
      XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
      XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
      XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
      XtSetArg(args[n], XmNtopWidget, edit_find_text); n++;
      XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
      XtSetArg(args[n], XmNmarginHeight, 10); n++;
      edit_find_label = XtCreateManagedWidget("    ", xmLabelWidgetClass, rc, args, n);
      
      n = 0;
      XtSetArg(args[n], XmNbackground, ss->basic_color); n++;
      XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
      XtSetArg(args[n], XmNtopWidget, edit_find_label); n++;
      XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
      XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
      XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
      XtSetArg(args[n], XmNallowResize, true); n++;
      XtSetArg(args[n], XmNshadowType, XmSHADOW_ETCHED_IN); n++;
      XtSetArg(args[n], XmNshadowThickness, 2); n++;
      find_error_frame = XtCreateManagedWidget("find-error-frame", xmFrameWidgetClass, rc, args, n);

      n = 0;
      XtSetArg(args[n], XmNbackground, ss->highlight_color); n++;
      find_error_label = XtCreateManagedWidget("", xmLabelWidgetClass, find_error_frame, args, n);
      
      map_over_children(edit_find_dialog, set_main_color_of_widget);
      XtVaSetValues(XmMessageBoxGetChild(edit_find_dialog, XmDIALOG_OK_BUTTON), XmNarmColor, ss->selection_color, NULL);
      XtVaSetValues(XmMessageBoxGetChild(edit_find_dialog, XmDIALOG_CANCEL_BUTTON), XmNarmColor, ss->selection_color, NULL);
      XtVaSetValues(XmMessageBoxGetChild(edit_find_dialog, XmDIALOG_HELP_BUTTON), XmNarmColor, ss->selection_color, NULL);
      XtVaSetValues(XmMessageBoxGetChild(edit_find_dialog, XmDIALOG_OK_BUTTON), XmNbackground, ss->highlight_color, NULL);
      XtVaSetValues(XmMessageBoxGetChild(edit_find_dialog, XmDIALOG_CANCEL_BUTTON), XmNbackground, ss->highlight_color, NULL);
      XtVaSetValues(XmMessageBoxGetChild(edit_find_dialog, XmDIALOG_HELP_BUTTON), XmNbackground, ss->highlight_color, NULL);

      cancelB = XmMessageBoxGetChild(edit_find_dialog, XmDIALOG_OK_BUTTON);
      set_dialog_widget(FIND_DIALOG, edit_find_dialog);

      XtUnmanageChild(find_error_frame);

      if (managed) XtManageChild(edit_find_dialog);

      {
	Atom wm_delete_window;
	wm_delete_window = XmInternAtom(MAIN_DISPLAY(ss), (char *)"WM_DELETE_WINDOW", false);
	XmAddWMProtocolCallback(XtParent(edit_find_dialog), wm_delete_window, find_dialog_close, NULL);
      }
    }
  else
    {
      if (managed)
	{
	  if (!XtIsManaged(edit_find_dialog)) XtManageChild(edit_find_dialog);
	  raise_dialog(edit_find_dialog);
	}
    }
}
コード例 #19
0
ファイル: font.c プロジェクト: juddy/edcde
extern void
load_app_font(
	Calendar	*cal, 
	Font_Weight	 weight,
	Cal_Font	*userfont,
	Cal_Font	*return_font)
{
	unsigned long	 pixel_size;
	Display		*dpy = XtDisplay(cal->frame);
	char		 font_name[128],
			*font_name_ptr = font_name,
		       **font_names;
	int		 nnames;
	XrmValue	 in_font;
	XrmValue	 out_fontlist;
	XmFontList	 font_list;
	Atom		 pixel_atom = XmInternAtom(dpy, "PIXEL_SIZE", FALSE);

	/* First get the pixel size from the User Font */
	if (userfont->cf_type == XmFONT_IS_FONT) {
		/* If we can't get the pixel size from the user font we
		 * defaults to a 12 pixel font.
		 */
		if (!XGetFontProperty(userfont->f.cf_font, pixel_atom, 
							&pixel_size))
			pixel_size = 12;
	} else {
		XFontStruct 	**font_struct_list;
		char		**font_name_list;
		int		  list_size;

		if (!(list_size = XFontsOfFontSet(userfont->f.cf_fontset,
					    &font_struct_list,
					    &font_name_list))) {
			pixel_size = 12;
		} else {
			int i;
			if (!XGetFontProperty(font_struct_list[0],
					      pixel_atom, 
					      &pixel_size))
				pixel_size = 12;
		}
	}

	/* If the font family is not ``application'' then it is probably
	 * multibyte so we can't assume there is an add-style or a proportional
	 * version available.
	 */
	if (!strcmp(cal->app_data->app_font_family, "application")) {
		sprintf (font_name, "-dt-%s-%s-r-normal-sans-%lu-*-*-*-p-*",
				cal->app_data->app_font_family,
				(weight == BOLD)?"bold":"medium",
				pixel_size);
	} else {
		sprintf (font_name, "-dt-%s-%s-r-normal--%lu-*-*-*-*-*",
				cal->app_data->app_font_family,
				(weight == BOLD)?"bold":"medium",
				pixel_size);
	}

	/* See if the font exists */
	font_names = XListFonts(dpy, font_name, 1, &nnames);
	if (!nnames) {
		if (!ProbeForFont(cal, weight, pixel_size, TRUE, 
							font_name_ptr)) {
			/* We didn't find anything */
			*return_font = *userfont;
			return;
		}
	} else
		XFreeFontNames(font_names);

	strcat(font_name, ":");
	in_font.size = strlen(font_name);
	in_font.addr = font_name;
	out_fontlist.size = sizeof(XmFontList);
	out_fontlist.addr = (XPointer)&font_list;

	/* Convert font string to a font list. */
	if (!XtConvertAndStore(cal->frame, XtRString, &in_font, XmRFontList,
				&out_fontlist)) {
		*return_font = *userfont;
	}

	if (!fontlist_to_font(font_list, return_font)) {
		*return_font = *userfont;
	}
}
コード例 #20
0
ファイル: xgps.c プロジェクト: gnehzuil/GeoSVR
static void
build_gui(Widget toplevel)
{
	Widget main_w, menubar, widget, sat_frame, sky_frame, gps_frame;
	Widget gps_form, gps_data, sw;

	Arg args[100];
	XGCValues gcv;
	Atom delw;
	int i;
	XmString string;
	XmString file, help, about, quit;

	/*@ -immediatetrans -usedef @*/
	/* the root application window */
	XtSetArg(args[0], XmNwidth, LEFTSIDE_WIDTH + SATDIAG_SIZE + 26);
	XtSetArg(args[1], XmNheight, SATDATA_HEIGHT + 14 * MAX_FONTSIZE + 12);
	/*@ +immediatetrans +usedef @*/
	XtSetValues(toplevel, args, 2);

	/*@ -onlytrans @*/
	main_w = XtVaCreateManagedWidget("main_window",
	    xmMainWindowWidgetClass,	toplevel,
	    NULL);

	/* Construct the menubar */
	file = XmStringCreateLocalized("File");
	help = XmStringCreateLocalized("Help");
	menubar = XmVaCreateSimpleMenuBar(main_w, "menubar",
	    XmVaCASCADEBUTTON,	file,	'F',
	    XmVaCASCADEBUTTON,	help,	'H',
	    NULL);
	XmStringFree(file);

	if ((widget = XtNameToWidget(menubar, "button_1")))
		XtVaSetValues(menubar, XmNmenuHelpWidget, widget, NULL);

	quit = XmStringCreateLocalized("Quit");
	(void)XmVaCreateSimplePulldownMenu(menubar, "file_menu", 0, file_cb,
	    XmVaPUSHBUTTON, quit, 'Q', NULL, NULL,
	    NULL);
	XmStringFree(quit);

	about = XmStringCreateLocalized("About");
	(void)XmVaCreateSimplePulldownMenu(menubar, "help_menu", 1, help_cb,
	    XmVaPUSHBUTTON, help,  'H', NULL, NULL,
	    XmVaSEPARATOR,
	    XmVaPUSHBUTTON, about, 'A', NULL, NULL,
	    NULL);
	XmStringFree(help);
	XmStringFree(about);

	XtManageChild(menubar);


	/* a form to assist with geometry negotiation */
	form = XtVaCreateManagedWidget("form",
	    xmFormWidgetClass,		main_w,
	    XmNfractionBase,		3,
	    NULL);

	/* satellite frame */
	sat_frame = XtVaCreateWidget("satellite_frame",
	    xmFrameWidgetClass,		form,
	    XmNshadowType,		XmSHADOW_ETCHED_IN,
	    XmNtopAttachment,		XmATTACH_FORM,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		1,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		2,
	    XmNleftAttachment,		XmATTACH_FORM,
	    NULL);
	(void)XtVaCreateManagedWidget("Satellite List",
	    xmLabelGadgetClass,		sat_frame,
	    XmNchildType,		XmFRAME_TITLE_CHILD,
	    XmNchildVerticalAlignment,	XmALIGNMENT_CENTER,
	    NULL);

	/* the left half of the screen */
	left = XtVaCreateManagedWidget("left",
	    xmFormWidgetClass, 	sat_frame,
	    NULL);

	/* skyview frame */
	sky_frame = XtVaCreateWidget("skyview_frame",
	    xmFrameWidgetClass,		form,
	    XmNshadowType,		XmSHADOW_ETCHED_IN,
	    XmNtopAttachment,		XmATTACH_FORM,
	    XmNrightAttachment,		XmATTACH_FORM,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		2,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		1,
	    NULL);
	(void)XtVaCreateManagedWidget("Skyview",
	    xmLabelGadgetClass,		sky_frame,
	    XmNchildType,		XmFRAME_TITLE_CHILD,
	    XmNchildVerticalAlignment,	XmALIGNMENT_CENTER,
	    NULL);

	/* the right half of the screen */
	right = XtVaCreateManagedWidget("right",
	    xmFormWidgetClass, 		sky_frame,
	    NULL);

	/* the application status bar */
	status_form = XtVaCreateManagedWidget("status_form",
	    xmFormWidgetClass,		form,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		2,
	    XmNleftAttachment,		XmATTACH_FORM,
	    XmNrightAttachment,		XmATTACH_FORM,
	    XmNtopAttachment,           XmATTACH_WIDGET,
	    XmNtopWidget,               left,
	    XmNfractionBase,		3,
	    NULL);
	status_frame = XtVaCreateWidget("status_frame",
	    xmFrameWidgetClass,		status_form,
	    XmNshadowType,		XmSHADOW_ETCHED_IN,
	    XmNtopAttachment,		XmATTACH_FORM,
	    XmNleftAttachment,		XmATTACH_FORM,
	    XmNrightAttachment,		XmATTACH_FORM,
	    XmNbottomAttachment,	XmATTACH_FORM,
	    NULL);
	(void)XtVaCreateManagedWidget("Message Data",
	    xmLabelGadgetClass,		status_frame,
	    XmNchildType,		XmFRAME_TITLE_CHILD,
	    XmNchildVerticalAlignment,	XmALIGNMENT_CENTER,
	    NULL);
	status = XtVaCreateManagedWidget("status", 
					 xmTextFieldWidgetClass, status_form,
					 XmNcursorPositionVisible, False,
					 XmNeditable, False,
					 XmNmarginHeight, 1,
					 XmNhighlightThickness, 0,
					 XmNshadowThickness, 2,
					 XmNleftAttachment, XmATTACH_FORM,
					 XmNrightAttachment, XmATTACH_FORM,
					 XmNtopAttachment, XmATTACH_FORM,
					 XmNbottomAttachment, XmATTACH_FORM,
					 NULL);

	/* gps information frame */
	gps_form = XtVaCreateManagedWidget("gps_form",
	    xmFormWidgetClass,		form,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		2,
	    XmNleftAttachment,		XmATTACH_FORM,
	    XmNrightAttachment,		XmATTACH_FORM,
	    XmNbottomAttachment,	XmATTACH_FORM,
	    XmNtopAttachment,           XmATTACH_WIDGET,
	    XmNtopWidget,               status_form,
	    XmNfractionBase,		3,
	    NULL);
	gps_frame = XtVaCreateWidget("gps_frame",
	    xmFrameWidgetClass,		gps_form,
	    XmNshadowType,		XmSHADOW_ETCHED_IN,
	    XmNtopAttachment,		XmATTACH_FORM,
	    XmNleftAttachment,		XmATTACH_FORM,
	    XmNrightAttachment,		XmATTACH_FORM,
	    XmNbottomAttachment,	XmATTACH_FORM,
	    NULL);
	(void)XtVaCreateManagedWidget("GPS Data",
	    xmLabelGadgetClass,		gps_frame,
	    XmNchildType,		XmFRAME_TITLE_CHILD,
	    XmNchildVerticalAlignment,	XmALIGNMENT_CENTER,
	    NULL);
	sw = XtVaCreateManagedWidget("scrolled_w",
	    xmScrolledWindowWidgetClass,	gps_frame,
	    XmNscrollingPolicy,			XmAUTOMATIC,
	    NULL);
	gps_data = XtVaCreateWidget("gps_data",
	    xmFormWidgetClass,		sw,
	    XmNfractionBase,		30,
	    NULL);

	/* satellite location and SNR data panel */
	satellite_list = XtVaCreateManagedWidget("satellite_list",
	    xmListWidgetClass,		left,
	    XmNbackground,		get_pixel(toplevel, "snow"),
	    XmNlistSizePolicy,		XmCONSTANT,
	    XmNhighlightThickness,	0,
	    XmNlistSpacing,		4,
	    XmNtopAttachment,		XmATTACH_FORM,
	    XmNrightAttachment,		XmATTACH_FORM,
	    XmNbottomAttachment,	XmATTACH_FORM,
	    XmNleftAttachment,		XmATTACH_FORM,
	    NULL);

	/* the satellite diagram */
	satellite_diagram = XtVaCreateManagedWidget("satellite_diagram",
	    xmDrawingAreaWidgetClass,	right, 
	    XmNbackground,		get_pixel(toplevel, "snow"),
	    XmNheight,			SATDIAG_SIZE + 24,
	    XmNwidth,			SATDIAG_SIZE,
	    XmNtopAttachment,		XmATTACH_FORM,
	    XmNrightAttachment,		XmATTACH_FORM,
	    XmNbottomAttachment,	XmATTACH_FORM,
	    XmNleftAttachment,		XmATTACH_FORM,
	    NULL);

	gcv.foreground = BlackPixelOfScreen(XtScreen(satellite_diagram));
	gc = XCreateGC(XtDisplay(satellite_diagram),
	RootWindowOfScreen(XtScreen(satellite_diagram)), GCForeground, &gcv);
	register_canvas(satellite_diagram, gc);
	XtVaSetValues(satellite_diagram, XmNuserData, gc, NULL);
	/*@i@*/XtAddCallback(satellite_diagram, XmNexposeCallback, redraw, NULL);
	/*@i@*/XtAddCallback(satellite_diagram, XmNresizeCallback, resize, NULL);

	/* the data display */
	(void)XtVaCreateManagedWidget("Time", xmLabelGadgetClass, gps_data,
	    XmNalignment,		XmALIGNMENT_END,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		0,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		5,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		6,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		0,
	    NULL);
	(void)XtVaCreateManagedWidget("Latitude", xmLabelGadgetClass, gps_data,
	    XmNalignment,		XmALIGNMENT_END,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		6,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		5,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		12,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		0,
	    NULL);
	(void)XtVaCreateManagedWidget("Longitude", xmLabelGadgetClass, gps_data,
	    XmNalignment,		XmALIGNMENT_END,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		12,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		5,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		18,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		0,
	    NULL);
	(void)XtVaCreateManagedWidget("Altitude", xmLabelGadgetClass, gps_data,
	    XmNalignment,		XmALIGNMENT_END,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		18,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		5,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		24,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		0,
	    NULL);
	(void)XtVaCreateManagedWidget("Speed", xmLabelGadgetClass, gps_data,
	    XmNalignment,		XmALIGNMENT_END,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		24,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		5,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		30,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		0,
	    NULL);

	text_1 = XtVaCreateManagedWidget("time",
	    xmTextFieldWidgetClass,	gps_data,
	    XmNeditable,		False,
	    XmNcursorPositionVisible,	False,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		0,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		15,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		6,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		5,
	    NULL);
	text_2 = XtVaCreateManagedWidget("latitude",
	    xmTextFieldWidgetClass,	gps_data,
	    XmNeditable,		False,
	    XmNcursorPositionVisible,	False,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		6,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		15,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		12,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		5,
	    NULL);
	text_3 = XtVaCreateManagedWidget("longitude",
	    xmTextFieldWidgetClass,	gps_data,
	    XmNeditable,		False,
	    XmNcursorPositionVisible,	False,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		12,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		15,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		18,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		5,
	    NULL);
	text_4 = XtVaCreateManagedWidget("altitude",
	    xmTextFieldWidgetClass,	gps_data,
	    XmNeditable,		False,
	    XmNcursorPositionVisible,	False,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		18,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		15,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		24,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		5,
	    NULL);
	text_5 = XtVaCreateManagedWidget("speed",
	    xmTextFieldWidgetClass,	gps_data,
	    XmNeditable,		False,
	    XmNcursorPositionVisible,	False,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		24,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		15,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		30,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		5,
	    NULL);

	(void)XtVaCreateManagedWidget("EPH", xmLabelGadgetClass, gps_data,
	    XmNalignment,		XmALIGNMENT_END,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		0,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		20,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		6,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		15,
	    NULL);
	(void)XtVaCreateManagedWidget("EPV", xmLabelGadgetClass, gps_data,
	    XmNalignment,		XmALIGNMENT_END,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		6,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		20,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		12,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		15,
	    NULL);
	(void)XtVaCreateManagedWidget("Climb", xmLabelGadgetClass, gps_data,
	    XmNalignment,		XmALIGNMENT_END,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		12,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		20,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		18,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		15,
	    NULL);
	(void)XtVaCreateManagedWidget("Track", xmLabelGadgetClass, gps_data,
	    XmNalignment,		XmALIGNMENT_END,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		18,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		20,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		24,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		15,
	    NULL);
	(void)XtVaCreateManagedWidget("Status", xmLabelGadgetClass, gps_data,
	    XmNalignment,		XmALIGNMENT_END,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		24,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		20,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		30,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		15,
	    NULL);

	text_7 = XtVaCreateManagedWidget("eph",
	    xmTextFieldWidgetClass,	gps_data,
	    XmNeditable,		False,
	    XmNcursorPositionVisible,	False,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		0,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		30,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		6,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		20,
	    NULL);
	text_8 = XtVaCreateManagedWidget("epv",
	    xmTextFieldWidgetClass,	gps_data,
	    XmNeditable,		False,
	    XmNcursorPositionVisible,	False,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		6,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		30,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		12,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		20,
	    NULL);
	text_9 = XtVaCreateManagedWidget("climb",
	    xmTextFieldWidgetClass,	gps_data,
	    XmNeditable,		False,
	    XmNcursorPositionVisible,	False,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		12,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		30,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		18,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		20,
	    NULL);
	text_6 = XtVaCreateManagedWidget("track",
	    xmTextFieldWidgetClass,	gps_data,
	    XmNeditable,		False,
	    XmNcursorPositionVisible,	False,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		18,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		30,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		24,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		20,
	    NULL);
	text_10 = XtVaCreateManagedWidget("status",
	    xmTextFieldWidgetClass,	gps_data,
	    XmNeditable,		False,
	    XmNcursorPositionVisible,	False,
	    XmNtopAttachment,		XmATTACH_POSITION,
	    XmNtopPosition,		24,
	    XmNrightAttachment,		XmATTACH_POSITION,
	    XmNrightPosition,		30,
	    XmNbottomAttachment,	XmATTACH_POSITION,
	    XmNbottomPosition,		30,
	    XmNleftAttachment,		XmATTACH_POSITION,
	    XmNleftPosition,		20,
	    NULL);

	XtManageChild(gps_data);
	XtManageChild(sat_frame);
	XtManageChild(sky_frame);
	XtManageChild(gps_frame);

	XtVaSetValues(main_w,
	    XmNmenuBar,		menubar,
	    XmNworkWindow,	form,
	    NULL);

	XtRealizeWidget(toplevel);
	delw = XmInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW",
	    (Boolean)False);
	/*@ -nullpass @*/
	(void)XmAddWMProtocolCallback(toplevel, delw, 
		(XtCallbackProc)quit_cb, NULL);
	/*@ +onlytrans @*/

	/* create empty list items to be replaced on update */
	string = XmStringCreateSimple(" ");
	for (i = 0; i <= MAXCHANNELS; i++)
		XmListAddItem(satellite_list, string, 0);
	XmStringFree(string);
}
コード例 #21
0
ファイル: Selection.c プロジェクト: att/uwin
Boolean
_XmTextConvert(Widget w,
	       Atom *selection,
	       Atom *target,
	       Atom *type,
	       XtPointer *value,
	       unsigned long *length,
	       int *format)
{
    char    *value_ptr;
    Boolean get_sel_flag;
    Boolean motif_sel_flag;
    Boolean secondary_sel_flag;
    Boolean primary_sel_flag;
    Boolean destination_sel_flag;
    Atom    encoding;
    Atom    motif_drop_atom;
    Atom    time_stamp_atom;
    Atom    compound_text_atom;
    Atom    text_atom;
    Atom    multiple_atom;
    Atom    targets_atom;
    Atom    delete_atom;
    Atom    insert_selection_atom;
    Atom    motif_destination_atom;
    XmTextSource    source_ts2;
    char    	*source_string;
    XmTextPosition     right_tp;
    XmTextPosition     left_tp;
    char    *list;
    Arg     args;
    Widget  wid;
    XTextProperty   text_prop_ret;
    int     count;
    Widget  wid2;
    int     status;

    motif_destination_atom = XmInternAtom( XtDisplay(w), "MOTIF_DESTINATION",
    	    	    	    	    	   False );
    insert_selection_atom = XmInternAtom( XtDisplay(w), "INSERT_SELECTION",
    	    	    	    	    	  False );
    delete_atom = XmInternAtom( XtDisplay(w), "DELETE", False );
    targets_atom = XmInternAtom( XtDisplay(w), "TARGETS", False );
    multiple_atom = XmInternAtom( XtDisplay(w), "MULTIPLE", False );
    text_atom = XmInternAtom( XtDisplay(w), "TEXT" , False );
    compound_text_atom = XmInternAtom( XtDisplay(w), "COMPOUND_TEXT", False );
    time_stamp_atom = XmInternAtom( XtDisplay(w), "TIMESTAMP", False );
    motif_drop_atom = XmInternAtom( XtDisplay(w), "_MOTIF_DROP", False );
    left_tp = 0;
    right_tp = 0;
    count = 0;
    list = "ABC";
    if ( *selection == motif_drop_atom )
    {
	XtSetArg( args, XmNclientData, &wid );
    	XtGetValues( w, &args, 1 );
    	wid2 = wid;
    }
    else
    {
    	wid2 = w;
    }

    if ( wid2 == NULL )
    {
    	return False;
    }

    source_ts2 = Text_Source(wid2);
    status = XmbTextListToTextProperty( XtDisplay(wid2), &list,
    	    	    	    	     1, XTextStyle, &text_prop_ret );
    encoding = 0x270f;
    if ( status  == Success )
    {
    	encoding = text_prop_ret.encoding;
    }
    XFree( (char *)text_prop_ret.value );
    if ( *selection == XA_PRIMARY )
    {
    	get_sel_flag = (Text_Source(wid2)->GetSelection)( source_ts2, &left_tp,
	    	    	    	    	    	 &right_tp);
    	primary_sel_flag = True;
    	motif_sel_flag = False;
    	destination_sel_flag = False;
    	secondary_sel_flag = False;
    }
    else if ( *selection == motif_destination_atom )
    {
    	get_sel_flag = Text_Input(wid)->data->sel_start;
    	destination_sel_flag = True;
    	motif_sel_flag = False;
    	primary_sel_flag = False;
    	secondary_sel_flag = False;
    }
    else if ( *selection == XA_SECONDARY )
    {
    	get_sel_flag = _XmTextGetSel2( (XmTextWidget)wid2, &left_tp,
	    	    	    	       &right_tp );
    	secondary_sel_flag = True;
    	motif_sel_flag = False;

    	primary_sel_flag = False;
    	destination_sel_flag = False;
    }
    else if ( *selection == motif_drop_atom )
    {
    	get_sel_flag = (Text_Source(wid2)->GetSelection)( source_ts2, &left_tp,
	    	    	    	    	    	    	  &right_tp );
    	motif_sel_flag = True;
    	secondary_sel_flag = False;

    	primary_sel_flag = False;
    	destination_sel_flag = False;
    }
    else
    {
	return False;
    }

    if ( *target == targets_atom )
    {
    	value_ptr = XtMalloc( 10 * sizeof( void *) );
    	*value = value_ptr;
    	*value_ptr++ = encoding;
    	*value_ptr++ = targets_atom;
    	*value_ptr++ = multiple_atom;
    	*value_ptr++ = time_stamp_atom;
    	count += 4;
    	if ( primary_sel_flag == False || destination_sel_flag == False )
	{
	    *value_ptr++ = insert_selection_atom;
    	    count += 1;
	}
    	if ( primary_sel_flag == True
    	|| secondary_sel_flag == True
	|| motif_sel_flag == True )
	{
    	    *value_ptr++ = compound_text_atom;
    	    *value_ptr++ = text_atom;
    	    *value_ptr++ = 31;
    	    count += 3;
	}
    	if ( primary_sel_flag == True || motif_sel_flag == True )
	{
    	    *value_ptr++ = delete_atom;
	    count += 1;
	}
    	*type = 4;
    	*length = count;

    	*format = 0x20;
    	return True;
    }
    else if ( *target == time_stamp_atom )
    {
    	value_ptr = XtMalloc( sizeof(void *) );
    	if ( primary_sel_flag == True )
	{
    	    *value_ptr = source_ts2->data->prim_time;
	}
	else if ( destination_sel_flag == True )
	{
    	    *value_ptr = Text_Input(wid2)->data->sec_time;
	}
	else if ( secondary_sel_flag == True || motif_sel_flag == True )
	{
    	    *value_ptr = Text_Input(wid2)->data->lasttime;
    	}
    	*value = value_ptr;
    	*type = 0x14;
    	*length = 4;
    	*format = 0x20;
    	return True;
    }
    else if ( *target == XA_STRING )
    {
    	*type = 0x1f;
    	*format = 8;
    	if ( destination_sel_flag == True || get_sel_flag == False )
	{
    	    return False;
	}
    	source_string = _XmStringSourceGetString( (XmTextWidget)wid2,
	    	    	    	left_tp, right_tp, False );
    	status = XmbTextListToTextProperty( XtDisplay(wid2), &source_string,
	    	    	    	    	  1, 0, (XTextProperty*)&right_tp );
    	XtFree( source_string );
    	if ( status == Success || status > 0 )
	{
    	    value_ptr = XtMalloc( text_prop_ret.nitems );
    	    *value = value_ptr;
    	    memcpy( value_ptr, text_prop_ret.value,
	    	    text_prop_ret.nitems );
    	    XFree( text_prop_ret.value );
    	    *length = text_prop_ret.nitems;
    	    return True;
    	}
	else
	{
	    *value = NULL;
    	    *length = 0x1c;
    	    return False;
	}
    }
    else if ( *target == text_atom )
    {
    	if ( destination_sel_flag == True || get_sel_flag == False )
	{
    	    return False;
	}
    	source_string = _XmStringSourceGetString( (XmTextWidget)wid2,
	    	    	    	    	    	  left_tp, right_tp,
						  False );
    	status = XmbTextListToTextProperty( XtDisplay(wid2), &source_string,
	    	    	    	    1, XStdICCTextStyle, &text_prop_ret );
    	*type = text_prop_ret.encoding;
    	*format = text_prop_ret.format;
    	XtFree( source_string );
    	if ( status == Success || status > 0 )
	{
    	    value_ptr = XtMalloc( text_prop_ret.nitems );
    	    *value = value_ptr;
    	    memcpy( value_ptr, text_prop_ret.value,
	    	    text_prop_ret.nitems );
    	    XFree( text_prop_ret.value );
    	    *length = text_prop_ret.nitems;
    	    return True;
	}
        *value = NULL;
        *length = 0;
    	return False;
    }
    else if ( *target == encoding )
    {
    	*type = encoding;
    	*format = 0x8;
        if ( destination_sel_flag == True || get_sel_flag == False )
	{
    	    return False;
	}
    	value_ptr = _XmStringSourceGetString( (XmTextWidget)wid2, left_tp,
	    	    	    	    	      right_tp, False );
    	*value = value_ptr;
    	*length = strlen( value_ptr );
    	return True;
    }
    else if ( *target == compound_text_atom )
    {
    	*type = compound_text_atom;
    	*format = 0x8;
    	if ( destination_sel_flag == True || get_sel_flag == False )
	{
    	    return False;
	}
    	source_string = _XmStringSourceGetString( (XmTextWidget)wid2, left_tp,
	    	    	    	    	    	  right_tp, False );
    	status = XmbTextListToTextProperty( XtDisplay(wid2), &source_string,
	    	    	    	    	    1, XCompoundTextStyle,
				    	    &text_prop_ret );
    	XtFree( source_string );
    	if ( status == Success || status > 0 )
	{
    	    value_ptr = XtMalloc( sizeof(void *) );
    	    *value = value_ptr;
    	    memcpy( value_ptr, text_prop_ret.value, text_prop_ret.nitems );
    	    XFree( text_prop_ret.value );
    	    *length = text_prop_ret.nitems;
            return True;
	}
	else
	{
            *value = NULL;
            *length = 0;
    	    return False;
    	}
    }
    else if ( *target == insert_selection_atom )
    {
    	if ( secondary_sel_flag == True )
	{
    	    return False;
	}
#if 0
    	return ConvertInsertSelection( w, selection, type, value,
	    	    	    	       length, format );
#else
	return False;
#endif
    }
    else if ( *target == delete_atom )
    {
    	if ( primary_sel_flag == False && motif_sel_flag == False )
	{
	    return False;
    	}
	/* the other flags are valid FIXME */
    	return False;
    }
    else
    {
    	return False;
    }
}
コード例 #22
0
ファイル: DragBS.c プロジェクト: att/uwin
/*
 * called when a drag starts, to allocate an Atom for the DragContext
 */
extern Atom
_XmAllocMotifAtom(Widget shell, Time time)
{
    XmDndAtomsTable atoms;
    Display *dpy = XtDisplay(shell);
    Atom alloc = None;
    int i;
    char buf[32];

    DEBUGOUT(_LtDebug(__FILE__, shell, "%s:_XmAllocMotifAtom(%d)\n",
		      __FILE__, __LINE__));
    DEBUGOUT(_LtDebug("DRAGSOURCE", shell, "%s:_XmAllocMotifAtom(%d)\n",
		      __FILE__, __LINE__));

    if ((atoms = get_atoms_table(dpy)) == NULL)
    {
	_XmInitTargetsTable(dpy);

	atoms = get_atoms_table(dpy);
    }

    XGrabServer(dpy);

    if (!read_atoms_table(dpy, atoms))
    {
	XUngrabServer(dpy);

	_XmInitTargetsTable(dpy);

	XGrabServer(dpy);

	atoms = get_atoms_table(dpy);
    }

    if (atoms->num_entries != 0)
    {
	for (i = 0; i < atoms->num_entries; i++)
	{
	    if (atoms->entries[i].time == CurrentTime)
	    {
		alloc = atoms->entries[i].atom;
		atoms->entries[i].time = time;

		break;
	    }
	}
    }

    if (alloc == None)
    {
	i = atoms->num_entries;

	atoms->num_entries++;

	atoms->entries =
	    (XmDndAtomsTableEntry) XtRealloc((char *)atoms->entries,
			 atoms->num_entries * sizeof(XmDndAtomsTableEntryRec));

	sprintf(buf, _XA_MOTIF_ATOM_FORMAT, i);
	alloc = XmInternAtom(dpy, buf, False);

	atoms->entries[i].atom = alloc;
	atoms->entries[i].time = time;
    }

    write_atoms_table(dpy, atoms);

    XUngrabServer(dpy);

    XFlush(dpy);

    if (_LtDebugInDebug("DRAGSOURCE", shell))
    {
    char *AtomName = XGetAtomName(dpy, alloc);

	DEBUGOUT(_LtDebug0("DRAGSOURCE", shell, "\t%s - 0x%x\n", AtomName, time));
    	XFree(AtomName);
    }

    return alloc;
}
コード例 #23
0
ファイル: UI2DView.C プロジェクト: bandi13/RGIS
UI2DView::UI2DView () : DBObject ("Noname 2DView",sizeof (UI2DView))

	{
	char name [DBStringLength];
	Widget menuBar, scrolledWindow, radioBox;
	Widget button;
	static Pixmap iconPixmap	 = (Pixmap) NULL, meshPixmap	 = (Pixmap) NULL;
	static Pixmap fullPixmap	 = (Pixmap) NULL, extentPixmap = (Pixmap) NULL;
	static Pixmap capturePixmap = (Pixmap) NULL, redrawPixmap = (Pixmap) NULL;
	static Pixmap zoomPixmap	 = (Pixmap) NULL, panePixmap	 = (Pixmap) NULL, userPixmap	 = (Pixmap) NULL;
	Pixel foreground, background;
	XWindowAttributes xwa;
	XSetWindowAttributes xswa;
	Atom deleteWindowAtom = XmInternAtom(XtDisplay(UITopLevel ()),(char *) "WM_DELETE_WINDOW",FALSE);

	_UI2DViewLIST.Add (this); sprintf (name,"2DView:%2d",RowID ()); Name (name);
	Image = (XImage *) NULL;
	DrawRegion = FullRegion = NULL;
	MaxVertexNumVAR = 0;
	PointARR = (XPoint *) NULL;
	RequiredEXT = (UIDataset ())->Extent ();
	DShell = XtVaCreatePopupShell ("UI2DView",xmDialogShellWidgetClass,UITopLevel (),
												XmNkeyboardFocusPolicy,		XmPOINTER,
												XmNtitle,						Name (),
												XmNtransient,					false,
												XmNminWidth,					600,
												XmNminHeight,					450,
												NULL);
	XmAddWMProtocolCallback (DShell,deleteWindowAtom,(XtCallbackProc) _UI2DViewDeleteCBK,(XtPointer) this);
	MainFormW = XtVaCreateManagedWidget ("UI2DViewForm",xmFormWidgetClass,DShell,
												XmNdialogStyle,				XmDIALOG_WORK_AREA,
												XmNshadowThickness,			0,
												XmNwidth,						600,
												XmNheight,						450,
												NULL);
	menuBar = XtVaCreateManagedWidget ("UI2DViewMenuBar",xmRowColumnWidgetClass,MainFormW,
												XmNtopAttachment,				XmATTACH_FORM,
												XmNtopOffset,					2,
												XmNleftAttachment,			XmATTACH_FORM,
												XmNleftOffset,					2,
												XmNrightAttachment, 			XmATTACH_FORM,
												XmNrightOffset,				2,
												XmNorientation,				XmHORIZONTAL,
												XmNrowColumnType,				XmWORK_AREA,
												NULL);
	XtVaGetValues (MainFormW,XmNforeground,	&foreground,XmNbackground,	&background,NULL);

	iconPixmap = iconPixmap == (Pixmap) NULL ?
					XmGetPixmap(XtScreen (UITopLevel()),(char *) "GHAAS2Dview.bmp",foreground,background): iconPixmap;
	XtVaSetValues (DShell,XmNiconPixmap, iconPixmap,NULL);

	fullPixmap = fullPixmap == (Pixmap) NULL ?
					XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASfull.bmp",  foreground,background) : fullPixmap;
	extentPixmap = extentPixmap  == (Pixmap) NULL ?
					XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASextent.bmp",foreground,background) : extentPixmap;
	capturePixmap= capturePixmap == (Pixmap) NULL ?
					XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAAScapture.bmp",foreground,background):capturePixmap;
	redrawPixmap = redrawPixmap == (Pixmap) NULL ?
					XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASredraw.bmp", foreground,background) : redrawPixmap;
	zoomPixmap = zoomPixmap == (Pixmap) NULL ?
					XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASzoom.bmp",  foreground,background) : zoomPixmap;
	panePixmap = panePixmap == (Pixmap) NULL ?
					XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASpane.bmp",  foreground,background) : panePixmap;
	userPixmap = userPixmap == (Pixmap) NULL ?
					XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASuser.bmp",  foreground,background) : userPixmap;
	meshPixmap = meshPixmap == (Pixmap) NULL ?
					XmGetPixmap(XtScreen(UITopLevel()),(char *) "GHAASmesh.bmp",  foreground,background) : meshPixmap;

	button = XtVaCreateManagedWidget ("UI2DViewRedrawButton",xmPushButtonGadgetClass,menuBar,
												XmNlabelType,					XmPIXMAP,
												XmNlabelPixmap,				redrawPixmap,
												NULL);
	XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _UI2DViewRedrawCBK,this);
	button = XtVaCreateManagedWidget ("UI2DViewFullButton",xmPushButtonGadgetClass,menuBar,
												XmNlabelType,					XmPIXMAP,
												XmNlabelPixmap,				fullPixmap,
												NULL);
	XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _UI2DViewFullActivateCBK,this);
	button = XtVaCreateManagedWidget ("UI2DViewExtentButton",xmPushButtonGadgetClass,menuBar,
												XmNlabelType,					XmPIXMAP,
												XmNlabelPixmap,				extentPixmap,
												NULL);
	XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _UI2DViewExtentActivateCBK,this);
	button = XtVaCreateManagedWidget ("UI2DViewCaptureButton",xmPushButtonGadgetClass,menuBar,
												XmNlabelType,					XmPIXMAP,
												XmNlabelPixmap,				capturePixmap,
												NULL);
	radioBox = XtVaCreateManagedWidget ("UI2DViewRadioBox",xmRowColumnWidgetClass,menuBar,
												XmNorientation,				XmHORIZONTAL,
												XmNpacking,						XmPACK_COLUMN,
												XmNisHomogeneous,				true,
												XmNentryClass,					xmToggleButtonGadgetClass,
												XmNradioBehavior,				true,
												NULL);
	ZoomToggle = XtVaCreateManagedWidget ("UI2DViewZoomToggle",xmToggleButtonGadgetClass,radioBox,
												XmNlabelType,					XmPIXMAP,
												XmNlabelPixmap,				zoomPixmap,
												XmNshadowThickness,			0,
												XmNset,							true,
												NULL);
	XtAddCallback (ZoomToggle,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewZoomToggleValueCBK,this);
	PaneToggle = XtVaCreateManagedWidget ("UI2DViewPaneToggle",xmToggleButtonGadgetClass,radioBox,
												XmNlabelType,					XmPIXMAP,
												XmNlabelPixmap,				panePixmap,
												XmNshadowThickness,			0,
												NULL);
	XtAddCallback (PaneToggle,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewPaneToggleValueCBK,this);
	UserToggle = XtVaCreateWidget ("UI2DViewUserToggle",xmToggleButtonGadgetClass,radioBox,
												XmNlabelType,					XmPIXMAP,
												XmNlabelPixmap,				userPixmap,
												XmNmappedWhenManaged,		false,
												XmNshadowThickness,			0,
												NULL);
	XtAddCallback (UserToggle,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewUserToggleValueCBK,this);
	if (_UI2DViewUserFunction != (UI2DViewUserFunction) NULL) XtManageChild (UserToggle);
	MeshOptionW = XtVaCreateManagedWidget ("UI2DViewMeshOption",xmToggleButtonGadgetClass,menuBar,
												XmNlabelType,					XmPIXMAP,
												XmNlabelPixmap,				meshPixmap,
												XmNshadowThickness,			0,
												NULL);
	XtAddCallback (MeshOptionW,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewMeshOptionCBK,this);
	XtVaSetValues (menuBar,	XmNmenuHelpWidget, MeshOptionW, NULL);

	ScaleW = XtVaCreateManagedWidget ("UI2DViewScale",xmScaleWidgetClass,MainFormW,
												XmNtopAttachment,				XmATTACH_WIDGET,
												XmNtopWidget,					menuBar,
												XmNleftAttachment,			XmATTACH_FORM,
												XmNleftOffset,					2,
												XmNbottomAttachment,			XmATTACH_FORM,
												XmNbottomOffset,				18,
												XmNorientation,				XmVERTICAL,
												XmNwidth,						16,
												NULL);
	XtAddCallback (ScaleW,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewScaleValueChangedCBK,this);
	scrolledWindow = XtVaCreateManagedWidget ("UI2DViewScrolledWindow",xmScrolledWindowWidgetClass,MainFormW,
												XmNtopAttachment,				XmATTACH_WIDGET,
												XmNtopWidget,					menuBar,
												XmNtopOffset,					2,
												XmNleftAttachment,			XmATTACH_WIDGET,
												XmNleftWidget,					ScaleW,
												XmNleftOffset,					3,
												XmNrightAttachment,			XmATTACH_FORM,
												XmNrightOffset,				3,
												XmNbottomAttachment,			XmATTACH_FORM,
												XmNbottomOffset,				3,
												XmNspacing,						2,
												NULL);
	HorScrollBarW = XtVaCreateManagedWidget ("UI2DViewHorScrollBar", xmScrollBarWidgetClass, scrolledWindow,
												XmNsliderSize,					100,
												XmNorientation,				XmHORIZONTAL,
												XmNheight,						16,
												NULL);
	XtAddCallback (HorScrollBarW,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewHorScrollBarValueChangedCBK,this);
	VerScrollBarW = XtVaCreateManagedWidget ("UI2DViewVerScrollBar", xmScrollBarWidgetClass, scrolledWindow,
												XmNsliderSize,					100,
												XmNorientation,				XmVERTICAL,
												XmNwidth,						16,
												NULL);
	XtAddCallback (VerScrollBarW,XmNvalueChangedCallback,(XtCallbackProc) _UI2DViewVerScrollBarValueChangedCBK,this);
	DrawingAreaW = XtVaCreateManagedWidget ("UI2DViewDrawingArea", xmDrawingAreaWidgetClass, scrolledWindow,
												XmNuserData,					this,
												XmNbackground,					UIColor (UIColorStandard,0),
												NULL);
	XtAddCallback (DrawingAreaW,XmNresizeCallback,(XtCallbackProc) _UI2DViewResizeCBK,this);
	XtAddEventHandler (DrawingAreaW,EnterWindowMask|LeaveWindowMask|PointerMotionMask|ButtonPressMask|ButtonReleaseMask, false,(XtEventHandler) _UI2DViewPointerEHR,this);
	XmScrolledWindowSetAreas(scrolledWindow,HorScrollBarW,VerScrollBarW,DrawingAreaW);

	_UI2DViewViewCursor  =  _UI2DViewViewCursor != (Cursor) NULL ? _UI2DViewViewCursor : XCreateFontCursor (XtDisplay (DrawingAreaW),XC_top_left_arrow),
	_UI2DViewUserCursor  =  _UI2DViewUserCursor != (Cursor) NULL ? _UI2DViewUserCursor : XCreateFontCursor (XtDisplay (DrawingAreaW),XC_crosshair);
	RegenCursor =  XCreateFontCursor (XtDisplay (DrawingAreaW),XC_watch);
	ActiveCursor = xswa.cursor = _UI2DViewViewCursor;
	XChangeWindowAttributes (XtDisplay (DrawingAreaW), XtWindow (DrawingAreaW), CWCursor, &xswa);

	XGetWindowAttributes (XtDisplay (DrawingAreaW),XtWindow (DrawingAreaW),&xwa);
	Background = xwa.backing_pixel;
	xswa.backing_store = Always;
	XChangeWindowAttributes (XtDisplay (DrawingAreaW),  XtWindow (DrawingAreaW),CWBackingStore,&xswa);
	InputMode (ZOOM_MODE);
	Size ();
	Set ();
	}
コード例 #24
0
static Widget
create_dialogs(popupMessageSizeHintT size,
	       Widget parent,
	       int cnt,
	       const char *helptext,
	       pre_message_cbT pre_cb, XtPointer arg,
	       const char *yes_button, message_cbT yes_cb, XtPointer yes_arg,
	       const char *no_button, message_cbT no_cb, XtPointer no_arg,
	       const char *cancel_button, message_cbT cancel_cb, XtPointer cancel_arg)
{
    Widget new_popup_window;
    char *translations_str = NULL;
#ifdef MOTIF
    Widget new_dialog;
    UNUSED(size);
#else
    char *key_translations_str = NULL;
    int msg_w = 400, msg_h = 100;
    Widget new_message_paned, new_message_text, new_message_box, new_message_ok,
	new_message_help = 0, new_message_not_ok;
    XtTranslations wm_translations, key_translations;
#endif

    /* save callbacks to global arrays */
    pre_callbacks[cnt].callback = pre_cb;
    pre_callbacks[cnt].arg = arg;
    
    yes_callbacks[cnt].callback = yes_cb;
    yes_callbacks[cnt].arg = yes_arg;

    no_callbacks[cnt].callback = no_cb;
    no_callbacks[cnt].arg = no_arg;

    cancel_callbacks[cnt].callback = cancel_cb;
    cancel_callbacks[cnt].arg = cancel_arg;

    XtAddActions(popdown_actions, XtNumber(popdown_actions));

#ifndef MOTIF
    /* get index into WM_popdown arg */
    translations_str = get_string_va("<Message>WM_PROTOCOLS: WM_popdown(%d)", cnt);
    wm_translations = XtParseTranslationTable(translations_str);
    free(translations_str);
#endif

    if (!XtIsRealized(globals.widgets.top_level)) {
	/* If toplevel window hasn't been realized yet, create a new toplevel shell
	   (otherwise, setting visual/color map wouldn't work); use same application names
	   so that resource settings will also apply to this window.
	*/
	new_popup_window = XtVaAppCreateShell("xdvi", "Xdvi",
					      transientShellWidgetClass, DISP,
					      NULL);
    }
    else {
	new_popup_window = XtVaCreatePopupShell(Xdvi_MESSAGE_SHELL_NAME,
#ifdef MOTIF
						xmDialogShellWidgetClass, parent,
						XmNdeleteResponse, XmDO_NOTHING, /* we'll take care of that ourselves */
#else
						transientShellWidgetClass, parent,
						XtNx, 60,
						XtNy, 80,
						XtNtranslations, wm_translations,
						XtNaccelerators, G_accels_cr,
#endif
						XtNtransientFor, parent,
						XtNmappedWhenManaged, False,
						NULL);
    }
    
#ifdef MOTIF

    WM_DELETE_WINDOW = XmInternAtom(XtDisplay(new_popup_window), "WM_DELETE_WINDOW", False);
    XmAddWMProtocolCallback(new_popup_window, WM_DELETE_WINDOW, cancel_action, NULL);
    
    /* We also need to override the default ESC binding to use our internal
       housekeeping functions */
    translations_str = get_string_va("#override\n<Key>osfCancel:close-popup-cancel(%d)", cnt);
    /*      { */
    /*  	XtTranslations xlats; */
    /*  	char *translation_str = get_string_va("<Key>osfCancel:close-popup-cancel(%d)", cnt); */
    /*  	xlats = XtParseTranslationTable(translation_str); */
    /*  	free(translation_str); */
    /*  	XtOverrideTranslations(new_dialog, xlats); */
    /*      } */

    new_dialog = XtVaCreateWidget(Xdvi_MESSAGE_DIALOG_NAME, xmMessageBoxWidgetClass, new_popup_window,
				  XmNdialogType, XmDIALOG_WARNING, /* default */
				  XmNtraversalOn, True,
				  XmNhighlightOnEnter, True,
				  XmNuserData, cast_int_to_XtPointer(cnt),
				  XmNtranslations, XtParseTranslationTable(translations_str),
				  NULL);
    free(translations_str);
    XtAddCallback(new_dialog, XmNokCallback, ok_action, NULL);

    if (no_button != NULL) {
	Arg args[4];
	Widget b;
	XmString b_str = XmStringCreateLocalized((char *)no_button);
	XtSetArg(args[0], XmNlabelString, b_str);
	b = XmCreatePushButton(new_dialog, "no_button", args, 1);
	XtAddCallback(b, XmNactivateCallback, not_ok_action, NULL);
	XtManageChild(b);
    }
    
    if (cancel_button != NULL) {
	XmString cancel_label = XmStringCreateLtoR((char *)cancel_button, G_charset);
	XtVaSetValues(XmMessageBoxGetChild(new_dialog, XmDIALOG_CANCEL_BUTTON),
		      XmNlabelString, cancel_label, NULL);
	XmStringFree(cancel_label);
	XtAddCallback(new_dialog, XmNcancelCallback, cancel_action, NULL);
    }
    else {
	XtUnmanageChild(XmMessageBoxGetChild(new_dialog, XmDIALOG_CANCEL_BUTTON));
    }
    XtInstallAllAccelerators(new_dialog,
			     XmMessageBoxGetChild(new_dialog, XmDIALOG_OK_BUTTON));

    if (helptext != NULL) {
	XtAddCallback(new_dialog, XmNhelpCallback, help_action, (XtPointer)helptext);
    }
    else {
	XtUnmanageChild(XmMessageBoxGetChild(new_dialog, XmDIALOG_HELP_BUTTON));
    }

    if (yes_button != NULL) { /* change `OK' button label */
	XmString yes_label;
	yes_label = XmStringCreateLtoR((char *)yes_button, G_charset);
	XtVaSetValues(XmMessageBoxGetChild(new_dialog, XmDIALOG_OK_BUTTON),
		      XmNlabelString, yes_label, NULL);
	XmStringFree(yes_label);
    }
    
    /* insert the new widgets into the global arrays */
    dialog[cnt] = new_dialog;

#else /* MOTIF */
    switch (size) {
    case SIZE_SMALL:
	msg_w = 300;
	msg_h = 100;
	break;
    case SIZE_MEDIUM:
	msg_w = 430;
	msg_h = 160;
	break;
    case SIZE_LARGE:
	msg_w = 450;
	msg_h = 180;
	break;
    }
    WM_DELETE_WINDOW = XInternAtom(XtDisplay(new_popup_window), "WM_DELETE_WINDOW", False);
    
    new_message_paned = XtVaCreateManagedWidget("message_paned", panedWidgetClass, new_popup_window,
						XtNaccelerators, G_accels_cr,
						NULL);

    new_message_text = XtVaCreateManagedWidget("message_text", asciiTextWidgetClass, new_message_paned,
					       /* 					       XtNheight, 100, */
					       /* 					       XtNwidth, 400, */
					       XtNwidth, msg_w,
					       XtNheight, msg_h,
					       /* wrap horizontally instead of scrolling
						* TODO: this won't work for the first widget instance?
						*/
					       XtNwrap, XawtextWrapWord,
					       XtNscrollVertical, XAW_SCROLL_ALWAYS,
					       XtNeditType, XawtextRead,
					       XtNinput, True,
					       XtNdisplayCaret, False,
					       XtNleftMargin, 5,
					       XtNaccelerators, G_accels_cr,
					       NULL);

    /* box for the OK/Cancel button */
    new_message_box = XtVaCreateManagedWidget("message_box", formWidgetClass, new_message_paned,
					      /* resizing by user isn't needed */
					      XtNshowGrip, False,
					      XtNdefaultDistance, 6, /* some padding */
					      /* resizing the window shouldn't influence this box,
					       * but only the text widget
					       */
					      XtNskipAdjust, True,
					      XtNaccelerators, G_accels_cr,
					      NULL);

    new_message_ok = XtVaCreateManagedWidget(yes_button == NULL ? "OK" : yes_button,
					     commandWidgetClass, new_message_box,
					     XtNtop, XtChainTop,
 					     XtNbottom, XtChainBottom,
 					     XtNleft, XtChainLeft,
 					     XtNright, XtChainLeft,
					     XtNaccelerators, G_accels_cr,
					     NULL);
    /* add quit_action callback for the "OK" button */
    /* FIXME: how to make accelerators be accepted by new_popup_window as well? */
    key_translations_str = get_string_va("<Key>q:close-popup-cancel(%d)\n"
					 "<Key>Return:close-popup-cancel(%d)\n"
					 "<Key>Escape:close-popup-cancel(%d)\n",
					 cnt, cnt, cnt);
    key_translations = XtParseTranslationTable(key_translations_str);
    free(key_translations_str);
    XtOverrideTranslations(new_popup_window, key_translations);
    XtOverrideTranslations(new_message_paned, key_translations);
    XtOverrideTranslations(new_message_text, key_translations);
    
    XtInstallAllAccelerators(new_message_box, new_message_ok);
    XtAddCallback(new_message_ok, XtNcallback, ok_action, cast_int_to_XtPointer(cnt));

    /* we create additional buttons in any case,
       to make the sizing more consistent */
    new_message_help = XtVaCreateManagedWidget("Help", commandWidgetClass, new_message_box,
					       XtNtop, XtChainTop,
					       XtNfromHoriz, new_message_ok,
					       XtNbottom, XtChainBottom,
					       XtNleft, XtChainRight,
					       XtNright, XtChainRight,
					       XtNaccelerators, G_accels_cr,
					       NULL);
    message_help[cnt] = new_message_help;
    
    /* add cancel button */
    new_message_not_ok = XtVaCreateManagedWidget(cancel_button == NULL ? "Cancel" : cancel_button,
						 commandWidgetClass, new_message_box,
						 XtNtop, XtChainTop,
						 XtNfromHoriz, new_message_ok,
						 XtNbottom, XtChainBottom,
						 XtNleft, helptext == NULL ? XtChainRight : XtChainLeft,
						 XtNright, helptext == NULL ? XtChainRight : XtChainLeft,
						 XtNaccelerators, G_accels_cr,
						 NULL);
    message_not_ok[cnt] = new_message_not_ok;

    if (no_button != NULL) {
	ASSERT(0, "third button not yet implemented in Xaw!!!");
    }

    adjust_width_to_max(new_message_ok, new_message_help, new_message_not_ok, NULL);
    
    /* if helptext argument is not-NULL, add help_action callback,
       else unmanage help button */
    if (helptext != NULL) {
	XtAddCallback(new_message_help, XtNcallback, help_action, (XtPointer)helptext);
    }
    else {
	XtUnmanageChild(new_message_help);
    }

    if (cancel_button != NULL) {
	XtAddCallback(new_message_not_ok, XtNcallback, cancel_action, cast_int_to_XtPointer(cnt));
    }
    else {
	XtUnmanageChild(new_message_not_ok);
    }
    /* insert the new widgets into the global arrays */
    message_box[cnt] = new_message_box;
    message_paned[cnt] = new_message_paned;
    message_text[cnt] = new_message_text;
    message_ok[cnt] = new_message_ok;

#endif /* MOTIF */
    popup_window[cnt] = new_popup_window;

    return new_popup_window;
}
コード例 #25
0
ファイル: XUICreate.c プロジェクト: idunham/cdesktop
/*********************************************************************
 * Function: CreateDA
 *
 *    CreateDA creates a Text Graphic area with the appropriate scroll bars.
 *
 *********************************************************************/
static XtPointer
HelpCreateDA(
    Widget	 parent,
    char	*name,
    short	 vert_flag,
    short	 horz_flag,
    Boolean	 traversal_flag,
    _DtCvValue   honor_size,
    _DtCvRenderType render_type,
    int          rows,
    int          columns,
    unsigned short media_resolution,
    void	(*hyperTextCB)(),
    void	(*resizeCB)(),
    int		(*exec_ok_routine)(),
    XtPointer	 client_data,
    XmFontList	 default_list )
{
    DtHelpDispAreaStruct *pDAS;
    DAArgs DA_args;
    Arg args[20];
    int n;
    int maxFontAscent;
    int maxFontDescent;
    int maxFontCharWidth;
  
    short margin_width;
    short margin_height;
    short shadowThick, highThick;
    Dimension hBarHeight = 0;
    Dimension vBarWidth  = 0;
    Dimension width;
    Boolean   value;

    Widget form;
    Display *dpy = XtDisplay(parent);
    Screen      *retScr = XtScreen(parent);
    int          screen = XScreenNumberOfScreen(retScr);

    Colormap colormap;

    Pixmap		 tile;
    XGCValues		 gcValues;
    unsigned long	 gcMask;

    unsigned long char_width;

    Atom xa_ave_width;

    XFontStruct *tmpFont = NULL;
    XtPointer	 default_font = NULL;
    XRectangle   rectangle[1];

    XmFontContext	fontContext;
    XmFontListEntry	fontEntry;
    XmFontType		fontType;

    /* Allocate the Display Area. */
    pDAS = (DtHelpDispAreaStruct *) XtMalloc(sizeof(DtHelpDispAreaStruct));

   /*
     * get the resources
     */
    XtGetSubresources(parent, &DA_args, name, "XmDrawnButton",
		    Resources, XtNumber(Resources), NULL, 0);

    if (rows <= 0)
	rows = 1;
    if (columns <= 0)
	columns = 1;

    /*
     * initialize the structure variables.
     */
    pDAS->text_selected = False;
    pDAS->primary       = False;
    pDAS->select_state  = _DtHelpNothingDoing;
    pDAS->toc_y         = 0;
    pDAS->toc_base      = 0;
    pDAS->toc_flag      = 0;
    if (traversal_flag)
        pDAS->toc_flag  = _DT_HELP_SHADOW_TRAVERSAL | _DT_HELP_NOT_INITIALIZED;

    pDAS->max_spc       = 0;
    pDAS->cur_spc       = 0;
    pDAS->maxX          = 0;
    pDAS->virtualX      = 0;
    pDAS->firstVisible  = 0;
    pDAS->visibleCount  = rows;
    pDAS->maxYpos       = 0;
    pDAS->neededFlags   = 0;
    pDAS->vert_init_scr = DA_args.initialDelay;
    pDAS->vert_rep_scr  = DA_args.repeatDelay;
    pDAS->horz_init_scr = DA_args.initialDelay;
    pDAS->horz_rep_scr  = DA_args.repeatDelay;
    pDAS->moveThreshold = DA_args.moveThreshold;
    pDAS->marginWidth   = DA_args.marginWidth;
    pDAS->marginHeight  = DA_args.marginHeight;
    pDAS->searchColor   = DA_args.search_color;
    pDAS->depth		= 0;
    pDAS->spc_chars     = NULL;
    pDAS->scr_timer_id  = 0;
    pDAS->def_pix       = 0;
    pDAS->context       = NULL;
    pDAS->vertIsMapped  = False;
    pDAS->horzIsMapped  = False;
    pDAS->lst_topic     = NULL;
    pDAS->nextNonVisible = 0;
    pDAS->media_resolution = media_resolution;
    pDAS->honor_size = honor_size;
    pDAS->render_type = render_type;
    pDAS->dtinfo = 0;
    pDAS->stipple = None;

    /*
     * locale dependant information
     */
    pDAS->nl_to_space      = 1;
    pDAS->cant_begin_chars = NULL;
    pDAS->cant_end_chars   = NULL;
    if (1 < MB_CUR_MAX)
	_DtHelpLoadMultiInfo (&(pDAS->cant_begin_chars),
				&(pDAS->cant_end_chars), &(pDAS->nl_to_space));

    /*
     * initialize the hypertext callback pointer
     */
    pDAS->exec_filter = exec_ok_routine;
    pDAS->hyperCall   = hyperTextCB;
    pDAS->resizeCall  = resizeCB;
    pDAS->clientData  = client_data;

    /*
     * zero out other callback fields
     */
    pDAS->vScrollNotify = NULL ;
    pDAS->armCallback = NULL ;

    /*
     * create the atoms needed
     */
    xa_ave_width = XmInternAtom(dpy, "AVERAGE_WIDTH"     , False);

    /*
     * Malloc for the default font.
     */
    (void) XmeRenderTableGetDefaultFont(DA_args.userFont, &tmpFont);
    if (default_list != NULL &&
		XmFontListInitFontContext (&fontContext, default_list))
      {
	fontEntry = XmFontListNextEntry (fontContext);
	if (fontEntry != NULL)
	    default_font = XmFontListEntryGetFont (fontEntry, &fontType);

	XmFontListFreeFontContext (fontContext);
      }

    /*
     * fake out the next call by using the parent as the display widget
     */
    pDAS->dispWid = parent;
    __DtHelpFontDatabaseInit (pDAS, default_font, fontType, tmpFont);

    /*
     * Get the base font meterics.
     */
    __DtHelpFontMetrics (pDAS->font_info, __DtHelpDefaultFontIndexGet(pDAS),
			&maxFontAscent, &maxFontDescent, &maxFontCharWidth,
			NULL, NULL);

    pDAS->leading    = DA_args.leading;
    pDAS->fontAscent = maxFontAscent;
    pDAS->lineHeight = maxFontAscent + maxFontDescent + pDAS->leading + 1;

    n = __DtHelpDefaultFontIndexGet(pDAS);
    if (n < 0)
        value = get_fontsetproperty(__DtHelpFontSetGet(pDAS->font_info, n),
			xa_ave_width, ((unsigned long *) &(pDAS->charWidth)));
    else
	value = XGetFontProperty(__DtHelpFontStructGet(pDAS->font_info, n),
			xa_ave_width, ((unsigned long *) &(pDAS->charWidth)));

    if (False == value || 0 == pDAS->charWidth)
      {
	int len = maxFontCharWidth;

	if (n < 0)
	    len += XmbTextEscapement(
				__DtHelpFontSetGet(pDAS->font_info,n),"1",1);
	else
	    len += XTextWidth(__DtHelpFontStructGet(pDAS->font_info, n),"1",1);

        pDAS->charWidth = 10 * len / 2;
      }

    /*
     * Create the form to manage the window and scroll bars.
     */
    n = 0;
    XtSetArg(args[n], XmNresizePolicy      , XmRESIZE_ANY);		++n;
    XtSetArg(args[n], XmNshadowType	, XmSHADOW_OUT);		++n;
    form = XmCreateForm(parent, "DisplayAreaForm", args, n);
    XtManageChild(form);

    /*
     * force the shadowThickness to zero. The XmManager will try to set
     * this to one.
     */
    n = 0;
    XtSetArg(args[n], XmNshadowThickness   , 0);			++n;
    XtSetArg(args[n], XmNhighlightThickness, 0);			++n;
    XtSetValues (form, args, n);

    /*
     * get the colors and margin widths and heights
     */
    n = 0;
    XtSetArg (args[n], XmNmarginWidth , &margin_width);		++n;
    XtSetArg (args[n], XmNmarginHeight, &margin_height);	++n;
    XtSetArg (args[n], XmNcolormap    , &colormap);		++n;
    XtGetValues(form, args, n);

    /* Create the vertical scrollbar. */
    pDAS->vertScrollWid = NULL;
    if (vert_flag != _DtHelpNONE)
      {
	if (vert_flag == _DtHelpSTATIC)
	    pDAS->vertIsMapped = True;

	n = 0;
	XtSetArg(args[n], XmNtopAttachment     , XmATTACH_FORM);	++n;
	XtSetArg(args[n], XmNtopOffset         , 0);			++n;
	XtSetArg(args[n], XmNbottomAttachment  , XmATTACH_FORM);	++n;
	XtSetArg(args[n], XmNbottomOffset      , margin_height);	++n;
	XtSetArg(args[n], XmNrightAttachment   , XmATTACH_FORM);	++n;
	XtSetArg(args[n], XmNrightOffset       , 0);			++n;
	XtSetArg(args[n], XmNorientation       , XmVERTICAL);		++n;
	XtSetArg(args[n], XmNtraversalOn       , True);			++n;
	XtSetArg(args[n], XmNhighlightThickness, 1);			++n;
	XtSetArg(args[n], XmNshadowType        , XmSHADOW_IN);		++n;
	XtSetArg(args[n], XmNvalue             , 0);			++n;
	XtSetArg(args[n], XmNminimum           , 0);			++n;
	/* fake out the scrollbar manager, who will init dims to 100 */
	XtSetArg(args[n], XmNheight            , 1);			++n;
	XtSetArg(args[n], XmNmaximum           , 1);			++n;
	XtSetArg(args[n], XmNincrement         , 1);			++n;
	XtSetArg(args[n], XmNpageIncrement     , 1);			++n;
	XtSetArg(args[n], XmNsliderSize        , 1);			++n;
	XtSetArg(args[n], XtNmappedWhenManaged , pDAS->vertIsMapped);	++n;
	pDAS->vertScrollWid = XmCreateScrollBar(form,
					"DisplayDtHelpVertScrollBar", args, n);

	XtManageChild(pDAS->vertScrollWid);
	if (vert_flag != _DtHelpSTATIC)
	    pDAS->neededFlags = _DtHelpSET_AS_NEEDED (pDAS->neededFlags,
						_DtHelpVERTICAL_SCROLLBAR);
  
	XtAddCallback(pDAS->vertScrollWid, XmNdragCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->vertScrollWid, XmNincrementCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->vertScrollWid, XmNdecrementCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->vertScrollWid, XmNpageIncrementCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->vertScrollWid, XmNpageDecrementCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->vertScrollWid, XmNtoBottomCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->vertScrollWid, XmNtoTopCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->vertScrollWid, XmNvalueChangedCallback,
					_DtHelpVertScrollCB, (XtPointer) pDAS);

	XtAddEventHandler (pDAS->vertScrollWid, ButtonPressMask, True,
			(XtEventHandler)_DtHelpMoveBtnFocusCB,(XtPointer) pDAS);

      }

    /* Create the horizontal scrollbar. */
    pDAS->horzScrollWid = NULL;
    if (horz_flag != _DtHelpNONE)
      {
	if (horz_flag == _DtHelpSTATIC)
	    pDAS->horzIsMapped = True;

	n = 0;
	XtSetArg(args[n], XmNbottomAttachment  , XmATTACH_FORM);	++n;
	XtSetArg(args[n], XmNbottomOffset      , 0);			++n;
	XtSetArg(args[n], XmNrightAttachment   , XmATTACH_FORM);	++n;
	XtSetArg(args[n], XmNrightOffset       , margin_width);		++n;
	XtSetArg(args[n], XmNleftAttachment    , XmATTACH_FORM);	++n;
	XtSetArg(args[n], XmNleftOffset        , 0);			++n;
	XtSetArg(args[n], XmNorientation       , XmHORIZONTAL);		++n;
	XtSetArg(args[n], XmNtraversalOn       , True);			++n;
	XtSetArg(args[n], XmNhighlightThickness, 1);			++n;
	XtSetArg(args[n], XmNshadowType        , XmSHADOW_IN);		++n;
	XtSetArg(args[n], XmNvalue             , 0);			++n;
	XtSetArg(args[n], XmNminimum           , 0);			++n;
	XtSetArg(args[n], XmNmaximum           , (pDAS->charWidth/10));	++n;
	/* fake out the scrollbar manager, who will init dims to 100 */
	XtSetArg(args[n], XmNwidth             , 1);			++n;
	XtSetArg(args[n], XmNincrement         , (pDAS->charWidth/10));	++n;
	XtSetArg(args[n], XmNpageIncrement     , (pDAS->charWidth/10));	++n;
	XtSetArg(args[n], XmNsliderSize        , (pDAS->charWidth/10));	++n;
	XtSetArg(args[n], XtNmappedWhenManaged , pDAS->horzIsMapped);	++n;
	pDAS->horzScrollWid = XmCreateScrollBar(form,
					"DisplayHorzScrollBar", args, n);
	XtManageChild(pDAS->horzScrollWid);
	if (horz_flag != _DtHelpSTATIC)
	    pDAS->neededFlags = _DtHelpSET_AS_NEEDED (pDAS->neededFlags,
						_DtHelpHORIZONTAL_SCROLLBAR);
  
	XtAddCallback(pDAS->horzScrollWid, XmNdragCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->horzScrollWid, XmNincrementCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->horzScrollWid, XmNdecrementCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->horzScrollWid, XmNpageIncrementCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->horzScrollWid, XmNpageDecrementCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->horzScrollWid, XmNtoBottomCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->horzScrollWid, XmNtoTopCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
	XtAddCallback(pDAS->horzScrollWid, XmNvalueChangedCallback,
					_DtHelpHorzScrollCB, (XtPointer) pDAS);
      }

    /*
     * check for the horizontal attachments
     */
    n = 0;
    if (horz_flag == _DtHelpSTATIC)
      {
	XtSetArg(args[n], XmNbottomAttachment  , XmATTACH_WIDGET);	++n;
	XtSetArg(args[n], XmNbottomWidget      , pDAS->horzScrollWid);	++n;
      }
    else
      {
	XtSetArg(args[n], XmNbottomAttachment  , XmATTACH_FORM);	++n;
      }

    /*
     * check for the vertical attachments
     */
    if (vert_flag == _DtHelpSTATIC)
      {
	XtSetArg(args[n], XmNrightAttachment   , XmATTACH_WIDGET);	++n;
	XtSetArg(args[n], XmNrightWidget       , pDAS->vertScrollWid);	++n;
      }
    else
      {
	XtSetArg(args[n], XmNrightAttachment  , XmATTACH_FORM);		++n;
      }

    /*
     * do the rest of the arguments
     */
    XtSetArg(args[n], XmNbottomOffset      , margin_height);		++n;
    XtSetArg(args[n], XmNrightOffset       , margin_width);		++n;
    XtSetArg(args[n], XmNtopAttachment     , XmATTACH_FORM);		++n;
    XtSetArg(args[n], XmNtopOffset	   , 0);			++n;
    XtSetArg(args[n], XmNleftAttachment    , XmATTACH_FORM);		++n;
    XtSetArg(args[n], XmNleftOffset	   , 0);			++n;
    XtSetArg(args[n], XmNrecomputeSize     , False);			++n;
    XtSetArg(args[n], XmNpushButtonEnabled , False);			++n;
    XtSetArg(args[n], XmNtraversalOn       , True);			++n;
    XtSetArg(args[n], XmNhighlightThickness, 1);			++n;
    XtSetArg(args[n], XmNshadowType        , XmSHADOW_IN);		++n;
    XtSetArg(args[n], XmNmultiClick	   , XmMULTICLICK_DISCARD);	++n;
    XtSetArg(args[n], XmNuserData  	   , pDAS);			++n;
    pDAS->dispWid = XmCreateDrawnButton(form, name, args, n);
    XtManageChild(pDAS->dispWid);
  
    XtAddCallback(pDAS->dispWid, XmNexposeCallback, _DtHelpExposeCB,
						(XtPointer) pDAS);
    XtAddCallback(pDAS->dispWid, XmNresizeCallback, _DtHelpResizeCB,
						(XtPointer) pDAS);
    XtAddCallback(pDAS->dispWid, XmNarmCallback, _DtHelpClickOrSelectCB,
						(XtPointer) pDAS);
    XtAddCallback(pDAS->dispWid, XmNdisarmCallback, _DtHelpEndSelectionCB,
						(XtPointer) pDAS);

    XtAddEventHandler (pDAS->dispWid, Button1MotionMask, True,
			(XtEventHandler)_DtHelpMouseMoveCB, (XtPointer) pDAS);

    /*
     * add my actions
     * parse the translations.
     */
    _DtHelpProcessLock();
    if (DrawnBTrans == NULL)
        DrawnBTrans = XtParseTranslationTable(DrawnBTransTable);

     /*
     * override the translations
    XtSetArg(args[n], XmNtranslations	   , DrawnBTrans);		++n;
     */
    if (DrawnBTrans != NULL)
	XtOverrideTranslations(pDAS->dispWid, DrawnBTrans);
    _DtHelpProcessUnlock();
  
    if (_XmGetFocusPolicy(parent) == XmPOINTER)
      {
	XtAddEventHandler (pDAS->dispWid, EnterWindowMask, True,
			(XtEventHandler)_DtHelpEnterLeaveCB, (XtPointer) pDAS);
	XtAddEventHandler (pDAS->dispWid, LeaveWindowMask, True,
			(XtEventHandler)_DtHelpEnterLeaveCB, (XtPointer) pDAS);
      }
    else
	XtAddEventHandler (pDAS->dispWid, FocusChangeMask, True,
			(XtEventHandler)_DtHelpFocusCB, (XtPointer) pDAS);

    XtAddEventHandler (pDAS->dispWid, VisibilityChangeMask, True,
			(XtEventHandler)_DtHelpVisibilityCB, (XtPointer) pDAS);
  

    /* Add a destroy callback so that the display area can clean up prior to
     * the help widget getting destroyed (e.g. display area's parent) 
     */
    XtAddCallback(pDAS->dispWid, XmNdestroyCallback,
				_DtHelpDisplayAreaDestroyCB, (XtPointer) pDAS);
  
    n = 0;
    XtSetArg(args[n], XmNshadowThickness   , &shadowThick);	++n;
    XtSetArg(args[n], XmNhighlightThickness, &highThick);	++n;
    XtSetArg(args[n], XmNforeground    , &(pDAS->foregroundColor)); ++n;
    XtSetArg(args[n], XmNbackground    , &(pDAS->backgroundColor)); ++n;
    XtSetArg(args[n], XmNhighlightColor, &(pDAS->traversalColor) ); ++n;
    XtSetArg(args[n], XmNdepth         , &(pDAS->depth)          ); ++n;
    XtGetValues(pDAS->dispWid, args, n);
    pDAS->decorThickness = shadowThick + highThick;

    /*
     * Get the underline information
     */
    GetUnderLineInfo (dpy, pDAS, &(pDAS->lineThickness));

    /*
     * get the tiling pattern.
     */
    tile = XmGetPixmap (XtScreen(pDAS->dispWid), "50_foreground",
				pDAS->foregroundColor, pDAS->backgroundColor);

    /*
     * Get the data for the graphics contexts and create the GC's.
     */
    gcMask = (GCFunction   | GCPlaneMask   | GCForeground  |
		GCBackground  | GCLineWidth   | GCLineStyle   |
		GCClipXOrigin | GCClipYOrigin | GCClipMask);

    gcValues.function      = GXcopy;
    gcValues.plane_mask    = AllPlanes;
    gcValues.foreground    = pDAS->foregroundColor;
    gcValues.background    = pDAS->backgroundColor;
    gcValues.line_style    = LineSolid;
    gcValues.line_width    = pDAS->lineThickness;
    gcValues.clip_x_origin = 0;
    gcValues.clip_y_origin = 0;
    gcValues.clip_mask     = None;
    if (tile)
      {
	gcMask |= GCTile;
	gcValues.tile = tile;
      }
 
    pDAS->normalGC = XCreateGC(dpy,
		RootWindowOfScreen(XtScreen(pDAS->dispWid)), gcMask, &gcValues);

    gcMask &= (~GCTile);
    pDAS->pixmapGC = XCreateGC(dpy,
		RootWindowOfScreen(XtScreen(pDAS->dispWid)), gcMask, &gcValues);
  
    gcValues.foreground = pDAS->backgroundColor;
    gcValues.background = pDAS->foregroundColor;
    pDAS->invertGC = XCreateGC(dpy,
		RootWindowOfScreen(XtScreen(pDAS->dispWid)), gcMask, &gcValues);
  
    /*
     * Set the size of the text view area to the requested
     * number of columns and lines.
     */
    char_width          = pDAS->charWidth * columns;

    /*
     * Make sure the margins include enough room for a traversal line
     */
    if (((int) pDAS->marginWidth) < pDAS->lineThickness)
	pDAS->marginWidth = pDAS->lineThickness;
    if (((int) pDAS->marginHeight) < pDAS->lineThickness)
	pDAS->marginHeight = pDAS->lineThickness;
    if (pDAS->leading < pDAS->lineThickness)
	pDAS->leading = pDAS->lineThickness;

    /*
     * get the scrollbar widths.
     */
    if (NULL != pDAS->horzScrollWid)
      {
	n = 0;
	XtSetArg(args[n], XmNheight      , &hBarHeight); n++;
	XtSetArg(args[n], XmNinitialDelay, &(pDAS->horz_init_scr)); n++;
	XtSetArg(args[n], XmNrepeatDelay , &(pDAS->horz_rep_scr));  n++;
	XtGetValues(pDAS->horzScrollWid, args, n);
      }

    if (NULL != pDAS->vertScrollWid)
      {
	n = 0;
	XtSetArg(args[n], XmNwidth       , &vBarWidth);             n++;
	XtSetArg(args[n], XmNinitialDelay, &(pDAS->vert_init_scr)); n++;
	XtSetArg(args[n], XmNrepeatDelay , &(pDAS->vert_rep_scr));  n++;
	XtGetValues(pDAS->vertScrollWid, args, n);
      }

    /*
     * calculate the display area height/width
     */
    pDAS->dispUseWidth  = ((int) (char_width / 10 + (char_width % 10 ? 1 : 0)))
					      + 2 * pDAS->marginWidth;
    if (vert_flag != _DtHelpSTATIC && pDAS->dispUseWidth < vBarWidth)
	pDAS->dispUseWidth = vBarWidth;
    pDAS->dispWidth     = pDAS->dispUseWidth  + 2 * pDAS->decorThickness;

    pDAS->dispUseHeight = pDAS->lineHeight * rows;
    if (horz_flag != _DtHelpSTATIC && pDAS->dispUseHeight < hBarHeight)
	pDAS->dispUseHeight = hBarHeight;
    pDAS->dispHeight    = pDAS->dispUseHeight + 2 * pDAS->decorThickness;

    /*
     * Truncate the width and height to the size of the display.
     * This will prevent an X protocal error when it is asked for
     * a too large size. Besides, any decent window manager will
     * force the overall size to the height and width of the display.
     * This simply refines the size down to a closer (but not perfect)
     * fit.
     */
    if (((int) pDAS->dispWidth) > XDisplayWidth (dpy, screen)) {
	pDAS->dispWidth = XDisplayWidth (dpy, screen);
    }
    if (((int) pDAS->dispHeight) > XDisplayHeight (dpy, screen)) {
	pDAS->dispHeight = XDisplayHeight (dpy, screen);
    }

    n = 0;
    pDAS->formWidth  = 0;
    pDAS->formHeight = 0;
    XtSetArg(args[n], XmNwidth, pDAS->dispWidth);		++n;
    XtSetArg(args[n], XmNheight, pDAS->dispHeight);		++n;
    XtSetValues(pDAS->dispWid, args, n);

    /*
     * set the scroll bar values
     */
    if (pDAS->vertScrollWid != NULL)
      {
        n = 0;
        XtSetArg(args[n], XmNmaximum           , pDAS->dispUseHeight);	++n;
        XtSetArg(args[n], XmNincrement         , pDAS->lineHeight);	++n;
        XtSetArg(args[n], XmNpageIncrement     , pDAS->lineHeight);	++n;
        XtSetArg(args[n], XmNsliderSize        , pDAS->dispUseHeight);	++n;
        XtSetValues(pDAS->vertScrollWid, args, n);
      }
  
    if (pDAS->resizeCall)
	(*(pDAS->resizeCall)) (pDAS->clientData);

    /*
     * calculate the offset for the right edge of the
     * horizontal scrollbar.
     */
    if (vert_flag == _DtHelpSTATIC && pDAS->horzScrollWid)
      {
	width = vBarWidth + margin_width;

	XtSetArg(args[0], XmNrightOffset , width);
	XtSetValues(pDAS->horzScrollWid, args, 1);
      }

    /*
     * calculate the offset for the bottom end of the
     * vertical scrollbar.
     */
    if (horz_flag == _DtHelpSTATIC && pDAS->vertScrollWid)
      {
	width = hBarHeight + margin_height;

	XtSetArg(args[0], XmNbottomOffset , width);
	XtSetValues(pDAS->vertScrollWid, args, 1);
      }

    rectangle[0].x      = pDAS->decorThickness;
    rectangle[0].y      = pDAS->decorThickness;
    rectangle[0].width  = pDAS->dispUseWidth;
    rectangle[0].height = pDAS->dispUseHeight;
    XSetClipRectangles(XtDisplay(pDAS->dispWid), pDAS->normalGC, 0, 0,
						rectangle, 1, Unsorted);
    XSetClipRectangles(XtDisplay(pDAS->dispWid), pDAS->invertGC, 0, 0,
						rectangle, 1, Unsorted);

    /*
     * get the colormap and the visual
     */
    if (!XtIsShell(parent) && XtParent(parent) != NULL)
	parent = XtParent(parent);

    pDAS->visual = NULL;

    n = 0;
    XtSetArg (args[n], XmNcolormap, &(pDAS->colormap)); n++;
    XtSetArg (args[n], XmNvisual  , &(pDAS->visual  )); n++;
    XtGetValues (parent, args, n);

    if (pDAS->visual == NULL)
	pDAS->visual = XDefaultVisualOfScreen(XtScreen(pDAS->dispWid));

    /*
     * set up the canvas
     */
    _DtHelpProcessLock();
    DefVirtFunctions.exec_cmd_filter = exec_ok_routine;

    pDAS->canvas = _DtCanvasCreate (DefVirtFunctions, (_DtCvPointer) pDAS);
    _DtHelpProcessUnlock();

    return (XtPointer) pDAS;

}  /* End _DtHelpCreateDA */
コード例 #26
0
ファイル: track_gui.c プロジェクト: dranch/Xastir
void Track_station( /*@unused@*/ Widget w, /*@unused@*/ XtPointer clientData, /*@unused@*/ XtPointer callData) {
    static Widget pane, my_form, button_ok, button_close, button_clear, call, sep;
    Atom delw;

    if (!track_station_dialog) {

begin_critical_section(&track_station_dialog_lock, "track_gui.c:Track_station" );

        track_station_dialog = XtVaCreatePopupShell(langcode("WPUPTSP001"),
                xmDialogShellWidgetClass, appshell,
                XmNdeleteResponse, XmDESTROY,
                XmNdefaultPosition, FALSE,
                XmNfontList, fontlist1,
                NULL);

        pane = XtVaCreateWidget("Track_station pane",
                xmPanedWindowWidgetClass, 
                track_station_dialog,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                NULL);

        my_form =  XtVaCreateWidget("Track_station my_form",
                xmFormWidgetClass, 
                pane,
                XmNfractionBase, 3,
                XmNautoUnmanage, FALSE,
                XmNshadowThickness, 1,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                NULL);

        call = XtVaCreateManagedWidget(langcode("WPUPTSP002"),
                xmLabelWidgetClass, 
                my_form,
                XmNtopAttachment, XmATTACH_FORM,
                XmNtopOffset, 10,
                XmNbottomAttachment, XmATTACH_NONE,
                XmNleftAttachment, XmATTACH_FORM,
                XmNleftOffset, 10,
                XmNrightAttachment, XmATTACH_NONE,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                XmNfontList, fontlist1,
                NULL);

        track_station_data = XtVaCreateManagedWidget("Track_station track locate data", 
                xmTextFieldWidgetClass, 
                my_form,
                XmNeditable,   TRUE,
                XmNcursorPositionVisible, TRUE,
                XmNsensitive, TRUE,
                XmNshadowThickness,    1,
                XmNcolumns, 15,
                XmNwidth, ((15*7)+2),
                XmNmaxLength, 15,
                XmNbackground, colors[0x0f],
                XmNtopAttachment,XmATTACH_FORM,
                XmNtopOffset, 5,
                XmNbottomAttachment,XmATTACH_NONE,
                XmNleftAttachment, XmATTACH_WIDGET,
                XmNleftWidget, call,
                XmNleftOffset, 10,
                XmNrightAttachment,XmATTACH_NONE,
                XmNnavigationType, XmTAB_GROUP,
                XmNtraversalOn, TRUE,
                XmNfontList, fontlist1,
                NULL);

        track_case_data  = XtVaCreateManagedWidget(langcode("WPUPTSP003"),
                xmToggleButtonWidgetClass,
                my_form,
                XmNtopAttachment, XmATTACH_WIDGET,
                XmNtopWidget, call,
                XmNtopOffset, 20,
                XmNbottomAttachment, XmATTACH_NONE,
                XmNleftAttachment, XmATTACH_FORM,
                XmNleftOffset ,10,
                XmNrightAttachment, XmATTACH_NONE,
                XmNnavigationType, XmTAB_GROUP,
                XmNtraversalOn, TRUE,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                XmNfontList, fontlist1,
                NULL);

        track_match_data  = XtVaCreateManagedWidget(langcode("WPUPTSP004"),
                xmToggleButtonWidgetClass,
                my_form,
                XmNtopAttachment, XmATTACH_WIDGET,
                XmNtopWidget, call,
                XmNtopOffset, 20,
                XmNbottomAttachment, XmATTACH_NONE,
                XmNleftAttachment, XmATTACH_WIDGET,
                XmNleftWidget,track_case_data,
                XmNrightOffset ,20,
                XmNrightAttachment, XmATTACH_NONE,
                XmNnavigationType, XmTAB_GROUP,
                XmNtraversalOn, TRUE,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                XmNfontList, fontlist1,
                NULL);

        sep = XtVaCreateManagedWidget("Track_station sep", 
                xmSeparatorGadgetClass,
                my_form,
                XmNorientation, XmHORIZONTAL,
                XmNtopAttachment,XmATTACH_WIDGET,
                XmNtopWidget,track_case_data,
                XmNtopOffset, 10,
                XmNbottomAttachment,XmATTACH_NONE,
                XmNleftAttachment, XmATTACH_FORM,
                XmNrightAttachment,XmATTACH_FORM,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                XmNfontList, fontlist1,
                NULL);

        button_ok = XtVaCreateManagedWidget(langcode("WPUPTSP005"),
                xmPushButtonGadgetClass, 
                my_form,
                XmNtopAttachment, XmATTACH_WIDGET,
                XmNtopWidget, sep,
                XmNtopOffset, 5,
                XmNbottomAttachment, XmATTACH_FORM,
                XmNbottomOffset, 5,
                XmNleftAttachment, XmATTACH_POSITION,
                XmNleftPosition, 0,
                XmNleftOffset, 5,
                XmNrightAttachment, XmATTACH_POSITION,
                XmNrightPosition, 1,
                XmNnavigationType, XmTAB_GROUP,
                XmNtraversalOn, TRUE,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                XmNfontList, fontlist1,
                NULL);

        button_clear = XtVaCreateManagedWidget(langcode("WPUPTSP006"),
                xmPushButtonGadgetClass, 
                my_form,
                XmNtopAttachment, XmATTACH_WIDGET,
                XmNtopWidget, sep,
                XmNtopOffset, 5,
                XmNbottomAttachment, XmATTACH_FORM,
                XmNbottomOffset, 5,
                XmNleftAttachment, XmATTACH_POSITION,
                XmNleftPosition, 1,
                XmNrightAttachment, XmATTACH_POSITION,
                XmNrightPosition, 2,
                XmNnavigationType, XmTAB_GROUP,
                XmNtraversalOn, TRUE,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                XmNfontList, fontlist1,
                NULL);

        button_close = XtVaCreateManagedWidget(langcode("UNIOP00003"),
                xmPushButtonGadgetClass, 
                my_form,
                XmNtopAttachment, XmATTACH_WIDGET,
                XmNtopWidget, sep,
                XmNtopOffset, 5,
                XmNbottomAttachment, XmATTACH_FORM,
                XmNbottomOffset, 5,
                XmNleftAttachment, XmATTACH_POSITION,
                XmNleftPosition, 2,
                XmNrightAttachment, XmATTACH_POSITION,
                XmNrightPosition, 3,
                XmNrightOffset, 5,
                XmNnavigationType, XmTAB_GROUP,
                XmNtraversalOn, TRUE,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                XmNfontList, fontlist1,
                NULL);

        XtAddCallback(button_ok, XmNactivateCallback, Track_station_now, track_station_dialog);
        XtAddCallback(button_close, XmNactivateCallback, track_station_destroy_shell, track_station_dialog);
        XtAddCallback(button_clear, XmNactivateCallback, Track_station_clear, track_station_dialog);

        XmToggleButtonSetState(track_case_data,FALSE,FALSE);
        XmToggleButtonSetState(track_match_data,TRUE,FALSE);

        pos_dialog(track_station_dialog);

        delw = XmInternAtom(XtDisplay(track_station_dialog),"WM_DELETE_WINDOW", FALSE);
        XmAddWMProtocolCallback(track_station_dialog, delw, track_station_destroy_shell, (XtPointer)track_station_dialog);

//        if (track_station_on==1)
            XmTextFieldSetString(track_station_data,tracking_station_call);

        XtManageChild(my_form);
        XtManageChild(pane);

end_critical_section(&track_station_dialog_lock, "track_gui.c:Track_station" );

        XtPopup(track_station_dialog,XtGrabNone);
        fix_dialog_size(track_station_dialog);

        // Move focus to the Cancel button.  This appears to highlight the
        // button fine, but we're not able to hit the <Enter> key to
        // have that default function happen.  Note:  We _can_ hit the
        // <SPACE> key, and that activates the option.
//        XmUpdateDisplay(track_station_dialog);
        XmProcessTraversal(button_close, XmTRAVERSE_CURRENT);

    } else
        (void)XRaiseWindow(XtDisplay(track_station_dialog), XtWindow(track_station_dialog));
}
コード例 #27
0
ファイル: toplevel.cpp プロジェクト: czxxjtu/wxPython-1
bool wxTopLevelWindowMotif::Create( wxWindow *parent, wxWindowID id,
                                    const wxString& title,
                                    const wxPoint& pos,
                                    const wxSize& size,
                                    long style,
                                    const wxString& name )
{
    SetName(name);
    m_windowStyle = style;

    if ( parent )
        parent->AddChild(this);

    wxTopLevelWindows.Append(this);

    m_windowId = ( id > -1 ) ? id : NewControlId();
    // MBN: More backward compatible, but uglier
    m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
    m_inheritFont = true;

    bool retval = XmDoCreateTLW( parent, id, title, pos, size, style, name );

    if( !retval ) return false;

    // Intercept CLOSE messages from the window manager
    Widget shell = (Widget)GetShellWidget();
    Atom WM_DELETE_WINDOW = XmInternAtom( XtDisplay( shell ),
                                          "WM_DELETE_WINDOW", False );

    // Remove and add WM_DELETE_WINDOW so ours is only handler
    // This only appears to be necessary for wxDialog, but does not hurt
    // for wxFrame
    XmRemoveWMProtocols( shell, &WM_DELETE_WINDOW, 1 );
    XmAddWMProtocols( shell, &WM_DELETE_WINDOW, 1 );
    XmActivateWMProtocol( shell, WM_DELETE_WINDOW );

    // Modified Steve Hammes for Motif 2.0
#if (XmREVISION > 1 || XmVERSION > 1)
    XmAddWMProtocolCallback( shell, WM_DELETE_WINDOW,
                             (XtCallbackProc)wxCloseTLWCallback,
                             (XtPointer)this );
#elif XmREVISION == 1
    XmAddWMProtocolCallback( shell, WM_DELETE_WINDOW,
                             (XtCallbackProc)wxCloseTLWCallback,
                             (caddr_t)this );
#else
    XmAddWMProtocolCallback( shell, WM_DELETE_WINDOW,
                             (void (*)())wxCloseTLWCallback, (caddr_t)this );
#endif

    // This patch come from Torsten Liermann [email protected]
    if( XmIsMotifWMRunning( shell ) )
    {
        int decor = 0 ;
        if( !(m_windowStyle & wxNO_BORDER) )
            decor |= MWM_DECOR_BORDER;
        if( m_windowStyle & wxRESIZE_BORDER )
            decor |= MWM_DECOR_RESIZEH;
        if( m_windowStyle & wxSYSTEM_MENU )
            decor |= MWM_DECOR_MENU;
        if( ( m_windowStyle & wxCAPTION ) ||
            ( m_windowStyle & wxTINY_CAPTION_HORIZ ) ||
            ( m_windowStyle & wxTINY_CAPTION_VERT ) )
            decor |= MWM_DECOR_TITLE;
        if( m_windowStyle & wxRESIZE_BORDER )
            decor |= MWM_DECOR_BORDER;
        if( m_windowStyle & wxMINIMIZE_BOX )
            decor |= MWM_DECOR_MINIMIZE;
        if( m_windowStyle & wxMAXIMIZE_BOX )
            decor |= MWM_DECOR_MAXIMIZE;

        XtVaSetValues( shell,
                       XmNmwmDecorations, decor,
                       NULL );
    }
    else
    {
        // This allows non-Motif window managers to support at least the
        // no-decorations case.
        if( ( m_windowStyle & wxCAPTION ) != wxCAPTION )
            XtVaSetValues( shell,
                           XmNoverrideRedirect, True,
                           NULL );
    }

    XtAddEventHandler( (Widget)GetClientWidget(),
                       ButtonPressMask | ButtonReleaseMask |
                       PointerMotionMask | KeyPressMask,
                       False,
                       wxTLWEventHandler,
                       (XtPointer)this );

    return retval;
}
コード例 #28
0
ファイル: DragBS.c プロジェクト: att/uwin
/*
 * get the drag receiver info property from the target
 *
 * check out the _XA_MOTIF_DRAG_RECEIVER_INFO property on a Motif
 * application's window.  There's a lot more there than what Daniel
 * talks about.  Must be due to PREREGISTER, yes?
 */
extern Boolean
_XmGetDragReceiverInfo(Display *display, Window win, XmDragReceiverInfo ri)
{
    Atom dri;
    XmDndReceiverProp *receiver;
    Atom type;
    int format;
    unsigned int border;
    unsigned long bafter, length;
    Window root;

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:_XmGetDragReceiverInfo(%d)\n",
		      __FILE__, __LINE__));
    DEBUGOUT(_LtDebug0("DRAGSOURCE", NULL, "%s:_XmGetDragReceiverInfo(%d) - %p\n",
		      __FILE__, __LINE__, win));

    dri = XmInternAtom(display, _XA_MOTIF_DRAG_RECEIVER_INFO, False);

    if (XGetWindowProperty(display, win, dri, 0L, PROP_LENGTH, False,
			   dri, &type, &format, &length, &bafter,
			   (unsigned char **)&receiver) != Success)
    {
	DEBUGOUT(_LtDebug0("DRAGSOURCE", NULL, "%s:_XmGetDragReceiverInfo(%d) - getting prop failed\n",
		      __FILE__, __LINE__));
	return False;
    }

    if (length < sizeof(XmDndReceiverProp))
    {
	ri->dragProtocolStyle = XmDRAG_NONE;
	XFree((char *)receiver);
	DEBUGOUT(_LtDebug0("DRAGSOURCE", NULL, "%s:_XmGetDragReceiverInfo(%d) - None available\n",
		      __FILE__, __LINE__));
	return False;
    }

    if (receiver->protocol_version != DND_PROTOCOL_VERSION)
    {
	_XmWarning(NULL, "Drag protocol version mismatch: %d vs %d\n",
		   DND_PROTOCOL_VERSION, receiver->protocol_version);
    }

    if (receiver->byte_order != _XmByteOrder())
    {
	SWAP4BYTES(receiver->proxy_window);
	SWAP2BYTES(receiver->num_drop_sites);
	SWAP4BYTES(receiver->total_size);
    }

    Display_ProxyWindow(XmGetXmDisplay(display)) = receiver->proxy_window;

    ri->dragProtocolStyle = receiver->protocol_style;
    ri->iccInfo = (XtPointer)XtMalloc(sizeof(XmShellDropSiteInfoRec));

    DSI_ByteOrder(ri->iccInfo) = receiver->byte_order;
    DSI_NumDropSites(ri->iccInfo) = receiver->num_drop_sites;
    DSI_Info(ri->iccInfo).atoms = (char *)receiver;
    DSI_Info(ri->iccInfo).atom_size = receiver->total_size;
    DSI_Info(ri->iccInfo).atom_start = (char *)(receiver + 1);
    DSI_Info(ri->iccInfo).names = (char *)receiver + receiver->total_size;
    DSI_Info(ri->iccInfo).name_size = length - receiver->total_size;

    XGetGeometry(display, win, &root,
		 &ri->xOrigin, &ri->yOrigin, &ri->width, &ri->height,
		 &border, &ri->depth);

    XTranslateCoordinates(display, win, root, -border, -border,
			  &ri->xOrigin, &ri->yOrigin, &root);

    return True;
}
コード例 #29
0
ファイル: track_gui.c プロジェクト: dranch/Xastir
void Download_findu_trail( /*@unused@*/ Widget w, /*@unused@*/ XtPointer clientData, /*@unused@*/ XtPointer callData) {
    static Widget pane, my_form, button_ok, button_cancel, call, sep;
    Atom delw;
    XmString x_str;


    if (!download_findu_dialog) {

begin_critical_section(&download_findu_dialog_lock, "track_gui.c:Download_findu_trail" );

        download_findu_dialog = XtVaCreatePopupShell(langcode("WPUPTSP007"),
                xmDialogShellWidgetClass, appshell,
                XmNdeleteResponse,XmDESTROY,
                XmNdefaultPosition, FALSE,
                XmNfontList, fontlist1,
                NULL);

        pane = XtVaCreateWidget("Download_findu_trail pane",
                xmPanedWindowWidgetClass, 
                download_findu_dialog,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                NULL);

        my_form =  XtVaCreateWidget("Download_findu_trail my_form",
                xmFormWidgetClass, 
                pane,
                XmNfractionBase, 2,
                XmNautoUnmanage, FALSE,
                XmNshadowThickness, 1,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                NULL);

        call = XtVaCreateManagedWidget(langcode("WPUPTSP008"),
                xmLabelWidgetClass, 
                my_form,
                XmNtopAttachment, XmATTACH_FORM,
                XmNtopOffset, 10,
                XmNbottomAttachment, XmATTACH_NONE,
                XmNleftAttachment, XmATTACH_FORM,
                XmNleftOffset, 10,
                XmNrightAttachment, XmATTACH_NONE,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                XmNfontList, fontlist1,
                NULL);

        download_trail_station_data = XtVaCreateManagedWidget("download_trail_station_data", 
                xmTextFieldWidgetClass, 
                my_form,
                XmNeditable,   TRUE,
                XmNcursorPositionVisible, TRUE,
                XmNsensitive, TRUE,
                XmNshadowThickness,    1,
                XmNcolumns, 15,
                XmNwidth, ((15*7)+2),
                XmNmaxLength, 15,
                XmNbackground, colors[0x0f],
                XmNtopAttachment,XmATTACH_FORM,
                XmNtopOffset, 5,
                XmNbottomAttachment,XmATTACH_NONE,
                XmNleftAttachment, XmATTACH_WIDGET,
                XmNleftWidget, call,
                XmNleftOffset, 10,
                XmNrightAttachment,XmATTACH_NONE,
                XmNnavigationType, XmTAB_GROUP,
                XmNtraversalOn, TRUE,
                XmNfontList, fontlist1,
                NULL);

        x_str = XmStringCreateLocalized(langcode("WPUPTSP009"));
        posit_start_value = XtVaCreateManagedWidget("Start of Trail (hrs ago)", 
                xmScaleWidgetClass, 
                my_form,
                XmNtopAttachment,XmATTACH_WIDGET,
                XmNtopWidget, call,
                XmNtopOffset, 15,
                XmNbottomAttachment,XmATTACH_NONE,
                XmNleftAttachment, XmATTACH_FORM,
                XmNleftOffset, 10,
                XmNrightAttachment,XmATTACH_NONE,
                XmNnavigationType, XmTAB_GROUP,
                XmNtraversalOn, TRUE,
                //XmNwidth, 190,
                XmNrightAttachment, XmATTACH_FORM,
                XmNrightOffset, 10,
                XmNsensitive, TRUE,
                XmNorientation, XmHORIZONTAL,
                XmNborderWidth, 1,
                XmNminimum, 1,
                XmNmaximum, MAX_FINDU_START_TIME,
                XmNshowValue, TRUE,
                XmNvalue, posit_start,
// Note:  Some versions of OpenMotif (distributed with Fedora,
// perhaps others) don't work properly with XtVaTypedArg() as used
// here, instead showing blank labels for the Scale widgets.
//                XtVaTypedArg, XmNtitleString, XmRString, langcode("WPUPTSP009"), 22,
                XmNtitleString, x_str,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                XmNfontList, fontlist1,
                NULL);
        XmStringFree(x_str);

        x_str = XmStringCreateLocalized(langcode("WPUPTSP010"));
        posit_length_value = XtVaCreateManagedWidget("Length of trail (hrs)", 
                xmScaleWidgetClass, 
                my_form,
                XmNtopAttachment,XmATTACH_WIDGET,
                XmNtopWidget, posit_start_value,
                XmNtopOffset, 15,
                XmNbottomAttachment,XmATTACH_NONE,
                XmNleftAttachment, XmATTACH_FORM,
                XmNleftOffset, 10,
                XmNrightAttachment,XmATTACH_NONE,
                XmNnavigationType, XmTAB_GROUP,
                XmNtraversalOn, TRUE,
                //XmNwidth, 190,
                XmNrightAttachment, XmATTACH_FORM,
                XmNrightOffset, 10,
                XmNsensitive, TRUE,
                XmNorientation, XmHORIZONTAL,
                XmNborderWidth, 1,
                XmNminimum, 1,
                XmNmaximum, MAX_FINDU_DURATION,
                XmNshowValue, TRUE,
                XmNvalue, posit_length,
// Note:  Some versions of OpenMotif (distributed with Fedora,
// perhaps others) don't work properly with XtVaTypedArg() as used
// here, instead showing blank labels for the Scale widgets.
//                XtVaTypedArg, XmNtitleString, XmRString, langcode("WPUPTSP010"), 19,
                XmNtitleString, x_str,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                XmNfontList, fontlist1,
                NULL);
        XmStringFree(x_str);

        sep = XtVaCreateManagedWidget("Download_findu_trail sep", 
                xmSeparatorGadgetClass,
                my_form,
                XmNorientation, XmHORIZONTAL,
                XmNtopAttachment,XmATTACH_WIDGET,
                XmNtopWidget,posit_length_value,
                XmNtopOffset, 10,
                XmNbottomAttachment,XmATTACH_NONE,
                XmNleftAttachment, XmATTACH_FORM,
                XmNrightAttachment,XmATTACH_FORM,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                XmNfontList, fontlist1,
                NULL);

        button_ok = XtVaCreateManagedWidget(langcode("WPUPTSP007"),
                xmPushButtonGadgetClass, 
                my_form,
                XmNtopAttachment, XmATTACH_WIDGET,
                XmNtopWidget, sep,
                XmNtopOffset, 5,
                XmNbottomAttachment, XmATTACH_FORM,
                XmNbottomOffset, 5,
                XmNleftAttachment, XmATTACH_POSITION,
                XmNleftPosition, 0,
                XmNleftOffset, 5,
                XmNrightAttachment, XmATTACH_POSITION,
                XmNrightPosition, 1,
                XmNnavigationType, XmTAB_GROUP,
                XmNtraversalOn, TRUE,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                XmNfontList, fontlist1,
                NULL);
        if (fetching_findu_trail_now)
            XtSetSensitive(button_ok, FALSE);

        button_cancel = XtVaCreateManagedWidget(langcode("UNIOP00002"),
                xmPushButtonGadgetClass, 
                my_form,
                XmNtopAttachment, XmATTACH_WIDGET,
                XmNtopWidget, sep,
                XmNtopOffset, 5,
                XmNbottomAttachment, XmATTACH_FORM,
                XmNbottomOffset, 5,
                XmNleftAttachment, XmATTACH_POSITION,
                XmNleftPosition, 1,
                XmNrightAttachment, XmATTACH_POSITION,
                XmNrightPosition, 2,
                XmNrightOffset, 5,
                XmNnavigationType, XmTAB_GROUP,
                XmNtraversalOn, TRUE,
                MY_FOREGROUND_COLOR,
                MY_BACKGROUND_COLOR,
                XmNfontList, fontlist1,
                NULL);

        XtAddCallback(button_ok, XmNactivateCallback, Download_trail_now, download_findu_dialog);
        XtAddCallback(button_cancel, XmNactivateCallback, Download_trail_destroy_shell, download_findu_dialog);
        XtAddCallback(posit_start_value, XmNvalueChangedCallback, Reset_posit_length_max, download_findu_dialog);

        pos_dialog(download_findu_dialog);

        delw = XmInternAtom(XtDisplay(download_findu_dialog),"WM_DELETE_WINDOW", FALSE);
        XmAddWMProtocolCallback(download_findu_dialog, delw, Download_trail_destroy_shell, (XtPointer)download_findu_dialog);

        XmTextFieldSetString(download_trail_station_data,download_trail_station_call);

        XtManageChild(my_form);
        XtManageChild(pane);

end_critical_section(&download_findu_dialog_lock, "track_gui.c:Download_trail" );

        XtPopup(download_findu_dialog,XtGrabNone);
        fix_dialog_size(download_findu_dialog);

        // Move focus to the Cancel button.  This appears to highlight the
        // button fine, but we're not able to hit the <Enter> key to
        // have that default function happen.  Note:  We _can_ hit the
        // <SPACE> key, and that activates the option.
//        XmUpdateDisplay(download_findu_dialog);
        XmProcessTraversal(button_cancel, XmTRAVERSE_CURRENT);

    } else
        (void)XRaiseWindow(XtDisplay(download_findu_dialog), XtWindow(download_findu_dialog));
}
コード例 #30
0
ファイル: DragBS.c プロジェクト: att/uwin
/*
 * get the ATOM_PAIRS.  They may or may not already exist
 */
static Boolean
read_atom_pairs(Display *display)
{
    Atom pa, atype;
    Window win;
    Boolean gotit = False;
    XmDndAtomPairs *pairs;
    XmDndBufMgrRec bmgr;
    int i;
    XmDndAtomPair pair;
    char buf[32];
    int aformat;
    unsigned long nitems, bafter;
    unsigned char *prop = NULL;

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:read_atom_pairs(%d)\n",
		      __FILE__, __LINE__));

    pa = XmInternAtom(display, _XA_MOTIF_DRAG_ATOM_PAIRS, False);

    win = get_drag_window(display);

    begin_protection(display, win);

    if (XGetWindowProperty(display, win, pa, 0L, PROP_LENGTH,
			   False, pa,
			   &atype, &aformat, &nitems, &bafter,
			   (unsigned char **)&pairs) == Success &&
	nitems >= 8 && pairs != NULL)
    {
	DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:read_atom_pairs(%d) - got property, bafter=%i\n",
		      __FILE__, __LINE__, bafter));

	gotit = True;
	prop = (unsigned char *)pairs;
    }
    end_protection(display);

    if (bad_window)
    {
	_XmWarning((Widget)XmGetXmDisplay(display),
		   "Bad window ATOM_PAIRS property on DRAG_WINDOW.");
    }

    if (!gotit)
    {
#if 0
	_XmWarning((Widget)XmGetXmDisplay(display),
		   "No ATOM_PAIRS property on DRAG_WINDOW.");
#endif

	if (prop)
	{
	    XFree((char *)prop);
	}

	DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:read_atom_pairs(%d) - did not get property\n",
		      __FILE__, __LINE__));

	return False;
    }

    if (pairs->protocol_version != DND_PROTOCOL_VERSION)
    {
	_XmWarning((Widget)XmGetXmDisplay(display),
		   "DND Protocol version mismatch.");
    }

    if (pairs->byte_order != _XmByteOrder())
    {
	SWAP2BYTES(pairs->num_pairs);
	SWAP4BYTES(pairs->data_size);
    }

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:read_atom_pairs(%d) - %i pairs\n",
		      __FILE__, __LINE__,
		      pairs->num_pairs));

    if (pairs->num_pairs > 0)
    {
	bmgr.atoms = (char *)pairs;
	bmgr.atom_start = (char *)(pairs + 1);
	bmgr.atom_size = pairs->data_size;
	bmgr.names = (char *)pairs + pairs->data_size;
	bmgr.name_start = (char *)pairs + pairs->data_size;
	bmgr.name_size = nitems - pairs->data_size;

	for (i = 0; i < pairs->num_pairs; i++)
	{
	    _XmReadDragBuffer(&bmgr, False, (char *)&pair,
			      sizeof(XmDndAtomPair));

	    if (pairs->byte_order != _XmByteOrder())
	    {
		SWAP4BYTES(pair.atom);
		SWAP2BYTES(pair.namelen);
	    }

	    _XmReadDragBuffer(&bmgr, True, buf, pair.namelen);

	    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:read_atom_pairs(%d) - intern %s\n",
		      __FILE__, __LINE__,
		      buf));

	    _XmInternAtomAndName(display, pair.atom, buf);
	}
    }

    if (prop)
    {
	XFree((char *)prop);
    }

    return gotit;
}