void wl_help_context(Widget w, XtPointer closure, XtPointer call) { XmAnyCallbackStruct cbs; Cursor qa; XEvent ev; Widget top; USEUP(closure); USEUP(call); top = wl_top(w); memset((void *)&ev, '\0', sizeof(ev)); qa = XCreateFontCursor(XtDisplay(top), XC_question_arrow); w = XmTrackingEvent(top, qa, False, &ev); while(w != NULL) { if(XtHasCallbacks(w, XmNhelpCallback) != XtCallbackHasSome) { w = XtParent(w); continue; } memset((void *)&cbs, '\0', sizeof(cbs)); cbs.reason = XmCR_HELP; cbs.event = &ev; XtCallCallbacks(w, XmNhelpCallback, (XtPointer)&cbs); w = NULL; } /* * XmTrackingEvent() will take care of resetting the cursor */ XFreeCursor(XtDisplay(top), qa); }
void HelpAgent::context_help(Widget widget) { while(!XtIsSubclass(widget, topLevelShellWidgetClass)) widget = XtParent(widget); if (widget != NULL) { XEvent event; Widget sel_widget = XmTrackingEvent(widget, f_cursor, False, &event); if (sel_widget != NULL) display_help(sel_widget); } }
void HGU_XmHelpOnContextCb(Widget w, XtPointer client_data, XtPointer call_data) { Widget help_widget, topl; Cursor cursor; XmAnyCallbackStruct *cbs = (XmAnyCallbackStruct *) call_data; /* check initialisation */ if( help_resources.help_dir == NULL ){ HGU_XmHelpMenuInit( get_topl_widget( w ) ); } cursor = XCreateFontCursor(XtDisplayOfObject(w), XC_hand2); topl = get_topl_widget( w ); if( (help_widget = XmTrackingEvent(topl, cursor, False, cbs->event)) ){ cbs->reason = XmCR_HELP; XtCallCallbacks(help_widget, XmNhelpCallback, &cbs); } XFreeCursor(XtDisplayOfObject(w), cursor); return; }
void PrefAgent::get_geometry (WCallback *wcb) { WXmTextField text_field ((Widget)wcb->ClientData()); char *shell_name = NULL; if (text_field == f_map_geo) shell_name = (char*)"map"; else if (text_field == f_browse_geo) shell_name = (char*)"nodeview"; // Display an instructional dialog. WXmMessageDialog info_dialog ((Widget)f_shell, (char*)"geometry_msg", WArgList (XmNdialogType, XmDIALOG_INFORMATION, NULL)); WXmDialogShell shell (info_dialog.Parent()); // set window title String string = CATGETS(Set_PrefAgent, 2, "Dtinfo: Get Geometry"); XtVaSetValues((Widget)shell, XmNtitle, string, NULL); // window_system().register_full_modal_shell (&shell); info_dialog.MessageString ( (char*)UAS_String(CATGETS(Set_Messages, 16, "File a Bug"))); XtUnmanageChild (info_dialog.OkPB()); XtUnmanageChild (info_dialog.HelpPB()); XtVaSetValues((Widget)info_dialog, XmNdefaultPosition, False, NULL); // Wait for the dialog to appear. int mapped = FALSE; info_dialog.Manage(); XtAddEventHandler (info_dialog, ExposureMask, False, dialog_mapped, (XtPointer) &mapped); XtAppContext app_context = window_system().app_context(); XEvent event; while (!mapped) { XtAppNextEvent (app_context, &event); XtDispatchEvent (&event); } // Let the user pick an OLIAS window. static Cursor pick_cursor = XCreateFontCursor (window_system().display(), XC_crosshair); Widget target; target = XmTrackingEvent (f_shell, pick_cursor, False, &event); // Get the geometry of the selected window. while (target != NULL && !XtIsShell (target)) target = XtParent (target); if (target != (Widget) info_dialog.Parent()) { // Make sure the user clicked on the right kind of window. if (target != NULL && strcmp (XtName(target), shell_name) != 0) target = NULL; if (target == NULL) { XBell (window_system().display(), 100); } else { WShell shell (target); WindowGeometry wg; wg.width = shell.Width(); wg.height = shell.Height(); set_geometry (text_field, wg); } } // Nuke the dialog. info_dialog.Unmanage(); XtDestroyWidget (info_dialog.Parent()); }
void MotifUI::DoContextualHelp() { Widget context_widget, shell; #ifdef NO_CDE XEvent event; static Cursor cursor = (Cursor) NULL; if (cursor == (Cursor) NULL) cursor = XCreateFontCursor(display, XC_question_arrow); #endif BaseUI *window = this; while (window->UIClass() != MAIN_WINDOW) window = window->Parent(); shell = ((MotifUI *)window)->_w; #ifdef NO_CDE context_widget = XmTrackingEvent(shell, cursor, False, &event); if (event.type == KeyPress || event.type == KeyRelease) { int offset; KeySym keySym; // Look for ESC key press and stop if we get one if (event.xkey.state & ShiftMask) offset = 1; else offset = 0; keySym = XLookupKeysym((XKeyEvent *)&event, offset); if (keySym == XK_Escape) return; } if (context_widget != NULL) { #else int returnVal = DtHelpReturnSelectedWidgetId(shell, NULL, &context_widget); if (returnVal == DtHELP_SELECT_VALID) { #endif XmAnyCallbackStruct cb; cb.reason = XmCR_HELP; #ifdef NO_CDE cb.event = &event; #endif while (context_widget != NULL) { // If there is no help at this widget, back track to find help if (XtHasCallbacks(context_widget, XmNhelpCallback) == XtCallbackHasSome) { XtCallCallbacks(context_widget, XmNhelpCallback, &cb); break; } else context_widget = XtParent(context_widget); } } } void MotifUI::WidgetHelpCB(Widget, XtPointer clientData, XtPointer) { MotifUI * obj = (MotifUI *) clientData; obj->HandleHelpRequest(); }