On output, the currently selected menu item is displayed. On input, the user can select from a list in the pull-down menu, or use the keyboard to slect a menu entry by typing the first few menu characters.
Copyright (c) 1998 Linas Vepstas <linas@linas.org>
Copyright (c) 2000 Dave Peticolas
Definition in file combocell.h.
#include <glib.h>
#include "basiccell.h"
#include "QuickFill.h"
Go to the source code of this file.
Data Structures | |
| struct | ComboCell |
Functions | |
| BasicCell * | gnc_combo_cell_new (void) |
| void | gnc_combo_cell_init (ComboCell *cell) |
| void | gnc_combo_cell_set_value (ComboCell *cell, const char *value) |
| void | gnc_combo_cell_clear_menu (ComboCell *cell) |
| void | gnc_combo_cell_add_menu_item (ComboCell *cell, char *menustr) |
| void | gnc_combo_cell_add_account_menu_item (ComboCell *cell, char *menustr) |
| void | gnc_combo_cell_set_strict (ComboCell *cell, gboolean strict) |
| void | gnc_combo_cell_set_complete_char (ComboCell *cell, char complete_char) |
| void | gnc_combo_cell_add_ignore_string (ComboCell *cell, const char *ignore_string) |
| void | gnc_combo_cell_set_autosize (ComboCell *cell, gboolean autosize) |
| void | gnc_combo_cell_use_quickfill_cache (ComboCell *cell, QuickFill *shared_qf) |
|
||||||||||||
|
Add a 'account name' menu item to the list. When testing for equality with the currently selected item, this function will ignore the characters normally used to separate account names. Definition at line 476 of file combocell-gnome.c. 00477 { 00478 PopBox *box; 00479 gchar *menu_copy, *value_copy; 00480 00481 if (cell == NULL) 00482 return; 00483 if (menustr == NULL) 00484 return; 00485 00486 box = cell->cell.gui_private; 00487 box->menustrings = g_list_append (box->menustrings, 00488 g_strdup (menustr)); 00489 00490 gnc_combo_sync_edit_list(box); 00491 00492 if (box->item_list != NULL) 00493 { 00494 block_list_signals (cell); 00495 00496 gnc_item_list_append (box->item_list, menustr); 00497 if (cell->cell.value) { 00498 menu_copy = g_strdelimit(g_strdup(menustr), "-:/\\.", ' '); 00499 value_copy = 00500 g_strdelimit(g_strdup(cell->cell.value), "-:/\\.", ' '); 00501 if (strcmp (menu_copy, value_copy) == 0) { 00502 gnc_combo_cell_set_value (cell, menustr); 00503 gnc_item_list_select (box->item_list, menustr); 00504 } 00505 g_free(value_copy); 00506 g_free(menu_copy); 00507 } 00508 unblock_list_signals (cell); 00509 } 00510 else 00511 box->list_in_sync = FALSE; 00512 00513 /* If we're going to be using a pre-fab quickfill, 00514 * then don't fill it in here */ 00515 if (FALSE == box->use_quickfill_cache) 00516 { 00517 gnc_quickfill_insert (box->qf, menustr, QUICKFILL_ALPHA); 00518 } 00519 00520 box->list_sorted = FALSE; 00521 }
|
|
||||||||||||
|
Add a string to a list of strings which, if the cell has that value, will cause the cell to be uneditable on 'enter'. Definition at line 961 of file combocell-gnome.c. 00963 { 00964 PopBox *box; 00965 00966 if (cell == NULL) 00967 return; 00968 00969 if (!ignore_string) 00970 return; 00971 00972 box = cell->cell.gui_private; 00973 00974 box->ignore_strings = g_list_prepend (box->ignore_strings, 00975 g_strdup (ignore_string)); 00976 }
|
|
||||||||||||
|
Add a menu item to the list. Definition at line 436 of file combocell-gnome.c. 00437 { 00438 PopBox *box; 00439 00440 if (cell == NULL) 00441 return; 00442 if (menustr == NULL) 00443 return; 00444 00445 box = cell->cell.gui_private; 00446 box->menustrings = g_list_append (box->menustrings, 00447 g_strdup (menustr)); 00448 00449 gnc_combo_sync_edit_list(box); 00450 00451 if (box->item_list != NULL) 00452 { 00453 block_list_signals (cell); 00454 00455 gnc_item_list_append (box->item_list, menustr); 00456 if (cell->cell.value && 00457 (strcmp (menustr, cell->cell.value) == 0)) 00458 gnc_item_list_select (box->item_list, menustr); 00459 00460 unblock_list_signals (cell); 00461 } 00462 else 00463 box->list_in_sync = FALSE; 00464 00465 /* If we're going to be using a pre-fab quickfill, 00466 * then don't fill it in here */ 00467 if (FALSE == box->use_quickfill_cache) 00468 { 00469 gnc_quickfill_insert (box->qf, menustr, QUICKFILL_ALPHA); 00470 } 00471 00472 box->list_sorted = FALSE; 00473 }
|
|
||||||||||||
|
Determines whether the popup list autosizes itself or uses all available space. FALSE by default. Definition at line 979 of file combocell-gnome.c. 00980 { 00981 PopBox *box; 00982 00983 if (!cell) 00984 return; 00985 00986 box = cell->cell.gui_private; 00987 if (!box) 00988 return; 00989 00990 box->autosize = autosize; 00991 }
|
|
||||||||||||
|
Sets a character used for special completion processing. Definition at line 948 of file combocell-gnome.c. 00949 { 00950 PopBox *box; 00951 00952 if (cell == NULL) 00953 return; 00954 00955 box = cell->cell.gui_private; 00956 00957 box->complete_char = complete_char; 00958 }
|
|
||||||||||||
|
Determines whether the cell will accept strings not in the menu. Defaults to strict, i.e., only menu items are accepted. Definition at line 935 of file combocell-gnome.c. 00936 { 00937 PopBox *box; 00938 00939 if (cell == NULL) 00940 return; 00941 00942 box = cell->cell.gui_private; 00943 00944 box->strict = strict; 00945 }
|
|
||||||||||||
|
Tell the combocell to use a shared QuickFill object. Using this routine can dramatically improve performance when creating combocells with a large number of entries. For example, users with thousands of accounts are complaining about 10-second register startup times, of which 98% of the cpu is spent building the multi-thousand entry quickfill. When a shared quickfill is specified, the combo-cell will not add to nor delete the quickfill; it is the users resonsibility to manage the quickfill object. The combocell will *not* make a copy of teh quickfill. Definition at line 389 of file combocell-gnome.c. 00390 { 00391 PopBox *box; 00392 00393 if (cell == NULL) return; 00394 00395 box = cell->cell.gui_private; 00396 if (NULL == box) return; 00397 00398 if (FALSE == box->use_quickfill_cache) 00399 { 00400 box->use_quickfill_cache = TRUE; 00401 gnc_quickfill_destroy (box->qf); 00402 } 00403 box->qf = shared_qf; 00404 }
|
1.4.3-20050530