GnuCash  4.12-73-g094a971c03+
Data Structures | Typedefs | Enumerations | Functions
table-allgui.h File Reference

Declarations for the Table object. More...

#include <glib.h>
#include "basiccell.h"
#include "cellblock.h"
#include "gtable.h"
#include "register-common.h"
#include "table-control.h"
#include "table-layout.h"
#include "table-model.h"

Go to the source code of this file.

Data Structures

struct  VirtualCell
 holds information about each virtual cell. More...
struct  TableGUIHandlers
struct  Table


typedef void(* TableCursorRefreshCB) (Table *table, VirtualCellLocation vcell_loc, gboolean do_scroll)
typedef void(* TableRedrawHelpCB) (Table *table)
typedef void(* TableDestroyCB) (Table *table)


enum  RegisterColor {
 Color definitions used for table elements.


void gnc_table_set_default_gui_handlers (TableGUIHandlers *gui_handlers)
 Set the default gui handlers used by new tables. More...
Table * gnc_table_new (TableLayout *layout, TableModel *model, TableControl *control)
void gnc_virtual_location_init (VirtualLocation *vloc)
void gnc_table_save_state (Table *table, const gchar *state_section)
void gnc_table_destroy (Table *table)
int gnc_table_current_cursor_changed (Table *table, gboolean include_conditional)
void gnc_table_clear_current_cursor_changes (Table *table)
void gnc_table_save_current_cursor (Table *table, CursorBuffer *buffer)
void gnc_table_restore_current_cursor (Table *table, CursorBuffer *buffer)
const char * gnc_table_get_current_cell_name (Table *table)
gboolean gnc_table_get_current_cell_location (Table *table, const char *cell_name, VirtualLocation *virt_loc)
gboolean gnc_table_virtual_cell_out_of_bounds (Table *table, VirtualCellLocation vcell_loc)
 checks the given location and returns true if it is out of bounds of the table. More...
gboolean gnc_table_virtual_location_in_header (Table *table, VirtualLocation virt_loc)
VirtualCellgnc_table_get_virtual_cell (Table *table, VirtualCellLocation vcell_loc)
 returns the virtual cell associated with a particular virtual location. More...
const char * gnc_table_get_entry (Table *table, VirtualLocation virt_loc)
char * gnc_table_get_tooltip (Table *table, VirtualLocation virt_loc)
const char * gnc_table_get_label (Table *table, VirtualLocation virt_loc)
CellIOFlags gnc_table_get_io_flags (Table *table, VirtualLocation virt_loc)
guint32 gnc_table_get_color (Table *table, VirtualLocation virt_loc, gboolean *hatching)
void gnc_table_get_borders (Table *table, VirtualLocation virt_loc, PhysicalCellBorders *borders)
CellAlignment gnc_table_get_align (Table *table, VirtualLocation virt_loc)
gboolean gnc_table_is_popup (Table *table, VirtualLocation virt_loc)
char * gnc_table_get_help (Table *table)
BasicCell * gnc_table_get_cell (Table *table, VirtualLocation virt_loc)
const char * gnc_table_get_cell_name (Table *table, VirtualLocation virt_loc)
const gchar * gnc_table_get_cell_type_name (Table *table, VirtualLocation virt_loc)
gboolean gnc_table_get_cell_location (Table *table, const char *cell_name, VirtualCellLocation vcell_loc, VirtualLocation *virt_loc)
void gnc_table_save_cells (Table *table, gpointer save_data)
VirtualCellgnc_table_get_header_cell (Table *table)
 Return the virtual cell of the header.
void gnc_table_set_size (Table *table, int virt_rows, int virt_cols)
 The gnc_table_set_size() method will resize the table to the indicated dimensions. More...
void gnc_table_set_vcell (Table *table, CellBlock *cursor, gconstpointer vcell_data, gboolean visible, gboolean start_primary_color, VirtualCellLocation vcell_loc)
 Indicate what handler should be used for a given virtual block.
void gnc_table_set_virt_cell_data (Table *table, VirtualCellLocation vcell_loc, gconstpointer vcell_data)
 Set the virtual cell data for a particular location. More...
void gnc_table_set_virt_cell_visible (Table *table, VirtualCellLocation vcell_loc, gboolean visible)
 Set the visibility flag for a particular location. More...
void gnc_table_set_virt_cell_cursor (Table *table, VirtualCellLocation vcell_loc, CellBlock *cursor)
 Set the cellblock handler for a virtual cell. More...
void gnc_table_move_cursor (Table *table, VirtualLocation virt_loc)
 will move the cursor (but not the cursor GUI) to the indicated location. More...
void gnc_table_move_cursor_gui (Table *table, VirtualLocation virt_loc)
 will move the cursor and its GUI to the indicated location. More...
gboolean gnc_table_verify_cursor_position (Table *table, VirtualLocation virt_loc)
 checks the location of the cursor with respect to a virtual location position, and if the resulting virtual location has changed, repositions the cursor and gui to the new position. More...
gpointer gnc_table_get_vcell_data (Table *table, VirtualCellLocation vcell_loc)
 returns the virtual cell data associated with a cursor located at the given virtual coords, or NULL if the coords are out of bounds. More...
gboolean gnc_table_find_close_valid_cell (Table *table, VirtualLocation *virt_loc, gboolean exact_cell)
 Find a close valid cell. More...
void gnc_table_init_gui (Table *table)
 UI-specific functions. More...
void gnc_table_realize_gui (Table *table)
void gnc_table_refresh_current_cursor_gui (Table *table, gboolean do_scroll)
 Refresh the current cursor gui.
void gnc_table_refresh_gui (Table *table, gboolean do_scroll)
 Refresh the whole GUI from the table. More...
void gnc_table_show_range (Table *table, VirtualCellLocation start_loc, VirtualCellLocation end_loc)
 Try to show the whole range in the register. More...
void gnc_table_refresh_cursor_gui (Table *table, VirtualCellLocation vcell_loc, gboolean do_scroll)
 Refresh the cursor in the given location. More...
void gnc_table_wrap_verify_cursor_position (Table *table, VirtualLocation virt_loc)
gboolean gnc_table_virtual_loc_valid (Table *table, VirtualLocation virt_loc, gboolean exact_pointer)
gboolean gnc_table_move_tab (Table *table, VirtualLocation *virt_loc, gboolean move_right)
gboolean gnc_table_move_vertical_position (Table *table, VirtualLocation *virt_loc, int phys_row_offset)
 Moves away from virtual location virt_loc by phys_row_offset physical rows. More...
gboolean gnc_table_enter_update (Table *table, VirtualLocation virt_loc, int *cursor_position, int *start_selection, int *end_selection)
void gnc_table_leave_update (Table *table, VirtualLocation virt_loc)
gboolean gnc_table_confirm_change (Table *table, VirtualLocation virt_loc)
const char * gnc_table_modify_update (Table *table, VirtualLocation virt_loc, const char *change, int change_len, const char *newval, int newval_len, int *cursor_position, int *start_selection, int *end_selection, gboolean *cancelled)
gboolean gnc_table_direct_update (Table *table, VirtualLocation virt_loc, char **newval_ptr, int *cursor_position, int *start_selection, int *end_selection, gpointer gui_data)
gboolean gnc_table_traverse_update (Table *table, VirtualLocation virt_loc, gncTableTraversalDir dir, VirtualLocation *dest_loc)

Detailed Description

Declarations for the Table object.

Copyright (c) 1998,1999,2000 Linas Vepstas
Copyright (c) 2000-2001 Dave Peticolas
The Table object defines the structure and the GUI required
to display a two-dimensional grid. It provides several
important functions:
- An array of virtual cells. These cells contain:
   - the cellblock handler for that virtual cell.
   - a user data pointer
- Tab-traversing mechanism so that operator can tab in a
   predefined order between cells.

This implements the gui-independent parts of the table
infrastructure. Additional, GUI-dependent parts are implemented
in table-gnome.c.

The following concepts apply to the rows in a table:
- a cursor is always the same size as the virt row its on,
- there is only one cursor for a given virt row.
- there is no overlap; a phys row can only belong to one virt row.

Lets say there are three cursors T(rans), S(plit), and B(lank).
Lets say that these are used to 'print' the following table layout:
virtual row 1   T
virtual row 2   S
virtual row 3   B
virtual row 4   T
virtual row 5   S
virtual row 6   S
virtual row 7   S
virtual row 8   S
virtual row 9   B
You can see there is only one cursor per virtual row. There is no overlap
between cursors and virtual rows; the correspondence is one to one. Note
that the three cursors T, S and B may consist of one, or more physical rows,
e.g. B and S may be one line each, but T may be two lines. Thus, we
have the following physical layout:
physical row 1    virtual row 1   T
physical row 2    virtual row 1   T
physical row 3    virtual row 2   S
physical row 4    virtual row 3   B
physical row 5    virtual row 4   T
physical row 6    virtual row 4   T
physical row 7    virtual row 5   S
physical row 8    virtual row 6   S
physical row 9    virtual row 7   S
physical row 10   virtual row 8   S
physical row 11   virtual row 9   B
This layout remains static until the next time that the table is

Definition in file table-allgui.h.