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.
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_sort_enabled (ComboCell *cell, gboolean enabled) |
| void | gnc_combo_cell_set_strict (ComboCell *cell, gboolean strict) |
| void | gnc_combo_cell_set_complete_char (ComboCell *cell, gunichar 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) |
| void | gnc_combo_cell_use_list_store_cache (ComboCell *cell, gpointer data) |
| void gnc_combo_cell_add_account_menu_item | ( | ComboCell * | cell, | |
| char * | menustr | |||
| ) |
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 451 of file combocell-gnome.c.
00452 { 00453 PopBox *box; 00454 gchar *menu_copy, *value_copy; 00455 00456 if (cell == NULL) 00457 return; 00458 if (menustr == NULL) 00459 return; 00460 00461 box = cell->cell.gui_private; 00462 00463 if (box->item_list != NULL) 00464 { 00465 block_list_signals (cell); 00466 00467 gnc_item_list_append (box->item_list, menustr); 00468 if (cell->cell.value) { 00469 menu_copy = g_strdelimit(g_strdup(menustr), "-:/\\.", ' '); 00470 value_copy = 00471 g_strdelimit(g_strdup(cell->cell.value), "-:/\\.", ' '); 00472 if (strcmp (menu_copy, value_copy) == 0) { 00473 gnc_combo_cell_set_value (cell, menustr); 00474 gnc_item_list_select (box->item_list, menustr); 00475 } 00476 g_free(value_copy); 00477 g_free(menu_copy); 00478 } 00479 unblock_list_signals (cell); 00480 } 00481 00482 /* If we're going to be using a pre-fab quickfill, 00483 * then don't fill it in here */ 00484 if (FALSE == box->use_quickfill_cache) 00485 { 00486 gnc_quickfill_insert (box->qf, menustr, QUICKFILL_ALPHA); 00487 } 00488 }
| void gnc_combo_cell_add_ignore_string | ( | ComboCell * | cell, | |
| const char * | ignore_string | |||
| ) |
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 931 of file combocell-gnome.c.
00933 { 00934 PopBox *box; 00935 00936 if (cell == NULL) 00937 return; 00938 00939 if (!ignore_string) 00940 return; 00941 00942 box = cell->cell.gui_private; 00943 00944 box->ignore_strings = g_list_prepend (box->ignore_strings, 00945 g_strdup (ignore_string)); 00946 }
| void gnc_combo_cell_add_menu_item | ( | ComboCell * | cell, | |
| char * | menustr | |||
| ) |
Add a menu item to the list.
Definition at line 414 of file combocell-gnome.c.
00415 { 00416 PopBox *box; 00417 00418 if (cell == NULL) 00419 return; 00420 if (menustr == NULL) 00421 return; 00422 00423 box = cell->cell.gui_private; 00424 00425 if (box->item_list != NULL) 00426 { 00427 block_list_signals (cell); 00428 00429 gnc_item_list_append (box->item_list, menustr); 00430 if (cell->cell.value && 00431 (strcmp (menustr, cell->cell.value) == 0)) 00432 gnc_item_list_select (box->item_list, menustr); 00433 00434 unblock_list_signals (cell); 00435 } else { 00436 GtkTreeIter iter; 00437 00438 gtk_list_store_append(box->tmp_store, &iter); 00439 gtk_list_store_set(box->tmp_store, &iter, 0, menustr, -1); 00440 } 00441 00442 /* If we're going to be using a pre-fab quickfill, 00443 * then don't fill it in here */ 00444 if (FALSE == box->use_quickfill_cache) 00445 { 00446 gnc_quickfill_insert (box->qf, menustr, QUICKFILL_ALPHA); 00447 } 00448 }
| void gnc_combo_cell_set_autosize | ( | ComboCell * | cell, | |
| gboolean | autosize | |||
| ) |
Determines whether the popup list autosizes itself or uses all available space. FALSE by default.
Definition at line 949 of file combocell-gnome.c.
00950 { 00951 PopBox *box; 00952 00953 if (!cell) 00954 return; 00955 00956 box = cell->cell.gui_private; 00957 if (!box) 00958 return; 00959 00960 box->autosize = autosize; 00961 }
| void gnc_combo_cell_set_complete_char | ( | ComboCell * | cell, | |
| gunichar | complete_char | |||
| ) |
Sets a character used for special completion processing.
Definition at line 918 of file combocell-gnome.c.
00919 { 00920 PopBox *box; 00921 00922 if (cell == NULL) 00923 return; 00924 00925 box = cell->cell.gui_private; 00926 00927 box->complete_char = complete_char; 00928 }
| void gnc_combo_cell_set_sort_enabled | ( | ComboCell * | cell, | |
| gboolean | enabled | |||
| ) |
Enable sorting of the menu item's contents. Loading the item is much faster with sorting disabled.
Definition at line 342 of file combocell-gnome.c.
00343 { 00344 PopBox *box; 00345 00346 if (cell == NULL) 00347 return; 00348 00349 box = cell->cell.gui_private; 00350 if (box->item_list == NULL) 00351 return; 00352 00353 block_list_signals (cell); 00354 gnc_item_list_set_sort_enabled(box->item_list, enabled); 00355 unblock_list_signals (cell); 00356 }
| void gnc_combo_cell_set_strict | ( | ComboCell * | cell, | |
| gboolean | strict | |||
| ) |
Determines whether the cell will accept strings not in the menu. Defaults to strict, i.e., only menu items are accepted.
Definition at line 905 of file combocell-gnome.c.
00906 { 00907 PopBox *box; 00908 00909 if (cell == NULL) 00910 return; 00911 00912 box = cell->cell.gui_private; 00913 00914 box->strict = strict; 00915 }
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 388 of file combocell-gnome.c.
00389 { 00390 PopBox *box; 00391 00392 if (cell == NULL) return; 00393 00394 box = cell->cell.gui_private; 00395 if (NULL == box) return; 00396 00397 if (FALSE == box->use_quickfill_cache) 00398 { 00399 box->use_quickfill_cache = TRUE; 00400 gnc_quickfill_destroy (box->qf); 00401 } 00402 box->qf = shared_qf; 00403 }
1.5.2