Aggiunto supporto della versione 4.0e di XI
git-svn-id: svn://10.65.10.50/trunk@5792 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
3e793a4cab
commit
e74646805d
@ -34,6 +34,9 @@ typedef struct _stx_data
|
||||
int cid;
|
||||
WINDOW win;
|
||||
RCT rct;
|
||||
#ifdef XI_R4
|
||||
RCT edit_rct;
|
||||
#endif
|
||||
unsigned long attrib;
|
||||
} STX_DATA;
|
||||
|
||||
@ -200,7 +203,12 @@ XVT_FNTID xvt_load_default_font()
|
||||
return font;
|
||||
}
|
||||
|
||||
#ifdef XI_R4
|
||||
static byte event_map[XIE_XVT_POST_EVENT+1];
|
||||
#else
|
||||
static byte event_map[XIE_POST_NAVIGATION+1];
|
||||
#endif
|
||||
|
||||
enum event_action { a_ignore, a_xvt, a_xvt_post, a_obj, a_child, a_update, a_select, a_post, a_debug };
|
||||
|
||||
HIDDEN void set_default_palette(WINDOW win)
|
||||
@ -267,6 +275,7 @@ void customize_colors()
|
||||
xi_set_pref(XI_PREF_COLOR_CTRL, MASK_BACK_COLOR);
|
||||
xi_set_pref(XI_PREF_COLOR_DARK, MASK_DARK_COLOR);
|
||||
xi_set_pref(XI_PREF_COLOR_DISABLED, DISABLED_COLOR);
|
||||
xi_set_pref(XI_PREF_COMBO_ICON, COMBO_ICON);
|
||||
|
||||
BTN_BACK_COLOR = colors.get_color("ButtonBack", NULL, -1, BTN_BACK_COLOR);
|
||||
aga_set_pref(AGA_PREF_BTN_COLOR_CTRL, BTN_BACK_COLOR);
|
||||
@ -408,7 +417,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
||||
CHECK(win, "Can't create an XVT window for an interface");
|
||||
set_default_palette(win);
|
||||
|
||||
XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, &r, (char*)caption, (long)msk);
|
||||
XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, (XinRect *) &r, (char*)caption, (long)msk);
|
||||
CHECK(def, "Can't define an interface");
|
||||
|
||||
def->v.itf->automatic_back_color = FALSE;
|
||||
@ -426,17 +435,17 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
||||
if (Y_FU_MULTIPLE == 0)
|
||||
{
|
||||
RCT max; xvt_vobj_get_client_rect(TASK_WIN, &max);
|
||||
xi_pu_to_fu(itf, (PNT*)&max, 2);
|
||||
xi_pu_to_fu(itf, (XinPoint *) &max, 2);
|
||||
X_FU_MULTIPLE = max.right / 80;
|
||||
Y_FU_MULTIPLE = max.bottom / 25;
|
||||
}
|
||||
|
||||
if (dx > 0)
|
||||
{
|
||||
xi_pu_to_fu(itf, (PNT*)&r, 2);
|
||||
xi_pu_to_fu(itf, (XinPoint *) &r, 2);
|
||||
r.right = r.left + (dx+1) * XI_FU_MULTIPLE;
|
||||
r.bottom = r.top + (dy+1) * Y_FU_MULTIPLE;
|
||||
xi_fu_to_pu(itf, (PNT*)&r, 2);
|
||||
xi_fu_to_pu(itf, (XinPoint *) &r, 2);
|
||||
xvt_vobj_move(win, &r);
|
||||
}
|
||||
|
||||
@ -449,7 +458,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
||||
CHECK(obj, "Can't create page rectangle");
|
||||
|
||||
// Fa coincidere esattamente il rettangolo con la finestra che lo contiene
|
||||
RCT& rect = obj->v.rect->rct;
|
||||
RCT& rect = (RCT &) obj->v.rect->rct;
|
||||
const int oldy = rect.top;
|
||||
xvt_vobj_get_client_rect(win, &rect);
|
||||
rect.top = oldy;
|
||||
@ -468,7 +477,7 @@ void attach_interface(WINDOW win, COLOR back)
|
||||
xvt_vobj_translate_points(win, wp, (PNT*)&rc, 2);
|
||||
char caption[80]; xvt_vobj_get_title(win, caption, 80);
|
||||
TWindow* parent = (TWindow*)xvt_vobj_get_data(win);
|
||||
XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, &rc, caption, (long)parent);
|
||||
XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, (XinRect *) &rc, caption, (long)parent);
|
||||
CHECK(def, "Can't define an interface");
|
||||
|
||||
def->v.itf->automatic_back_color = FALSE;
|
||||
@ -506,7 +515,7 @@ HIDDEN void xi_event_handler(XI_OBJ* itf, XI_EVENT* xiev)
|
||||
XI_OBJ* b = button[i];
|
||||
if (b->type == XIT_BTN && b->v.btn->drawable)
|
||||
{
|
||||
if (xvt_rect_intersect(NULL, &b->v.btn->rct, &xiev->v.xvte.v.update.rct))
|
||||
if (xvt_rect_intersect(NULL, (RCT *) &b->v.btn->rct, &xiev->v.xvte.v.update.rct))
|
||||
{
|
||||
TPushbutton_control* p = (TPushbutton_control*)b->app_data;
|
||||
p->update();
|
||||
@ -729,7 +738,7 @@ void TControl::update_tab_cid()
|
||||
}
|
||||
}
|
||||
|
||||
void TControl::coord2rct(WINDOW win, short x, short y, short dx, short dy, XI_RCT& rct) const
|
||||
void TControl::coord2rct(WINDOW win, short x, short y, short dx, short dy, RCT & rct) const
|
||||
{
|
||||
// Spazio da lasciare prima di toccare i bordi
|
||||
const int X_FU_DELTA = XI_FU_MULTIPLE / 4;
|
||||
@ -747,7 +756,7 @@ void TControl::coord2rct(WINDOW win, short x, short y, short dx, short dy, XI_RC
|
||||
}
|
||||
|
||||
RCT max; xvt_vobj_get_client_rect(win, &max);
|
||||
xi_pu_to_fu(itf, (PNT*)&max, 2);
|
||||
xi_pu_to_fu(itf, (XinPoint *) &max, 2);
|
||||
const int& MAXX = max.right;
|
||||
const int& MAXY = max.bottom;
|
||||
|
||||
@ -809,7 +818,7 @@ void TControl::coord2rct(WINDOW win, short x, short y, short dx, short dy, XI_RC
|
||||
|
||||
RCT& TControl::get_rect(RCT& r) const
|
||||
{
|
||||
xi_get_rect(_obj, &r);
|
||||
xi_get_rect(_obj, (XinRect *) &r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -936,6 +945,7 @@ void TControl::change_attrib(unsigned long mask, bool on, XI_OBJ* obj)
|
||||
else attr &= ~mask;
|
||||
if (attr != old_attr) // C'e' un vero cambiamento d'attributo
|
||||
{
|
||||
#ifndef XI_R4
|
||||
// Se la finestra e' chiusa e il campo e un bottone o e' editabile allora cambia l'attributo
|
||||
// senza ridisegnare il campo, il che provocherebbe problemi di funzionamento degli sheet
|
||||
if (_obj->type == XIT_BTN || _obj->type == XIT_FIELD)
|
||||
@ -951,6 +961,7 @@ void TControl::change_attrib(unsigned long mask, bool on, XI_OBJ* obj)
|
||||
}
|
||||
}
|
||||
// Usa tranquillamente il metodo ortodosso
|
||||
#endif
|
||||
xi_set_attrib(obj, attr);
|
||||
}
|
||||
}
|
||||
@ -1011,11 +1022,11 @@ TText_control::TText_control(WINDOW win, short cid,
|
||||
if (width <= 0)
|
||||
width = t.len();
|
||||
|
||||
XI_RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
rct.right += bold ? (width*XI_FU_MULTIPLE/4) : XI_FU_MULTIPLE;
|
||||
|
||||
const unsigned long attrib = flags2attr(flags);
|
||||
XI_OBJ_DEF* def = xi_add_text_def(NULL, cid, &rct, attrib, (char*)(const char*)t);
|
||||
XI_OBJ_DEF* def = xi_add_text_def(NULL, cid, (XinRect *) &rct, attrib, (char*)(const char*)t);
|
||||
CHECKS(def, "Can't create the definition of TText_control:", text);
|
||||
def->v.text->fore_color = color;
|
||||
if (bold)
|
||||
@ -1035,13 +1046,22 @@ void TText_control::set_caption(const char* text)
|
||||
xi_set_text(_obj, (char*)c);
|
||||
_obj->v.text->fore_color = color;
|
||||
|
||||
#ifdef XI_R4
|
||||
XinFont * &f = _obj->v.text->font;
|
||||
|
||||
if (bold && f == NULL)
|
||||
XinFontCopy(&f, xi_get_system_font());
|
||||
if (f != NULL && XinFontBoldGet(f) != bold)
|
||||
XinFontBoldSet(f, bold);
|
||||
#else
|
||||
FONT_OBJ* &font = _obj->v.text->font;
|
||||
|
||||
if (font == NULL)
|
||||
font = (FONT_OBJ*)xi_tree_malloc(sizeof(FONT_OBJ), _obj->v.text);
|
||||
*font = xi_create_copy_font_id(get_interface(), xvt_default_font(bold), NULL);
|
||||
|
||||
RCT rct; get_rect(rct);
|
||||
xi_invalidate_rect(parent(), &rct);
|
||||
xi_invalidate_rect(parent(), (XinRect *) &rct);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1055,14 +1075,14 @@ TGroupbox_control::TGroupbox_control(WINDOW win, short cid,
|
||||
: TText_control(win, cid, left, top, width, 1, flags, text)
|
||||
{
|
||||
// Alza di un pixel il rettangolo per non coprire il rettangolo
|
||||
RCT& tr = _obj->v.text->rct;
|
||||
RCT& tr = (RCT &) _obj->v.text->rct;
|
||||
tr.top--; tr.bottom--;
|
||||
|
||||
XI_RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
rct.top += XI_FU_MULTIPLE - 2;
|
||||
rct.bottom -= Y_FU_MULTIPLE / 2;
|
||||
|
||||
XI_OBJ_DEF* def = xi_add_rect_def(NULL, cid, &rct, XI_ATR_VISIBLE, 0, 0); // Ignore colors
|
||||
XI_OBJ_DEF* def = xi_add_rect_def(NULL, cid, (XinRect *) &rct, XI_ATR_VISIBLE, 0, 0); // Ignore colors
|
||||
CHECKS(def, "Can't create the definition of TGroupbox_control ", text);
|
||||
def->v.rect->hilight_color = MASK_LIGHT_COLOR;
|
||||
def->v.rect->back_color = MASK_BACK_COLOR;
|
||||
@ -1077,7 +1097,7 @@ TGroupbox_control::TGroupbox_control(WINDOW win, short cid,
|
||||
_rct = xi_create(get_interface(win), def);
|
||||
CHECKD(_rct, "Can't create Groupbox_control ", cid);
|
||||
|
||||
RCT& rt = _obj->v.text->rct;
|
||||
RCT& rt = (RCT &) _obj->v.text->rct;
|
||||
rt.top--; rt.bottom--;
|
||||
|
||||
xi_dequeue();
|
||||
@ -1114,7 +1134,7 @@ void TField_control::create(WINDOW win, short cid,
|
||||
XI_OBJ_DEF* frm_def = xi_add_form_def(NULL, fcid, fcid);
|
||||
frm_def->app_data = (long)this;
|
||||
|
||||
XI_RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
rct.right += XI_FU_MULTIPLE/4;
|
||||
|
||||
unsigned long attrib = flags2attr(flags);
|
||||
@ -1144,7 +1164,12 @@ void TField_control::create(WINDOW win, short cid,
|
||||
f->pixel_button_distance = 1;
|
||||
}
|
||||
if (height != 1) // E' un multiline, quindi setto il rettangolo
|
||||
f->xi_rct = rct;
|
||||
{
|
||||
f->xi_rct.top = rct.top;
|
||||
f->xi_rct.bottom = rct.bottom;
|
||||
f->xi_rct.right = rct.right;
|
||||
f->xi_rct.left = rct.left;
|
||||
}
|
||||
|
||||
XI_OBJ* itf = get_interface(win);
|
||||
XI_OBJ* form = xi_create(itf, frm_def);
|
||||
@ -1155,10 +1180,10 @@ void TField_control::create(WINDOW win, short cid,
|
||||
CHECKD(stx, "NULL stx for field ", cid);
|
||||
|
||||
// Aggiusta il rettangolo del bottone in modo da allinearlo al testo
|
||||
RCT& br = _obj->v.field->btn_rct;
|
||||
RCT& br = (RCT &) _obj->v.field->btn_rct;
|
||||
const int offset = stx->rct.right - br.left - 1;
|
||||
br.left += offset;
|
||||
br.right += offset;
|
||||
br.right += offset;
|
||||
|
||||
update_tab_cid();
|
||||
|
||||
@ -1180,7 +1205,10 @@ void TField_control::show_button(bool on)
|
||||
|
||||
void TField_control::set_rect(const RCT& r)
|
||||
{
|
||||
_obj->v.field->rct = r;
|
||||
_obj->v.field->rct.top = r.top;
|
||||
_obj->v.field->rct.bottom = r.bottom;
|
||||
_obj->v.field->rct.right = r.right;
|
||||
_obj->v.field->rct.left = r.left;
|
||||
}
|
||||
|
||||
bool TField_control::read_only() const
|
||||
@ -1270,7 +1298,7 @@ void TButton_control::create(WINDOW win, short cid,
|
||||
RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
|
||||
const unsigned long attrib = flags2attr(flags);
|
||||
XI_OBJ_DEF* def = xi_add_button_def(NULL, cid, &rct, attrib, (char*)t, cid);
|
||||
XI_OBJ_DEF* def = xi_add_button_def(NULL, cid, (XinRect *) &rct, attrib, (char*)t, cid);
|
||||
CHECKD(def, "Can't create the interface of TButton_control ", cid);
|
||||
def->v.btn->fore_color = color;
|
||||
def->app_data = (long)this;
|
||||
@ -1290,7 +1318,7 @@ void TButton_control::create(WINDOW win, short cid,
|
||||
// Aggiusta bottoni con icona a sinistra
|
||||
if (wc == WC_CHECKBOX || wc == WC_RADIOBUTTON)
|
||||
{
|
||||
RCT& r = _obj->v.btn->rct;
|
||||
RCT& r = (RCT &) _obj->v.btn->rct;
|
||||
r.top++; r.bottom-=2;
|
||||
r.right += XI_FU_MULTIPLE / 2;
|
||||
}
|
||||
@ -1330,7 +1358,10 @@ bool TButton_control::toggle()
|
||||
|
||||
void TButton_control::set_rect(const RCT& r)
|
||||
{
|
||||
_obj->v.btn->rct = r;
|
||||
_obj->v.btn->rct.top = r.top;
|
||||
_obj->v.btn->rct.bottom = r.bottom;
|
||||
_obj->v.btn->rct.left = r.left;
|
||||
_obj->v.btn->rct.right = r.right;
|
||||
}
|
||||
|
||||
bool TButton_control::event_handler(XI_OBJ* itf, XI_EVENT* xiev)
|
||||
@ -1391,6 +1422,7 @@ TPushbutton_control::TPushbutton_control(WINDOW win, short cid,
|
||||
|
||||
create(win, cid, left, top, width, height, flags, text, WC_PUSHBUTTON, NULL);
|
||||
_obj->v.btn->drawable = TRUE;
|
||||
|
||||
*_obj->v.btn->text = '\0';
|
||||
|
||||
set_bmp(bmp_up, bmp_dn);
|
||||
@ -1413,7 +1445,7 @@ void TPushbutton_control::set_icon(word hicon)
|
||||
{
|
||||
_hicon = hicon;
|
||||
set_bmp(0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TPushbutton_control::set_bmp(short bmp_up, short bmp_dn)
|
||||
@ -1431,6 +1463,8 @@ void TPushbutton_control::set_bmp(short bmp_up, short bmp_dn)
|
||||
{
|
||||
_bmp_up = _bmp_dn = 0;
|
||||
}
|
||||
#ifdef XI_R4
|
||||
#endif
|
||||
}
|
||||
|
||||
void TPushbutton_control::update()
|
||||
@ -1443,7 +1477,7 @@ void TPushbutton_control::update()
|
||||
if (_hicon)
|
||||
{
|
||||
HDC hdc = (HDC)xvt_vobj_get_attr(win, ATTR_NATIVE_GRAPHIC_CONTEXT);
|
||||
const RCT& rct = _obj->v.btn->rct;
|
||||
const RCT& rct = (RCT &) _obj->v.btn->rct;
|
||||
int x = rct.left + (rct.right - rct.left - 32) / 2;
|
||||
int y = rct.top + (rct.bottom - rct.top - 32) / 2;
|
||||
DrawIcon(hdc, x, y, (HICON)_hicon);
|
||||
@ -1454,7 +1488,7 @@ void TPushbutton_control::update()
|
||||
if (bmp > 0)
|
||||
{
|
||||
const TImage& i = _picture->image(bmp);
|
||||
const RCT& rct = _obj->v.btn->rct;
|
||||
const RCT& rct = (RCT &) _obj->v.btn->rct;
|
||||
int x = rct.left + (rct.right - rct.left - i.width()) / 2;
|
||||
int y = rct.top + (rct.bottom - rct.top - i.height()) / 2;
|
||||
if (_obj->v.btn->down)
|
||||
@ -1462,8 +1496,16 @@ void TPushbutton_control::update()
|
||||
x += 2;
|
||||
y += 2;
|
||||
}
|
||||
#ifdef XI_R4
|
||||
XinWindow win = xi_get_window(_obj->itf);
|
||||
xi_set_clip( win, (XinRect *) &rct );
|
||||
#endif
|
||||
|
||||
i.draw(win, x, y);
|
||||
#ifdef XI_R4
|
||||
xi_set_clip( win, NULL );
|
||||
#endif
|
||||
|
||||
if (!(attrib & XI_ATR_ENABLED))
|
||||
{
|
||||
CPEN pen;
|
||||
@ -1490,7 +1532,7 @@ void TPushbutton_control::update()
|
||||
}
|
||||
else
|
||||
{
|
||||
RCT& r = _obj->v.btn->rct;
|
||||
RCT& r = (RCT &) _obj->v.btn->rct;
|
||||
xvt_dwin_set_font(win, xvt_default_font());
|
||||
|
||||
int ascent, descent;
|
||||
@ -1564,7 +1606,7 @@ TRadiobutton_control::TRadiobutton_control(WINDOW win, short cid,
|
||||
const int tot = testo.items();
|
||||
|
||||
const XI_CONTAINER_ORIENTATION orient = height == 1 ? XI_STACK_HORIZONTAL : XI_STACK_VERTICAL;
|
||||
XI_RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
|
||||
if (height > 1)
|
||||
{
|
||||
@ -1578,7 +1620,7 @@ TRadiobutton_control::TRadiobutton_control(WINDOW win, short cid,
|
||||
rct.left -= XI_FU_MULTIPLE / 4;
|
||||
rct.right += XI_FU_MULTIPLE / 4;
|
||||
}
|
||||
XI_OBJ_DEF* def = xi_add_container_def(NULL, cid, &rct, orient, cid);
|
||||
XI_OBJ_DEF* def = xi_add_container_def(NULL, cid, (XinRect *) &rct, orient, cid);
|
||||
def->app_data = (long)this;
|
||||
|
||||
const unsigned long attrib = flags2attr(flags);
|
||||
@ -1867,8 +1909,10 @@ void TDropDownList::ddl_str_eh(XI_OBJ* itf, XI_EVENT* xiev)
|
||||
xiev->v.xvte.type == E_MOUSE_UP)
|
||||
{
|
||||
ddl->close();
|
||||
#ifndef XI_R4
|
||||
if (xiev->v.xvte.type == E_FOCUS)
|
||||
_button_blocked = TRUE;
|
||||
#endif
|
||||
}
|
||||
else if (xiev->v.xvte.type == E_CHAR)
|
||||
{
|
||||
@ -2031,7 +2075,7 @@ void TDropDownList::open()
|
||||
ld->single_select = TRUE;
|
||||
|
||||
// compute size in pixel of field (with button enclosed)
|
||||
RCT r; xi_get_rect(_obj, &r);
|
||||
RCT r; xi_get_rect(_obj, (XinRect *) &r);
|
||||
|
||||
// Larghezza in pixel dell'edit field
|
||||
int len = r.right - r.left;
|
||||
@ -2058,7 +2102,7 @@ void TDropDownList::open()
|
||||
XI_ATR_VISIBLE|XI_ATR_ENABLED|XI_ATR_READONLY|XI_ATR_SELECTABLE,
|
||||
0, len, 80, "");
|
||||
|
||||
RCT l; xi_get_def_rect(lstdef, &l);
|
||||
RCT l; xi_get_def_rect(lstdef, (XinRect *) &l);
|
||||
PNT p; p.h = r.left;
|
||||
WINDOW pwin = xi_get_window(_obj->itf);
|
||||
RCT w; xvt_vobj_get_client_rect(pwin, &w);
|
||||
@ -2072,7 +2116,7 @@ void TDropDownList::open()
|
||||
}
|
||||
RCT wr;
|
||||
wr.left = p.h; wr.top = p.v;
|
||||
xi_get_def_rect(lstdef, &l);
|
||||
xi_get_def_rect(lstdef, (XinRect *) &l);
|
||||
wr.right = r.right; // wr.left + (l.right - l.left) -1;
|
||||
wr.bottom = wr.top + l.bottom - l.top;
|
||||
const int delta_x = _obj->itf->v.itf->delta_x;
|
||||
@ -2085,7 +2129,7 @@ void TDropDownList::open()
|
||||
WINDOW win = xvt_win_create(W_PLAIN, &wr, "", 0, pwin, WSF_NO_MENUBAR, EM_ALL,
|
||||
(EVENT_HANDLER)xi_event, 0L);
|
||||
itfdef->v.itf->win = win;
|
||||
itfdef->v.itf->rctp = ≀
|
||||
itfdef->v.itf->rctp = (XinRect *) ≀
|
||||
XI_OBJ* itfobj = xi_create(NULL, itfdef);
|
||||
xi_tree_free(itfdef);
|
||||
|
||||
|
@ -11,6 +11,11 @@ class TMask_field; // __MASKFLD_H
|
||||
#ifndef INCL_XI
|
||||
#define XI_INTERNAL
|
||||
#include <xi.h>
|
||||
#endif
|
||||
|
||||
#ifndef XI_R4
|
||||
#define XinRect RCT
|
||||
#define XinPoint PNT
|
||||
#endif
|
||||
|
||||
void init_controls();
|
||||
|
@ -509,7 +509,7 @@ void TGolem_field::set_window_data(const char* data)
|
||||
btn->set_bmp(BMP_OLE, 0);
|
||||
|
||||
RCT rct; btn->get_rect(rct);
|
||||
xi_invalidate_rect(btn->parent(), &rct);
|
||||
xi_invalidate_rect(btn->parent(), (XinRect *) &rct);
|
||||
}
|
||||
|
||||
bool TGolem_field::is_editable() const
|
||||
|
@ -390,8 +390,12 @@ TSpreadsheet::TSpreadsheet(
|
||||
CHECK(listdef, "Can't create spreadsheet definition");
|
||||
listdef->app_data = (long)this;
|
||||
XI_LIST_DEF* l = listdef->v.list;
|
||||
l->width = rct.right - rct.left;
|
||||
l->width = rct.right - rct.left;
|
||||
#ifdef XI_R4
|
||||
l->min_heading_height = xi_button_calc_height_font(xi_get_system_font()) * lines_in_header;
|
||||
#else
|
||||
l->min_heading_height = xi_button_calc_height_font_id(xvt_default_font()) * lines_in_header;
|
||||
#endif
|
||||
l->sizable_columns = TRUE;
|
||||
l->movable_columns = TRUE;
|
||||
l->scroll_bar = TRUE;
|
||||
@ -474,7 +478,7 @@ TSpreadsheet::TSpreadsheet(
|
||||
XI_OBJ** column = xi_get_member_list(_obj, &num);
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
RCT rct; xi_get_rect(column[i], &rct);
|
||||
RCT rct; xi_get_rect(column[i], (XinRect *) &rct);
|
||||
_default_width[i] = rct.right - rct.left;
|
||||
}
|
||||
}
|
||||
@ -1099,7 +1103,14 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
}
|
||||
if (_cur_rec >= 0 && _cur_rec < items())
|
||||
set_focus_cell(_cur_row, _cur_col);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (k == K_ESC)
|
||||
{
|
||||
XI_OBJ row;
|
||||
XI_MAKE_ROW(&row, _obj, _cur_row);
|
||||
xi_cell_request(&row);
|
||||
}
|
||||
_check_enabled = TRUE;
|
||||
}
|
||||
break;
|
||||
@ -1193,8 +1204,13 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
_edit_field->set_focusdirty(_cell_dirty = FALSE);
|
||||
|
||||
// Azzera il flag di update_pending
|
||||
#ifdef XI_R4
|
||||
XinEvent e; e.type = XinEventPaint;
|
||||
xi_eh(_obj->itf->v.itf->xin_win, &e);
|
||||
#else
|
||||
EVENT e; e.type = E_UPDATE;
|
||||
xi_eh(_obj->itf->v.itf->xvt_win, &e);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1352,6 +1368,13 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
if (_cur_rec >= 0 && _cur_rec < items())
|
||||
set_focus_cell(_cur_row, _cur_col);
|
||||
}
|
||||
else
|
||||
if (k == K_ESC)
|
||||
{
|
||||
XI_OBJ row;
|
||||
XI_MAKE_ROW(&row, _obj, _cur_row);
|
||||
xi_cell_request(&row);
|
||||
}
|
||||
_check_enabled = TRUE;
|
||||
refused = TRUE;
|
||||
}
|
||||
@ -1903,7 +1926,7 @@ void TSpreadsheet::save_columns_order() const
|
||||
for (int i = 0; i < num; i++) // Scorre le colonne
|
||||
{
|
||||
order.add(column[i]->cid);
|
||||
RCT rct; xi_get_rect(column[i], &rct);
|
||||
RCT rct; xi_get_rect(column[i], (XinRect *) &rct);
|
||||
order << ',' << rct.right - rct.left;
|
||||
}
|
||||
config.set("Browse", order, NULL, TRUE, owner().dlg());
|
||||
@ -1951,7 +1974,7 @@ void TSpreadsheet::set_columns_order(TToken_string* order)
|
||||
if (index >= fixed)
|
||||
xi_move_column(col, index);
|
||||
|
||||
RCT rct; xi_get_rect(col, &rct);
|
||||
RCT rct; xi_get_rect(col, (XinRect *) &rct);
|
||||
if (_default_width[index] != rct.right - rct.left)
|
||||
xi_column_set_pixel_width(col, _default_width[index]-offset);
|
||||
}
|
||||
|
@ -123,24 +123,24 @@ void TIndwin::update_bar()
|
||||
if (CAMPI_SCAVATI)
|
||||
{
|
||||
// Rettangolo scavato
|
||||
xi_draw_3d_rect(w, &r, TRUE, 2,
|
||||
xi_draw_3d_rect(w, (XinRect *) &r, TRUE, 2,
|
||||
BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR);
|
||||
b.left += 2; b.right -= 1;
|
||||
b.top += 2; b.bottom -= 1;
|
||||
// Rettangolo in rilievo
|
||||
b.right = b.left + int((b.right-b.left)*prc);
|
||||
xi_draw_3d_rect(w, &b, FALSE, 2,
|
||||
xi_draw_3d_rect(w, (XinRect *) &b, FALSE, 2,
|
||||
BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Rettangolo in rilievo
|
||||
b.right = b.left + int((r.right-r.left)*prc);
|
||||
xi_draw_3d_rect(w, &b, FALSE, 2,
|
||||
xi_draw_3d_rect(w, (XinRect *) &b, FALSE, 2,
|
||||
BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR);
|
||||
// Rettangolo scavato
|
||||
b.left = b.right; b.right = r.right;
|
||||
xi_draw_3d_rect(w, &b, TRUE, 2,
|
||||
xi_draw_3d_rect(w, (XinRect *) &b, TRUE, 2,
|
||||
BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR);
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ TSheet_control::TSheet_control(
|
||||
}
|
||||
|
||||
// Calcola rettangolo massimo per lo sheet
|
||||
XI_RCT rct; coord2rct(parent, x, y, dx, dy, rct);
|
||||
RCT rct; coord2rct(parent, x, y, dx, dy, rct);
|
||||
rct.right -= 2*XI_FU_MULTIPLE; // toglie scroll-bar
|
||||
|
||||
// Controlla se ci sono troppe colonne fisse
|
||||
@ -202,7 +202,11 @@ TSheet_control::TSheet_control(
|
||||
listdef->app_data = (long)this;
|
||||
|
||||
XI_LIST_DEF* l = listdef->v.list;
|
||||
#ifdef XI_R4
|
||||
l->min_heading_height = xi_button_calc_height_font(xi_get_system_font()) * lines_in_header;
|
||||
#else
|
||||
l->min_heading_height = xi_button_calc_height_font_id(xvt_default_font()) * lines_in_header;
|
||||
#endif
|
||||
l->max_lines_in_cell = lines_in_cell;
|
||||
l->sizable_columns = TRUE;
|
||||
l->movable_columns = TRUE;
|
||||
@ -245,7 +249,7 @@ TSheet_control::TSheet_control(
|
||||
}
|
||||
}
|
||||
|
||||
RCT rd; xi_get_def_rect(listdef, &rd);
|
||||
RCT rd; xi_get_def_rect(listdef, (XinRect *) &rd);
|
||||
if ((rd.right - rd.left) > (rct.right - rct.left))
|
||||
l->width = rct.right - rct.left;
|
||||
|
||||
@ -258,10 +262,10 @@ TSheet_control::TSheet_control(
|
||||
|
||||
// Se la finestra e' troppo grande riducila
|
||||
RCT cli; xvt_vobj_get_client_rect(parent, &cli);
|
||||
XI_RCT xc = cli; xi_pu_to_fu(itf, (PNT*)&xc, 2);
|
||||
RCT xc = cli; xi_pu_to_fu(itf, (XinPoint *) &xc, 2);
|
||||
if (xc.right > 45 * XI_FU_MULTIPLE) // Deve contenere almeno 4 bottoni
|
||||
{
|
||||
xi_get_rect(_obj, &rct);
|
||||
xi_get_rect(_obj, (XinRect *) &rct);
|
||||
|
||||
const int width = rct.right + 2*XI_FU_MULTIPLE;
|
||||
if (width < cli.right)
|
||||
@ -277,7 +281,7 @@ TSheet_control::TSheet_control(
|
||||
XI_OBJ** column = xi_get_member_list(_obj, &num);
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
RCT rct; xi_get_rect(column[i], &rct);
|
||||
RCT rct; xi_get_rect(column[i], (XinRect *) &rct);
|
||||
_default_width[i] = rct.right - rct.left;
|
||||
}
|
||||
}
|
||||
@ -585,7 +589,7 @@ void TSheet_control::save_columns_order(const TMask_field& field) const
|
||||
char head[80];
|
||||
xi_get_text(column[i], head, sizeof(head));
|
||||
order.add(head);
|
||||
RCT rct; xi_get_rect(column[i], &rct);
|
||||
RCT rct; xi_get_rect(column[i], (XinRect *) &rct);
|
||||
order << ',' << rct.right - rct.left;
|
||||
}
|
||||
config.set("Browse", order, NULL, TRUE, field.dlg());
|
||||
@ -643,7 +647,7 @@ void TSheet_control::set_columns_order(TToken_string* order)
|
||||
if (col)
|
||||
{
|
||||
xi_move_column(col, index);
|
||||
RCT rct; xi_get_rect(col, &rct);
|
||||
RCT rct; xi_get_rect(col, (XinRect *) &rct);
|
||||
if (_default_width[index] != rct.right - rct.left)
|
||||
xi_column_set_pixel_width(col, _default_width[index]-offset);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user