Aggiunto funzione membro public:

TSheet_control::align_column(int c, bool right)
per permettere al costruttore TCursor_sheet::TCursor_sheet
di settare l'allineamento a destra delle colonne int,long o real


git-svn-id: svn://10.65.10.50/trunk@4126 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luciano 1997-02-10 16:03:10 +00:00
parent 92217b167a
commit 8b10f609ff

View File

@ -73,7 +73,8 @@ public:
bool row_enabled(long n) const { return _disabled[n] == FALSE; } bool row_enabled(long n) const { return _disabled[n] == FALSE; }
bool one_enabled() const { return _disabled.ones() < _sheet->items(); } bool one_enabled() const { return _disabled.ones() < _sheet->items(); }
byte& column_type(int c) { CHECKD(c >= 0 && c < MAX_COL, "Bad column ", c); return _type[c]; } byte column_type(int c) const { CHECKD(c >= 0 && c < MAX_COL, "Bad column ", c); return _type[c]; }
void align_column(int c, bool right);
void set_columns_order(TToken_string* order); void set_columns_order(TToken_string* order);
void save_columns_order(const TMask_field& f) const; void save_columns_order(const TMask_field& f) const;
@ -585,6 +586,19 @@ void TSheet_control::load_columns_order(const TMask_field& field)
_save_columns_order = FALSE; _save_columns_order = FALSE;
} }
void TSheet_control::align_column(int c, bool right)
{
XI_OBJ* column = find_column(c);
CHECK(column, "Can't find numeric column");
dword attr = xi_get_attrib(column);
if (right)
attr |= XI_ATR_RJUST;
else
attr &= ~XI_ATR_RJUST;
xi_set_attrib(column, attr);
_type[c] = right ? 'R' : ' ';
}
void TSheet_control::set_columns_order(TToken_string* order) void TSheet_control::set_columns_order(TToken_string* order)
{ {
XI_OBJ* itf = get_interface(); XI_OBJ* itf = get_interface();
@ -1206,8 +1220,9 @@ TCursor_sheet::TCursor_sheet(TCursor* cursor, const char* fields,
const TFieldtypes tipo = rf->type(); const TFieldtypes tipo = rf->type();
if (tipo == _intfld || tipo == _longfld || tipo == _realfld) if (tipo == _intfld || tipo == _longfld || tipo == _realfld)
{ {
byte& c = sheet().column_type(campo); byte c = sheet().column_type(campo);
if (c == '\0') c = 'R'; // Allinea a destra tutti i campi numerici if (c == ' ')
sheet().align_column(campo, TRUE);
} }
} }
} }