📄 sumprefwinc.c
字号:
/* * $Id: SumPrefWinC.C,v 1.3 2000/05/07 12:26:13 fnevgeny 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 "SumPrefWinC.h"#include "SumPrefC.h"#include "IshAppC.h"#include "MainWinC.h"#include "UndelWinC.h"#include <hgl/WArgList.h>#include <hgl/rsrc.h>#include <hgl/FieldViewC.h>#include <hgl/RowColC.h>#include <hgl/TextMisc.h>#include <Xm/Label.h>#include <Xm/ToggleB.h>#include <Xm/TextF.h>#include <Xm/Separator.h>#include <Xm/Form.h>static StringC *intStr = NULL;inline char *StringOf(int I) { if ( !intStr ) intStr = new StringC; intStr->Clear(); *intStr += (I); return *intStr;}inline char *FieldOf(int I) { return ( (I) == 0 ) ? (char *) "" : StringOf(I);}/*--------------------------------------------------------------- * Main window constructor */ // historical nameSumPrefWinC::SumPrefWinC(Widget par) : OptWinC(par, "summaryWin"){ WArgList args;//// Create appForm hierarchy//// appForm// RowColC fieldRC// ToggleButton iconTB// Form dateFormatForm// args.Reset(); args.LeftAttachment(XmATTACH_FORM); args.RightAttachment(XmATTACH_FORM); args.TopAttachment(XmATTACH_FORM); args.BottomAttachment(XmATTACH_NONE); RowColC *fieldRC = new RowColC(appForm, "fieldRC", ARGS); args.Reset(); args.TopAttachment(XmATTACH_WIDGET, *fieldRC); args.LeftAttachment(XmATTACH_FORM); args.RightAttachment(XmATTACH_NONE); args.BottomAttachment(XmATTACH_NONE); iconTB = XmCreateToggleButton(appForm, "iconTB", ARGS); args.Reset(); args.TopAttachment(XmATTACH_WIDGET, iconTB); args.LeftAttachment(XmATTACH_FORM); args.RightAttachment(XmATTACH_FORM); args.BottomAttachment(XmATTACH_NONE); Widget dateFormatForm = XmCreateForm(appForm, "dateFormatForm", ARGS);//// Use row-major layout with 5 columns// fieldRC->Defer(True); fieldRC->SetOrientation(RcROW_MAJOR); fieldRC->SetColCount(9);//// Center all columns// fieldRC->SetColAlignment(XmALIGNMENT_CENTER);//// Leave the widget sizes alone for all columns except the first and last.// fieldRC->SetColWidthAdjust(RcADJUST_NONE); fieldRC->SetColWidthAdjust(0, RcADJUST_EQUAL); fieldRC->SetColWidthAdjust(8, RcADJUST_ATTACH);//// Allow only the last column to be resized// fieldRC->SetColResize(False); fieldRC->SetColResize(8, True);//// Create the first row//// Label fieldTitle// Separator titleSep1// Label posTitle// Separator titleSep2// Label minTitle// Separator titleSep3// Label maxTitle// Separator titleSep4// Label titleTitle// args.Reset(); args.Alignment(XmALIGNMENT_CENTER); Widget fieldTitle = XmCreateLabel(*fieldRC, "fieldTitle", ARGS); Widget posTitle = XmCreateLabel(*fieldRC, "posTitle", ARGS); Widget minTitle = XmCreateLabel(*fieldRC, "minTitle", ARGS); Widget maxTitle = XmCreateLabel(*fieldRC, "maxTitle", ARGS); Widget titleTitle = XmCreateLabel(*fieldRC, "titleTitle", ARGS); args.Reset(); args.Orientation(XmVERTICAL); Widget titleSep1 = XmCreateSeparator(*fieldRC, "titleSep1", ARGS); Widget titleSep2 = XmCreateSeparator(*fieldRC, "titleSep2", ARGS); Widget titleSep3 = XmCreateSeparator(*fieldRC, "titleSep3", ARGS); Widget titleSep4 = XmCreateSeparator(*fieldRC, "titleSep4", ARGS);//// Create the 2nd (number) row//// ToggleButton numberTB// TextField numberPosTF// TextField numberMinTF// TextField numberMaxTF// TextField numberTitleTF// numberTB = XmCreateToggleButton(*fieldRC, "numberTB", 0,0); numberPosTF = CreateTextField (*fieldRC, "posTF", 0,0); numberMinTF = CreateTextField (*fieldRC, "minTF", 0,0); numberMaxTF = CreateTextField (*fieldRC, "maxTF", 0,0); numberTitleTF = CreateTextField (*fieldRC, "titleTF", 0,0);//// Create the 3rd (status) row//// ToggleButton statusTB// TextField statusPosTF// TextField statusMinTF// TextField statusMaxTF// TextField statusTitleTF// statusTB = XmCreateToggleButton(*fieldRC, "statusTB", 0,0); statusPosTF = CreateTextField (*fieldRC, "posTF", 0,0); statusMinTF = CreateTextField (*fieldRC, "minTF", 0,0); statusMaxTF = CreateTextField (*fieldRC, "maxTF", 0,0); statusTitleTF = CreateTextField (*fieldRC, "titleTF", 0,0);//// Create the 4th (sender) row//// ToggleButton senderTB// TextField senderPosTF// TextField senderMinTF// TextField senderMaxTF// TextField senderTitleTF// senderTB = XmCreateToggleButton(*fieldRC, "senderTB", 0,0); senderPosTF = CreateTextField (*fieldRC, "posTF", 0,0); senderMinTF = CreateTextField (*fieldRC, "minTF", 0,0); senderMaxTF = CreateTextField (*fieldRC, "maxTF", 0,0); senderTitleTF = CreateTextField (*fieldRC, "titleTF", 0,0);//// Create the 5th (subject) row//// ToggleButton subjectTB// TextField subjectPosTF// TextField subjectMinTF// TextField subjectMaxTF// TextField subjectTitleTF// subjectTB = XmCreateToggleButton(*fieldRC, "subjectTB", 0,0); subjectPosTF = CreateTextField (*fieldRC, "posTF", 0,0); subjectMinTF = CreateTextField (*fieldRC, "minTF", 0,0); subjectMaxTF = CreateTextField (*fieldRC, "maxTF", 0,0); subjectTitleTF = CreateTextField (*fieldRC, "titleTF", 0,0);//// Create the 6th (date) row//// ToggleButton dateTB// TextField datePosTF// TextField dateMinTF// TextField dateMaxTF// TextField dateTitleTF// dateTB = XmCreateToggleButton(*fieldRC, "dateTB", 0,0); datePosTF = CreateTextField (*fieldRC, "posTF", 0,0); dateMinTF = CreateTextField (*fieldRC, "minTF", 0,0); dateMaxTF = CreateTextField (*fieldRC, "maxTF", 0,0); dateTitleTF = CreateTextField (*fieldRC, "titleTF", 0,0);//// Create the 7th (line) row//// ToggleButton lineTB// TextField linePosTF// TextField lineMinTF// TextField lineMaxTF// TextField lineTitleTF// lineTB = XmCreateToggleButton(*fieldRC, "lineTB", 0,0); linePosTF = CreateTextField (*fieldRC, "posTF", 0,0); lineMinTF = CreateTextField (*fieldRC, "minTF", 0,0); lineMaxTF = CreateTextField (*fieldRC, "maxTF", 0,0); lineTitleTF = CreateTextField (*fieldRC, "titleTF", 0,0);//// Create the 8th (byte) row//// ToggleButton byteTB// TextField bytePosTF// TextField byteMinTF// TextField byteMaxTF// TextField byteTitleTF// byteTB = XmCreateToggleButton(*fieldRC, "byteTB", 0,0); bytePosTF = CreateTextField (*fieldRC, "posTF", 0,0); byteMinTF = CreateTextField (*fieldRC, "minTF", 0,0); byteMaxTF = CreateTextField (*fieldRC, "maxTF", 0,0); byteTitleTF = CreateTextField (*fieldRC, "titleTF", 0,0);//// Manage widgets// Widget wlist[10]; wlist[0] = fieldTitle; wlist[1] = titleSep1; wlist[2] = posTitle; wlist[3] = titleSep2; wlist[4] = minTitle; wlist[5] = titleSep3; wlist[6] = maxTitle; wlist[7] = titleSep4; wlist[8] = titleTitle; fieldRC->AddChildren(wlist, 9); wlist[0] = numberTB; wlist[1] = NULL; wlist[2] = numberPosTF; wlist[3] = NULL; wlist[4] = numberMinTF; wlist[5] = NULL; wlist[6] = numberMaxTF; wlist[7] = NULL; wlist[8] = numberTitleTF; fieldRC->AddChildren(wlist, 9); wlist[0] = statusTB; wlist[1] = NULL; wlist[2] = statusPosTF; wlist[3] = NULL; wlist[4] = statusMinTF; wlist[5] = NULL; wlist[6] = statusMaxTF; wlist[7] = NULL; wlist[8] = statusTitleTF; fieldRC->AddChildren(wlist, 9); wlist[0] = senderTB; wlist[1] = NULL; wlist[2] = senderPosTF; wlist[3] = NULL; wlist[4] = senderMinTF; wlist[5] = NULL; wlist[6] = senderMaxTF; wlist[7] = NULL; wlist[8] = senderTitleTF; fieldRC->AddChildren(wlist, 9); wlist[0] = subjectTB; wlist[1] = NULL; wlist[2] = subjectPosTF; wlist[3] = NULL; wlist[4] = subjectMinTF; wlist[5] = NULL; wlist[6] = subjectMaxTF; wlist[7] = NULL; wlist[8] = subjectTitleTF; fieldRC->AddChildren(wlist, 9); wlist[0] = dateTB; wlist[1] = NULL;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -