summaryrefslogtreecommitdiffstats
path: root/kexi/widget/kexipropertyeditorview.h
blob: 008e6759dfdaf50d3c82efbd7b00c016a141e92c (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/* This file is part of the KDE project
   Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
   Copyright (C) 2004-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 KEXIPROPERTYEDITORVIEW_H
#define KEXIPROPERTYEDITORVIEW_H

//#include "kexiviewbase.h"
#include <tqwidget.h>

class TQLabel;
class KexiMainWindow;

namespace KoProperty {
	class Editor;
	class Set;
}

//! @short Helper class displaying small icon with class name and object name
/*! The info label is displayed in a form:
 <i>[ObjectClassIcon] ClassName "ObjectName"</i>

 The <i>ObjectClassIcon</i> is optional. If "ClassName" is empty, the information 
 is displayed as:
 <i>[ObjectClassIcon] ObjectName</i>

 Example uses:
 - [button_icon] Button "quit"
 - [label_icon] Label "welcome"
*/
class KEXIEXTWIDGETS_EXPORT KexiObjectInfoLabel : public TQWidget
{
	public:
		KexiObjectInfoLabel(TQWidget* parent, const char* name = 0);
		~KexiObjectInfoLabel();

		void setObjectClassIcon(const TQString& name);
		TQString objectClassIcon() const { return m_classIcon; }
		void setObjectClassName(const TQString& name);
		TQString objectClassName() const { return m_className; }
		void setObjectName(const TQString& name);
		TQString objectName() const { return m_objectName; }
		void setBuddy( TQWidget * buddy );
	protected:
		void updateName();

		TQString m_className;
		TQString m_classIcon, m_objectName;
		TQLabel *m_objectIconLabel, *m_objectNameLabel;
};

//! @short The container (acts as a dock window) for KexiPropertyEditor.
/*! The widget displays KexiObjectInfoLabel on its top, to show user what
 object the properties belong to. Read KexiObjectInfoLabel documentation for 
 the description what information is displayed.

 There are properties obtained from KexiMainWindow's current property set 
 that help to customize displaying this information:
 - "this:classString property" of type string describes object's class name
 - "this:iconName" property of type string describes class name
 - "name" or "caption" property of type string describes object's name
 - "this:useCaptionAsObjectName" property of type boolean forces displaying "caption"
   property instead of "name" - this can be usable when we know that "caption" properties
   are available for a given type of objects (this is the case for Table Designer fields)
*/
class KEXIEXTWIDGETS_EXPORT KexiPropertyEditorView : public TQWidget
{
	Q_OBJECT
  TQ_OBJECT

	public:
		KexiPropertyEditorView(KexiMainWindow *mainWin, TQWidget* parent);
		virtual ~KexiPropertyEditorView();

		/*! Helper function. Updates \a infoLabel widget by reusing properties provided 
		 by property set \a set.
		 Read documentation of KexiPropertyEditorView class for information about accepted properties.
		 If \a set is 0 and \a textToDisplayForNullSet string is not empty, this string is displayed 
		 (without icon or any other additional part). 
		 If \a set is 0 and \a textToDisplayForNullSet string is empty, the \a infoLabel widget becomes 
		 hidden. */
		static void updateInfoLabelForPropertySet(
			KexiObjectInfoLabel *infoLabel, KoProperty::Set* set, 
			const TQString& textToDisplayForNullSet = TQString());

		virtual TQSize sizeHint() const;
		virtual TQSize minimumSizeHint() const;
		KoProperty::Editor *editor() const;

//	public slots:
//		virtual void setGeometry( const TQRect &r );
//		virtual void resize( int w, int h );

	protected slots:
		void slotPropertySetChanged(KoProperty::Set* );

	protected:
		class Private;
		Private *d;
};

#endif