Patch level : 4.0

Files correlati     : ba?.exe
Ricompilazione Demo : [ ]
Commento            :
Corretta gestione "orecchie" usando controlli nativi
Coretta "riselezione" nei tree controls


git-svn-id: svn://10.65.10.50/trunk@15996 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-01-17 11:03:22 +00:00
parent 91aa6d8c89
commit 9565e5b41a
3 changed files with 54 additions and 16 deletions

View File

@ -40,6 +40,7 @@ bool ADVANCED_GRAPHICS = true;
bool AUTOZOOM = false;
bool AUTOEND = false;
bool NATIVE_CONTROLS = false;
bool USE_NOTEBOOK = false; // NATIVE_CONTROLS
HIDDEN bool _button_blocked = false;
HIDDEN int _last_mouse_button = 0;
@ -526,15 +527,14 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
long wsf = WSF_INVISIBLE | WSF_NO_MENUBAR;
WINDOW win = NULL_WIN;
/* if (NATIVE_CONTROLS && orecchie && parent != NULL_WIN)
if (USE_NOTEBOOK && orecchie && parent != NULL_WIN)
{
const short tab_no = xvt_notebk_get_num_tabs(parent);
xvt_notebk_add_tab(parent, tab_no, caption, NULL);
xvt_notebk_add_page(parent, tab_no, 0, caption, (long)msk);
win = xvt_notebk_create_face(parent, tab_no, 0, EM_ALL, xi_event, (long)msk);
}
else*/
else
win = xvt_win_create(wt, &r, caption, 0L, parent, wsf,
EM_ALL, (EVENT_HANDLER)xi_event, (long)msk);
CHECK(win, "Can't create an XVT window for an interface");
@ -577,7 +577,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
}
// Aggiunge rettangolo di cornice per pagine con orecchie
if (!NATIVE_CONTROLS && orecchie)
if (!USE_NOTEBOOK && orecchie)
{
XI_RCT rct; xi_get_xi_rct(itf, &rct);
rct.top += Y_FU_MULTIPLE; // Lascia lo spazio per i Bottoni di cambio pagina
@ -593,7 +593,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 = (RCT &) 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;
@ -1547,7 +1547,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, (XinRect *) &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;

View File

@ -1096,9 +1096,26 @@ bool TMask::check_current_field() const
return ok;
}
WINDOW TMask::insert_page(const char* title, int where)
WINDOW TMask::insert_page(const char* title, int dove)
{
WINDOW w = NULL_WIN;
if (dove < 0 || dove >= MAX_PAGES)
{
CHECK(toolwin() == NULL_WIN, "One single toolbar, please!");
const int nHeight = atoi(title);
w = create_interface(NULL_WIN, 0, -nHeight, 0, 0, "", this, false);
_pagewin[MAX_PAGES] = w;
if (_pages > 0)
{
RCT rctool; xvt_vobj_get_client_rect(w, &rctool);
RCT rctask; xvt_vobj_get_client_rect(TASK_WIN, &rctask);
rctask.bottom -= rctool.bottom;
for (int i = 0; i < _pages; i++)
xvt_vobj_move(win(i), &rctask);
}
} else
if (_pages < MAX_PAGES)
{
w = create_interface(NULL_WIN, 0, 0, 0, 0, title, this, true);
@ -1112,9 +1129,9 @@ WINDOW TMask::insert_page(const char* title, int where)
}
int i;
for (i = _pages; i > where; i--)
for (i = _pages; i > dove; i--)
_pagewin[i] = _pagewin[i-1];
_pagewin[where] = w;
_pagewin[dove] = w;
_pages++;
TToken_string tags;
@ -1763,7 +1780,7 @@ TEdit_field& TMask::add_string (
// <mf TMask::add_button> <mf TMask::add_radio> <mf TMask::add_memo>
{
TEdit_field* f = new TEdit_field(this);
f->construct(id, prompt, x, y, dim, _pagewin[page], flags, width);
f->construct(id, prompt, x, y, dim, win(page), flags, width);
add_field(f);
return *f;
}
@ -1789,7 +1806,7 @@ TButton_field& TMask::add_button (
// <mf TMask::add_date> <mf TMask::add_radio> <mf TMask::add_memo>
{
TButton_field* f = new TButton_field(this);
f->construct(id, prompt, x, y, dy, _pagewin[page], flags, dx);
f->construct(id, prompt, x, y, dy, win(page), flags, dx);
if (bmpup > 0)
f->set_bmp(bmpup, bmpdn);
add_field(f);

View File

@ -873,6 +873,14 @@ 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;
}
@ -885,9 +893,22 @@ bool TTree_window::select_current()
if (_tree != NULL)
{
xvt_treeview_suspend(_ctrl); // Sospendo le notifiche degli eventi
xvt_treeview_suspend(_ctrl); // Sospendo le notifiche degli eventi
TString id; _tree->curr_id(id); // id del nodo corrente dell'albero
// Controllo se il tree control e' gia' posizionato bene
XVT_TREEVIEW_NODE cursel = xvt_treeview_get_selected_node(_ctrl);
if (cursel != NULL)
{
const char* curdata = xvt_treeview_get_node_data(_ctrl, cursel);
if (id == curdata)
{
xvt_treeview_resume(_ctrl);
return true;
}
}
TString id; _tree->curr_id(id);
TString_array a;
a.add(id);
// Creo la lista dei progenitori
@ -918,7 +939,7 @@ bool TTree_window::select_current()
//killed = true; // Non ho trovato quello che cercavo: esco subito
break;
}
const char* data = (const char*)xvt_treeview_get_node_data(_ctrl, child);
const char* data = xvt_treeview_get_node_data(_ctrl, child);
if (*row == data)
{
selected = child;
@ -938,7 +959,7 @@ bool TTree_window::select_current()
xvt_treeview_resume(_ctrl); // Riattivo le notifiche degli eventi
_tree->goto_node(id);
if (_tree->expanded())
if (selected != NULL && _tree->expanded())
xvt_treeview_expand_node(_ctrl, selected, FALSE);
}
return selected != NULL;
@ -980,7 +1001,7 @@ 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)
_tree(NULL), _hide_leaves(false), _ctrl(NULL_WIN)
{
set_scroll_max(0, 0); // Get rid of that useless scrollbars
RCT rct; xvt_vobj_get_client_rect(win(), &rct);