GnuCash  5.6-150-g038405b370+
Data Fields
BasicCell Struct Reference

The BasicCell class provides an abstract base class defining the handling of the editing of a cell of a table. More...

#include <basiccell.h>

Data Fields

char * cell_name
 
gchar * cell_type_name
 
char * value
 
guint value_chars
 current value
 
gboolean changed
 number of characters in value
 
gboolean conditionally_changed
 true if value modified
 
CellSetValueFunc set_value
 true if value modified conditionally
 
CellDestroyFunc destroy
 
CellEnterFunc enter_cell
 
CellModifyVerifyFunc modify_verify
 
CellDirectUpdateFunc direct_update
 
CellLeaveFunc leave_cell
 
CellRealizeFunc gui_realize
 
CellMoveFunc gui_move
 
CellDestroyFunc gui_destroy
 
char * sample_text
 
CellAlignment alignment
 sample text for sizing purposes
 
gboolean expandable
 horizontal alignment in column
 
gboolean span
 can fill with extra space
 
gboolean is_popup
 can span multiple columns
 
gpointer gui_private
 is a popup widget
 

Detailed Description

The BasicCell class provides an abstract base class defining the handling of the editing of a cell of a table.

Classes that provide the actual handling for different cell types should inherit from this class.

The BasicCell class encapsulates a single string value which can be set & read by the programmer, and edited by the "user". In the text below, the "user" is the person controlling the mouse and keyboard. Thus, when the user makes a move, it means that they have somehow interacted with the cell, by clicking with mouse or by typing at the keyboard. This class provides three callbacks which allow the programmer to understand what the user is doing.

The programmer can create a custom GUI for editing the contents of the cell. There are three callbacks to allow a custom GUI to be created, destroyed and moved about.

Since this class is implemented in C not C++, there is a "minor" problem with inheritance. To emulate the overloading of a virtual "SetValues" method, there is a set_value() callback, which will be called whenever the xaccSetBasicCellValue() subroutine is called.

VIRTUAL/OVERLOADED METHODS: The set_value() callback will be called whenever the xaccSetBasicCellValue() method is called. Derived classes should provide a callback here if they need to understand special cell formats.

USER CALLBACKS: The enter_cell() callback is called when the user first makes a move to enter a cell. This might be by clicking on the cell with the mouse, by tabbing to it, using the arrow keys, or otherwise "selecting" it as the current cell to edit.

The callback may change the value of the cell. The callback should return true if the cell should allow direct editing by the user, FALSE otherwise.

The callback is also passed pointers to the cursor position and the start and end of the highlited region. If the callback returns NULL, it may also change these values and the GUI will update appropriately.

The leave_cell() callback is called when the user exits a cell. This can be by tabbing or arrow-keying away from it, or by using the mouse to specify a different cell, etc. The callback may change the value of the cell.

The modify_verify() callback is called when a user makes a change to a cell. It is called after every keystroke, (actually, after every X11 "input-method" type input, so that ctrl-alt-etc modifier keys are pre-processed in the usual X11 fashion).

The arguments passed in are : "add", the string the user is attempting to add (will be null if text is being deleted). "new", the string that would result is user's changes are accepted. "cursor_position", the position of the editing cursor in the text. This may be modified by the callback, in which case the GUI will reflect the change. Set to -1 to make the cursor go to the end of the text. "start_selection", the starting character of the highlited selection. "end_selection", the index immediately after the last character in the selection. Set both start and end to 0 for no selection. Set the end to -1 to make the selection go to the end of the text.

The direct_update() callback is called to pass raw gui data to the cell. The exact format of the data is determined by the gui. The callback should return TRUE if the event was handled, i.e., there is no need to call the modify update. If the value needs to be changed, the cell should go ahead and change it.

GUI CALLBACKS: The cell may have some specific GUI elements which need to be initialized/positioned/etc. There are three GUI callbacks that allow the programmer to perform GUI-specific initialization & changes.

The gui_realize() callback will be called when GUI-specific initialization needs to be done. For Gnome, the second argument will be cast to the parent widget.

The gui_destroy() callback will be called when the GUI associated with the cell needs to be destroyed.

The gui_move() callback will be called when the GUI element needs to be positioned to a new location within the table grid. The second argument is the virtual location the GUI element should be moved to.

The gui_private member may be used by the derived class to store any additional GUI-specific data.

Definition at line 212 of file basiccell.h.


The documentation for this struct was generated from the following file: