Beispiel #1
0
void
HelpModeCB(
        Widget w,
        caddr_t client_data,
        caddr_t call_data )
{
   Widget widget;

   switch(DtHelpReturnSelectedWidgetId(style.shell, (Cursor)NULL, &widget))
   {
      /*
       * There are additional cases (e.g. user aborts request) but I
       * don't feel they warrant an error dialog.
       */
      case DtHELP_SELECT_VALID:

          while (!XtIsShell(widget))
          {
             if (XtHasCallbacks(widget, XmNhelpCallback) == XtCallbackHasSome)
             {
                XtCallCallbacks(widget, XmNhelpCallback, (XtPointer)NULL);
                return;
             }
             widget = XtParent(widget);
          }
          break;

      case DtHELP_SELECT_INVALID:

          ErrDialog((char *)GETMESSAGE(2, 8, "You must select an item\nwithin the Style Manager."), style.shell);
          break;

   }
}
Beispiel #2
0
static Boolean
ProcessItemHelp(
   Widget shell )

{
   Widget selectedWidget;
   int returnVal;

   returnVal = DtHelpReturnSelectedWidgetId(shell, NULL, &selectedWidget);
   switch(returnVal)
   {  
      case DtHELP_SELECT_VALID:
      {
         while (!XtIsShell(selectedWidget))
         {
            if (XtHasCallbacks(selectedWidget, XmNhelpCallback)
                  == XtCallbackHasSome)
            {
               XtCallCallbacks(selectedWidget, 
                                  XmNhelpCallback, NULL);
               return True;
            }

            selectedWidget = XtParent(selectedWidget);
         }
         break;
      }

      case DtHELP_SELECT_INVALID:
         return False;

      case DtHELP_SELECT_ABORT:
      case DtHELP_SELECT_ERROR:
      default:
         break;
   }
   return True;
}
Beispiel #3
0
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();
}
Beispiel #4
0
void show_main_help(Widget w, XtPointer clientData, XtPointer cbs)
{
        int 		ac;
        Arg 		al[10];
        Calendar 	*c = calendar;
	Props_pu       	*p = (Props_pu *) c->properties_pu;
        Widget 		selWidget = NULL;
        int 		status = DtHELP_SELECT_ERROR;
 
        ac = 0;
        XtSetArg(al[ac], DtNhelpType, DtHELP_TYPE_TOPIC); ac++;
        switch ((int)clientData) {
            case HELP_OVERVIEW:
        	XtSetArg(al[ac], DtNhelpVolume, "Calendar"); ac++;
                XtSetArg(al[ac], DtNlocationId, "_HOMETOPIC"); ac++;
                break;
            case HELP_USINGHELP:
        	XtSetArg(al[ac], DtNhelpVolume, "Help4Help"); ac++;
                XtSetArg(al[ac], DtNlocationId, "_HOMETOPIC"); ac++;
                break;
            case HELP_TASKS:
        	XtSetArg(al[ac], DtNhelpVolume, "Calendar"); ac++;
                XtSetArg(al[ac], DtNlocationId, "TASKS"); ac++;
                break;
            case HELP_REFERENCE:
        	XtSetArg(al[ac], DtNhelpVolume, "Calendar"); ac++;
                XtSetArg(al[ac], DtNlocationId, "REFERENCE"); ac++;
                break;
            case HELP_ABOUTCALENDAR:
        	XtSetArg(al[ac], DtNhelpVolume, "Help4Help"); ac++;
                XtSetArg(al[ac], DtNlocationId, "_COPYRIGHT"); ac++;
                break;
            case HELP_TOC:
        	XtSetArg(al[ac], DtNhelpVolume, "Calendar"); ac++;
                XtSetArg(al[ac], DtNlocationId, "TOC"); ac++;
                break;
            case HELP_ONITEM:
               while (!XtIsSubclass(w, applicationShellWidgetClass))
                   w = XtParent(w);
 
               status = DtHelpReturnSelectedWidgetId(w, NULL, &selWidget);     
               switch ((int)status)
                  {
                    case DtHELP_SELECT_ERROR:
                      printf(catgets(c->DT_catd, 1, 350, "Selection Error, cannot continue\n"));
                    break;
                    case DtHELP_SELECT_VALID:
                      while (selWidget != NULL)
                        {
                          if ((XtHasCallbacks(selWidget, XmNhelpCallback)                                            == XtCallbackHasSome))
                            {
                               XtCallCallbacks((Widget)selWidget,
                                               XmNhelpCallback,NULL);
                               break;
                            }
                          else
                           selWidget = XtParent(selWidget);
                        }
                    break;
                    case DtHELP_SELECT_ABORT:
                      return;

                    case DtHELP_SELECT_INVALID:
		      {
			char *title = XtNewString(catgets(c->DT_catd, 1, 110, "Calendar : Error - Help"));
			char *text = XtNewString(catgets(c->DT_catd, 1, 352, "You must select a component within your application."));
			char *ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
			dialog_popup(c->frame,
				     DIALOG_TITLE, title,
				     DIALOG_TEXT, text,
				     BUTTON_IDENT, 1, ident1,
				     DIALOG_IMAGE, p->xm_error_pixmap,
				     NULL);
			XtFree(ident1);
			XtFree(text);
			XtFree(title);
			return;
		      }
                  }
 
               break;
 
            default:
        	XtSetArg(al[ac], DtNhelpVolume, "Calendar"); ac++;
                XtSetArg(al[ac], DtNlocationId, "_HOMETOPIC"); ac++;
                break;
        }

	display_help(c, al, ac);
}