campo-sirio/include/varmask.cpp
guy c09ac8f7a7 mask.h Tolto membro int _sheets che teneva il conto degli
spreadsheets contenuti in una maschera che richiedeva di
             essere aggiornato da tutte le maschere derivate
mask.cpp     Modificato metodo sheets() che conta gli sheet presenti
             semplificando la vita alle maschere derivate
             Gestione menu di modifica
msksheet.cpp Adeguato uso del metodo TMask::sheets()
varmask.h    Modificata indentazione
varmask.cpp  Adeguato uso del metodo TMask::sheets()
             Tolta stringa statica var_mask_str
maskfld.*    Tolti metodi obsoleti on_clipboard


git-svn-id: svn://10.65.10.50/trunk@6042 c028cbd2-c16b-5b4b-a496-9718f37d4682
1998-01-28 08:45:59 +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();
}