UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
ZmTableTool Class Reference

#include <ZmTableTool.H>

Inheritance diagram for ZmTableTool:
ZmSelection ZmDbTableTool

Public Types

enum  ValueDiagnose {
  vdOK, vdBadNumber, vdBadDomain, vdBadRange,
  vdBadDbName, vdTooLong, vdTooShort, vdSkip,
  vdEmpty
}
 

Public Member Functions

 ZmTableTool (Widget wParent, int nColumns, const char *szResName=ZmTT_DEFAULT_RES_NAME)
 
virtual ~ZmTableTool ()
 
 operator Widget () const
 
virtual void set_visible_rows_number (int nVisRows)
 
virtual void limit_size ()
 
virtual void refresh ()
 
virtual void commit_changes ()
 
void fix_left_column (Logic flag)
 
Logic is_left_column_fixed () const
 
void fix_rows_number (Logic flag)
 
Logic is_rows_number_fixed () const
 
void set_current_pos (int iRow, int iColumn)
 
void get_current_pos (int &iRow, int &iColumn) const
 
ValueDiagnose verify_string (AtomType atype, int dim, const char *s)
 
ValueDiagnose verify_int (AtomType atype, const char *s)
 
ValueDiagnose verify_real (AtomType atype, const char *s)
 
void scan_string (AtomType atype, const char *s, void *v)
 
void scan_string (AtomType atype, int dim, const char *s, void *v)
 
virtual void write_cell (int iRow, int iColumn, const char *s)
 
virtual void delete_rows (int iRow, int nRows)
 
virtual void insert_rows (int iRow, int nRows)
 
virtual void add_row ()
 
virtual int get_rows_count ()
 
virtual char * draw_cell (int iRow, int iColumn)
 
virtual char * get_column_label (int iColumn)
 
virtual char * get_row_label (int iRow)
 
virtual int get_column_width (int iColumn)
 
virtual int get_column_length (int iColumn)
 
virtual int get_row_labels_width ()
 
virtual Logic start_modifying_cell (int iRow, int iColumn, const char *szText)
 
virtual Logic verify_cell (int iRow, int iColumn, const char *szText)
 
virtual void popup_menu (int iRow, int iColumn)
 
void select_all_rows ()
 
void unselect_rows ()
 
void select_row (int iRow)
 
void select_till_row (int iRow)
 
void get_selected_rows (IntAr &sRows) const
 
void select_all_columns ()
 
void unselect_columns ()
 
void select_column (int iColumn, bool bForce=false)
 
void get_selected_columns (IntAr &sCols) const
 
virtual void highlight_data (bool flag)
 
void copy_to_clipboard (Time timestamp)
 
void paste_from_clipboard (Time timestamp)
 
- Public Member Functions inherited from ZmSelection
 ZmSelection (Widget w, Atom name=XA_PRIMARY)
 
virtual ~ZmSelection ()
 
virtual bool publish_data (const char *text, Time timestamp)
 
virtual void unpublish_data (Time timestamp)
 
virtual bool request_data (char *&text, Time timestamp)
 

Protected Types

enum  DataDirection { Cell, Rows, Columns }
 

Protected Member Functions

Logic event_to_pos (XEvent *xev, int &iRow, int &iColumn)
 
void set_row_labels ()
 
void set_column_labels ()
 
void set_column_widths ()
 
void set_column_lengths ()
 
void normalize_pos (int &iRow, int &iColumn)
 
Logic dialog_number_of_rows (int &nRows)
 

Static Protected Member Functions

static void PostItCB (Widget w, XtPointer pUserData, XEvent *event, Boolean *rc)
 
static void DrawWriteCellCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void InsertRowCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void InsertRowsCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void DeleteRowsCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void DuplicateRowsCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void SelectRowCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void SelectRowsHereCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void SelectAllRowsCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void UnselectAllRowsCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void EnterCellCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void ModifyCellCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void VerifyCellCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void TrackVisibleCellCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void LabelCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void ClipbCutCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void ClipbCopyCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 
static void ClipbPasteCB (Widget w, XtPointer pUserData, XtPointer pCallData)
 

Protected Attributes

Widget wMatrix
 
Widget wPopup
 
Widget wPopupItem [16]
 
int rows_cnt
 
int columns_cnt
 
int popup_row
 
int popup_column
 
Logic bFixedRowsNumber
 
GrowingBuffer gb
 
GrowingBuffer gbClipboard
 
int last_sel_row
 
IntAr selRows
 
IntAr selCols
 
IntAr pubRows
 
IntAr pubCols
 
- Protected Attributes inherited from ZmSelection
struct {
   Atom   type
 
   XtPointer   data
 
   unsigned long   size
 
   int   format
 
im_buf
 
struct {
   Atom   type
 
   XtPointer   data
 
   unsigned long   size
 
