Cazzatine varie

git-svn-id: svn://10.65.10.50/trunk@3526 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1996-09-05 14:14:31 +00:00
parent 64fc84dbd0
commit 4229abb2c4
2 changed files with 56 additions and 11 deletions

View File

@ -1,12 +1,17 @@
#include <varmask.h> #include <varmask.h>
#include <utility.h> #include <utility.h>
HIDDEN TString __varmask_str;
const TString& TVariable_mask::get(short fld_id) const const TString& TVariable_mask::get(short fld_id) const
{ {
if (present( fld_id )) if (present( fld_id ))
return TMask::get( fld_id ); return TMask::get( fld_id );
else else
return ""; {
__varmask_str.cut(0);
return __varmask_str;
}
} }
void TVariable_mask::set_handler(short fld_id, CONTROL_HANDLER handler) void TVariable_mask::set_handler(short fld_id, CONTROL_HANDLER handler)
@ -64,15 +69,51 @@ TMask& TVariable_sheet_field::sheet_mask() const
const int current = selected(); const int current = selected();
if (_getmask != NULL && current >= 0 && current < items()) if (_getmask != NULL && current >= 0 && current < items())
return *_getmask(current, m, FALSE); {
TMask & vm = *_getmask(current, m);
vm.set_sheet((TSheet_field *) this);
return vm;
}
return m; 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() TVariable_sheet_field::~TVariable_sheet_field()
{ {
TMask & m = TSheet_field::sheet_mask(); TMask & m = TSheet_field::sheet_mask();
if (_getmask != NULL)
_getmask(0, m, TRUE); // Distrugge la maschera customizzata
} }

View File

@ -8,7 +8,7 @@
// @doc EXTERNAL // @doc EXTERNAL
// @type SPREADSHEET_GETMASK | Prototipo funzione che ritorna una maschera di edit diversa a seconda della riga // @type SPREADSHEET_GETMASK | Prototipo funzione che ritorna una maschera di edit diversa a seconda della riga
typedef TMask* (*SPREADSHEET_GETMASK)( int numriga, TMask& fullmask, bool destroy ); typedef TMask* (*SPREADSHEET_GETMASK)( int numriga, TMask& fullmask);
// @doc EXTERNAL // @doc EXTERNAL
@ -40,6 +40,9 @@ class TVariable_mask : public TMask
virtual void enable(short fld_id, bool on = TRUE); virtual void enable(short fld_id, bool on = TRUE);
// @cmember Legge il campo da file // @cmember Legge il campo da file
virtual TMask_field* parse_field(TScanner& scanner); virtual TMask_field* parse_field(TScanner& scanner);
// @cmember Distruttore
virtual ~TVariable_mask() {}
}; };
@ -58,11 +61,12 @@ class TVariable_sheet_field : public TSheet_field
protected: protected:
public: public:
// @cmember Setta il membro <p _set_getmask> con il valore <p n> // @cmember Setta il membro <p _set_getmask> con il valore <p n>
void set_getmask(SPREADSHEET_GETMASK n) void set_getmask(SPREADSHEET_GETMASK n)
{ _getmask = n; } { _getmask = n; }
// @cmember Funzione eseguita dopo ogni insert
virtual void post_insert(int r);
// @cmember Ritorna la maschera corrispondente ad una riga dello spreadsheet // @cmember Ritorna la maschera corrispondente ad una riga dello spreadsheet
virtual TMask& sheet_mask() const; virtual TMask& sheet_mask() const;