kexi

#include <kexicomboboxbase.h>

Inheritance diagram for KexiComboBoxBase:
KexiComboBoxTableEdit KexiDBComboBox

Public Member Functions

virtual KexiTableViewColumn * column () const =0
 
virtual KexiDB::Field * field () const =0
 
virtual TQVariant origValue () const =0
 
virtual TQVariant value ()
 
virtual TQVariant visibleValue ()
 
virtual void clear ()
 
virtual tristate valueChangedInternal ()
 
virtual bool valueIsNull ()
 
virtual bool valueIsEmpty ()
 
virtual void hide ()
 
void createPopup (bool show)
 
void showPopup ()
 
virtual void slotRowAccepted (KexiTableItem *item, int row)
 
virtual void slotItemSelected (KexiTableItem *)
 
void slotInternalEditorValueChanged (const TQVariant &v)
 
virtual TQWidget * internalEditor () const =0
 

Protected Member Functions

virtual void setValueInternal (const TQVariant &add, bool removeOld)
 
KexiTableItem * selectItemForEnteredValueInLookupTable (const TQVariant &v)
 
TQString valueForString (const TQString &str, int *row, uint lookInColumn, uint returnFromColumn, bool allowNulls=false)
 
void setValueOrTextInInternalEditor (const TQVariant &value)
 
KexiDB::LookupFieldSchema * lookupFieldSchema () const
 
int rowToHighlightForLookupTable () const
 
virtual void moveCursorToEndInInternalEditor ()=0
 
virtual void selectAllInInternalEditor ()=0
 
virtual void setValueInInternalEditor (const TQVariant &value)=0
 
virtual TQVariant valueFromInternalEditor ()=0
 
virtual void editRequested ()=0
 
virtual void acceptRequested ()=0
 
virtual TQPoint mapFromParentToGlobal (const TQPoint &pos) const =0
 
virtual int popupWidthHint () const =0
 
virtual void updateButton ()
 
virtual KexiComboBoxPopup * popup () const =0
 
virtual void setPopup (KexiComboBoxPopup *popup)=0
 
virtual TQVariant visibleValueForLookupField ()
 
void updateTextForHighlightedRow ()
 
bool handleKeyPressForPopup (TQKeyEvent *ke)
 
void acceptPopupSelection ()
 
void undoChanges ()
 

Protected Attributes

TQVariant m_visibleValue
 
TQVariant m_userEnteredValue
 
bool m_internalEditorValueChanged: 1
 
bool m_slotInternalEditorValueChanged_enabled: 1
 
bool m_setValueOrTextInInternalEditor_enabled: 1
 
bool m_mouseBtnPressedWhenPopupVisible: 1
 
bool m_insideCreatePopup: 1
 
bool m_updatePopupSelectionOnShow: 1
 
bool m_moveCursorToEndInInternalEditor_enabled: 1
 
bool m_selectAllInInternalEditor_enabled: 1
 
bool m_setValueInInternalEditor_enabled: 1
 
bool m_setVisibleValueOnSetValueInternal: 1
 

Detailed Description

A base class for handling data-aware combo boxes. This class is used by KexiComboBoxTableEdit and KexiDBComboBox.

Definition at line 37 of file kexicomboboxbase.h.

Constructor & Destructor Documentation

◆ KexiComboBoxBase()

KexiComboBoxBase::KexiComboBoxBase ( )

Definition at line 35 of file kexicomboboxbase.cpp.

◆ ~KexiComboBoxBase()

KexiComboBoxBase::~KexiComboBoxBase ( )
virtual

Definition at line 49 of file kexicomboboxbase.cpp.

Member Function Documentation

◆ acceptPopupSelection()

void KexiComboBoxBase::acceptPopupSelection ( )
protected

Definition at line 444 of file kexicomboboxbase.cpp.

◆ acceptRequested()

virtual void KexiComboBoxBase::acceptRequested ( )
protectedpure virtual

Implement this as signal.

Implemented in KexiDBComboBox, and KexiComboBoxTableEdit.

◆ clear()

void KexiComboBoxBase::clear ( )
virtual

Reimplement this and call this impl.: used to clear internal editor.

Reimplemented in KexiComboBoxTableEdit.

Definition at line 301 of file kexicomboboxbase.cpp.

◆ column()

virtual KexiTableViewColumn * KexiComboBoxBase::column ( ) const
pure virtual
Returns
column related to this combo; for KexiComboBoxTableEdit 0 is returned here

Implemented in KexiDBComboBox, and KexiComboBoxTableEdit.

◆ createPopup()

void KexiComboBoxBase::createPopup ( bool  show)

todo alter the position to fit the popup within screen boundaries

Definition at line 350 of file kexicomboboxbase.cpp.

◆ editRequested()

virtual void KexiComboBoxBase::editRequested ( )
protectedpure virtual

Implement this as signal.

Implemented in KexiDBComboBox, and KexiComboBoxTableEdit.

◆ field()

virtual KexiDB::Field * KexiComboBoxBase::field ( ) const
pure virtual
Returns
database field related to this combo

