Patch level : 10.0 916

Files correlati     : ci2.exe
Ricompilazione Demo : [ ]
Commento            :

Aggiunti i metodi per cambiare la dimensione di una colonna di un sheet


git-svn-id: svn://10.65.10.50/branches/R_10_00@21606 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2011-02-09 00:17:50 +00:00
parent 7b54bcbb0c
commit f4e02b3f68
2 changed files with 50 additions and 1 deletions

View File

@ -324,11 +324,15 @@ public:
// @cmember Salva la disposizione delle colonne
void load_columns_order();
// @cmember Setta la disposizione delle colonne
void set_columns_order();
// @cmember Setta la disposizione delle colonne
void set_columns_order(TToken_string* order);
static int set_line_number_width(int digits);
// @cmember Setta la larghezza della colonna
void set_column_width(const int col, const int width) const;
// @cmember Aggiorna la larghezza di default della colonna
void update_column_default_width(const int col) const;
// @cmember Setta il titolo della colonna
void set_column_header(const int col, const TString& header) const;
// @cmember Getta il titolo della colonna
@ -2237,6 +2241,25 @@ void TSpreadsheet::set_column_width(const int col, const int width) const
xi_set_column_width(column, width); // Force redraw
}
void TSpreadsheet::update_column_default_width(const int col) const
{
XI_OBJ* column = find_column(col);
if (column)
{
XI_RCT rct; xi_get_rect(column, &rct);
int cid = col;
if (cid >= FIRST_FIELD+100) // Riportalo nel range 101 - 199
cid = FIRST_FIELD + cid2index(cid);
int num;
XI_OBJ** column = xi_get_member_list(_obj, &num);
for (int c = num-1; c > 0; c--)
{
if (column[c]->cid == cid)
((TSpreadsheet *)this)->_default_width[c] = rct.right - rct.left;
}
}
}
void TSpreadsheet::set_column_header(const int col, const TString& header) const
{
XI_OBJ* column = find_column(col);
@ -2343,6 +2366,16 @@ void TSpreadsheet::load_columns_order()
set_columns_order(&order);
}
void TSpreadsheet::set_columns_order()
{
TFilename parag; field2parag(owner(), parag);
TConfig config(CONFIG_USER, parag);
const int index = owner().dlg();
TToken_string order(config.get("Browse", NULL, index));
if (!order.empty_items())
set_columns_order(&order);
}
void TSpreadsheet::set_columns_order(TToken_string* order)
{
XI_OBJ* itf = get_interface();
@ -2737,7 +2770,6 @@ void TSheet_field::create(WINDOW parent)
((TSpreadsheet*)_ctl)->load_columns_order();
}
// Certified 100%
TString_array& TSheet_field::rows_array() const
{
@ -2960,6 +2992,13 @@ void TSheet_field::set_columns_order(TToken_string* order)
s->set_columns_order(order);
}
void TSheet_field::set_columns_order()
{
TSpreadsheet* s = (TSpreadsheet*)_ctl;
s->set_columns_order(NULL);
s->set_columns_order();
}
const char* TSheet_field::get_column_header( const int col) const
{
TSpreadsheet* s = (TSpreadsheet*)_ctl;
@ -3009,6 +3048,12 @@ void TSheet_field::set_column_width( const int col, const int width ) const
s->set_column_width(col, width);
}
void TSheet_field::update_column_width( const int col) const
{
TSpreadsheet* s = (TSpreadsheet*)_ctl;
s->update_column_default_width(col);
}
void TSheet_field::set_column_header( const int col, const TString& header ) const
{
TSpreadsheet* s = (TSpreadsheet*)_ctl;

View File

@ -243,6 +243,8 @@ public:
static int set_line_number_width(int width = 3);
// @cmember Setta la larghezza della colonna
void set_column_width( const int col, const int width ) const;
// @cmember aggiorna la larghezza della colonna
void update_column_width( const int col) const;
// @cmember Setta il titolo della colonna
void set_column_header( const int col, const TString& header ) const;
// @cmember Getta il titolo della colonna
@ -256,6 +258,8 @@ public:
// @cmember Memorizza la disposizione delle colonne
void save_columns_order();
// @cmember Imposta la disposizione delle colonne
void set_columns_order();
// @cmember Imposta la disposizione delle colonne
void set_columns_order(TToken_string* order);
// @cmember Dispone le colonne come all'atto del caricamento
void reset_columns_order();