summaryrefslogtreecommitdiffstats
path: root/part/kxe_viewelement.h
blob: 72ad060295ea56bf3647e43809726814f72acb2f (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
/***************************************************************************
                          kxe_viewelement.h  -  description
                             -------------------
    begin                : Mon Oct 15 2001
    copyright            : (C) 2001, 2002, 2003 by The KXMLEditor Team
    email                : lvanek@users.sourceforge.net
 ***************************************************************************/

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

#ifndef KXE_VIEWELEMENT_H
#define KXE_VIEWELEMENT_H

#include <tqsplitter.h>

#include <tqdom.h>

// forward declarations
class KXE_ViewAttributes;
class KTextEdit;
class TDEConfig;
class KXESyntaxHighlighter;


/**
 * This widget shows a table of XML elements attributes
 * and plain XML text of this element and its children.
 *
 * @short Widget for XML elements.
 */
class KXE_ViewElement : public TQSplitter
{
		TQ_OBJECT

	public:

		KXE_ViewElement( TQWidget * pParent, TDEConfig *pConfig, const char * pszName = 0 );
		~KXE_ViewElement();

		/** Returns a pointer to the currently selected attribute or a null pointer. */
		TQDomAttr getSelectedAttribute() const;

		/** Changes the behaviour of this view to readonly or readwrite. */
		void setReadWrite( bool fReadWrite );

	public slots:

		/** Changes/Rebuilds the whole widget according to the given element. */
		void slotChange( const TQDomElement & );

		/**
		 * Changes syntax highlighting colors.
		 */
		void slotTextViewSettingsChanged();

	protected:

		/** table widget to display XML attributes */
		KXE_ViewAttributes * m_pViewAttributes;
		/** edit widget for plain XML */
		KTextEdit * m_pViewPlainXML;

		/** configuration used to store splitter sizes */
		TDEConfig *m_pConfig;

		/** Syntax highlighter for m_pViewPlainXML */
		KXESyntaxHighlighter *m_pSyntaxHighlighter;

	signals:

		/** Emitted, when a context menu is requested (see @ref KXE_ViewAttributes::sigContextMenuRequested) */
		void sigContextMenuRequested( const TQString & szMenuName, const TQPoint & pos );

		/**
		 * Emitted, when an attributes name was renamed via inplace editing
		 * (see @ref KXE_ViewAttributes::sigAttributeChangedInplace).
		 */
		void sigAttributeNameChangedInplace( const TQDomAttr &, const TQString );

    /**
		 * Emitted, when an attributes value was renamed via inplace editing
		 * (see @ref KXE_ViewAttributes::sigAttributeChangedInplace).
		 */
		void sigAttributeValueChangedInplace( const TQDomAttr &, const TQString );
};

#endif