Implemented in KexiDBComboBox, and KexiComboBoxTableEdit.

◆ handleKeyPressForPopup()

bool KexiComboBoxBase::handleKeyPressForPopup ( TQKeyEvent *  ke)
protected

Definition at line 522 of file kexicomboboxbase.cpp.

◆ hide()

void KexiComboBoxBase::hide ( )
virtual

Definition at line 428 of file kexicomboboxbase.cpp.

◆ internalEditor()

virtual TQWidget * KexiComboBoxBase::internalEditor ( ) const
pure virtual

Implement this to return the internal editor.

Implemented in KexiDBComboBox, and KexiComboBoxTableEdit.

◆ lookupFieldSchema()

KexiDB::LookupFieldSchema * KexiComboBoxBase::lookupFieldSchema ( ) const
protected
Returns
lookup field schema for this combo box, if present and if is valid (i.e. has defined row source)

Definition at line 53 of file kexicomboboxbase.cpp.

◆ mapFromParentToGlobal()

virtual TQPoint KexiComboBoxBase::mapFromParentToGlobal ( const TQPoint &  pos) const
protectedpure virtual

Implement this to return a position pos mapped from parent (e.g.

viewport) to global coordinates. TQPoint(-1, -1) should be returned if this cannot be computed.

Implemented in KexiDBComboBox, and KexiComboBoxTableEdit.

◆ moveCursorToEndInInternalEditor()

virtual void KexiComboBoxBase::moveCursorToEndInInternalEditor ( )
protectedpure virtual

Implement this to perform "move cursor to end" in the internal editor.

Implemented in KexiDBComboBox, and KexiComboBoxTableEdit.

◆ origValue()

virtual TQVariant KexiComboBoxBase::origValue ( ) const
pure virtual
Returns
the original value

Implemented in KexiDBComboBox, and KexiComboBoxTableEdit.

◆ popupWidthHint()

virtual int KexiComboBoxBase::popupWidthHint ( ) const
protectedpure virtual

Implement this to return a hint for popup width.

Implemented in KexiDBComboBox, and KexiComboBoxTableEdit.

◆ rowToHighlightForLookupTable()

int KexiComboBoxBase::rowToHighlightForLookupTable ( ) const
protected
Todo:
for now we're assuming the id is INTEGER

Definition at line 63 of file kexicomboboxbase.cpp.

◆ selectAllInInternalEditor()

virtual void KexiComboBoxBase::selectAllInInternalEditor ( )
protectedpure virtual

Implement this to perform "select all" in the internal editor.

Implemented in KexiDBComboBox, and KexiComboBoxTableEdit.

◆ selectItemForEnteredValueInLookupTable()

KexiTableItem * KexiComboBoxBase::selectItemForEnteredValueInLookupTable ( const TQVariant &  v)
protected

Used to select row item for an user-entered value v.

Only for "lookup table" mode.

Definition at line 168 of file kexicomboboxbase.cpp.

◆ setValueInInternalEditor()

virtual void KexiComboBoxBase::setValueInInternalEditor ( const TQVariant &  value)
protectedpure virtual

Implement this to perform "set value" in the internal editor.

Implemented in KexiDBComboBox, and KexiComboBoxTableEdit.

◆ setValueInternal()

void KexiComboBoxBase::setValueInternal ( const TQVariant &  add,
bool  removeOld 
)
protectedvirtual
Todo:
support more RowSourceType's, not only table
Todo:
errmsg

show

Reimplemented in KexiDBComboBox, and KexiComboBoxTableEdit.

Definition at line 89 of file kexicomboboxbase.cpp.

◆ setValueOrTextInInternalEditor()

void KexiComboBoxBase::setValueOrTextInInternalEditor ( const TQVariant &  value)
protected

sets value for the line edit without setting a flag (m_userEnteredValue) that indicates that the text has been entered by hand (by a user)

Definition at line 512 of file kexicomboboxbase.cpp.

◆ showPopup()

void KexiComboBoxBase::showPopup ( )

Definition at line 345 of file kexicomboboxbase.cpp.

◆ slotInternalEditorValueChanged()

void KexiComboBoxBase::slotInternalEditorValueChanged ( const TQVariant &  v)

Call this from slot.

Definition at line 498 of file kexicomboboxbase.cpp.

◆ slotItemSelected()

void KexiComboBoxBase::slotItemSelected ( KexiTableItem *  )
virtual

Call this from slot.

Definition at line 456 of file kexicomboboxbase.cpp.

◆ slotRowAccepted()

void KexiComboBoxBase::slotRowAccepted ( KexiTableItem *  item,
int  row 
)
virtual

Call this from slot.

Definition at line 434 of file kexicomboboxbase.cpp.

◆ undoChanges()

void KexiComboBoxBase::undoChanges ( )
protected

Used by KexiDBComboBox.

Definition at line 586 of file kexicomboboxbase.cpp.

◆ updateButton()

virtual void KexiComboBoxBase::updateButton ( )
inlineprotectedvirtual

Implement this to update button state.

Table view just updates on/off state for the button depending on visibility of the popup

