GnuCash c935c2f+
Loading...
Searching...
No Matches
table-allgui.h
Go to the documentation of this file.
1/********************************************************************\
2 * table-allgui.h -- 2D grid table object, embeds cells for i/o *
3 * *
4 * This program is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU General Public License as *
6 * published by the Free Software Foundation; either version 2 of *
7 * the License, or (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License*
15 * along with this program; if not, contact: *
16 * *
17 * Free Software Foundation Voice: +1-617-542-5942 *
18 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
19 * Boston, MA 02110-1301, USA gnu@gnu.org *
20 * *
21\********************************************************************/
118#ifndef TABLE_ALLGUI_H
119#define TABLE_ALLGUI_H
120
121#include <glib.h>
122
123#include "basiccell.h"
124#include "cellblock.h"
125#include "gtable.h"
126#include "register-common.h"
127#include "table-control.h"
128#include "table-layout.h"
129#include "table-model.h"
130
132typedef struct
133{
134 CellBlock *cellblock;
135 gpointer vcell_data;
137 /* flags */
138 unsigned int visible : 1;
139 unsigned int start_primary_color : 1;
141
142typedef struct table Table;
143
144typedef void (*TableCursorRefreshCB) (Table *table,
145 VirtualCellLocation vcell_loc,
146 gboolean do_scroll);
147
148typedef void (*TableRedrawHelpCB) (Table *table);
149typedef void (*TableDestroyCB) (Table *table);
150
151typedef struct
152{
153 TableCursorRefreshCB cursor_refresh;
154
155 TableRedrawHelpCB redraw_help;
156 TableDestroyCB destroy;
157
158 CellDirectUpdateFunc default_direct_update;
160
161struct table
162{
163 TableLayout *layout;
164 TableModel *model;
165 TableControl *control;
166
167 int num_virt_rows;
168 int num_virt_cols;
169
170 CellBlock *current_cursor;
171
172 VirtualLocation current_cursor_loc;
173
174 /* private data */
175
176 /* The virtual cell table */
177 GTable *virt_cells;
178
179 TableGUIHandlers gui_handlers;
180 gpointer ui_data;
181};
182
184typedef enum {
185 COLOR_UNDEFINED = 0, // 0
186 COLOR_HEADER, // 1
187 COLOR_PRIMARY, // 2
188 COLOR_PRIMARY_ACTIVE, // 3
189 COLOR_SECONDARY, // 4
190 COLOR_SECONDARY_ACTIVE, // 5
191 COLOR_SPLIT, // 6
192 COLOR_SPLIT_ACTIVE, // 7
193 COLOR_NEGATIVE = 16, // 16
195
196
199
200/* Functions to create and destroy Tables. */
201Table * gnc_table_new (TableLayout *layout,
202 TableModel *model,
203 TableControl *control);
204void gnc_virtual_location_init (VirtualLocation *vloc);
205
206void gnc_table_save_state (Table *table, const gchar *state_section);
207void gnc_table_destroy (Table *table);
208
209
210/* Functions to work with current cursor */
211int gnc_table_current_cursor_changed (Table *table,
212 gboolean include_conditional);
213
214void gnc_table_clear_current_cursor_changes (Table *table);
215
216void gnc_table_save_current_cursor (Table *table, CursorBuffer *buffer);
217void gnc_table_restore_current_cursor (Table *table,
218 CursorBuffer *buffer);
219
220const char * gnc_table_get_current_cell_name (Table *table);
221
222gboolean gnc_table_get_current_cell_location (Table *table,
223 const char *cell_name,
224 VirtualLocation *virt_loc);
225
226
230 VirtualCellLocation vcell_loc);
231
232gboolean gnc_table_virtual_location_in_header (Table *table,
233 VirtualLocation virt_loc);
234
235
239 VirtualCellLocation vcell_loc);
240
241const char * gnc_table_get_entry (Table *table, VirtualLocation virt_loc);
242
243char * gnc_table_get_tooltip (Table *table, VirtualLocation virt_loc);
244
245const char * gnc_table_get_label (Table *table, VirtualLocation virt_loc);
246
247CellIOFlags gnc_table_get_io_flags (Table *table, VirtualLocation virt_loc);
248
249guint32 gnc_table_get_color (Table *table, VirtualLocation virt_loc,
250 gboolean *hatching);
251
252void gnc_table_get_borders (Table *table, VirtualLocation virt_loc,
253 PhysicalCellBorders *borders);
254
255CellAlignment gnc_table_get_align (Table *table, VirtualLocation virt_loc);
256
257gboolean gnc_table_is_popup (Table *table, VirtualLocation virt_loc);
258
259char * gnc_table_get_help (Table *table);
260
261BasicCell * gnc_table_get_cell (Table *table, VirtualLocation virt_loc);
262
263const char * gnc_table_get_cell_name (Table *table,
264 VirtualLocation virt_loc);
265const gchar * gnc_table_get_cell_type_name (Table *table,
266 VirtualLocation virt_loc);
267gboolean gnc_table_get_cell_location (Table *table,
268 const char * cell_name,
269 VirtualCellLocation vcell_loc,
270 VirtualLocation *virt_loc);
271
272const char * gnc_table_get_model_entry (Table *table, const char *cell_name);
273
274void gnc_table_save_cells (Table *table, gpointer save_data);
275
276
279
282void gnc_table_set_size (Table * table, int virt_rows, int virt_cols);
283
285void gnc_table_set_vcell (Table *table, CellBlock *cursor,
286 gconstpointer vcell_data,
287 gboolean visible,
288 gboolean start_primary_color,
289 VirtualCellLocation vcell_loc);
290
293 VirtualCellLocation vcell_loc,
294 gconstpointer vcell_data);
295
298 VirtualCellLocation vcell_loc,
299 gboolean visible);
300
303 VirtualCellLocation vcell_loc,
304 CellBlock *cursor);
305
310void gnc_table_move_cursor (Table *table, VirtualLocation virt_loc);
311
314void gnc_table_move_cursor_gui (Table *table, VirtualLocation virt_loc);
315
321 VirtualLocation virt_loc);
322
325gpointer gnc_table_get_vcell_data (Table *table,
326 VirtualCellLocation vcell_loc);
327
332 VirtualLocation *virt_loc,
333 gboolean exact_cell);
334
338void gnc_table_init_gui (Table *table);
339
340void gnc_table_realize_gui (Table *table);
341
344 gboolean do_scroll);
345
347void gnc_table_refresh_gui (Table *table, gboolean do_scroll);
348
350void gnc_table_show_range (Table *table,
351 VirtualCellLocation start_loc,
352 VirtualCellLocation end_loc);
353
357 VirtualCellLocation vcell_loc,
358 gboolean do_scroll);
359
360/* ==================================================== */
361
362void gnc_table_wrap_verify_cursor_position (Table *table,
363 VirtualLocation virt_loc);
364
365gboolean gnc_table_virtual_loc_valid(Table *table,
366 VirtualLocation virt_loc,
367 gboolean exact_pointer);
368
369gboolean gnc_table_move_tab (Table *table,
370 VirtualLocation *virt_loc,
371 gboolean move_right);
372
387 VirtualLocation *virt_loc,
388 int phys_row_offset);
389
390gboolean gnc_table_enter_update(Table *table,
391 VirtualLocation virt_loc,
392 int *cursor_position,
393 int *start_selection,
394 int *end_selection);
395
396void gnc_table_leave_update(Table *table, VirtualLocation virt_loc);
397
398gboolean gnc_table_confirm_change(Table *table, VirtualLocation virt_loc);
399
400const char * gnc_table_modify_update(Table *table,
401 VirtualLocation virt_loc,
402 const char *change,
403 int change_len,
404 const char *newval,
405 int newval_len,
406 int *cursor_position,
407 int *start_selection,
408 int *end_selection,
409 gboolean *cancelled);
410
411gboolean gnc_table_direct_update(Table *table,
412 VirtualLocation virt_loc,
413 char **newval_ptr,
414 int *cursor_position,
415 int *start_selection,
416 int *end_selection,
417 gpointer gui_data);
418
419gboolean gnc_table_traverse_update(Table *table,
420 VirtualLocation virt_loc,
421 gncTableTraversalDir dir,
422 VirtualLocation *dest_loc);
423
424#endif /* TABLE_ALLGUI_H */
Declarations for the CellBlock object.
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 v...
void gnc_table_refresh_gui(Table *table, gboolean do_scroll)
Refresh the whole GUI from the table.
RegisterColor
Color definitions used for table elements.
void gnc_table_refresh_cursor_gui(Table *table, VirtualCellLocation vcell_loc, gboolean do_scroll)
Refresh the cursor in the given location.
void gnc_table_set_default_gui_handlers(TableGUIHandlers *gui_handlers)
Set the default gui handlers used by new tables.
void gnc_table_move_cursor(Table *table, VirtualLocation virt_loc)
will move the cursor (but not the cursor GUI) to the indicated location.
void gnc_table_move_cursor_gui(Table *table, VirtualLocation virt_loc)
will move the cursor and its GUI to the indicated location.
void gnc_table_set_virt_cell_data(Table *table, VirtualCellLocation vcell_loc, gconstpointer vcell_data)
Set the virtual cell data for a particular location.
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.
void gnc_table_set_virt_cell_cursor(Table *table, VirtualCellLocation vcell_loc, CellBlock *cursor)
Set the cellblock handler for a virtual cell.
void gnc_table_init_gui(Table *table)
UI-specific functions.
void gnc_table_set_virt_cell_visible(Table *table, VirtualCellLocation vcell_loc, gboolean visible)
Set the visibility flag for a particular location.
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.
gboolean gnc_table_find_close_valid_cell(Table *table, VirtualLocation *virt_loc, gboolean exact_cell)
Find a close valid cell.
VirtualCell * gnc_table_get_header_cell(Table *table)
Return the virtual cell of the header.
void gnc_table_save_state(Table *table, const gchar *state_section)
Implementation.
Definition table-gnome.c:71
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.
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,...
void gnc_table_show_range(Table *table, VirtualCellLocation start_loc, VirtualCellLocation end_loc)
Try to show the whole range in the register.
void gnc_table_refresh_current_cursor_gui(Table *table, gboolean do_scroll)
Refresh the current cursor gui.
VirtualCell * gnc_table_get_virtual_cell(Table *table, VirtualCellLocation vcell_loc)
returns the virtual cell associated with a particular virtual location.
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.
This is the API for GTables, a datatype for 2-dimensional tables with automatic resizing and memory m...
Common declarations for the register core.
holds information about each virtual cell.
unsigned int start_primary_color
visible in the GUI
gpointer vcell_data
Array of physical cells.
unsigned int visible
Used by higher-level code.