   int   format
 
ex_buf
 
bool bPaste
 
Atom aName
 
Atom aData
 
Widget wToplevel
 

Detailed Description

Base class for building arbitrary table editors with fixed number of columns. ATTENSION! Row and column indeces are counted from 0!

Member Enumeration Documentation

Selected and published data direction.

Kind of

Enumerator
vdOK 

right syntax of the value

vdBadNumber 

bad syntax of number

vdBadDomain 

for floating numbers

vdBadRange 

if is not in range

vdBadDbName 

bad db name syntax

vdTooLong 

too long string

vdTooShort 

less values than vector needs

vdSkip 

internal reason to skip value

vdEmpty 

empty value for specific types (floating point)

Constructor & Destructor Documentation

ZmTableTool::ZmTableTool ( Widget  wParent,
int  nColumns,
const char *  szResName = ZmTT_DEFAULT_RES_NAME 
)

Common constructor

virtual ZmTableTool::~ZmTableTool ( )
virtual

Destructor

Member Function Documentation

virtual void ZmTableTool::add_row ( )
virtual

Callback to add one row at the end of table.

Reimplemented in ZmDbTableTool.

static void ZmTableTool::ClipbCopyCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Copy selected rows/columns into the clipboard buffer.

static void ZmTableTool::ClipbCutCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Cut selected rows/columns into the clipboard buffer. In case of fixed number of rows performs 'Copy' into clipboard.

static void ZmTableTool::ClipbPasteCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Paste rows/columns into the table. Columns replace contents at the current cursor. Rows are inserted at the current cursor position in case of editable table and replace contents at the current cursor position in case of fixed number of rows.

virtual void ZmTableTool::commit_changes ( )
virtual

Called to synchronize with other objects which share the same internal data representation. At this moment internal data already has been changed.

void ZmTableTool::copy_to_clipboard ( Time  timestamp)

Publish current selection to clipboard.

virtual void ZmTableTool::delete_rows ( int  iRow,
int  nRows 
)
virtual

Callback to delete rows iRow..iRow+nRows-1.

Reimplemented in ZmDbTableTool.

static void ZmTableTool::DeleteRowsCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Callback to delete current row/selected rows.

Logic ZmTableTool::dialog_number_of_rows ( int &  nRows)
protected

Enter number of rows. TRUE - OK; FALSE - Cancel.

virtual char* ZmTableTool::draw_cell ( int  iRow,
int  iColumn 
)
virtual

Draw data from internal data structures to screen

Reimplemented in ZmDbTableTool.

static void ZmTableTool::DrawWriteCellCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Support draw/write cell data events.

static void ZmTableTool::DuplicateRowsCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Callback to duplicate rows.

static void ZmTableTool::EnterCellCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Callback to enter into the cell.

Logic ZmTableTool::event_to_pos ( XEvent *  xev,
int &  iRow,
int &  iColumn 
)
protected

Address cell by XEvent

void ZmTableTool::fix_left_column ( Logic  flag)

Fix left column.

void ZmTableTool::fix_rows_number ( Logic  flag)

Fix number of rows.

virtual char* ZmTableTool::get_column_label ( int  iColumn)
virtual

Draw column title from data structures to screen. Default method: draw index of column + 1

Reimplemented in ZmDbTableTool.

virtual int ZmTableTool::get_column_length ( int  iColumn)
virtual

Get column length (characters to enter).

Reimplemented in ZmDbTableTool.

virtual int ZmTableTool::get_column_width ( int  iColumn)
virtual

Get column width (visible column).

Reimplemented in ZmDbTableTool.

virtual char* ZmTableTool::get_row_label ( int  iRow)
virtual

Callback to draw row title from data structures to screen. Default method: draw index of row + 1

virtual int ZmTableTool::get_row_labels_width ( )
virtual

Get row labels width.

virtual int ZmTableTool::get_rows_count ( )
virtual

Get count of rows in internal data table.

Reimplemented in ZmDbTableTool.

void ZmTableTool::get_selected_columns ( IntAr sCols) const

Obtain list of selected columns or 0 items in case of no rows were selected or columns are selected now.

void ZmTableTool::get_selected_rows ( IntAr sRows) const

Obtain list of selected rows or 0 items in case of no rows were selected or columns are selected now.

virtual void ZmTableTool::highlight_data ( bool  flag)
virtual

Method for visual highlighting of selected data. True means an request to highlight, false means to reset highlighting. An application may ignore this order.

Reimplemented from ZmSelection.

virtual void ZmTableTool::insert_rows ( int  iRow,
int  nRows 
)
virtual

Callback to insert nRows on iRow position.

Reimplemented in ZmDbTableTool.

static void ZmTableTool::InsertRowCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Callback to insert row(s).

static void ZmTableTool::LabelCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Called when label is pressed.

virtual void ZmTableTool::limit_size ( )
virtual

Limit size of widget to be less than Screen

static void ZmTableTool::ModifyCellCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Callback to start modify the cell.

void ZmTableTool::normalize_pos ( int &  iRow,
int &  iColumn 
)
protected

Normalize position.

ZmTableTool::operator Widget ( ) const

Return widget of this object.

void ZmTableTool::paste_from_clipboard ( Time  timestamp)

Extract data from clipboard.

virtual void ZmTableTool::popup_menu ( int  iRow,
int  iColumn 
)
virtual

Call this code before manage popup menu.

static void ZmTableTool::PostItCB ( Widget  w,
XtPointer  pUserData,
XEvent *  event,
Boolean *  rc 
)
staticprotected

Callback to process Popup event.

virtual void ZmTableTool::refresh ( )
virtual

Refresh changes that took place. Involves titles and labels, widths, count of rows, values, fixed columns. At the end of refresh new geometry request is performed.

void ZmTableTool::scan_string ( AtomType  atype,
const char *  s,
void *  v 
)

Universal scalar data type scanner. Does not check validity. s -> (convert) -> v

void ZmTableTool::scan_string ( AtomType  atype,
int  dim,
const char *  s,
void *  v 
)

Universal data type scanner. Does not check validity. s -> (convert) -> v

void ZmTableTool::select_all_columns ( )

Select all columns (unselect rows if any).

void ZmTableTool::select_all_rows ( )

Select all rows (unselect columns if any).

void ZmTableTool::select_column ( int  iColumn,
bool  bForce = false 
)

Select/unselect given column (unselect rows if any). If someone wants to force selection to mark the column after rows inserting he should bForce=true.

void ZmTableTool::select_row ( int  iRow)

Select/unselect given row (unselect columns if any).

void ZmTableTool::select_till_row ( int  iRow)

Select several rows from the last selected (if defined) until pointed.

static void ZmTableTool::SelectAllRowsCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Callback to select all rows.

static void ZmTableTool::SelectRowCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Callback to select/unselect row; mark start of selection.

static void ZmTableTool::SelectRowsHereCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Callback to select all rows from last SelectRowCB till here.

void ZmTableTool::set_column_labels ( )
protected

Set column labels.

void ZmTableTool::set_column_lengths ( )
protected

Set column lengths.

void ZmTableTool::set_column_widths ( )
protected

Set column widths.

void ZmTableTool::set_current_pos ( int  iRow,
int  iColumn 
)

Current edited cell.

void ZmTableTool::set_row_labels ( )
protected

Set per row labels and their width.

virtual void ZmTableTool::set_visible_rows_number ( int  nVisRows)
virtual

Set number of visible rows and adjust widget size accordingly.

virtual Logic ZmTableTool::start_modifying_cell ( int  iRow,
int  iColumn,
const char *  szText 
)
virtual

Start to modify cell value. Return TRUE to allow and FALSE to reject changes.

Reimplemented in ZmDbTableTool.

static void ZmTableTool::TrackVisibleCellCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Callback responsible for visibility of the current cell.

void ZmTableTool::unselect_columns ( )

Unselect all columns (if any).

void ZmTableTool::unselect_rows ( )

Unselect all rows (if any).

static void ZmTableTool::UnselectAllRowsCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Callback to unselect all rows.

virtual Logic ZmTableTool::verify_cell ( int  iRow,
int  iColumn,
const char *  szText 
)
virtual

Verify string before pass it in write_cell() callback. Return TRUE to allow write_cell() and FALSE to reject changes.

Reimplemented in ZmDbTableTool.

ValueDiagnose ZmTableTool::verify_int ( AtomType  atype,
const char *  s 
)

Check scalar integer number.

ValueDiagnose ZmTableTool::verify_real ( AtomType  atype,
const char *  s 
)

Check scalar floating point number.

ValueDiagnose ZmTableTool::verify_string ( AtomType  atype,
int  dim,
const char *  s 
)

Universal data type verifier.

static void ZmTableTool::VerifyCellCB ( Widget  w,
XtPointer  pUserData,
XtPointer  pCallData 
)
staticprotected

Callback to check validity before write_cell().

virtual void ZmTableTool::write_cell ( int  iRow,
int  iColumn,
const char *  s 
)
virtual

Write data from screen to internal data structures. Do not check validity of entered data. At least, this callback should not diagnose errors because of it is used in DuplicateRowsCB.

Reimplemented in ZmDbTableTool.

Member Data Documentation

Logic ZmTableTool::bFixedRowsNumber
protected

Fixed number of rows

GrowingBuffer ZmTableTool::gb
protected

Structure to allocate memory for temporal string drawing

GrowingBuffer ZmTableTool::gbClipboard
protected

Structure to allocate memory temporally for clipboard operations

int ZmTableTool::popup_row
protected

Pointed by popup cell

IntAr ZmTableTool::pubCols
protected

List of published (copied to clipboard) columns.

IntAr ZmTableTool::pubRows
protected

List of published (copied to clipboard) rows.

int ZmTableTool::rows_cnt
protected

Current count of columns and rows - only data one!!! It does not include top title row nor leftmost index column

IntAr ZmTableTool::selCols
protected

List of selected columns.

IntAr ZmTableTool::selRows
protected

List of selected rows.

Widget ZmTableTool::wMatrix
protected

Widget of table

Widget ZmTableTool::wPopup
protected

Widget of popup menu

Widget ZmTableTool::wPopupItem[16]
protected

Item widgets of popup menu.


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