⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 halappc.c

📁 linux下的E_MAIL客户端源码
💻 C
📖 第 1 页 / 共 3 页
字号:
   }   switch (event->error_code) {      case (BadWindow):      case (BadPixmap):      case (BadCursor):      case (BadFont):      case (BadDrawable):      case (BadColor):      case (BadGC):      case (BadIDChoice):      case (BadValue):      case (BadAtom):         if ( event->error_code == BadValue )	    XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", mesg,				  BUFSIZ);	 else if ( event->error_code == BadAtom )	    XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", mesg,				  BUFSIZ);	 else	    XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x",				  mesg, BUFSIZ);	 fputs("  ", stderr);	 fprintf(stderr, mesg, event->resourceid);	 fputs("\n", stderr);	 break;   }   XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", mesg,			  BUFSIZ);   fputs("  ", stderr);   fprintf(stderr, mesg, event->serial);   XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",			 mesg, BUFSIZ);   fputs("\n", stderr);   fflush(stderr);#if 0   StringC	msg = halApp->name + ": " + buffer;   cerr <<msg NL;//   kill(getpid(), SIGTRAP);//   halApp->PopupMessage(msg);#endif}/*---------------------------------------------------------------------- * Interrupt handler for X IO errors */voidHalAppC::HandleXIOError(Display *d){   if (errno == EPIPE) {      cerr <<halApp->name <<": X connection to " <<DisplayString(d)           <<" broken (Server error - EPIPE)." NL;   }   else {      StringC	msg = halApp->name + ": fatal IO error on X Server \"";      msg += DisplayString(d);      msg += "\"";      perror(msg);   }   halApp->xRunning = False;   halApp->exitSignal = SIGPIPE;   DoExit(NULL, True/*interrupted*/, NULL);}/*---------------------------------------------------------------------- *  Turn the quick help on or off for all known windows */voidHalAppC::QuickHelp(Boolean val){   if ( quickHelpEnabled == val ) return;   unsigned	count = shellList.size();   for (int i=0; i<count; i++) {      HalShellC	*shell = (HalShellC *)*shellList[i];      if ( val ) shell->ShowQuickHelp();      else	 shell->HideQuickHelp();   }   quickHelpEnabled = val;}/*---------------------------------------------------------------------- *  Turn the specified cursor on for all shell widgets in the given *     hierarchy. */static voidDefineCursor(Widget parent, Cursor c){   if ( !XtIsComposite(parent) ) return;   if ( XtIsShell(parent) && XtWindow(parent) )      XDefineCursor(halApp->display, XtWindow(parent), c);//// Loop through the children.//   WidgetList	list;   Cardinal	count;   XtVaGetValues(parent, XmNnumChildren, &count, XmNchildren, &list, NULL);   int	i;   for (i=0; i<count; i++) {      Widget	w = list[i];      DefineCursor(w, c);   }//// If there are any popups associated with this widget, check them//   for (i=0; i<parent->core.num_popups; i++) {      Widget	w = parent->core.popup_list[i];      DefineCursor(w, c);   }} // End DefineCursor/*---------------------------------------------------------------------- *  Restore the default cursor for all shell widgets in the given *     hierarchy. */static voidUndefineCursor(Widget parent){   if ( !XtIsComposite(parent) ) return;   if ( XtIsShell(parent) && XtWindow(parent) )      XUndefineCursor(halApp->display, XtWindow(parent));//// If this is a composite loop through the children.//   WidgetList	list;   Cardinal	count;   XtVaGetValues(parent, XmNnumChildren, &count, XmNchildren, &list, NULL);   int	i;   for (i=0; i<count; i++) {      Widget	w = list[i];      UndefineCursor(w);   }//// If there are any popups associated with this widget, check them//   for (i=0; i<parent->core.num_popups; i++) {      Widget	w = parent->core.popup_list[i];      UndefineCursor(w);   }} // End UndefineCursor/*---------------------------------------------------------------------- *  Turn the busy cursor on or off for all known windows */voidHalAppC::BusyCursor(Boolean on){   if ( !xRunning ) return;   if ( on ) {//// Show watch if not already on//      if ( !busyOn ) {	 unsigned	count = shellList.size();	 for (int i=0; i<count; i++) {	    HalShellC	*shell = (HalShellC *)*shellList[i];	    if ( (Window)*shell ) DefineCursor(*shell, busyCursor);	 }	 XFlush(display);	 busyOn = True;      }      busyCount++;		// Up the count   } // End if turning on   else {      if ( busyCount>0 ) busyCount--;		// Lower the count//// Reset cursor if necessary//      if ( busyCount==0 && busyOn ) {	 unsigned	count = shellList.size();	 for (int i=0; i<count; i++) {	    HalShellC	*shell = (HalShellC *)*shellList[i];	    if ( (Window)*shell ) UndefineCursor(*shell);	 }	 XFlush(display);	 busyOn = False;      }   } // End if turning off} // End HalAppC BusyCursor/*---------------------------------------------------------------------- * Register a shell */voidHalAppC::RegisterShell(HalShellC *shell){   void	*ptr = shell;   shellList.add(ptr);   if ( busyOn && (Window)*shell ) DefineCursor(*shell, busyCursor);   if ( quickHelpEnabled ) shell->ShowQuickHelp();   else			   shell->HideQuickHelp();}/*---------------------------------------------------------------------- * Unregister a shell */voidHalAppC::UnregisterShell(HalShellC *shell){   void	*ptr = shell;   shellList.remove(ptr);   if ( busyOn && (Window)*shell ) UndefineCursor(*shell);}/*---------------------------------------------------------------------- *  Display message in popup window */static voidAcknowledgePopup(Widget, Boolean *answered, XtPointer){   *answered = True;}voidHalAppC::PopupMessage(const char *msg, Widget parent, unsigned char type){   if ( !xRunning ) {      cerr <<msg <<endl;      return;   }   static Boolean	answered;   static MimeRichTextC	*errText;   WArgList		args;   if ( !msgDialog ) {      Boolean useErrorText = get_boolean(*this, "useErrorText", False);      args.DialogStyle(XmDIALOG_FULL_APPLICATION_MODAL);      msgDialog = XmCreateMessageDialog(*this, "msgDialog", ARGS);      XtUnmanageChild(XmMessageBoxGetChild(msgDialog, XmDIALOG_CANCEL_BUTTON));      XtUnmanageChild(XmMessageBoxGetChild(msgDialog, XmDIALOG_HELP_BUTTON));      XtAddCallback(XmMessageBoxGetChild(msgDialog, XmDIALOG_OK_BUTTON),		    XmNactivateCallback, (XtCallbackProc)AcknowledgePopup,		    (XtPointer)&answered);//// Trap window manager close function//      XmAddWMProtocolCallback(XtParent(msgDialog), halApp->delWinAtom,			      (XtCallbackProc)AcknowledgePopup,			      (caddr_t)&answered);      if (useErrorText) {	XtUnmanageChild(XmMessageBoxGetChild(msgDialog, XmDIALOG_MESSAGE_LABEL));	errText = new MimeRichTextC(msgDialog, "errText", 0 ,0);	XtManageChild(errText->MainWidget());      }      else {	errText = NULL;      }   }//// Set the dialog's parent so it pops up in the desired place//   if ( !parent  || !XtIsRealized(parent) || !XtIsManaged(parent))      parent = appShell;   Widget	dShell = XtParent(msgDialog);   dShell->core.parent = parent;   XtVaSetValues(dShell, XmNtransientFor, parent, NULL);//// Set the message and type//   args.Reset();   WXmString	str;   if ( errText == NULL ) {     str = msg;     args.MessageString((XmString)str);   }   args.DialogType(type);//// DJL - when setting the dialog type, also check to see about the dialog title//   StringC newTitle;   if ( type == XmDIALOG_ERROR ) {      if ( errorPM )         args.SymbolPixmap(errorPM);      newTitle = get_string(*this, "errorPopupTitle", "");   }   else if ( type == XmDIALOG_WARNING ) {      if ( warningPM )         args.SymbolPixmap(warningPM);      newTitle = get_string(*this, "warningPopupTitle", "");   }   else if ( type == XmDIALOG_QUESTION ) {      if ( questionPM )         args.SymbolPixmap(questionPM);      newTitle = get_string(*this, "questionPopupTitle", "");   }   else {      if ( messagePM )         args.SymbolPixmap(messagePM);      newTitle = get_string(*this, "messagePopupTitle", "");   }   if (newTitle.size()) {      args.Title((char*)newTitle);   }       XtSetValues(msgDialog, ARGS);   if (errText != NULL) {     CharC msgStr(msg);     errText->SetString(msgStr);     errText->ScrollTop();   }   XtManageChild(msgDialog);   XMapRaised(display, XtWindow(XtParent(msgDialog)));//// Wait for the popup to be acknowledged//   answered = False;   while ( !answered ) {      XtAppProcessEvent(context, XtIMXEvent);      XSync(display, False);   }} // End HalAppC PopupMessagevoidHalAppC::PopupMessage(const char *msg, unsigned char type){   PopupMessage(msg, appShell, type);}WorkingBoxC*HalAppC::WorkBox(){//// Create working dialog//   if ( !workBox ) workBox = new WorkingBoxC(appShell);   return(workBox);}HelpC*HalAppC::HelpWin(){   return helpWin;}BooleanHalAppC::HasHelp(){   return hasHelp;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -