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

📄 compleximapfindwinc.c

📁 linux下的E_MAIL客户端源码
💻 C
📖 第 1 页 / 共 2 页
字号:
/* *  $Id: ComplexImapFindWinC.C,v 1.3 2000/08/07 11:05:16 evgeny Exp $ *   *  Copyright (c) 1994 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 "ComplexImapFindWinC.h"#include "IshAppC.h"#include "MainWinC.h"#include "AppPrefC.h"#include "MsgItemC.h"#include "MsgC.h"#include "ImapFolderC.h"#include "ImapServerC.h"#include "Misc.h"#include "ReadWinC.h"#include <hgl/WArgList.h>#include <hgl/RowColC.h>#include <hgl/FieldViewC.h>#include <hgl/VBoxC.h>#include <hgl/TextMisc.h>#include <hgl/rsrc.h>#include <Xm/PushB.h>#include <Xm/TextF.h>#include <Xm/ToggleB.h>#include <Xm/Label.h>/*--------------------------------------------------------------- *  Constructor */ComplexImapFindWinC::ComplexImapFindWinC(Widget parent): HalDialogC("complexImapFindWin", parent){   WArgList	args;   findIndex    = 0;   stateChanged = True;   numList.AllowDuplicates(FALSE);   numList.SetSorted(FALSE);//// Create appForm hierarchy////   RowColC	termRC//   args.Reset();   args.TopAttachment(XmATTACH_FORM);   args.LeftAttachment(XmATTACH_FORM);   args.RightAttachment(XmATTACH_FORM);   args.BottomAttachment(XmATTACH_FORM);   RowColC	*termRC = new RowColC(appForm, "termRC", ARGS);   termRC->Defer(True);//// Set up 2 columns//   termRC->SetOrientation(RcROW_MAJOR);   termRC->SetColCount(2);   termRC->SetColAlignment(XmALIGNMENT_CENTER);   termRC->SetColAlignment(0, XmALIGNMENT_BEGINNING);   termRC->SetColWidthAdjust(RcADJUST_EQUAL);   termRC->SetColWidthAdjust(1, RcADJUST_ATTACH);   termRC->SetColResize(False);   termRC->SetColResize(1, True);//// Create termRC children////   ToggleButton	toTB//   TextField		toTF//   ToggleButton	ccTB//   TextField		ccTF//   ToggleButton	bccTB//   TextField		bccTF//   ToggleButton	fromTB//   TextField		fromTF//   ToggleButton	subjTB//   TextField		subjTF//   ToggleButton	bodyTB//   TextField		bodyTF//   ToggleButton	msgTB//   TextField		msgTF//   ToggleButton	befDateTB//   TextField		befDateTF//   ToggleButton	onDateTB//   TextField		onDateTF//   ToggleButton	aftDateTB//   TextField		aftDateTF//   ToggleButton	recTB//   ToggleButton	notRecTB//   ToggleButton	seenTB//   ToggleButton	notSeenTB//   ToggleButton	repTB//   ToggleButton	notRepTB//   ToggleButton	delTB//   ToggleButton	notDelTB//   toTB      = XmCreateToggleButton(*termRC, "toTB",      0,0);   toTF      = CreateTextField     (*termRC, "toTF",      0,0);   ccTB      = XmCreateToggleButton(*termRC, "ccTB",      0,0);   ccTF      = CreateTextField     (*termRC, "ccTF",      0,0);   bccTB     = XmCreateToggleButton(*termRC, "bccTB",     0,0);   bccTF     = CreateTextField     (*termRC, "bccTF",     0,0);   fromTB    = XmCreateToggleButton(*termRC, "fromTB",    0,0);   fromTF    = CreateTextField     (*termRC, "fromTF",    0,0);   subjTB    = XmCreateToggleButton(*termRC, "subjTB",    0,0);   subjTF    = CreateTextField     (*termRC, "subjTF",    0,0);   bodyTB    = XmCreateToggleButton(*termRC, "bodyTB",    0,0);   bodyTF    = CreateTextField     (*termRC, "bodyTF",    0,0);   msgTB     = XmCreateToggleButton(*termRC, "msgTB",     0,0);   msgTF     = CreateTextField     (*termRC, "msgTF",     0,0);   befDateTB = XmCreateToggleButton(*termRC, "befDateTB", 0,0);   befDateTF = CreateTextField     (*termRC, "befDateTF", 0,0);   onDateTB  = XmCreateToggleButton(*termRC, "onDateTB",  0,0);   onDateTF  = CreateTextField     (*termRC, "onDateTF",  0,0);   aftDateTB = XmCreateToggleButton(*termRC, "aftDateTB", 0,0);   aftDateTF = CreateTextField     (*termRC, "aftDateTF", 0,0);   recTB     = XmCreateToggleButton(*termRC, "recTB",     0,0);   notRecTB  = XmCreateToggleButton(*termRC, "notRecTB",  0,0);   seenTB    = XmCreateToggleButton(*termRC, "seenTB",    0,0);   notSeenTB = XmCreateToggleButton(*termRC, "notSeenTB", 0,0);   repTB     = XmCreateToggleButton(*termRC, "repTB",     0,0);   notRepTB  = XmCreateToggleButton(*termRC, "notRepTB",  0,0);   delTB     = XmCreateToggleButton(*termRC, "delTB",     0,0);   notDelTB  = XmCreateToggleButton(*termRC, "notDelTB",  0,0);   AddValueChanged(toTF,      AutoSelect,   toTB);   AddValueChanged(ccTF,      AutoSelect,   ccTB);   AddValueChanged(bccTF,     AutoSelect,   bccTB);   AddValueChanged(fromTF,    AutoSelect,   fromTB);   AddValueChanged(subjTF,    AutoSelect,   subjTB);   AddValueChanged(bodyTF,    AutoSelect,   bodyTB);   AddValueChanged(msgTF,     AutoSelect,   msgTB);   AddValueChanged(befDateTF, AutoSelect,   befDateTB);   AddValueChanged(onDateTF,  AutoSelect,   onDateTB);   AddValueChanged(aftDateTF, AutoSelect,   aftDateTB);   AddValueChanged(recTB,     AutoDeselect, notRecTB);   AddValueChanged(notRecTB,  AutoDeselect, recTB);   AddValueChanged(seenTB,    AutoDeselect, notSeenTB);   AddValueChanged(notSeenTB, AutoDeselect, seenTB);   AddValueChanged(repTB,     AutoDeselect, notRepTB);   AddValueChanged(notRepTB,  AutoDeselect, repTB);   AddValueChanged(delTB,     AutoDeselect, notDelTB);   AddValueChanged(notDelTB,  AutoDeselect, delTB);   AddValueChanged(toTF,      StateChanged, this);   AddValueChanged(ccTF,      StateChanged, this);   AddValueChanged(bccTF,     StateChanged, this);   AddValueChanged(fromTF,    StateChanged, this);   AddValueChanged(subjTF,    StateChanged, this);   AddValueChanged(bodyTF,    StateChanged, this);   AddValueChanged(msgTF,     StateChanged, this);   AddValueChanged(befDateTF, StateChanged, this);   AddValueChanged(onDateTF,  StateChanged, this);   AddValueChanged(aftDateTF, StateChanged, this);   AddValueChanged(toTB,      StateChanged, this);   AddValueChanged(ccTB,      StateChanged, this);   AddValueChanged(bccTB,     StateChanged, this);   AddValueChanged(fromTB,    StateChanged, this);   AddValueChanged(subjTB,    StateChanged, this);   AddValueChanged(bodyTB,    StateChanged, this);   AddValueChanged(msgTB,     StateChanged, this);   AddValueChanged(befDateTB, StateChanged, this);   AddValueChanged(onDateTB,  StateChanged, this);   AddValueChanged(aftDateTB, StateChanged, this);   AddValueChanged(recTB,     StateChanged, this);   AddValueChanged(notRecTB,  StateChanged, this);   AddValueChanged(seenTB,    StateChanged, this);   AddValueChanged(notSeenTB, StateChanged, this);   AddValueChanged(repTB,     StateChanged, this);   AddValueChanged(notRepTB,  StateChanged, this);   AddValueChanged(delTB,     StateChanged, this);   AddValueChanged(notDelTB,  StateChanged, this);   int	wcount = 0;   Widget	wlist[30];   wlist[wcount++] = toTB;   wlist[wcount++] = toTF;   wlist[wcount++] = ccTB;   wlist[wcount++] = ccTF;   wlist[wcount++] = bccTB;   wlist[wcount++] = bccTF;   wlist[wcount++] = fromTB;   wlist[wcount++] = fromTF;   wlist[wcount++] = subjTB;   wlist[wcount++] = subjTF;   wlist[wcount++] = bodyTB;   wlist[wcount++] = bodyTF;   wlist[wcount++] = msgTB;   wlist[wcount++] = msgTF;   wlist[wcount++] = befDateTB;   wlist[wcount++] = befDateTF;   wlist[wcount++] = onDateTB;   wlist[wcount++] = onDateTF;   wlist[wcount++] = aftDateTB;   wlist[wcount++] = aftDateTF;   wlist[wcount++] = recTB;   wlist[wcount++] = notRecTB;   wlist[wcount++] = seenTB;   wlist[wcount++] = notSeenTB;   wlist[wcount++] = repTB;   wlist[wcount++] = notRepTB;   wlist[wcount++] = delTB;   wlist[wcount++] = notDelTB;   termRC->SetChildren(wlist, wcount);   termRC->Defer(False);   XtManageChild(*termRC);	// termForm children//// Add buttons//   AddButtonBox();   Widget findNextPB = XmCreatePushButton(buttonRC, "findNextPB", ARGS);   Widget findPrevPB = XmCreatePushButton(buttonRC, "findPrevPB", ARGS);   Widget findAllPB  = XmCreatePushButton(buttonRC, "findAllPB",  ARGS);   Widget clearPB    = XmCreatePushButton(buttonRC, "clearPB",    ARGS);   Widget donePB     = XmCreatePushButton(buttonRC, "donePB",     ARGS);   Widget helpPB     = XmCreatePushButton(buttonRC, "helpPB",     ARGS);   wcount = 0;   wlist[wcount++] = findNextPB;   wlist[wcount++] = findPrevPB;   wlist[wcount++] = findAllPB;   wlist[wcount++] = clearPB;   wlist[wcount++] = donePB;   wlist[wcount++] = helpPB;   XtManageChildren(wlist, wcount);   AddActivate(findNextPB, DoFindNext, this);   AddActivate(findPrevPB, DoFindPrev, this);   AddActivate(findAllPB,  DoFindAll,  this);   AddActivate(clearPB,    DoClear,    this);   AddActivate(donePB,     DoHide,     this);   AddActivate(helpPB,     HalAppC::DoHelp, "helpcard");   ShowInfoMsg();		// Add message line   HandleHelp();} // End constructor/*--------------------------------------------------------------- *  Method to display dialog */voidComplexImapFindWinC::Show(){   findIndex = 0;   HalDialogC::Show();}/*--------------------------------------------------------------- *  Callback to auto select toggle button when text field changes */voidComplexImapFindWinC::AutoSelect(Widget tf, Widget tb, XtPointer){   XmToggleButtonSetState(tb, XmTextFieldGetLastPosition(tf) > 0, True);}/*--------------------------------------------------------------- *  Callback to auto deselect a toggle button when another toggle button *     is pressed */voidComplexImapFindWinC::AutoDeselect(Widget, Widget tb2,				  XmToggleButtonCallbackStruct *tb1){   if ( tb1->set )      XmToggleButtonSetState(tb2, False, True);}/*--------------------------------------------------------------- *  Callback to update stateChanged flag */voidComplexImapFindWinC::StateChanged(Widget, ComplexImapFindWinC *This, XtPointer){   This->stateChanged = True;}/*--------------------------------------------------------------- *  Callback routine to handle press of find next */voidComplexImapFindWinC::DoFindNext(Widget, ComplexImapFindWinC *This, XtPointer){   This->ClearMessage();   ishApp->mainWin->BusyCursor(True);   if ( This->stateChanged )      if ( !This->GetNumList() ) return;   VBoxC&	vbox    = ishApp->mainWin->MsgVBox();   VItemListC&	msgList = vbox.VisItems();   u_int	count   = msgList.size();//// If there is a single selected message, use that as the start index//   int		start;   VItemListC&	selList = ishApp->mainWin->MsgVBox().SelItems();   if ( selList.size() == 1 ) {      VItemC	*vi = selList[0];      start = msgList.indexOf(vi) + 1;      if ( start >= count ) start = 0;   }   else      start = This->findIndex;//// Loop from the start position to the end of the list and look for the//    next message whose number appears in the IMAP number list//   Boolean	found = False;   MsgItemC	*item;   int	index;   for (index=start; !found && index<count; index++) {      item = (MsgItemC*)msgList[index];      found = This->numList.includes(item->msg->Number());   }//// Loop from the beginning of the list to the start position

⌨️ 快捷键说明

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