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

📄 halshellc.c

📁 linux下的E_MAIL客户端源码
💻 C
📖 第 1 页 / 共 2 页
字号:
/* * $Id: HalShellC.C,v 1.2 2000/05/07 12:26:10 fnevgeny Exp $ * * Copyright (c) 1993 HAL Computer Systems International, Ltd. *  *          HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. *                  1315 Dell Avenue *                  Campbell, CA  95008 * * Author: Greg Hilton * Contributors: Tom Lang, Frank Bieser, and others * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * http://www.gnu.org/copyleft/gpl.html * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. */#include <config.h>#include "HalAppC.h"#include "HalShellC.h"#include "ForceDialog.h"#include "WArgList.h"#include "WXmString.h"#include "rsrc.h"#include "TextMisc.h"#include "ButtonBox.h"#include <Xm/MessageB.h>#include <Xm/Label.h>#include <Xm/PushB.h>#include <Xm/ToggleB.h>#include <Xm/CascadeB.h>#include <Xm/DrawnB.h>#include <Xm/Frame.h>#include <Xm/RowColumn.h>#include <Xm/Separator.h>#include <Xm/Text.h>#include <Xm/TextF.h>#include <Xm/DragDrop.h>#include <Xm/DrawingA.h>#include <X11/IntrinsicP.h>#include <X11/CoreP.h>extern int	debuglev;/*---------------------------------------------------------------------- * Constructor */HalShellC::HalShellC(){   shown  = False;   mapped = False;   shell      = NULL;   mainWindow = NULL;   topForm    = NULL;   appFrame   = NULL;   appForm    = NULL;   msgDialog  = NULL;   msgWin     = NULL;   quickHelp  = NULL;   infoMsg    = NULL;   hideCalls.AllowDuplicates(TRUE);   mapCalls.AllowDuplicates(TRUE);   unmapCalls.AllowDuplicates(TRUE);//// The topForm is created by the derived class.  The button box children are//    created on demand.////// Traditional setup//// topForm//   Separator          buttonSep       (on demand)//   Frame              buttonFrame     (on demand)//      RowColumn       buttonRC        (on demand)////// Alternate setup//// topForm//   Separator		buttonSep       (on demand)//   ButtonBox		buttonRC        (on demand)//   buttonSep = buttonFrame = buttonRC = NULL;   buttonGravity = SouthGravity;} // End HalShellC constructorHalShellC::~HalShellC(){   if ( shown && halApp->xRunning ) Hide();   shown  = False;   DeleteCallbacks(hideCalls);   DeleteCallbacks(mapCalls);   DeleteCallbacks(unmapCalls);}/*---------------------------------------------------------------------- * Method to add button box */voidHalShellC::AddButtonBox(){   if ( buttonRC ) return;   char	*cl = "HalShellC";   int	   gravity   = get_gravity(cl, *this, "buttonGravity", "South");   Boolean useRowCol = get_boolean(cl, *this, "useRowCol",     True);   WArgList	args;   if ( useRowCol ) { // Traditional layout//// Create the frame with south gravity//      args.ShadowThickness(0);      args.MarginWidth(0);      args.MarginHeight(0);      args.TopAttachment(XmATTACH_NONE);      args.LeftAttachment(XmATTACH_FORM);      args.RightAttachment(XmATTACH_FORM);      args.BottomAttachment(XmATTACH_FORM);      buttonFrame = XmCreateFrame(topForm, "buttonFrame", ARGS);//// Create and position the row/column for south gravity//      args.Reset();      args.Orientation(XmHORIZONTAL);      args.ChildType(XmFRAME_TITLE_CHILD);      args.ChildHorizontalAlignment(XmALIGNMENT_CENTER);      args.ChildHorizontalSpacing(0);      args.ChildVerticalAlignment(XmALIGNMENT_WIDGET_TOP);      args.EntryAlignment(XmALIGNMENT_CENTER);      buttonRC = XmCreateRowColumn(buttonFrame, "buttonRC", ARGS);      XtManageChild(buttonRC);   } // End if traditional layout   else { // Alternate layout      args.TopAttachment(XmATTACH_NONE);      args.LeftAttachment(XmATTACH_FORM);      args.RightAttachment(XmATTACH_FORM);      args.BottomAttachment(XmATTACH_FORM);      args.Orientation(XmHORIZONTAL);      args.ResizeWidth(False);      args.ResizeHeight(True);      buttonRC = CreateButtonBox(topForm, "buttonRC", ARGS);      XtManageChild(buttonRC);   }//// Create and position the separator for south gravity//   args.Reset();   args.Orientation(XmHORIZONTAL);   args.LeftAttachment(XmATTACH_FORM);   args.RightAttachment(XmATTACH_FORM);   if ( buttonFrame ) args.BottomAttachment(XmATTACH_WIDGET, buttonFrame);   else		      args.BottomAttachment(XmATTACH_WIDGET, buttonRC);   args.TopAttachment(XmATTACH_NONE);   buttonSep = XmCreateSeparator(topForm, "buttonSep", ARGS);   Widget	wlist[2];   wlist[0] = buttonSep;   wlist[1] = buttonFrame ? buttonFrame : buttonRC;   XtManageChildren(wlist, 2);//// Attach the app form to the separator//   args.Reset();   args.LeftAttachment(XmATTACH_FORM);   args.RightAttachment(XmATTACH_FORM);   args.TopAttachment(XmATTACH_FORM);   args.BottomAttachment(XmATTACH_WIDGET, buttonSep);   XtSetValues(appForm, ARGS);//// Now set the real gravity//   SetButtonGravity(gravity);} // End AddButtonBox/*---------------------------------------------------------------------- * Method to set the button gravity */voidHalShellC::SetButtonGravity(int gravity){   if ( buttonGravity == gravity ) return;   WArgList	args;   Widget	buttonW = buttonFrame ? buttonFrame : buttonRC;//// Get size of separator//   Dimension	sepWd, sepHt;   XtVaGetValues(buttonSep, XmNwidth, &sepWd, XmNheight, &sepHt, NULL);#if 0//// Keep form from resizing//   unsigned char	policy;   XtVaGetValues(topForm, XmNresizePolicy, &policy, NULL);   XtVaSetValues(topForm, XmNresizePolicy, XmRESIZE_NONE, NULL);#endif#if 0//// Unmanage widgets//   XtUnmanageChild(appForm);   XtUnmanageChild(buttonSep);   XtUnmanageChild(buttonW);   XtUnmanageChild(buttonRC);   WidgetList   wlist;   Cardinal     wcount;   XtVaGetValues(buttonRC, XmNnumChildren, &wcount, XmNchildren, &wlist, 0);   XtUnmanageChildren(wlist, wcount);#endif//// Remove current attachments//   args.Reset();   args.TopAttachment(XmATTACH_FORM);   args.LeftAttachment(XmATTACH_FORM);   args.RightAttachment(XmATTACH_NONE);   args.BottomAttachment(XmATTACH_NONE);   XtSetValues(appForm,   ARGS);   XtSetValues(buttonSep, ARGS);   XtSetValues(buttonW,   ARGS);//// Set the new attachments based on the new gravity//   switch (gravity) {      case (NorthWestGravity):      case (SouthWestGravity):	 gravity = WestGravity;      case (WestGravity):	 args.Reset();	 args.Orientation(XmVERTICAL);	 if ( buttonFrame )	    args.ChildHorizontalSpacing(0);	 else {	    args.ResizeWidth(True);	    args.ResizeHeight(False);	 }	 XtSetValues(buttonRC, ARGS);	 args.Reset();	 args.TopAttachment(XmATTACH_FORM);	 args.LeftAttachment(XmATTACH_FORM);	 args.RightAttachment(XmATTACH_NONE);	 args.BottomAttachment(XmATTACH_FORM);	 XtSetValues(buttonW, ARGS);	 args.Reset();	 args.TopAttachment(XmATTACH_FORM);	 args.LeftAttachment(XmATTACH_WIDGET, buttonW);	 args.RightAttachment(XmATTACH_NONE);	 args.BottomAttachment(XmATTACH_FORM);	 args.Orientation(XmVERTICAL);	 if ( buttonGravity == NorthGravity ||	      buttonGravity == SouthGravity ) {	    args.Width(sepHt);	    args.Height(sepWd);	 }	 XtSetValues(buttonSep, ARGS);	 args.Reset();	 args.TopAttachment(XmATTACH_FORM);	 args.LeftAttachment(XmATTACH_WIDGET, buttonSep);	 args.RightAttachment(XmATTACH_FORM);	 args.BottomAttachment(XmATTACH_FORM);	 XtSetValues(appForm, ARGS);	 break;      case (NorthEastGravity):      case (SouthEastGravity):	 gravity = EastGravity;      case (EastGravity):	 args.Reset();	 args.Orientation(XmVERTICAL);	 if ( buttonFrame )	    args.ChildHorizontalSpacing(0);	 else {	    args.ResizeWidth(True);	    args.ResizeHeight(False);	 }	 XtSetValues(buttonRC, ARGS);	 args.Reset();	 args.TopAttachment(XmATTACH_FORM);	 args.LeftAttachment(XmATTACH_NONE);	 args.RightAttachment(XmATTACH_FORM);	 args.BottomAttachment(XmATTACH_FORM);	 XtSetValues(buttonW, ARGS);	 args.Reset();	 args.TopAttachment(XmATTACH_FORM);	 args.LeftAttachment(XmATTACH_NONE);	 args.RightAttachment(XmATTACH_WIDGET, buttonW);	 args.BottomAttachment(XmATTACH_FORM);	 args.Orientation(XmVERTICAL);	 if ( buttonGravity == NorthGravity ||	      buttonGravity == SouthGravity ) {	    args.Width(sepHt);	    args.Height(sepWd);	 }	 XtSetValues(buttonSep, ARGS);	 args.Reset();	 args.TopAttachment(XmATTACH_FORM);	 args.LeftAttachment(XmATTACH_FORM);	 args.RightAttachment(XmATTACH_WIDGET, buttonSep);	 args.BottomAttachment(XmATTACH_FORM);	 XtSetValues(appForm, ARGS);	 break;      case (NorthGravity):	 gravity = NorthGravity;	 args.Reset();	 args.Orientation(XmHORIZONTAL);	 if ( buttonFrame )	    args.ChildHorizontalSpacing(0);	 else {	    args.ResizeWidth(False);	    args.ResizeHeight(True);	 }	 XtSetValues(buttonRC, ARGS);	 args.Reset();	 args.TopAttachment(XmATTACH_FORM);	 args.LeftAttachment(XmATTACH_FORM);	 args.RightAttachment(XmATTACH_FORM);	 args.BottomAttachment(XmATTACH_NONE);	 XtSetValues(buttonW, ARGS);	 args.Reset();	 args.TopAttachment(XmATTACH_WIDGET, buttonW);	 args.LeftAttachment(XmATTACH_FORM);	 args.RightAttachment(XmATTACH_FORM);	 args.BottomAttachment(XmATTACH_NONE);	 args.Orientation(XmHORIZONTAL);	 if ( buttonGravity == EastGravity ||	      buttonGravity == WestGravity ) {	    args.Width(sepHt);	    args.Height(sepWd);	 }	 XtSetValues(buttonSep, ARGS);	 args.Reset();	 args.TopAttachment(XmATTACH_WIDGET, buttonSep);	 args.LeftAttachment(XmATTACH_FORM);	 args.RightAttachment(XmATTACH_FORM);	 args.BottomAttachment(XmATTACH_FORM);	 XtSetValues(appForm, ARGS);	 break;      case (SouthGravity):      default:	 gravity = SouthGravity;	 args.Reset();	 args.Orientation(XmHORIZONTAL);	 if ( buttonFrame )	    args.ChildHorizontalSpacing(0);	 else {	    args.ResizeWidth(False);	    args.ResizeHeight(True);	 }	 XtSetValues(buttonRC, ARGS);	 	 args.Reset();	 args.TopAttachment(XmATTACH_NONE);	 args.LeftAttachment(XmATTACH_FORM);	 args.RightAttachment(XmATTACH_FORM);	 args.BottomAttachment(XmATTACH_FORM);	 XtSetValues(buttonW, ARGS);	 args.Reset();	 args.TopAttachment(XmATTACH_NONE);	 args.LeftAttachment(XmATTACH_FORM);	 args.RightAttachment(XmATTACH_FORM);	 args.BottomAttachment(XmATTACH_WIDGET, buttonW);	 args.Orientation(XmHORIZONTAL);	 if ( buttonGravity == EastGravity ||	      buttonGravity == WestGravity ) {	    args.Width(sepHt);	    args.Height(sepWd);	 }	 XtSetValues(buttonSep, ARGS);	 args.Reset();	 args.TopAttachment(XmATTACH_FORM);	 args.LeftAttachment(XmATTACH_FORM);	 args.RightAttachment(XmATTACH_FORM);	 args.BottomAttachment(XmATTACH_WIDGET, buttonSep);	 XtSetValues(appForm, ARGS);	 break;   } // End switch new gravity#if 0//// Remanage widgets//   XtManageChildren(wlist, wcount);   XtManageChild(buttonRC);   XtManageChild(buttonFrame);   XtManageChild(buttonSep);   XtManageChild(appForm);#endif#if 0   XtVaSetValues(topForm, XmNresizePolicy, policy, NULL);#endif   buttonGravity = gravity;} // End SetButtonGravity/*---------------------------------------------------------------------- * Since the stippled cursor looks dumb in every text field, hide it in *    fields without the focus. */static voidTextGainFocus(Widget w, XtPointer, XtPointer){   XtVaSetValues(w, XmNcursorPositionVisible, True, NULL);}

⌨️ 快捷键说明

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