campo-sirio/include/varmask.cpp
guy 956304d26c Patch level :
Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
array.cpp    Migliorata gestione [] quando non c'e' l'oggetto desiderato
classes.h    Aggiunta CLASS_CURRENCY_FIELD
config.*     Aggiunto metodo for_each_paragraph
controls.cpp BOOLEAN trasformati in bool
currency.*   Reimplementati completamente i TCurrency
date.*       Migliorati operatori aritmetici sulle date
default.url  Modificati identificatori per gestire popup degli sheet
isam.*       Aggiunta gestione flag di modifica e ridotto uso __isam_string
mask.*       Reso pubblico il costruttore vuoto e read_mask
             Aggiunta gestione TCurrency_field
maskfld.*    Aggiornati TCurrency_field
msksheet.cpp Usata read_mask per leggere la maschera degli sheet
multirec.cpp Eliminato memory_leak causato da _fiels.remove
prefix.cpp   Riga vuota
progind.cpp  Corretto aggiornamento in assenza di barra
rdoc.h       Aggiunti campi IMPIANTO e LINEA
real.cpp     Allungata stringa fissa di lavoro da 24 a 64
relapp.cpp   Migliorata gestione /I
relation.cpp Corretta gestione indici dei cursori
strings.cpp  Corretto << dei TObject
tabutil.*    Eliminato uso TRecfield erratissimo
varmask.*    Aggiunto costruttore vuoto
viswin.cpp   Ridotta frequenza di update dell'icona in basso a sinistra
window.cpp   Corretto disegno in modo _pixmap
xvtility.cpp Allungata stringa per status_bar


git-svn-id: svn://10.65.10.50/trunk@7391 c028cbd2-c16b-5b4b-a496-9718f37d4682
1998-11-03 10:27:35 +00:00

111 lines
2.4 KiB
C++
Executable File

#include <varmask.h>
const TString& TVariable_mask::get(short fld_id) const
{
if (present( fld_id ))
return TMask::get( fld_id );
else
return EMPTY_STRING;
}
void TVariable_mask::set_handler(short fld_id, CONTROL_HANDLER handler)
{
if(present( fld_id ))
TMask::set_handler( fld_id, handler );
}
void TVariable_mask::set(short fld_id, const char* str, bool hit )
{
if(present( fld_id ))
TMask::set( fld_id, str, hit );
}
void TVariable_mask::show(short fld_id, bool on )
{
if(present( fld_id ) )
TMask::show( fld_id, on );
}
void TVariable_mask::enable(short fld_id, bool on )
{
if(present( fld_id ))
TMask::enable( fld_id, on );
}
void TVariable_mask::check_field( short fld_id )
{
if (present( fld_id ))
TMask::check_field(fld_id);
}
TMask_field* TVariable_mask::parse_field(TScanner& scanner)
{
if (scanner.key() == "SP")
return new TVariable_sheet_field(this);
return TMask::parse_field(scanner);
}
TVariable_mask::TVariable_mask(const char* name, int num, int max) : TMask()
{
if (name && *name)
read_mask(name, num, max);
}
TMask& TVariable_sheet_field::sheet_mask() const
{
TMask & m = TSheet_field::sheet_mask();
const int current = selected();
if (_getmask != NULL && current >= 0 && current < items())
{
TMask & vm = *_getmask(current, m);
vm.set_sheet((TSheet_field *) this);
return vm;
}
return m;
}
void TVariable_sheet_field::post_insert(int r)
{
if (!active() || _getmask == NULL || r < 0 || r >= items())
return;
const TMask& m = *_getmask(r, TSheet_field::sheet_mask());
for (short id = FIRST_FIELD; id <= _last_column_id ; id++)
{
const int col = cid2index(id);
if (column_enabled(col))
{
int pos = m.id2pos(id);
const int firstpos = pos;
if (pos >= 0)
{
for(int dlg = id; pos >= 0; pos = m.id2pos(dlg += 100))
{
const TMask_field& f = m.fld(pos);
if (f.shown() || f.ghost())
{
const bool on = f.enabled();
enable_cell(r, col, on);
}
break;
}
}
else
disable_cell(r, col);
}
}
}
TVariable_sheet_field::~TVariable_sheet_field()
{
TMask & m = TSheet_field::sheet_mask();
}