home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
g
/
gina15.zip
/
demos
/
sleuth
/
ZatDialog.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-02-27
|
4KB
|
167 lines
// This may look like C code, but it is really -*- C++ -*-
// Module : ZatDialog.C Version 1.2
// LastSCCS : 2/26/92 16:38:24
// LastEdit : "Tue Nov 5 14:53:11 1991"
// Description :
// Author :
// Copyright : GMD Schloss Birlinghoven
#include <ctype.h>
ZatDialog::
ZatDialog(SleuthDocument *p_document)
: UpdatedDialog(True), document(p_document), view(p_document)
{
}
void ZatDialog::
Update()
{
if( ! document->IsRegistered(&view) )
document->AddCardView(&view);
int i;
int value = document->GetZatParameterDialog()->GetNumQuestions();
if( value == 0 )
for( i = 0; i < 5; i++)
questions[i].unmanage();
else {
for( i = 0; i < value; i++)
questions[i].manage();
for( i = value; i < 5; i++)
questions[i].unmanage();
}
game_name.setR_value(document->GetGameName());
game_name.SetValues();
strstream stream;
stream << document->GetRound() << '\0';
round.setR_value(stream.str());
round.SetValues();
player_name.setR_value(document->GetParticipant());
player_name.SetValues();
}
void ZatDialog::
Mapped()
{
document->GetZatParameterDialog()->Update();
}
void ZatDialog::
Unmapped()
{
document->GetZatParameterDialog()->Update();
}
void ZatDialog::
NewGameName(caddr_t)
{
document->SetGameName(game_name.get_string(), False);
}
void ZatDialog::
NewParticipant(caddr_t)
{
document->SetParticipant(player_name.get_string(), False);
}
void ZatDialog::
NoWhiteSpaceInString(caddr_t call_data)
{
XmTextVerifyCallbackStruct *cbs = (XmTextVerifyCallbackStruct *)call_data;
for(int i = 0; i < cbs->text->length; i++)
if(isspace(cbs->text->ptr[i])) {
cbs->doit = False;
return;
}
cbs->doit = True;
}
void ZatDialog::
before_create(GnWidget *)
{
setR_dialogTitle(DialogTitle());
setR_noResize(True);
setR_resizePolicy(XmRESIZE_ANY);
}
void ZatDialog::
after_create()
{
UpdatedDialog::after_create();
game_name.setR_labelString("Spiel: ");
game_name.setR_columns(35);
game_name.setR_topAttachment(XmATTACH_FORM);
game_name.setR_leftAttachment(XmATTACH_FORM);
game_name.create(this, "gameName");
game_name.add_activateCallback(CALLBACK(ZatDialog, NewGameName, this));
game_name.add_modifyVerifyCallback(CALLBACK(ZatDialog,
NoWhiteSpaceInString, this));
round.setR_labelString("Runde: ");
round.setR_columns(35);
round.setR_topAttachment(XmATTACH_WIDGET);
round.setR_topWidget(game_name);
round.setR_leftAttachment(XmATTACH_FORM);
round.create(this, "round");
player_name.setR_labelString("Spieler: ");
player_name.setR_columns(35);
player_name.setR_topAttachment(XmATTACH_WIDGET);
player_name.setR_topWidget(round);
player_name.setR_leftAttachment(XmATTACH_FORM);
player_name.create(this, "playerName");
player_name.add_activateCallback(CALLBACK(ZatDialog,NewParticipant, this));
date.setR_labelString("Datum: ");
date.setR_columns(35);
date.setR_topAttachment(XmATTACH_WIDGET);
date.setR_topWidget(player_name);
date.setR_leftAttachment(XmATTACH_FORM);
date.create(this, "date");
GnSeparator *separator = new GnSeparator;
separator->setR_topAttachment(XmATTACH_WIDGET);
separator->setR_topWidget(date);
separator->setR_topOffset(10);
separator->setR_leftAttachment(XmATTACH_FORM);
separator->setR_rightAttachment(XmATTACH_FORM);
separator->create(this, "sepp");
row_for_questions.setR_topAttachment(XmATTACH_WIDGET);
row_for_questions.setR_topWidget(separator);
row_for_questions.setR_topOffset(10);
row_for_questions.setR_leftAttachment(XmATTACH_FORM);
row_for_questions.setR_marginWidth(0);
row_for_questions.create(this, "rowForQuestions");
questions[0].setR_labelString("Frage: ");
questions[1].setR_labelString("Ersatzfrage: ");
questions[2].setR_labelString("2. Ersatzfrage:");
questions[3].setR_labelString("3. Ersatzfrage:");
questions[4].setR_labelString("4. Ersatzfrage:");
for( int i = 0; i < 5; i++ ) {
questions[i].setR_columns(35);
questions[i].create(row_for_questions, "question");
if( i >= 2 )
questions[i].unmanage();
}
view.setR_topAttachment(XmATTACH_WIDGET);
view.setR_topWidget(row_for_questions);
view.setR_leftAttachment(XmATTACH_FORM);
view.create(this, "view");
}