Reimplemented in KexiComboBoxTableEdit.

Definition at line 134 of file kexicomboboxbase.h.

◆ updateTextForHighlightedRow()

void KexiComboBoxBase::updateTextForHighlightedRow ( )
protected

Definition at line 579 of file kexicomboboxbase.cpp.

◆ value()

TQVariant KexiComboBoxBase::value ( )
virtual

Note: Generally in current implementation this is integer > 0; may be null if no value is set.

it &&

Todo:
don't return just 1st row, but use autocompletion feature and: show message box if entered text does not match!

Reimplemented in KexiDBComboBox, and KexiComboBoxTableEdit.

Definition at line 237 of file kexicomboboxbase.cpp.

◆ valueChangedInternal()

tristate KexiComboBoxBase::valueChangedInternal ( )
virtual

Definition at line 308 of file kexicomboboxbase.cpp.

◆ valueForString()

TQString KexiComboBoxBase::valueForString ( const TQString &  str,
int *  row,
uint  lookInColumn,
uint  returnFromColumn,
bool  allowNulls = false 
)
protected
Returns
value from returnFromColumn related to str value from column lookInColumn. If allowNulls is true, NULL is returend if no matched column found, else: str is returned. Example: lookInColumn=0, returnFromColumn=1 –returns user-visible string for column #1 for id-column #0

Definition at line 207 of file kexicomboboxbase.cpp.

◆ valueFromInternalEditor()

virtual TQVariant KexiComboBoxBase::valueFromInternalEditor ( )
protectedpure virtual

Implement this to return value from the internal editor.

Implemented in KexiDBComboBox, and KexiComboBoxTableEdit.

◆ valueIsEmpty()

bool KexiComboBoxBase::valueIsEmpty ( )
virtual

Definition at line 340 of file kexicomboboxbase.cpp.

◆ valueIsNull()

bool KexiComboBoxBase::valueIsNull ( )
virtual

Definition at line 332 of file kexicomboboxbase.cpp.

◆ visibleValue()

TQVariant KexiComboBoxBase::visibleValue ( )
virtual

Reimplemented in KexiDBComboBox, and KexiComboBoxTableEdit.

Definition at line 296 of file kexicomboboxbase.cpp.

◆ visibleValueForLookupField()

TQVariant KexiComboBoxBase::visibleValueForLookupField ( )
protectedvirtual

Definition at line 284 of file kexicomboboxbase.cpp.

Member Data Documentation

◆ m_insideCreatePopup

bool KexiComboBoxBase::m_insideCreatePopup
protected

true if we're inside createPopup(); used in slotItemSelected()

Definition at line 158 of file kexicomboboxbase.h.

◆ m_internalEditorValueChanged

bool KexiComboBoxBase::m_internalEditorValueChanged
protected

true if user has text or other value inside editor

Definition at line 154 of file kexicomboboxbase.h.

◆ m_mouseBtnPressedWhenPopupVisible

bool KexiComboBoxBase::m_mouseBtnPressedWhenPopupVisible
protected

Used only by KexiComboBoxTableEdit.

Definition at line 157 of file kexicomboboxbase.h.

◆ m_moveCursorToEndInInternalEditor_enabled

bool KexiComboBoxBase::m_moveCursorToEndInInternalEditor_enabled
protected

Definition at line 162 of file kexicomboboxbase.h.

◆ m_selectAllInInternalEditor_enabled

bool KexiComboBoxBase::m_selectAllInInternalEditor_enabled
protected

Definition at line 163 of file kexicomboboxbase.h.

◆ m_setValueInInternalEditor_enabled

bool KexiComboBoxBase::m_setValueInInternalEditor_enabled
protected

Definition at line 164 of file kexicomboboxbase.h.

◆ m_setValueOrTextInInternalEditor_enabled

bool KexiComboBoxBase::m_setValueOrTextInInternalEditor_enabled
protected

◆ m_setVisibleValueOnSetValueInternal

bool KexiComboBoxBase::m_setVisibleValueOnSetValueInternal
protected

Used in setValueInternal() to control whether we want to set visible value on setValueInternal()

  • true for table view's combo box

Definition at line 165 of file kexicomboboxbase.h.

◆ m_slotInternalEditorValueChanged_enabled

bool KexiComboBoxBase::m_slotInternalEditorValueChanged_enabled
protected

Used in slotInternalEditorValueChanged()

Definition at line 155 of file kexicomboboxbase.h.

◆ m_updatePopupSelectionOnShow

bool KexiComboBoxBase::m_updatePopupSelectionOnShow
protected

Set to false as soon as the item corresponding with the current value is selected in the popup table.

This avoids selecting item for origValue() and thus loosing the recent choice.

Definition at line 159 of file kexicomboboxbase.h.

◆ m_userEnteredValue

TQVariant KexiComboBoxBase::m_userEnteredValue
protected

value (usually a text) entered by hand (by the user)

Definition at line 152 of file kexicomboboxbase.h.

◆ m_visibleValue

TQVariant KexiComboBoxBase::m_visibleValue
protected

Definition at line 150 of file kexicomboboxbase.h.


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