Corretto funzionamento e dimensionamento bottoni

git-svn-id: svn://10.65.10.50/trunk@2916 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
villa 1996-05-28 09:24:12 +00:00
parent 87fb727947
commit c93dd6248a
2 changed files with 48 additions and 40 deletions

View File

@ -22,7 +22,7 @@ const int PRINT_HEIGHT = 10;
#define DLG_QUIT_TITLE "Fine"
#define DLG_EDIT_TITLE "~Edit"
#define DLG_LINK_TITLE "~Collega"
#define DLG_LINK_TITLE "Colle~ga"
#define DLG_PRINT_TITLE "~Stampa"
#if XVT_OS == XVT_OS_WIN
@ -337,15 +337,13 @@ void TViswin::paint_link (
// @doc INTERNAL
// @mfunc Modifica le dimensione di un box
//
// @rdesc Ritorna se sono state modificate le dimensioni del box:
//
// @flag TRUE | Sono state riassegante le coordinate a <p x1> e <p x2>
// @flag TRUE | Sono state riassegnate le coordinate a <p x1> e <p x2>
// @flag FALSE | Non sono state riassegnate le misure del box poiche' <p y> e' nel testo
bool TViswin::adjust_box (
long &x1, // @parm Prima coordinata da riassegnare
long &x2, // @parm Seconda coordinata da riassegnare
long y) // @parm Valore della riga che deve essere nel testo
long y) // @parm Valore della riga che deve essere nel testo
// @comm Sistema <p x1> e <p x2> in modo che il minore sia il primo, e controlla che <p y> sia
// nel testo (box e' su una sola riga, usata solo per i link)
@ -363,9 +361,7 @@ bool TViswin::adjust_box (
// @mfunc Controlla se la posizione cursore <p where> cade su un link ipertestuale e si
// comporta di conseguenza
//
// @rdesc Ritorna se la posizione cade sul link
//
// @flag TRUE | Se ha constatato la corrispondenza
// @flag FALSE | Se non ha constatato la corrispondenza
bool TViswin::check_link (
@ -587,7 +583,11 @@ TPushbutton_control* TViswin::add_button (
// @comm Aggiunge i bottoni nella finestra
{
TPushbutton_control* b = new TPushbutton_control(win(), id, -11, -1, 11, 2, "",
caption, bup, bdn);
caption, bup, bdn);
// ridimensiona sempre uguale dato che sono tutte bitmap
RCT br; b->get_rect(br);
br.top = br.bottom - taby(2);
b->set_rect(br);
_button.add(b);
return b;
}
@ -1256,7 +1256,44 @@ void TViswin::scroll_error(long x, long y)
SetCursorPos(p.x, p.y);
#endif
}
void TViswin::on_button(short dlg)
{
// if (ep->v.ctl.ci.type == WC_PUSHBUTTON)
switch (dlg)
{
case DLG_QUIT:
if (_isopen) abort_print();
else
{
#if XVT_OS == XVT_OS_WIN
xvt_statbar_set("");
xvt_statbar_refresh();
#endif
stop_run(K_ENTER);
}
break;
case DLG_PRINT:
dispatch_e_menu(win(), M_EDIT_SEL_ALL);
break;
case DLG_EDIT:
check_link();
call_editor();
_need_update = TRUE;
update();
check_link(&_point);
break;
case DLG_LINK:
exec_link();
break;
default:
TWindow::on_button(dlg);
break;
}
}
void TViswin::handler (WINDOW win, EVENT * ep)
{
int kdiff_x, kdiff_y;
@ -1353,35 +1390,6 @@ void TViswin::handler (WINDOW win, EVENT * ep)
}
break;
case E_CONTROL:
if (ep->v.ctl.ci.type == WC_PUSHBUTTON)
switch (ep->v.ctl.id)
{
case DLG_QUIT:
if (_isopen)
abort_print ();
else
{
#if XVT_OS == XVT_OS_WIN
xvt_statbar_set ("");
xvt_statbar_refresh ();
#endif
stop_run (K_ENTER);
}
break;
case DLG_PRINT:
dispatch_e_menu(win, M_EDIT_SEL_ALL);
break;
case DLG_EDIT:
check_link ();
call_editor ();
_need_update = TRUE;
update ();
check_link (&_point);
break;
case DLG_LINK:
exec_link();
break;
}
break;
case E_TIMER:
if (ep->v.timer.id == _timer)
@ -2570,7 +2578,7 @@ TViswin::TViswin(const char *fname,
add_button (DLG_EDIT, DLG_EDIT_TITLE, BMP_EDIT);
if (_islink)
{
_link_button = add_button (DLG_LINK, DLG_LINK_TITLE, BMP_LINK);
_link_button = add_button(DLG_LINK, DLG_LINK_TITLE, BMP_LINK);
_link_button->disable();
}
if (_isprint)

View File

@ -165,10 +165,8 @@ class TViswin : public TScroll_window
bool _inside_linkexec;
// òcmember:(INTERNAL) Indica se e' presente il menu' specifico della calsse
bool _menu_present;
// @cmember:(INTERNAL) Viene istanziato soltanto se e' usata come controllo
TBrowsefile_field* _brwfld;
// @cmember: (INTERNAL) Rettangolo finestra madre
RCT _wr;
@ -194,6 +192,8 @@ protected:
// @cmember Disegna il cursore a crossbar in XOR
void draw_crossbars();
virtual void on_button(short dlg);
// @cmember Disegna l'header del video (righello)
void paint_header();
// @cmember Disegna il cursore in xor nello stile del momento