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:
		
							parent
							
								
									bf9410aed9
								
							
						
					
					
						commit
						30776a4132
					
				| @ -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(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -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,16 +1387,16 @@ 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; | ||||||
|   	bool big = false; |   bool big = false; | ||||||
| 	bool bold = false; | 	bool bold = false; | ||||||
|   const short fcid = cid > 0 ? cid + 2000 : cid - 2000; |   const short fcid = cid > 0 ? cid + 2000 : cid - 2000; | ||||||
|   XI_OBJ_DEF* frm_def = xi_add_form_def(NULL, fcid, fcid); |   XI_OBJ_DEF* frm_def = xi_add_form_def(NULL, fcid, fcid); | ||||||
| @ -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,32 +1445,29 @@ 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) | 	if (height == 1) | ||||||
|   { | 	{ | ||||||
|     f->xi_rct.top = rct.top; | 		f->auto_tab = true; | ||||||
|     f->xi_rct.bottom = rct.bottom; | 		if (button != 0) | ||||||
|     f->xi_rct.right = rct.right; | 		{ | ||||||
|     f->xi_rct.left = rct.left; | 			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; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	else   // E' un multiline, quindi setto il rettangolo
 | ||||||
|  | 	{ | ||||||
|  | 		f->xi_rct.top = rct.top; | ||||||
|  | 		f->xi_rct.bottom = rct.bottom; | ||||||
|  | 		f->xi_rct.right = rct.right; | ||||||
|  | 		f->xi_rct.left = rct.left; | ||||||
|  | 		f->cr_ok = true; | ||||||
|  | 		f->var_len_text = true; | ||||||
| 	} | 	} | ||||||
| 	else |  | ||||||
| 		if (height == 1) |  | ||||||
| 		{ |  | ||||||
| 			f->auto_tab = true; |  | ||||||
| 			if (button) |  | ||||||
| 			{ |  | ||||||
| 				f->button = true; |  | ||||||
| 				f->pixel_button_distance = 1; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		else   // E' un multiline, quindi setto il rettangolo
 |  | ||||||
| 		{ |  | ||||||
| 			f->xi_rct.top = rct.top; |  | ||||||
| 			f->xi_rct.bottom = rct.bottom; |  | ||||||
| 			f->xi_rct.right = rct.right; |  | ||||||
| 			f->xi_rct.left = rct.left; |  | ||||||
| 			f->cr_ok = true; |  | ||||||
| 			f->var_len_text = true; |  | ||||||
| 		} |  | ||||||
| 
 | 
 | ||||||
|   XI_OBJ* itf = get_interface(win); |   XI_OBJ* itf = get_interface(win); | ||||||
|   XI_OBJ* form = xi_create(itf, frm_def); |   XI_OBJ* form = xi_create(itf, frm_def); | ||||||
| @ -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; | ||||||
| @ -1494,7 +1486,7 @@ void TField_control::create(WINDOW win, short cid, | |||||||
|     br.right += offset; |     br.right += offset; | ||||||
|     br.bottom = stx->rct.bottom; |     br.bottom = stx->rct.bottom; | ||||||
|   } |   } | ||||||
|    | 
 | ||||||
|   update_tab_cid(); |   update_tab_cid(); | ||||||
|   xi_dequeue(); |   xi_dequeue(); | ||||||
|   xi_tree_free(frm_def); |   xi_tree_free(frm_def); | ||||||
|  | |||||||
| @ -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() {} | ||||||
|    |    | ||||||
|  | |||||||
| @ -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,80 +1117,77 @@ 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) | ||||||
|  |       return true; | ||||||
|  | 
 | ||||||
|  |     if (nextsel == NULL) | ||||||
|     { |     { | ||||||
|       const char* curdata = xvt_treeview_get_node_data(_ctrl, cursel); |       xvt_treeview_suspend(_ctrl);     // Sospendo le notifiche degli eventi
 | ||||||
|       if (id == curdata) |       TString_array a; | ||||||
|  |       a.add(id); | ||||||
|  |       // Creo la lista dei progenitori
 | ||||||
|  |       while (_tree->goto_father()) | ||||||
|       { |       { | ||||||
|         xvt_treeview_resume(_ctrl); |         const int i = a.add(EMPTY_STRING); | ||||||
|         return true; |         _tree->curr_id(a.row(i)); | ||||||
|  |         _tree->expand(); // Nel caso non fosse gia' espanso
 | ||||||
|       } |       } | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     TString_array a; |       // Scandisco i progenitori partendo dalla radice
 | ||||||
|     a.add(id); |       XVT_TREEVIEW_NODE parent = NULL; // was xvt_treeview_get_root_node(_ctrl);
 | ||||||
|     // Creo la lista dei progenitori
 |       bool killed = false;             // Ho interrotto "bruscamente" la ricerca?
 | ||||||
|     while (_tree->goto_father()) |       FOR_EACH_ARRAY_ROW_BACK(a, r, row) | ||||||
|     { |  | ||||||
|       const int i = a.add(EMPTY_STRING); |  | ||||||
|       _tree->curr_id(a.row(i)); |  | ||||||
|       _tree->expand(); // Nel caso non fosse gia' espanso
 |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     // Scandisco i progenitori partendo dalla radice
 |  | ||||||
|     XVT_TREEVIEW_NODE parent = NULL; // was xvt_treeview_get_root_node(_ctrl);
 |  | ||||||
|     bool killed = false;             // Ho interrotto "bruscamente" la ricerca?
 |  | ||||||
|     FOR_EACH_ARRAY_ROW_BACK(a, r, row) |  | ||||||
|     { |  | ||||||
|       if (killed) |  | ||||||
|         break; |  | ||||||
|       for (int i = 0; ; i++) |  | ||||||
|       { |       { | ||||||
|         XVT_TREEVIEW_NODE child = xvt_treeview_get_child_node(_ctrl, parent, i); |         if (killed) | ||||||
|         if (child == NULL && i == 0) // Forse non c'e' nessun figlio ...
 |  | ||||||
|         { |  | ||||||
|           create_children(parent);   // ... sara' vero?
 |  | ||||||
|           child = xvt_treeview_get_child_node(_ctrl, parent, i); |  | ||||||
|         } |  | ||||||
|         if (child == NULL) // Certamente non ci sono piu' figli
 |  | ||||||
|         { |  | ||||||
|           //killed = true;   // Non ho trovato quello che cercavo: esco subito
 |  | ||||||
|           break; |           break; | ||||||
|         } |         for (int i = 0; ; i++) | ||||||
|         const char* data = xvt_treeview_get_node_data(_ctrl, child); |  | ||||||
|         if (*row == data) |  | ||||||
|         { |         { | ||||||
|           selected = child; |           XVT_TREEVIEW_NODE child = xvt_treeview_get_child_node(_ctrl, parent, i); | ||||||
|           if (*row == id) // Ho finito
 |           if (child == NULL && i == 0) // Forse non c'e' nessun figlio ...
 | ||||||
|             killed = true; |  | ||||||
|           else |  | ||||||
|           { |           { | ||||||
|             parent = child; |             create_children(parent);   // ... sara' vero?
 | ||||||
|             xvt_treeview_expand_node(_ctrl, child, FALSE); |             child = xvt_treeview_get_child_node(_ctrl, parent, i); | ||||||
|  |           } | ||||||
|  |           if (child == NULL) // Certamente non ci sono piu' figli
 | ||||||
|  |           { | ||||||
|  |             //killed = true;   // Non ho trovato quello che cercavo: esco subito
 | ||||||
|  |             break; | ||||||
|  |           } | ||||||
|  |           const char* data = xvt_treeview_get_node_data(_ctrl, child); | ||||||
|  |           if (*row == data) | ||||||
|  |           { | ||||||
|  |             nextsel = child; | ||||||
|  |             if (*row == id) // Ho finito
 | ||||||
|  |               killed = true; | ||||||
|  |             else | ||||||
|  |             { | ||||||
|  |               parent = child; | ||||||
|  |               xvt_treeview_expand_node(_ctrl, child, FALSE); | ||||||
|  |             } | ||||||
|  |             break; | ||||||
|           } |           } | ||||||
|           break; |  | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  |       xvt_treeview_resume(_ctrl); // Riattivo le notifiche degli eventi
 | ||||||
|  |       _tree->goto_node(id);       // Riposiziono l'albero
 | ||||||
|  |     } | ||||||
|  |     if (nextsel != NULL) | ||||||
|  |     { | ||||||
|  |       xvt_treeview_select_node(_ctrl, nextsel, TRUE); | ||||||
|  |       if (_tree->expanded()) | ||||||
|  |         xvt_treeview_expand_node(_ctrl, nextsel, FALSE); | ||||||
|     } |     } | ||||||
|     if (selected != NULL) |  | ||||||
|       xvt_treeview_select_node(_ctrl, selected, TRUE); |  | ||||||
|     xvt_treeview_resume(_ctrl); // Riattivo le notifiche degli eventi
 |  | ||||||
|      |  | ||||||
|     _tree->goto_node(id); |  | ||||||
|     if (selected != NULL && _tree->expanded()) |  | ||||||
|       xvt_treeview_expand_node(_ctrl, selected, FALSE); |  | ||||||
|   } |   } | ||||||
|   return selected != NULL; |   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); | ||||||
| }         | }         | ||||||
|  | |||||||
| @ -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 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user