Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages   Examples  

QdbtNoCell Class Reference
[Cell implementations]

The QdbtBaseCell class represents a not-editable, no-content cell. More...

#include <qdbtbasecell.h>

Inheritance diagram for QdbtNoCell:

Inheritance graph
[legend]
Collaboration diagram for QdbtNoCell:

Collaboration graph
[legend]
List of all members.

Public Methods

 QdbtNoCell ()
 QdbtNoCell (const QdbtNoCell &)
virtual ~QdbtNoCell ()
virtual QString text () const
virtual int widthHint (const QFontMetrics &fm) const
virtual int heightHint (const QFontMetrics &fm) const
virtual const QColorcolor (QdbtBaseTabular *) const
virtual const QColorbackground (QdbtBaseTabular *) const
virtual void setEditable (bool state)
bool isEditable () const
virtual void paintFocus (QPainter *p, QdbtBaseTabular *t, const QRect &r, bool selected, bool editing=FALSE)
virtual QRect getTextArea () const
virtual QRect getEditArea (int width) const
void rightButtonClicked (QdbtBaseTabular *tab, int row, int col) const

Protected Methods

virtual void paint (QPainter *p, QdbtBaseTabular *t, const QRect &r, bool selected, bool editing=FALSE)
virtual QdbtBaseCellclone (QdbtBaseTabular *) const
virtual QWidgeteditor (QdbtBaseTabular *) const
virtual bool beginEdit (QdbtBaseTabular *, int row, int col, const QRect cellGeometry) const
virtual bool acceptEdit (QdbtBaseTabular *, int row, int col)
virtual bool cancelEdit (QdbtBaseTabular *, int row, int col)
virtual bool mouseEvent (QdbtBaseTabular *, int row, int col, QMouseEvent *e, const QRect cellGeometry)
virtual bool keyEvent (QdbtBaseTabular *, int row, int col, QKeyEvent *e, const QRect cellGeometry)
virtual void setEditorEnabled (QdbtBaseTabular *, bool) const
virtual void moveEditor (QdbtBaseTabular *, const QRect cellGeometry) const
bool aboutToBeEdited (QdbtBaseTabular *) const
void notifyOnEditResult (QdbtBaseTabular *tab, int row, int col, int result, QString oldText)
QFont font (QdbtBaseTabular *) const
bool prepareEditor (QdbtBaseTabular *tab, const QRect &geom) const
bool cleanupEditor (QdbtBaseTabular *tab) const

Static Protected Attributes

int MASK_EDITABLE = 0x0001
int MASK_SELECTABLE = 0x0002
int MASK_SELECTED = 0x0004
int bw = 4

Detailed Description

The QdbtBaseCell class represents a not-editable, no-content cell.

This cell may be used as a default cell, whose behaviour is used whenever a cell is not present with the tabular's cell matrix.

Examples:

example4.cpp.


Constructor & Destructor Documentation

QdbtNoCell::QdbtNoCell   [inline]
 

Constuctor

QdbtNoCell::QdbtNoCell const QdbtNoCell &    [inline]
 

Copy-Constructor

QdbtNoCell::~QdbtNoCell   [inline, virtual]
 

Destructor


Member Function Documentation

bool QdbtBaseCell::aboutToBeEdited QdbtBaseTabular   tab const [protected, inherited]
 

This function interacts with the table and clarifies, if a new editing session may be started. If this function returns FALSE, no edit session may be started currently.

See also:
beginEdit()

bool QdbtBaseCell::acceptEdit QdbtBaseTabular  ,
int    row,
int    col
[protected, virtual, inherited]
 

If a cell is currently being edited and for any reason, another cells is supposed to be transfered into editing mode, the table triggers this function to make a cell accept its changes. If, for any reason, the content of the cell is not acceptable and the cell returns FALSE, the table will not start an editing session for the new cell.

When acceptEdit() returns TRUE, the tabular expects that the cell editor has been reset and made invisible again before this function returns.

See also:
cancelEdit()

Reimplemented in QdbtComboCell, QdbtIntCell, QdbtTableCell, QdbtTextCell, and QdbtValidatingCell.

const QColor & QdbtBaseCell::background QdbtBaseTabular   tab const [virtual, inherited]
 

This function computes the background color for a table's cell. This color is generated from the table-component's forground color, if it is existing. If not (e.g. if the pointer to the tabular tab is not supplied correctly), a default color or white is supplied.

Reimplemented in QdbtTableCell.

bool QdbtBaseCell::beginEdit QdbtBaseTabular  ,
int    row,
int    col,
const QRect    cellGeometry
const [protected, virtual, inherited]
 

This function is called by the table to put a single cell into editing mode. The cells is expected to return TRUE if it transfered itself into editing mode and FALSE of for any reason this task could not be performed.

