Patch level : 10.0

Files correlati     : tutti
Ricompilazione Demo : [ ]
Commento            :
Aggiunto bottone di ricerca con icona diversa dal normale bottone dei listbox


git-svn-id: svn://10.65.10.50/trunk@17319 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-09-29 14:21:49 +00:00
parent bf9410aed9
commit 30776a4132
5 changed files with 91 additions and 98 deletions

View File

@ -58,7 +58,7 @@ void TInfo_mask::add_row(const char* prompt, unsigned long value, int err)
} }
TInfo_mask::TInfo_mask() TInfo_mask::TInfo_mask()
: TArray_sheet(-1, -1, 78, 18, "Informazioni", "@16|@60") : TArray_sheet(-1, -1, 78, 20, "Informazioni", "@16|@60")
{ {
const word ser_no = dongle().number(); const word ser_no = dongle().number();

View File

@ -384,7 +384,7 @@ void init_controls()
xi_set_pref(XI_PREF_3D_LOOK, CAMPI_SCAVATI); xi_set_pref(XI_PREF_3D_LOOK, CAMPI_SCAVATI);
xi_set_pref(XI_PREF_CARET_WIDTH, 2); xi_set_pref(XI_PREF_CARET_WIDTH, 2);
xi_set_pref(XI_PREF_COMBO_ICON, ICO_COMBO); xi_set_pref(XI_PREF_COMBO_ICON, ICO_COMBO);
xi_set_pref(XI_PREF_OPTIMIZE_CELL_REQUESTS, true); xi_set_pref(XI_PREF_OPTIMIZE_CELL_REQUESTS, TRUE);
xi_init(); xi_init();
@ -1275,7 +1275,7 @@ TText_control::TText_control(WINDOW win, short cid,
if (big) if (big)
{ {
rct.right += (rct.right - rct.left); rct.right += (rct.right - rct.left);
rct.bottom += (rct.bottom - rct.top); rct.bottom += short(xvt_font_get_size(BIG_FONT) - xvt_font_get_size(DEF_FONT));
} }
const unsigned long attrib = flags2attr(flags); const unsigned long attrib = flags2attr(flags);
@ -1387,12 +1387,12 @@ TField_control::TField_control(WINDOW win, short cid,
const char* flags, const char* text) const char* flags, const char* text)
{ {
const bool button = strchr(flags, 'B') != NULL; const bool button = strchr(flags, 'B') != NULL;
create(win, cid, left, top, width, 1, maxlen, flags, text, button); create(win, cid, left, top, width, 1, maxlen, flags, text, button ? 2 : 0);
} }
void TField_control::create(WINDOW win, short cid, void TField_control::create(WINDOW win, short cid,
short left, short top, short width, short height, short maxlen, short left, short top, short width, short height, short maxlen,
const char* flags, const char* text, bool button) const char* flags, const char* text, int button)
{ {
CHECK(!in_create, "Nested control creation"); CHECK(!in_create, "Nested control creation");
in_create = true; in_create = true;
@ -1404,14 +1404,12 @@ void TField_control::create(WINDOW win, short cid,
for (const char* s = flags; *s; s++) for (const char* s = flags; *s; s++)
{ {
if (toupper(*s) == '{') if (*s == '{')
big = true; big = true; else
else if (*s == '}')
if (toupper(*s) == '}')
bold = true; bold = true;
} }
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/4; rct.right += bold ? (width*XI_FU_MULTIPLE/4) : XI_FU_MULTIPLE/4;
@ -1419,10 +1417,7 @@ void TField_control::create(WINDOW win, short cid,
if (big) if (big)
{ {
rct.right += (rct.right - rct.left); rct.right += (rct.right - rct.left);
rct.bottom += short(xvt_font_get_size(BIG_FONT) - xvt_font_get_size(DEF_FONT));
const int dy = (rct.bottom - rct.top) / 2;
rct.bottom += dy;
} }
unsigned long attrib = flags2attr(flags) | XI_ATR_EDITMENU; unsigned long attrib = flags2attr(flags) | XI_ATR_EDITMENU;
@ -1450,20 +1445,17 @@ void TField_control::create(WINDOW win, short cid,
f->well = CAMPI_SCAVATI; f->well = CAMPI_SCAVATI;
f->active_back_color = FOCUS_BACK_COLOR; f->active_back_color = FOCUS_BACK_COLOR;
if (big)
{
f->xi_rct.top = rct.top;
f->xi_rct.bottom = rct.bottom;
f->xi_rct.right = rct.right;
f->xi_rct.left = rct.left;
}
else
if (height == 1) if (height == 1)
{ {
f->auto_tab = true; f->auto_tab = true;
if (button) if (button != 0)
{ {
f->button = true; f->button = true;
switch (button)
{
case 2: f->icon_rid = ICO_SEARCH; break; // Bottone per ricerche
default: break; // Bottone standard ICO_COMBO
}
f->pixel_button_distance = 1; f->pixel_button_distance = 1;
} }
} }
@ -1485,7 +1477,7 @@ void TField_control::create(WINDOW win, short cid,
STX_DATA* stx = (STX_DATA*)_obj->v.field->stx; STX_DATA* stx = (STX_DATA*)_obj->v.field->stx;
CHECKD(stx, "NULL stx for field ", cid); CHECKD(stx, "NULL stx for field ", cid);
if (button) if (_obj->v.field->button)
{ {
// Aggiusta il rettangolo del bottone in modo da allinearlo al testo // Aggiusta il rettangolo del bottone in modo da allinearlo al testo
XinRect& br = (XinRect&)_obj->v.field->btn_rct; XinRect& br = (XinRect&)_obj->v.field->btn_rct;

View File

@ -159,7 +159,7 @@ protected:
void create(WINDOW win, short cid, void create(WINDOW win, short cid,
short left, short top, short left, short top,
short width, short height, short maxlen, short width, short height, short maxlen,
const char* flags, const char* text, bool button); const char* flags, const char* text, int button);
TField_control() {} TField_control() {}

View File

@ -2,6 +2,7 @@
#include <xinclude.h> #include <xinclude.h>
#include <colors.h> #include <colors.h>
#include <controls.h>
#include <image.h> #include <image.h>
#include <mask.h> #include <mask.h>
#include <tree.h> #include <tree.h>
@ -1116,26 +1117,21 @@ void TTree_window::handler(WINDOW win, EVENT* ep)
bool TTree_window::select_current() bool TTree_window::select_current()
{ {
XVT_TREEVIEW_NODE selected = NULL; // Nodo da selezionare (se mai lo trovero') XVT_TREEVIEW_NODE nextsel = NULL; // Nodo da selezionare (se mai lo trovero')
if (_tree != NULL) if (_tree != NULL)
{ {
xvt_treeview_suspend(_ctrl); // Sospendo le notifiche degli eventi
TString id; _tree->curr_id(id); // id del nodo corrente dell'albero TString id; _tree->curr_id(id); // id del nodo corrente dell'albero
// Controllo se il tree control e' gia' posizionato bene // Controllo se il tree control e' gia' posizionato bene
XVT_TREEVIEW_NODE cursel = xvt_treeview_get_selected_node(_ctrl); XVT_TREEVIEW_NODE cursel = xvt_treeview_get_selected_node(_ctrl);
if (cursel != NULL) nextsel = xvt_treeview_find_node_string(_ctrl, id);
{ if (nextsel != NULL && cursel == nextsel)
const char* curdata = xvt_treeview_get_node_data(_ctrl, cursel);
if (id == curdata)
{
xvt_treeview_resume(_ctrl);
return true; return true;
}
}
if (nextsel == NULL)
{
xvt_treeview_suspend(_ctrl); // Sospendo le notifiche degli eventi
TString_array a; TString_array a;
a.add(id); a.add(id);
// Creo la lista dei progenitori // Creo la lista dei progenitori
@ -1169,7 +1165,7 @@ bool TTree_window::select_current()
const char* data = xvt_treeview_get_node_data(_ctrl, child); const char* data = xvt_treeview_get_node_data(_ctrl, child);
if (*row == data) if (*row == data)
{ {
selected = child; nextsel = child;
if (*row == id) // Ho finito if (*row == id) // Ho finito
killed = true; killed = true;
else else
@ -1181,15 +1177,17 @@ bool TTree_window::select_current()
} }
} }
} }
if (selected != NULL)
xvt_treeview_select_node(_ctrl, selected, TRUE);
xvt_treeview_resume(_ctrl); // Riattivo le notifiche degli eventi xvt_treeview_resume(_ctrl); // Riattivo le notifiche degli eventi
_tree->goto_node(id); // Riposiziono l'albero
_tree->goto_node(id);
if (selected != NULL && _tree->expanded())
xvt_treeview_expand_node(_ctrl, selected, FALSE);
} }
return selected != NULL; if (nextsel != NULL)
{
xvt_treeview_select_node(_ctrl, nextsel, TRUE);
if (_tree->expanded())
xvt_treeview_expand_node(_ctrl, nextsel, FALSE);
}
}
return nextsel != NULL;
} }
bool TTree_window::goto_selected() bool TTree_window::goto_selected()
@ -1328,6 +1326,7 @@ TOutlook_window::TOutlook_window(int x, int y, int dx, int dy, WINDOW parent, TO
WIN_DEF wd; memset(&wd, 0, sizeof(wd)); WIN_DEF wd; memset(&wd, 0, sizeof(wd));
wd.wtype = WC_OUTLOOKBAR; wd.wtype = WC_OUTLOOKBAR;
wd.v.ctl.ctrl_id = owner->dlg(); wd.v.ctl.ctrl_id = owner->dlg();
wd.v.ctl.font_id = xvt_default_font(true); // Fat font
wd.rct = resize_rect(x, y, dx, dy, wd.wtype, parent); wd.rct = resize_rect(x, y, dx, dy, wd.wtype, parent);
_ctrl = xvt_ctl_create_def(&wd, win(), 0); _ctrl = xvt_ctl_create_def(&wd, win(), 0);
} }

View File

@ -103,6 +103,7 @@
#define BMP_PDF 174 #define BMP_PDF 174
#define BMP_ARCHIVE 175 #define BMP_ARCHIVE 175
#define BMP_PROGRAM 176 #define BMP_PROGRAM 176
#define BMP_FONT 179
#define BMP_CLOSETURN 206 #define BMP_CLOSETURN 206
#define BMP_CLOSESCONTR 207 #define BMP_CLOSESCONTR 207
#define BMP_SUSPSCONTR 208 #define BMP_SUSPSCONTR 208
@ -136,6 +137,7 @@
#define TOOL_HELP 163 #define TOOL_HELP 163
#define TOOL_SETPRINT 165 #define TOOL_SETPRINT 165
#define TOOL_LENTE 166 #define TOOL_LENTE 166
#define TOOL_FONT 179
#define TOOL_PREF 204 #define TOOL_PREF 204
#define TOOL_ADDPREF 205 #define TOOL_ADDPREF 205
#define TOOL_CLOSETURN 206 #define TOOL_CLOSETURN 206