kexi
kexicomboboxbase.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _KEXICOMBOBOXBASE_H_
00022 #define _KEXICOMBOBOXBASE_H_
00023
00024 #include "kexidb/field.h"
00025 #include "kexiinputtableedit.h"
00026 #include <kexidb/lookupfieldschema.h>
00027
00028 class KPushButton;
00029 class KLineEdit;
00030 class KexiComboBoxPopup;
00031 class KexiTableItem;
00032 class KexiTableViewColumn;
00033
00037 class KEXIDATATABLE_EXPORT KexiComboBoxBase
00038 {
00039 public:
00040 KexiComboBoxBase();
00041 virtual ~KexiComboBoxBase();
00042
00044 virtual KexiTableViewColumn *column() const = 0;
00045
00047 virtual KexiDB::Field *field() const = 0;
00048
00050 virtual QVariant origValue() const = 0;
00051
00053 virtual QVariant value();
00054
00055 virtual QVariant visibleValue();
00056
00058 virtual void clear();
00059
00060 virtual tristate valueChangedInternal();
00061 virtual bool valueIsNull();
00062 virtual bool valueIsEmpty();
00063
00064 public:
00065 virtual void hide();
00066
00067 void createPopup(bool show);
00068
00069 void showPopup();
00070
00072 virtual void slotRowAccepted(KexiTableItem *item, int row);
00073
00075 virtual void slotItemSelected(KexiTableItem*);
00076
00078 void slotInternalEditorValueChanged(const QVariant &v);
00079
00081 virtual QWidget *internalEditor() const = 0;
00082
00083 protected:
00084 virtual void setValueInternal(const QVariant& add, bool removeOld);
00085
00088 KexiTableItem* selectItemForEnteredValueInLookupTable(const QVariant& v);
00089
00095 QString valueForString(const QString& str, int* row, uint lookInColumn,
00096 uint returnFromColumn, bool allowNulls = false);
00097
00100 void setValueOrTextInInternalEditor(const QVariant& value);
00101
00102 KexiDB::LookupFieldSchema* lookupFieldSchema() const;
00103
00104 int rowToHighlightForLookupTable() const;
00105
00107 virtual void moveCursorToEndInInternalEditor() = 0;
00108
00110 virtual void selectAllInInternalEditor() = 0;
00111
00113 virtual void setValueInInternalEditor(const QVariant& value) = 0;
00114
00116 virtual QVariant valueFromInternalEditor() = 0;
00117
00119 virtual void editRequested() = 0;
00120
00122 virtual void acceptRequested() = 0;
00123
00126 virtual QPoint mapFromParentToGlobal(const QPoint& pos) const = 0;
00127
00129 virtual int popupWidthHint() const = 0;
00130
00133 virtual void updateButton() {}
00134
00135 virtual KexiComboBoxPopup *popup() const = 0;
00136 virtual void setPopup(KexiComboBoxPopup *popup) = 0;
00137
00138 virtual QVariant visibleValueForLookupField();
00139
00140 void updateTextForHighlightedRow();
00141
00142 bool handleKeyPressForPopup( QKeyEvent *ke );
00143
00144 void acceptPopupSelection();
00145
00147 void undoChanges();
00148
00149 QVariant m_visibleValue;
00150
00151 QVariant m_userEnteredValue;
00152
00153 bool m_internalEditorValueChanged : 1;
00154 bool m_slotInternalEditorValueChanged_enabled : 1;
00155 bool m_setValueOrTextInInternalEditor_enabled : 1;
00156 bool m_mouseBtnPressedWhenPopupVisible : 1;
00157 bool m_insideCreatePopup : 1;
00158 bool m_updatePopupSelectionOnShow : 1;
00159
00160
00161 bool m_moveCursorToEndInInternalEditor_enabled : 1;
00162 bool m_selectAllInInternalEditor_enabled : 1;
00163 bool m_setValueInInternalEditor_enabled : 1;
00164 bool m_setVisibleValueOnSetValueInternal : 1;
00165
00166
00167 };
00168
00169 #endif
|