When beginEdit() returns TRUE, the tabular expects that the cell editor has been initialized and made visible within the rectangle that is transfered as cellGeometry .

See also:
aboutToBeEdited()

Reimplemented in QdbtComboCell, QdbtIntCell, QdbtTableCell, QdbtTextCell, and QdbtValidatingCell.

bool QdbtBaseCell::cancelEdit QdbtBaseTabular  ,
int    row,
int    col
[protected, virtual, inherited]
 

If an edit-session has to be canceled for any reason, the table will use this function to ask for cancellation of an edit-session. The edit-session should then be canceled if possible.

When cancelEdit() returns TRUE, the tabular expects that the cell editor has been reset and made invisible again before this function returns.

See also:
acceptEdit()

Reimplemented in QdbtComboCell, QdbtIntCell, QdbtTableCell, QdbtTextCell, and QdbtValidatingCell.

bool QdbtBaseCell::cleanupEditor QdbtBaseTabular   tab const [protected, inherited]
 

This member cleans up a cell's editor and ensures that the editor is not visible any longer.

Parameters:
tab  The tabular, to which the cell belongs
Returns:
TRUE if the editor has been cleaned up correctly, FALSE otherwise. If this function returns FALSE, it has not take any actions.
Attention:
This function relies on the editor()-function to answer the correct cell editor widget.
See also:
prepareEditor()

virtual QdbtBaseCell* QdbtNoCell::clone QdbtBaseTabular   const [inline, protected, virtual]
 

This abstract method is being used to produce a new instance with exactly the same internal state as the original object was. If is being used whenever a copy of a cell has to be produced, e.g. when changing cells within the tabular widget's table matrix.

For initializing the new cell properly, the context of the cell (the tabular widget, that it is located in) is being transfered to the clone() function.

Warning:
This function is virtually used as a virtual constructor. Please refer to the Prototype paragraph from Erich Gamma et. al, 'Design Patterns, Elements of Reusable Object-Oriented Software', Addison-Wesley, 1995 (a book definitely worth its price)

Implements QdbtBaseCell.

const QColor & QdbtBaseCell::color QdbtBaseTabular   tab const [virtual, inherited]
 

This function computes the forground color for a table's cell. This color is generated from the table-component's forground color, if it is existing. If not (e.g. if the pointer to the tabular tab is not supplied correctly), a default color or black is supplied.

Reimplemented in QdbtTableCell.

QWidget * QdbtBaseCell::editor QdbtBaseTabular   const [protected, virtual, inherited]
 

This functions serves to determine the editor widget associated to a table cell. This function should be provided within a derived class, since the function determining if a tabular contains the keyboard focus relies on it. However it is safe to return 0, if no editor may be returned or even is only produced on demand.

Reimplemented in QdbtComboCell, QdbtIntCell, QdbtTableCell, QdbtTextCell, and QdbtValidatingCell.

QFont QdbtBaseCell::font QdbtBaseTabular   tab const [protected, inherited]
 

Read the font, that has been set for the QdbtTabular Widget. This font should be used for all text-editor facilities.

Parameters:
tab  The context (tabular), with which the cell is used

QRect QdbtBaseCell::getEditArea int    width const [virtual, inherited]
 

Returns the area inside the cell, where the edit focus may be placed. The coordinates of the rectangle are in pixels and relative to the cell. The top left of the cell has coordinates (0,0).

Reimplemented in QdbtComboCell, QdbtIntCell, QdbtTableCell, QdbtTextCell, and QdbtValidatingCell.

QRect QdbtBaseCell::getTextArea   const [virtual, inherited]
 

Returns the area inside the cell, where the text is being drawn. The coordinates of the rectangle are in pixels and relative to the cell. The top left of the cell has coordinates (0,0).

Reimplemented in QdbtComboCell, QdbtIntCell, QdbtTableCell, QdbtTextCell, and QdbtValidatingCell.

int QdbtBaseCell::heightHint const QFontMetrics   fm const [virtual, inherited]
 

Compute the height for a cell, based on the assumption that the line contains just one textline.

This function involved the static member QdbtBaseCell::bw .

Reimplemented in QdbtComboCell, QdbtBorderlessComboCell, QdbtIntCell, QdbtTableCell, QdbtTextCell, and QdbtValidatingCell.

bool QdbtBaseCell::isEditable   const [inherited]
 

Returns TRUE if the cell may be edited by the user.

See also:
setEditable().

bool QdbtBaseCell::keyEvent QdbtBaseTabular  ,
int    row,
int    col,
QKeyEvent   e,
const QRect    cellGeometry
[protected, virtual, inherited]
 

This method is used to inform a table cell about a key press event. The cell receives its coordinates with the table's matrix as row, col, all information on the key pressed e as well as its current geometry cellGeometry in the coordinate system of the table's cell matrix.

