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

📄 halshellc.c

📁 linux下的E_MAIL客户端源码
💻 C
📖 第 1 页 / 共 2 页
字号:
static voidTextLoseFocus(Widget w, XtPointer, XtPointer){   XtVaSetValues(w, XmNcursorPositionVisible, False, NULL);}/*---------------------------------------------------------------------- * Enable quick-help for specified widget */voidHalShellC::HandleFocus(Widget w){//// Add event handlers to this widget for pointer events//   XtAddEventHandler(w, EnterWindowMask, False, (XtEventHandler)EnterFocus,                     (XtPointer)this);   XtAddEventHandler(w, LeaveWindowMask, False, (XtEventHandler)LeaveFocus,                     (XtPointer)this);//// Add event handler for keyboard events//   XtAddEventHandler(w, FocusChangeMask, False, (XtEventHandler)ChangeFocus,                     (XtPointer)this);//// Add callbacks for text widgets to hide stippled cursor in inactive text//    fields//   if ( (XmIsText(w)      && XmTextGetEditable(w)) ||	(XmIsTextField(w) && XmTextFieldGetEditable(w)) ) {      XtAddCallback(w, XmNfocusCallback,       (XtCallbackProc)TextGainFocus,0);      XtAddCallback(w, XmNlosingFocusCallback, (XtCallbackProc)TextLoseFocus,0);   }//// Allow tabbing to this widget//   //XtVaSetValues(w, XmNtraversalOn, True, NULL);} // End HandleFocus/*---------------------------------------------------------------------- * Disable traversal for specified widget */voidHalShellC::UnhandleFocus(Widget w){//// Remove event handlers from this widget for pointer events//   XtRemoveEventHandler(w, EnterWindowMask, False, (XtEventHandler)EnterFocus,                        (XtPointer)this);   XtRemoveEventHandler(w, LeaveWindowMask, False, (XtEventHandler)LeaveFocus,                        (XtPointer)this);//// Add event handler for keyboard events//   XtRemoveEventHandler(w, FocusChangeMask, False, (XtEventHandler)ChangeFocus,                        (XtPointer)this);//// Disallow tabbing to this widget//   //XtVaSetValues(w, XmNtraversalOn, False, NULL);} // End UnhandleFocus/*---------------------------------------------------------------------- * Add and remove on-line and quick help callbacks for specified widget */#ifdef NO_HELPvoidHalShellC::HandleHelp(Widget w, Boolean){   HandleFocus(w);}voidHalShellC::UnhandleHelp(Widget w, Boolean){   UnhandleFocus(w);}#elsevoidHalShellC::HandleHelp(Widget w, Boolean doChildren){//// If this is a composite and doChildren is true, loop through the children//   and register them.//   if ( XtIsComposite(w) && doChildren ) {      WidgetList	list;      Cardinal		count;      XtVaGetValues(w, XmNnumChildren, &count, XmNchildren, &list, NULL);//// Loop through children, but don't cross into other shells//      for (int i=0; i<count; i++) {	 Widget	w = list[i];	 if ( !XtIsShell(w) ) HandleHelp(w, doChildren);      }      if ( XmIsDrawingArea(w) )	 HandleFocus(w);   }   //// If this is not a composite or doChildren is false, register this widget.// Do not register gadgets.//   else if ( !XmIsGadget(w) && !XtIsSubclass(w, xmDragIconObjectClass) /*&&	     (!XmIsLabel(w) || XmIsPushButton(w) || XmIsToggleButton(w) ||			       XmIsCascadeButton(w) || XmIsDrawnButton(w))*/ ) {      XtAddCallback(w, XmNhelpCallback, (XtCallbackProc)HalAppC::DoHelp, NULL);      HandleFocus(w);   }} // End HalShellC HandleHelpvoidHalShellC::UnhandleHelp(Widget w, Boolean doChildren){//// If this is a composite and doChildren is true, loop through the children//   and unregister them.//   if ( XtIsComposite(w) && doChildren ) {      WidgetList	list;      Cardinal		count;      XtVaGetValues(w, XmNnumChildren, &count, XmNchildren, &list, NULL);//// Loop through children, but don't cross into other shells//      for (int i=0; i<count; i++) {	 Widget	w = list[i];	 if ( !XtIsShell(w) ) UnhandleHelp(w, doChildren);      }      if ( XmIsDrawingArea(w) )	 UnhandleFocus(w);   }   //// If this is not a composite or doChildren is false, unregister this widget.//   else if ( !XmIsGadget(w) ) {      XtRemoveCallback(w, XmNhelpCallback, (XtCallbackProc)HalAppC::DoHelp, 0);      UnhandleFocus(w);   }}#endifvoidHalShellC::HandleHelp(){   HandleHelp(shell, /*doChildren*/True);}voidHalShellC::UnhandleHelp(){   UnhandleHelp(shell, /*doChildren*/True);}/*---------------------------------------------------------------------- *  Turn the busy cursor on or off */voidHalShellC::BusyCursor(Boolean on){   halApp->BusyCursor(on);}/*--------------------------------------------------------------- *  Event handlers for input focus changes */voidHalShellC::EnterFocus(Widget w, HalShellC *This, XEvent*, Boolean*){   if ( halApp->quickHelpEnabled ) {      StringC	str = get_string(w, "quickHelp", " ");      if ( debuglev>2 )	 cout <<"Quick help for " <<XtName(w) <<" is " <<str <<endl;      This->QuickHelp(str);   }}voidHalShellC::LeaveFocus(Widget, HalShellC *This, XEvent*, Boolean*){   if ( halApp->quickHelpEnabled )      This->ClearQuickHelp();}voidHalShellC::ChangeFocus(Widget w, HalShellC *This, XEvent *event, Boolean*){   if ( event->type == FocusIn ) EnterFocus(w, This, NULL, NULL);   else				 LeaveFocus(w, This, NULL, NULL);}/*---------------------------------------------------------------------- *  Display message in popup window */voidHalShellC::PopupMessage(const char *msg, unsigned char type){   if ( shell )      halApp->PopupMessage(msg, shell, type);}/*---------------------------------------------------------------------- *  Display quick-help and info messages */voidHalShellC::QuickHelp(const char *msg) const{   if ( !halApp->quickHelpEnabled || !quickHelp || !halApp->xRunning ) return;   WXmString str(msg);   XtVaSetValues(quickHelp, XmNlabelString, (XmString)str, NULL);}voidHalShellC::Message(const char *msg) const{   if ( !infoMsg || !halApp->xRunning ) return;   if ( XmIsLabel(infoMsg) ) {      WXmString str(msg);      XtVaSetValues(infoMsg, XmNlabelString, (XmString)str, NULL);//// Process outstanding expose events in this window//      XEvent       event;      while ( XCheckMaskEvent(halApp->display, ExposureMask, &event) )	 XtDispatchEvent(&event);   }   else {      XmTextFieldSetString(infoMsg, (char*)msg);      XmUpdateDisplay(infoMsg);   }}/*---------------------------------------------------------------------- *  Display and hide window */voidHalShellC::Show(){   if ( !halApp->xRunning ) return;   XtPopup(shell, XtGrabNone);   XMapRaised(halApp->display, XtWindow(shell));   ForceDialog(shell);   shown = True;   halApp->RegisterShell(this);   XUndefineCursor(halApp->display, *this);}voidHalShellC::Hide(){   if ( !shown || !halApp->xRunning ) return;   CallHideCallbacks();   halApp->UnregisterShell(this);   XtPopdown(shell);   shown  = False;}/*---------------------------------------------------------------------- * Call hide callbacks before hiding */voidHalShellC::DoHide(Widget, HalShellC *This, XtPointer){   This->Hide();}/*---------------------------------------------------------------------- * Find a widget, then display context help for it */voidHalShellC::DoContextHelp(Widget, HalShellC *This, XtPointer){   XEvent ev;   Widget w = XmTrackingEvent(*This, halApp->helpCursor, False, &ev);   if ( w != NULL ) HalAppC::DoHelp(w, NULL, NULL);}/*---------------------------------------------------------------------- * Callback to detect map and unmap */voidHalShellC::HandleMapChange(Widget, HalShellC *This, XEvent *ev, Boolean*){//// We can get this event after the X server has shutdown but before the//    xRunning flag is updated.  Call XFlush and XSync to force a SIGPIPE//   XFlush(halApp->display);   XSync(halApp->display, False);   if ( !halApp->xRunning ) return;   if ( ev->type == MapNotify ) {      This->mapped = True;      This->CallMapCallbacks();   }   else if ( ev->type == UnmapNotify ) {      This->CallUnmapCallbacks();      This->mapped = False;   }}/*---------------------------------------------------------------------- * Method to turn on quick help widget */voidHalShellC::ShowQuickHelp(){   if ( quickHelp && XtIsManaged(quickHelp) ) return;//// Manage message area widget if necessary//   if ( !XtIsManaged(msgWin) ) {      XtVaSetValues(mainWindow, XmNmessageWindow, msgWin, NULL);      XtManageChild(msgWin);   }//// Create quick help widget if necessary//   if ( !quickHelp ) {      WArgList	args;      args.Alignment(XmALIGNMENT_BEGINNING);      args.RecomputeSize(False);      args.PositionIndex(0);      quickHelp = XmCreateLabel(msgWin, "quickHelp", ARGS);   }//// Turn on quick help widget//   XtManageChild(quickHelp);} // End ShowQuickHelp/*---------------------------------------------------------------------- * Method to turn off quick help widget */voidHalShellC::HideQuickHelp(){   if ( quickHelp ) {      if ( !XtIsManaged(quickHelp) ) return;      XtUnmanageChild(quickHelp);   }   if ( !infoMsg || !XtIsManaged(infoMsg) ) {      XtUnmanageChild(msgWin);      XtVaSetValues(mainWindow, XmNmessageWindow, NULL, NULL);      // XtVaSetValues(msgWin, XmNheight, 1, NULL);   }}/*---------------------------------------------------------------------- * Method to turn on info message widget */voidHalShellC::ShowInfoMsg(){   if ( infoMsg && XtIsManaged(infoMsg) ) return;//// Manage message area widget if necessary//   if ( !XtIsManaged(msgWin) ) {      XtVaSetValues(mainWindow, XmNmessageWindow, msgWin, NULL);      XtManageChild(msgWin);   }//// Create info message widget if necessary//   if ( !infoMsg ) {      WArgList	args;      args.PositionIndex(1);      Boolean	useLabel = get_boolean(*this, "infoMsgIsLabel", False);      if ( useLabel ) {	 args.Alignment(XmALIGNMENT_BEGINNING);	 args.RecomputeSize(False);	 infoMsg = XmCreateLabel(msgWin, "infoMsg", ARGS);      }      else {	 args.ShadowThickness(0);	 args.Editable(False);	 args.CursorPositionVisible(False);	 args.TraversalOn(False);	 args.NavigationType(XmNONE);	 infoMsg = CreateTextField(msgWin, "infoMsg", ARGS);      }   }//// Turn on info message widget//   XtManageChild(infoMsg);} // End ShowInfoMsg/*---------------------------------------------------------------------- * Method to turn off info message widget */voidHalShellC::HideInfoMsg(){   if ( infoMsg ) {      if ( !XtIsManaged(infoMsg) ) return;      XtUnmanageChild(infoMsg);   }   if ( !quickHelp || !XtIsManaged(quickHelp) ) {      XtUnmanageChild(msgWin);      XtVaSetValues(mainWindow, XmNmessageWindow, NULL, NULL);      // XtVaSetValues(msgWin, XmNheight, 1, NULL);   }}

⌨️ 快捷键说明

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