summaryrefslogtreecommitdiffstats
path: root/kexi/widget/kexifieldcombobox.h
blob: d910bb079e7b88bfcfe4e5b81c869a8838018895 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* This file is part of the KDE project
   Copyright (C) 2005-2006 Jaroslaw Staniek <js@iidea.pl>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
*/

#ifndef KEXIFIELDCOMBOBOX_H
#define KEXIFIELDCOMBOBOX_H

#include <tqpixmap.h>
#include <kcombobox.h>

namespace KexiDB {
	class TableOrQuerySchema;
}
class KexiProject;

/*! This widget provides a list of fields from a table or query 
 within a combobox, so user can pick one of them.
*/
class KEXIEXTWIDGETS_EXPORT KexiFieldComboBox : public KComboBox
{
	TQ_OBJECT
  

	public:
		KexiFieldComboBox(TQWidget *parent, const char *name = 0);
		virtual ~KexiFieldComboBox();

//		/*! Sets table or query schema \a schema. 
//		 The schema object will be owned by the KexiFieldComboBox object. */
//		void setSchema(KexiDB::TableOrQuerySchema* schema);

//		KexiDB::TableOrQuerySchema* schema() const { return m_schema; }

	public slots:
		//! \return global project that is used to retrieve schema informationm for this combo box.
		KexiProject* project() const;

		//! Sets global project that is used to retrieve schema informationm for this combo box.
		void setProject(KexiProject *prj);

		void setTableOrQuery(const TQString& name, bool table);
		TQString tableOrQueryName() const;
		bool isTableAssigned() const;
		void setFieldOrExpression(const TQString& string);
		void setFieldOrExpression(int index);
		TQString fieldOrExpression() const;
		TQString fieldOrExpressionCaption() const;

		/*! \return index of selected table or query field.
		 -1 is returned if there is nothing selected or expression is selected
		 of project is not assigned or table or query is not assigned. */
		int indexOfField() const;

	signals:
		void selected();

	protected slots:
		void slotActivated(int);
		void slotReturnPressed(const TQString & text);

	protected:
		virtual void focusOutEvent( TQFocusEvent *e );

		class Private;
		Private *d;
};

#endif