If this method returns FALSE, the table will apply the normal 'keyboard' rules (cursor keys traverse the focus, etc). If the method returns TRUE, the table components assume, that anything necessary has already been taken care of.

Reimplemented in QdbtComboCell.

bool QdbtBaseCell::mouseEvent QdbtBaseTabular  ,
int    row,
int    col,
QMouseEvent   e,
const QRect    cellGeometry
[protected, virtual, inherited]
 

This method is used to inform a table cell about a mouse press event. The cell receives its coordinates with the table's matrix as row, col, the coordinates of the mouse click relative to the table's cell matrix as e as well as its current geometry cellGeometry in the coordinate system of the table's cell matrix.

If this method returns FALSE, the table will apply the normal 'editing' rules (center mousebutton will edit the cell). If the method returns TRUE, the table components assume, that anything necessary has already been taken care of.

Reimplemented in QdbtComboCell.

void QdbtBaseCell::moveEditor QdbtBaseTabular   tab,
const QRect    geom
const [protected, virtual, inherited]
 

This method is called whenever a table cell is being edited and the table is repainted. The method should check if the geometry of handed over is the same as the geometry applied to the editor widget and - if not - should resize or move the editor widget to the correct position.

The default implementation determines the editor widget by calling editor() and moves it to the correct location.

void QdbtBaseCell::notifyOnEditResult QdbtBaseTabular   tab,
int    row,
int    col,
int    result,
QString    oldText
[protected, inherited]
 

This function interacts with the tabular components and may be used to communicate the result of an edit session to the remaining programm parts.

void QdbtNoCell::paint QPainter   p,
QdbtBaseTabular   t,
const QRect   r,
bool    selected,
bool    editing = FALSE
[protected, virtual]
 

Paint function, which draw the cell as a non-editable cell, which honours selection state.

Reimplemented from QdbtBaseCell.

void QdbtBaseCell::paintFocus QPainter   p,
QdbtBaseTabular   t,
const QRect   r,
bool    selected,
bool    editing = FALSE
[virtual, inherited]
 

This function is called whenever the cell's focus needs to be repainted. The width of the cell is w and the height is h is passed. To be able to interact with the tabular widget (e.g. for style support) that paints this cell, a pointer to it is passed to this function. The painter p automatically clips against the area of the cell.

Reimplemented in QdbtComboCell, and QdbtBorderlessComboCell.

bool QdbtBaseCell::prepareEditor QdbtBaseTabular   tab,
const QRect   geom
const [protected, inherited]
 

Prepare the cell's editor for the about-to-be-started edit session.

Parameters:
tab  The tabular, to which this cell belongs
geom  The cell (and thus the editor's) geometry
Returns:
TRUE, if the editor has been configured appropriately, FALSE otherwise. If this function returns FALSE, it has not take any actions.
Attention:
This function relies on the editor()-function to anser the correct cell editor widget.
See also:
cleanupEditor()

void QdbtBaseCell::rightButtonClicked QdbtBaseTabular   tab,
int    row,
int    col
const [inherited]
 

This functions informs the user, that the right mouse buttons has been pressed on top of the cell in row row and col col. This method should be used within each of the editor widgets mapped on top of the table components, for the 'normal' cells this signal is begin generated automatically.

void QdbtBaseCell::setEditable bool    state [virtual, inherited]
 

Sets whether or not the cell may be edited by the application user.

If state is TRUE the cell may be edited.

If state is FALSE the cell may not be edited.

See also:
isEditable().
Examples:
example1.cpp, example3.cpp, example4.cpp, and example5.cpp.

void QdbtBaseCell::setEditorEnabled QdbtBaseTabular   tab,
bool    enable
const [protected, virtual, inherited]
 

This function serves to temporaryly disable/enable the editor widget, if there is any.

The default implementation determines the editor widget by calling editor() and disables or enables it according to enable.

QString QdbtNoCell::text   const [inline, virtual]
 

Function to access the not existing content of the cell

Reimplemented from QdbtBaseCell.

int QdbtBaseCell::widthHint const QFontMetrics   fm const [virtual, inherited]
 

Compute a width for the cell, so that the text fits in. The texte is queried using the virtual function text().

This function involved the static member QdbtBaseCell::bw .

Reimplemented in QdbtComboCell, QdbtIntCell, QdbtTableCell, QdbtTextCell, and QdbtValidatingCell.


Member Data Documentation

QdbtBaseCell::bw = 4 [static, protected, inherited]
 

Default spacing value for tabular cells.


The documentation for this class was generated from the following files:
Generated on Mon Apr 22 12:21:59 2002 for QdbtTabular by doxygen1.2.15-20020421