Patch level : 10.0

Files correlati     : tuttissimi
Ricompilazione Demo : [ ]
Commento            :
Aggiunto supporto per ListBox in stile Outlook
Migliorata gestione Status Bar


git-svn-id: svn://10.65.10.50/trunk@16064 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-01-31 14:02:52 +00:00
parent 6b8fa7fb49
commit 263a3a962c
18 changed files with 403 additions and 354 deletions

View File

@ -5,6 +5,7 @@
#include <prefix.h>
#include <recarray.h>
#include <statbar.h>
#include <treectrl.h>
#include <urldefid.h>
#include <utility.h>

View File

@ -571,11 +571,12 @@ void TApplication::check_parameters(
{
if (argc > 1)
{
TString u(argv[argc-1]);
u.upper();
if (u.compare("-u", 2, TRUE) == 0 || u.compare("/u", 2, TRUE) == 0)
const TFixed_string u(argv[argc-1]);
if (u.starts_with("-u", true) || u.starts_with("/u", true))
{
user() = u.mid(2);
TString80 usr = u.mid(2);
usr.upper();
user() = usr;
argc--;
}
}
@ -622,13 +623,9 @@ void TApplication::run(
_argv_ = (const char**)argv;
if (argc > 1 && argv[1][0] == '-')
{
_name = cmd2name(argv[0], argv[1]);
}
else
{
_name = cmd2name(argv[0]);
}
if (use_files())
init_global_vars();
@ -636,7 +633,6 @@ void TApplication::run(
CGetPref();
const int sn = get_serial_number();
if (sn < 0)
{
error_box(TR("Probabilmente non e' inserita la chiave di protezione\noppure mancano i relativi driver."));
@ -679,8 +675,7 @@ bool TApplication::get_version_info(int& year, int& release, int& tag, int& patc
int checksum = vep.get_int();
bool valid = year >= 2006 && release > 0 && tag >= 0 && patch >= 0 &&
checksum == (year + release + tag + patch);
checksum == (year + release + tag + patch);
return valid;
}
@ -700,16 +695,15 @@ void TApplication::print()
#endif
}
void TApplication::check_menu_item(MENU_TAG item)
void TApplication::check_menu_item(MENU_TAG item, bool chk)
{
xvt_menu_set_item_checked(TASK_WIN, item, TRUE);
xvt_menu_set_item_checked(TASK_WIN, item, chk);
xvt_menu_update(TASK_WIN);
}
void TApplication::uncheck_menu_item(MENU_TAG item)
{
xvt_menu_set_item_checked(TASK_WIN, item, FALSE);
xvt_menu_update(TASK_WIN);
check_menu_item(item, false);
}
// @doc EXTERNAL

View File

@ -140,7 +140,7 @@ public:
void stop_run();
// @cmember Mette il segno Check a fianco di una voce di menu
void check_menu_item(MENU_TAG item);
void check_menu_item(MENU_TAG item, bool on = true);
// @cmember Toglie il segno Check a fianco di una voce di menu
void uncheck_menu_item(MENU_TAG item);
// @cmember Permette di abilitare/disabilitare una voce di menu'

View File

@ -173,18 +173,16 @@ bool TArchive::move_file(const TFilename& file, const char* dir) const
TFilename dest(dir);
dest.add(file.name());
long filesize = ::fsize(file);
filesize -= ::fsize(dest);
bool space_ok = filesize <= 0;
const long needed = fsize(file) - fsize(dest);
bool space_ok = needed <= 0;
while (!space_ok)
{
space_ok = xvt_fsys_test_disk_free_space(dir, filesize) != 0;
space_ok = xvt_fsys_test_disk_free_space(dir, needed) != 0;
if (!space_ok)
{
TString msg(128);
msg.format(FR("Lo spazio disponibile e' insufficiente:\nNecessario: %.1lf Mb; Disponibile: %ld Mb\n"),
filesize/1024.0, xvt_fsys_get_disk_free_space(dir, 'M'));
needed/(1024.0*1024.0), xvt_fsys_get_disk_free_space(dir, 'M'));
if (xvt_fsys_is_floppy_drive(dir))
msg << TR("Inserire un nuovo disco e ritentare?");
else

View File

@ -95,7 +95,7 @@ bool TAutomask::universal_handler(TMask_field& f, KEY key)
TOperable_field& of = (TOperable_field&)f;
TAutomask& am = (TAutomask&)of.mask();
TField_event fe = am.key2event(of, key);
return fe == fe_null ? TRUE : am.on_field_event(of, fe, 0);
return fe == fe_null ? true : am.on_field_event(of, fe, 0);
}
bool TAutomask::insheet_universal_handler(TMask_field& f, KEY key)

View File

@ -48,9 +48,11 @@
#define CLASS_REAL_FIELD 245
#define CLASS_DATE_FIELD 246
#define CLASS_GRID_FIELD 247
#define CLASS_TREE_FIELD 248
#define CLASS_CURRENCY_FIELD 249
#define CLASS_GOLEM_CLIENT_FIELD 250
#define CLASS_CURRENCY_FIELD 248
#define CLASS_WINDOWED_FIELD 250
#define CLASS_TREE_FIELD 251
#define CLASS_GOLEM_CLIENT_FIELD 252
#define CLASS_OUTLOOK_FIELD 253
#define CLASS_BASEISAMFILE 300
#define CLASS_ISAMFILE 301

View File

@ -4,7 +4,7 @@
COLOR RGB2COLOR(unsigned char red, unsigned char green, unsigned char blue)
{
COLOR def = MAKE_COLOR(red, green, blue);
COLOR def = XVT_MAKE_COLOR(red, green, blue);
// Se nel colore non compare l'indice cerca di calcolarlo
const unsigned char color_index = (unsigned char)(def >> 12);
@ -46,7 +46,7 @@ COLOR blend_colors(COLOR col1, COLOR col2, double perc)
const byte g = byte(g1 * perc + g2*(1.0-perc));
const byte b = byte(b1 * perc + b2*(1.0-perc));
return MAKE_COLOR(r, g, b);
return XVT_MAKE_COLOR(r, g, b);
}
COLOR grayed_color(COLOR col)
@ -55,7 +55,7 @@ COLOR grayed_color(COLOR col)
const unsigned int g = XVT_COLOR_GET_GREEN(col);
const unsigned int b = XVT_COLOR_GET_BLUE(col);
const unsigned int k = (unsigned int)(0.299 * r + 0.587 * g + 0.114 * b);
return MAKE_COLOR(k, k, k);
return XVT_MAKE_COLOR(k, k, k);
}
unsigned int color_distance(COLOR col1, COLOR col2)

View File

@ -21,7 +21,7 @@ long TExternal_app::run(
TFilename path(_path);
TFilename comm_name(_path);
const int p = comm_name.find(' '); //c'e' uno spazio nella stringa?
const int p = comm_name.find(" -"); //c'e' uno spazio nella stringa?
if (p > 0) //se c'e' tronca il nome allo spazio
comm_name.cut(p);

View File

@ -35,10 +35,9 @@ public:
// @cmember Controlla se l'utente puo' eseguire il programma
bool can_run() const;
// @cmember Esegue il processo
long run(bool async = FALSE, byte user = TRUE, bool iconizetask = TRUE /*, bool showchild = TRUE */);
long run(bool async = FALSE, byte user = TRUE, bool iconizetask = true);
// @cmember Ritorna l'ultimo codice di uscita
int exitcode()
{ return _exitcode; }
int exitcode() const { return _exitcode; }
const TExternal_app& operator = (const TExternal_app& a)
{ copy(a); return a; }

View File

@ -3,15 +3,17 @@
#define XVT_INCL_NATIVE
#include <controls.h>
#include <execp.h>
#include <diction.h>
#include <golem.h>
#include <image.h>
#include <msksheet.h>
#include <prefix.h>
#include <relation.h>
#include <treectrl.h>
#include <urldefid.h>
#include <utility.h>
#ifdef WIN32
#include <mapi.h>
#include <shellapi.h>
@ -91,27 +93,19 @@ bool TGolem_mask::file_handler(TMask_field& f, KEY k)
if (k == K_F9)
{
FILE_SPEC fs;
if (!f.empty())
{
const TFilename n = f.get();
xvt_fsys_convert_str_to_dir(n.path(), &fs.dir);
}
else
xvt_fsys_convert_str_to_dir(".", &fs.dir);
strcpy(fs.type, "");
strcpy(fs.name, "*.*");
strcpy(fs.creator, "CAMPO");
TFilename n = f.get();
if (n.empty())
n = "*.*";
xvt_fsys_convert_str_to_fspec(n, &fs);
DIRECTORY dir; xvt_fsys_get_dir(&dir);
FL_STATUS ok = xvt_dm_post_file_open(&fs, "Selezionare il file ...");
FL_STATUS ok = xvt_dm_post_file_open(&fs, TR("Selezionare il file..."));
xvt_fsys_set_dir(&dir);
if (ok == FL_OK)
{
TFilename file;
xvt_fsys_convert_dir_to_str(&fs.dir, file.get_buffer(), file.size());
file.add(fs.name);
m.set(S_FILE, file);
xvt_fsys_convert_fspec_to_str(&fs, n.get_buffer(), n.size());
m.set(S_FILE, n);
k = K_TAB;
}
f.set_focus();
@ -934,6 +928,7 @@ TMAPI_session::~TMAPI_session()
SetCurrentDirectory(m_strBaseDir);
}
#endif
///////////////////////////////////////////////////////////
// TMail_message
///////////////////////////////////////////////////////////

View File

@ -8,6 +8,7 @@
#include <prefix.h>
#include <recarray.h>
#include <relation.h>
#include <treectrl.h>
#include <urldefid.h>
#include <utility.h>
@ -90,11 +91,9 @@ TMask::TMask()
: _mask_num(0)
{ init_mask(); }
TMask::TMask(const char* title, int pages, int cols, int rows,
int xpos, int ypos, WINDOW parent)
: _mask_num(0)
{
init_mask();
for (_pages = 0; _pages < pages; _pages++)

View File

@ -6,6 +6,7 @@
#endif
class TSheet_field;
class TTree_field;
class TCurrency;
// @doc EXTERNAL

View File

@ -1,6 +1,3 @@
#define XI_INTERNAL
#include <xinclude.h>
#include <automask.h>
#include <colors.h>
#include <controls.h>
@ -280,11 +277,16 @@ void TMask_field::construct(
_ctl_data._bmp_dn = bmp_dn;
break;
case CLASS_MEMO_FIELD:
case CLASS_TREE_FIELD:
_ctl_data._height = len;
_ctl_data._width = width;
_ctl_data._size = len * width;
break;
case CLASS_TREE_FIELD:
case CLASS_OUTLOOK_FIELD:
_ctl_data._height = len;
_ctl_data._width = width;
_ctl_data._size = 0;
break;
default:
_ctl_data._width = width == 0 ? len : width;
break;
@ -491,17 +493,18 @@ int TMask_field::page() const
void TMask_field::set(const char*)
{
// Place holder
}
void TMask_field::set(long n)
{
char s[16]; sprintf(s, "%ld", n);
TString16 s; s << n;
set(s);
}
const TString& TMask_field::get() const
{
return _ctl_data._park.cut(0);
return EMPTY_STRING;
}
void TMask_field::set_default(const char*)
@ -586,7 +589,7 @@ bool TMask_field::error_box(
{
xvt_dm_post_speech(_msg, 0, TRUE);
xvtil_statbar_set(_msg);
beep();
beep(2); // Error sound
}
else
{
@ -620,7 +623,7 @@ bool TMask_field::warning_box(
{
xvt_dm_post_speech(_msg, 1, TRUE);
xvtil_statbar_set(_msg);
beep();
beep(1);
}
else
{
@ -2796,12 +2799,12 @@ KEY TFile_select::run()
strcpy(fs.name, field().get());
strcpy(fs.creator, "AGA");
bool good = xvt_dm_post_file_open(&fs, (char*)field().prompt()) == FL_OK;
bool good = xvt_dm_post_file_open(&fs, field().prompt()) == FL_OK;
xvt_fsys_set_dir(&savedir);
if (good)
{
good = _filter.empty() || xvt_str_match(fs.name, _filter, false);
good = _filter.blank() || xvt_str_match(fs.name, _filter, false);
if (good)
{
TFilename path;
@ -5204,168 +5207,3 @@ const char* TZoom_field::get_first_line() const
{ return raw2win(_str); }
///////////////////////////////////////////////////////////
// TField_window
///////////////////////////////////////////////////////////
#ifndef INCL_XI
extern "C"
{
void xi_draw_3d_rect( WINDOW win, RCT* rctp, BOOLEAN well, int height,
COLOR color_light, COLOR color_ctrl, COLOR color_dark );
}
#endif
void TField_window::handler(WINDOW win, EVENT* ep)
{
switch (ep->type)
{
case E_FOCUS:
if (ep->v.active)
{
WINDOW parent = xvt_vobj_get_parent(win);
XI_OBJ* itf = xi_get_itf((XinWindow)parent);
xi_set_focus(itf);
}
break;
default:
break;
}
TScroll_window::handler(win, ep);
}
bool TField_window::on_key(KEY k)
{
if (k == K_TAB || k == K_BTAB || k == K_F3 || k == K_F4)
{
const TMask& m = _owner->mask();
const short id = _owner->dlg();
const int start = m.id2pos(id);
const int dir = (k == K_TAB || k == K_F3) ? +1 : -1;
int pos = start;
while (TRUE)
{
pos += dir;
if (pos < 0) pos = m.fields()-1;
if (pos >= m.fields()) pos = 0;
if (pos == start)
break;
TMask_field& f = m.fld(pos);
if (f.is_operable())
{
f.set_focus();
return TRUE;
}
}
}
return TScroll_window::on_key(k);
}
void TField_window::update()
{
const WINDOW me = win();
if (CAMPI_SCAVATI)
{
const WINDOW pa = parent();
RCT rct; xvt_vobj_get_outer_rect(me, &rct);
rct.left -= 2; rct.top -= 2; rct.right += 2; rct.bottom += 2;
xi_draw_3d_rect((XinWindow)pa, (XinRect *) &rct, TRUE, 2, // qui
MASK_LIGHT_COLOR, MASK_BACK_COLOR, MASK_DARK_COLOR);
}
xvt_dwin_clear(me, NORMAL_BACK_COLOR);
set_font();
}
TField_window::TField_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field* owner)
: _owner(owner)
{
if (owner != NULL)
{
create(x, y, dx, dy, "", WSF_HSCROLL | WSF_VSCROLL, W_PLAIN, parent);
activate(owner->enabled());
if (owner->shown())
open();
}
}
///////////////////////////////////////////////////////////
// TWindowed field
///////////////////////////////////////////////////////////
void TWindowed_field::enable(bool on)
{
TOperable_field::enable(on);
if (_win)
_win->activate(on);
}
void TWindowed_field::show(bool on)
{
TOperable_field::show(on);
if (_win && _win->is_open() != on)
{
if (on)
_win->open();
else
_win->close();
}
}
void TWindowed_field::highlight() const
{
if (_win && active())
_win->set_focus();
}
RCT& TWindowed_field::get_rect(RCT& r) const
{
if (_win)
xvt_vobj_get_outer_rect(_win->win(), &r);
else
xvt_rect_set_empty(&r);
return r;
}
void TWindowed_field::set_rect(const RCT& r)
{
if (_win)
xvt_vobj_move(_win->win(), (RCT*)&r);
}
short TWindowed_field::dlg() const
{
return _dlg ? _dlg : _ctl_data._dlg;
}
void TWindowed_field::parse_head(TScanner& scanner)
{
_ctl_data._width = scanner.integer();
_ctl_data._height = scanner.integer();
}
TField_window* TWindowed_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
{
// Must be always overridden and look like this
return new TField_window(x, y, dx, dy, parent, this);
}
void TWindowed_field::create(short id, int x, int y, int dx, int dy, WINDOW parent)
{
if (parent == NULL_WIN)
parent = mask().win();
_dlg = id;
_win = create_window(x, y, dx, dy, parent);
}
void TWindowed_field::create(WINDOW parent)
{
create(_ctl_data._dlg, _ctl_data._x, _ctl_data._y, _ctl_data._width, _ctl_data._height, parent);
}
TWindowed_field::~TWindowed_field()
{
if (_win)
delete _win;
}

View File

@ -1678,6 +1678,10 @@ protected:
virtual TField_window* create_window(int x, int y, int dx, int dy,
WINDOW parent) pure;
public: // TMask_field
virtual word class_id() const;
virtual bool is_kind_of(word id) const;
virtual const char* class_name() const;
virtual short dlg() const;
virtual WINDOW parent() const { return win().parent(); }
virtual void enable(bool on = true);
@ -1688,57 +1692,10 @@ public: // TMask_field
public:
TField_window& win() const { CHECK(_win, "NULL Window in field"); return *_win; }
TWindowed_field(TMask* m) : TOperable_field(m), _dlg(0), _win(NULL) { }
void create(short id, int x, int y, int dx, int dy, WINDOW parent = NULL_WIN);
TWindowed_field(TMask* m);
virtual ~TWindowed_field();
};
// Implemented in tree.cpp
class TTree;
class TTree_field : public TWindowed_field
{
protected: // TObject
virtual word class_id() const;
virtual bool is_kind_of(word cid) const;
protected: // TWindowed_field
virtual TField_window* create_window(int x, int y, int dx, int dy, WINDOW parent);
public:
TTree* tree() const;
void set_tree(TTree* t);
void hide_leaves(bool yes = true);
void show_leaves(bool yes = true) { hide_leaves(!yes); }
bool select_current();
bool goto_selected();
void set_header(const char* head);
void set_row_height(int rh);
TTree_field(TMask* m) : TWindowed_field(m) { }
virtual ~TTree_field() { }
};
class TGolem_client_field : public TWindowed_field
{
TGolem_field* _driver;
protected: // TObject
virtual word class_id() const;
virtual bool is_kind_of(word cid) const;
protected: // TWindowed_field
virtual TField_window* create_window(int x, int y, int dx, int dy, WINDOW parent);
virtual bool parse_item(TScanner& scan);
public:
TGolem_field* driver() const { return _driver; }
virtual bool on_hit();
TGolem_client_field(TMask* m);
virtual ~TGolem_client_field();
};
#endif // __MASKFLD_H
#endif // __MASKFLD_H

View File

@ -10,6 +10,7 @@
#include <reprint.h>
#include <spotlite.h>
#include <statbar.h>
#include <treectrl.h>
#include <urldefid.h>
#include <utility.h>
#include <xvtility.h>

View File

@ -1,7 +1,187 @@
#define XI_INTERNAL
#include <xinclude.h>
#include <colors.h>
#include <image.h>
#include <maskfld.h>
#include <mask.h>
#include <tree.h>
#include <treectrl.h>
///////////////////////////////////////////////////////////
// TField_window
///////////////////////////////////////////////////////////
#ifndef INCL_XI
extern "C"
{
void xi_draw_3d_rect( WINDOW win, RCT* rctp, BOOLEAN well, int height,
COLOR color_light, COLOR color_ctrl, COLOR color_dark );
}
#endif
void TField_window::handler(WINDOW win, EVENT* ep)
{
switch (ep->type)
{
case E_FOCUS:
if (ep->v.active)
{
WINDOW parent = xvt_vobj_get_parent(win);
XI_OBJ* itf = xi_get_itf((XinWindow)parent);
xi_set_focus(itf);
}
break;
default:
break;
}
TScroll_window::handler(win, ep);
}
bool TField_window::on_key(KEY k)
{
if (k == K_TAB || k == K_BTAB || k == K_F3 || k == K_F4)
{
const TMask& m = _owner->mask();
const short id = _owner->dlg();
const int start = m.id2pos(id);
const int dir = (k == K_TAB || k == K_F3) ? +1 : -1;
int pos = start;
while (TRUE)
{
pos += dir;
if (pos < 0) pos = m.fields()-1;
if (pos >= m.fields()) pos = 0;
if (pos == start)
break;
TMask_field& f = m.fld(pos);
if (f.is_operable())
{
f.set_focus();
return TRUE;
}
}
}
return TScroll_window::on_key(k);
}
void TField_window::update()
{
const WINDOW me = win();
if (CAMPI_SCAVATI)
{
const WINDOW pa = parent();
RCT rct; xvt_vobj_get_outer_rect(me, &rct);
rct.left -= 2; rct.top -= 2; rct.right += 2; rct.bottom += 2;
xi_draw_3d_rect((XinWindow)pa, (XinRect *) &rct, TRUE, 2, // qui
MASK_LIGHT_COLOR, MASK_BACK_COLOR, MASK_DARK_COLOR);
}
xvt_dwin_clear(me, NORMAL_BACK_COLOR);
set_font();
}
TField_window::TField_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field* owner)
: _owner(owner)
{
if (owner != NULL)
{
create(x, y, dx, dy, "", WSF_HSCROLL | WSF_VSCROLL, W_PLAIN, parent);
activate(owner->enabled());
if (owner->shown())
open();
}
}
///////////////////////////////////////////////////////////
// TWindowed field
///////////////////////////////////////////////////////////
void TWindowed_field::enable(bool on)
{
TOperable_field::enable(on);
if (_win)
_win->activate(on);
}
void TWindowed_field::show(bool on)
{
TOperable_field::show(on);
if (_win && _win->is_open() != on)
{
if (on)
_win->open();
else
_win->close();
}
}
void TWindowed_field::highlight() const
{
if (_win && active())
_win->set_focus();
}
RCT& TWindowed_field::get_rect(RCT& r) const
{
if (_win)
xvt_vobj_get_outer_rect(_win->win(), &r);
else
xvt_rect_set_empty(&r);
return r;
}
void TWindowed_field::set_rect(const RCT& r)
{
if (_win)
xvt_vobj_move(_win->win(), (RCT*)&r);
}
word TWindowed_field::class_id() const
{ return CLASS_WINDOWED_FIELD; }
bool TWindowed_field::is_kind_of(word id) const
{ return id == CLASS_WINDOWED_FIELD || TOperable_field::is_kind_of(id); }
const char* TWindowed_field::class_name() const
{ return "WINDOWED"; }
short TWindowed_field::dlg() const
{ return _dlg ? _dlg : _ctl_data._dlg; }
void TWindowed_field::parse_head(TScanner& scanner)
{
_ctl_data._width = scanner.integer();
_ctl_data._height = scanner.integer();
}
TField_window* TWindowed_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
{
// Must be always overridden and look like this
return new TField_window(x, y, dx, dy, parent, this);
}
void TWindowed_field::create(short id, int x, int y, int dx, int dy, WINDOW parent)
{
if (parent == NULL_WIN)
parent = mask().win();
_dlg = id;
_win = create_window(x, y, dx, dy, parent);
}
void TWindowed_field::create(WINDOW parent)
{
create(_ctl_data._dlg, _ctl_data._x, _ctl_data._y, _ctl_data._width, _ctl_data._height, parent);
}
TWindowed_field::TWindowed_field(TMask* m)
: TOperable_field(m), _dlg(0), _win(NULL)
{ }
TWindowed_field::~TWindowed_field()
{
if (_win)
delete _win;
}
#ifdef AGA_TREE
@ -694,14 +874,53 @@ TTree_window::TTree_window(int x, int y, int dx, int dy,
#else
///////////////////////////////////////////////////////////
// TControl_host_window
///////////////////////////////////////////////////////////
class TControl_host_window : public TField_window
{
protected:
WINDOW _ctrl;
protected:
void handler(WINDOW win, EVENT* ep);
TControl_host_window(int x, int y, int dx, int dy,
WINDOW parent, TWindowed_field* owner);
};
void TControl_host_window::handler(WINDOW win, EVENT* ep)
{
switch (ep->type)
{
case E_SIZE:
if (_ctrl != NULL_WIN)
{
RCT rct;
xvt_rect_set(&rct, 0, 0, ep->v.size.width, ep->v.size.height);
xvt_vobj_move(_ctrl, &rct);
}
break;
default:
break;
}
TField_window::handler(win, ep);
}
TControl_host_window::TControl_host_window(int x, int y, int dx, int dy,
WINDOW parent, TWindowed_field* owner)
: TField_window(x, y, dx, dy, parent, owner), _ctrl(NULL_WIN)
{
set_scroll_max(0, 0); // Get rid of that useless scrollbars
}
///////////////////////////////////////////////////////////
// TTree_window
///////////////////////////////////////////////////////////
class TTree_window : public TField_window
class TTree_window : public TControl_host_window
{
TTree* _tree;
WINDOW _ctrl;
bool _hide_leaves;
TAuto_token_string _header;
@ -873,18 +1092,10 @@ void TTree_window::handler(WINDOW win, EVENT* ep)
if (ep->v.ctl.ci.type == WC_TREE && _tree != NULL)
handle_tree_event(ep);
break;
case E_SIZE:
if (_ctrl != NULL_WIN)
{
RCT rct;
xvt_rect_set(&rct, 0, 0, ep->v.size.width, ep->v.size.height);
xvt_vobj_move(_ctrl, &rct);
}
break;
default:
break;
}
TField_window::handler(win, ep);
TControl_host_window::handler(win, ep);
}
bool TTree_window::select_current()
@ -1000,10 +1211,9 @@ void TTree_window::set_row_height(int rh)
TTree_window::TTree_window(int x, int y, int dx, int dy,
WINDOW parent, TTree_field* owner)
: TField_window(x, y, dx, dy, parent, owner),
_tree(NULL), _hide_leaves(false), _ctrl(NULL_WIN)
: TControl_host_window(x, y, dx, dy, parent, owner),
_tree(NULL), _hide_leaves(false)
{
set_scroll_max(0, 0); // Get rid of that useless scrollbars
RCT rct; xvt_vobj_get_client_rect(win(), &rct);
_ctrl = xvt_treeview_create(win(), &rct, "", 0, (long)this, owner->dlg(),
NULL, NULL, NULL, 0, CHARY+2);
@ -1053,3 +1263,109 @@ void TTree_field::set_row_height(int rh)
TField_window* TTree_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
{ return new TTree_window(x, y, dx, dy, parent, this); }
///////////////////////////////////////////////////////////
// TOutlook_field
///////////////////////////////////////////////////////////
class TOutlook_window : public TControl_host_window
{
public:
virtual void handler(WINDOW win, EVENT* ep);
public:
int add_item(short icon, const char* text, int flags);
bool select(int item, bool on);
int selected() const;
TOutlook_window(int x, int y, int dx, int dy, WINDOW parent, TOutlook_field* owner);
};
void TOutlook_window::handler(WINDOW win, EVENT* ep)
{
switch (ep->type)
{
case E_CONTROL:
if (ep->v.ctl.ci.type == WC_OUTLOOKBAR)
{
owner().on_key(K_SPACE);
return;
}
break;
default:
break;
}
TControl_host_window::handler(win, ep);
}
int TOutlook_window::add_item(short icon, const char* text, int flags)
{ return xvt_list_add_item(_ctrl, icon, text, flags); }
bool TOutlook_window::select(int item, bool on)
{ return xvt_list_set_sel(_ctrl, item, on) != FALSE; }
int TOutlook_window::selected() const
{ return xvt_list_get_sel_index(_ctrl); }
TOutlook_window::TOutlook_window(int x, int y, int dx, int dy, WINDOW parent, TOutlook_field* owner)
: TControl_host_window(x, y, dx, dy, parent, owner)
{
WIN_DEF wd; memset(&wd, 0, sizeof(wd));
wd.wtype = WC_OUTLOOKBAR;
wd.v.ctl.ctrl_id = owner->dlg();
wd.rct = resize_rect(x, y, dx, dy, wd.wtype, parent);
_ctrl = xvt_ctl_create_def(&wd, win(), 0);
}
word TOutlook_field::class_id() const
{ return CLASS_OUTLOOK_FIELD; }
bool TOutlook_field::is_kind_of(word cid) const
{ return cid == CLASS_OUTLOOK_FIELD || TWindowed_field::is_kind_of(cid); }
TField_window* TOutlook_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
{ return new TOutlook_window(x, y, dx, dy, parent, this); }
void TOutlook_field::create(short dlg, int x, int y, int dx, int dy, WINDOW parent)
{ construct(dlg, "", x, y, dy, parent, "", dx); }
int TOutlook_field::add_item(short icon, const char* text, int flags)
{
TOutlook_window& ow = (TOutlook_window&)win();
return ow.add_item(icon, text, flags);
}
void TOutlook_field::set_window_data(const char* data)
{
TOutlook_window& ow = (TOutlook_window&)win();
const int sel = atoi(data);
_str.cut(0) << sel;
ow.select(sel, true);
}
const TString& TOutlook_field::get_window_data()
{
TOutlook_window& ow = (TOutlook_window&)win();
_str.cut(0) << ow.selected();
return _str;
}
void TOutlook_field::set(const char* data)
{
set_window_data(data);
set_dirty();
}
const TString& TOutlook_field::get() const
{ return _str; }
bool TOutlook_field::on_key(KEY key)
{
if (key == K_SPACE)
{
get_window_data();
set_dirty();
on_hit();
return true;
}
return TWindowed_field::on_key(key);
}

View File

@ -194,7 +194,7 @@ void TEvent_manager::push(WINDOW w, const EVENT& e)
_e[_end] = e;
const int next = (_end+1) % MAX;
if (next == _begin)
warning_box("Hey %s, clicca piu' piano!", (const char*)user());
warning_box(FR("Hey %s, clicca piu' piano!"), (const char*)user());
else
_end = next;
}
@ -458,63 +458,6 @@ void xvtil_set_font(
}
}
/*
void xvt_draw_rect(WINDOW win, const RCT& rect, COLOR lt, COLOR rb, short depth)
{
RCT r = rect;
CPEN pen;
pen.width = 1;
pen.pat = PAT_SOLID;
pen.style = P_SOLID;
pen.color = lt;
for (short d = 0; d < depth;)
{
xvt_dwin_set_cpen(win, &pen);
PNT p; // Current vertex of the rectangle
bool drawn = FALSE;
if (lt != MASK_BACK_COLOR)
{
p.h = r.left; p.v = r.bottom;
xvt_dwin_draw_set_pos(win, p);
p.v = r.top;
xvt_dwin_draw_line(win, p);
p.h = r.right;
xvt_dwin_draw_line(win, p);
drawn = TRUE;
}
if (rb != MASK_BACK_COLOR)
{
if (pen.color != rb)
{
pen.color = rb;
xvt_dwin_set_cpen(win, &pen);
}
if (!drawn)
{
p.h = r.right; p.v = r.top;
xvt_dwin_draw_set_pos(win, p);
}
p.v = r.bottom;
xvt_dwin_draw_line(win, p);
p.h = r.left;
xvt_dwin_draw_line(win, p);
}
if (++d < depth)
{
r.left++; r.top++;
r.right--; r.bottom--;
}
}
}
*/
// @doc INTERNAL
// @func Permette di creare una finestra
@ -598,16 +541,15 @@ void xvtil_statbar_set(
//
// @xref <f xvt_create_statbar> <f xvt_statbar_refresh>
{
// CHECK(_statbar, "NULL statbar");
if (_statbar)
if (_statbar != NULL_WIN)
{
const TDate oggi(TODAY);
TString256 t;
t << text << '\t' << oggi.string() << " - " << main_app().title();
if (def)
statbar_set_default_title(_statbar, t.get_buffer());
statbar_set_title(_statbar, t.get_buffer());
statbar_set_default_title(_statbar, t);
statbar_set_title(_statbar, t);
}
}
@ -615,13 +557,18 @@ void xvtil_statbar_set(
// @func Setta il testo standard della barra di stato
void xvtil_statbar_refresh()
// @xref <f xvt_create_statbar> <f xvt_statbar_set>
{
if (_statbar)
statbar_set_title(_statbar, NULL);
}
void xvtil_statbar_destroy()
{
if (_statbar != NULL_WIN && statbar_destroy(_statbar))
_statbar = NULL;
}
///////////////////////////////////////////////////////////
// Test menu
///////////////////////////////////////////////////////////

View File

@ -37,6 +37,7 @@ WINDOW xvtil_create_window
WINDOW xvtil_create_statbar();
void xvtil_statbar_set(const char* text, bool def = FALSE);
void xvtil_statbar_refresh();
void xvtil_statbar_destroy();
void beep(int severity = 0);
void do_events();