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>
HIDDEN TString __varmask_str;
const TString& TVariable_mask::get(short fld_id) const
{
if (present( fld_id ))
return TMask::get( fld_id );
else
return "";
else
{
__varmask_str.cut(0);
return __varmask_str;
}
}
void TVariable_mask::set_handler(short fld_id, CONTROL_HANDLER handler)
@ -60,19 +65,55 @@ TVariable_mask::TVariable_mask(const char* name, int num, int max) : TMask()
TMask& TVariable_sheet_field::sheet_mask() const
{
TMask& m = TSheet_field::sheet_mask();
TMask & m = TSheet_field::sheet_mask();
const int current = selected();
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;
}
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();
if (_getmask != NULL)
_getmask(0, m, TRUE); // Distrugge la maschera customizzata
}

View File

@ -1,14 +1,14 @@
#ifndef __VARMASK_H
#define __VARMASK_H
#include <mask.h>
#include <msksheet.h>
// @doc EXTERNAL
// @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
@ -40,6 +40,9 @@ class TVariable_mask : public TMask
virtual void enable(short fld_id, bool on = TRUE);
// @cmember Legge il campo da file
virtual TMask_field* parse_field(TScanner& scanner);
// @cmember Distruttore
virtual ~TVariable_mask() {}
};
@ -57,12 +60,13 @@ class TVariable_sheet_field : public TSheet_field
SPREADSHEET_GETMASK _getmask;
protected:
public:
// @cmember Setta il membro <p _set_getmask> con il valore <p n>
void set_getmask(SPREADSHEET_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
virtual TMask& sheet_mask() const;