summaryrefslogtreecommitdiffstats
path: root/interfaces/khexedit
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /interfaces/khexedit
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'interfaces/khexedit')
-rw-r--r--interfaces/khexedit/Makefile.am13
-rw-r--r--interfaces/khexedit/byteseditinterface.h229
-rw-r--r--interfaces/khexedit/charcolumninterface.h105
-rw-r--r--interfaces/khexedit/clipboardinterface.h86
-rw-r--r--interfaces/khexedit/kbytesedit.desktop4
-rw-r--r--interfaces/khexedit/valuecolumninterface.h170
-rw-r--r--interfaces/khexedit/zoominterface.h79
7 files changed, 686 insertions, 0 deletions
diff --git a/interfaces/khexedit/Makefile.am b/interfaces/khexedit/Makefile.am
new file mode 100644
index 000000000..e2eb8a472
--- /dev/null
+++ b/interfaces/khexedit/Makefile.am
@@ -0,0 +1,13 @@
+
+INCLUDES= -I$(top_srcdir)/kparts $(all_includes)
+
+# the service type
+servicetypedir = $(kde_servicetypesdir)
+servicetype_DATA = kbytesedit.desktop
+
+# the interfaces
+khexeditinclude_HEADERS = byteseditinterface.h \
+ valuecolumninterface.h charcolumninterface.h \
+ zoominterface.h clipboardinterface.h
+
+khexeditincludedir = $(includedir)/khexedit
diff --git a/interfaces/khexedit/byteseditinterface.h b/interfaces/khexedit/byteseditinterface.h
new file mode 100644
index 000000000..dbc4c96bd
--- /dev/null
+++ b/interfaces/khexedit/byteseditinterface.h
@@ -0,0 +1,229 @@
+/***************************************************************************
+ byteseditinterface.h - description
+ -------------------
+ begin : Fri Sep 12 2003
+ copyright : (C) 2003 by Friedrich W. H. Kossebau
+ email : Friedrich.W.H@Kossebau.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef BYTESEDITINTERFACE_H
+#define BYTESEDITINTERFACE_H
+
+// kde specific
+#include <kparts/componentfactory.h>
+
+#include <qwidget.h>
+
+/**
+ * @short KHE (short for KHexEdit) is KDE's namespace for all things related
+ * to the viewing/editing of bytes.
+ *
+ * @since 3.2
+ */
+namespace KHE
+{
+
+/**
+ * @short An interface for a hex edit editor/viewer for arrays of byte
+ *
+ * \code
+ * KHE::BytesEditInterface *BytesEdit = KHE::bytesEditInterface( BytesEditWidget );
+ * \endcode
+ *
+ * It can be used in different ways:
+ * <ul>
+ * <li> as an viewer for array char* Data, sized DataSize
+ * \code
+ * BytesEdit->setData( Data, DataSize );
+ * BytesEdit->setReadOnly( true );
+ * \endcode
+ *
+ * <li> as an editor for a given array of bytes with a fixed size
+ * \code
+ * BytesEdit->setData( Data, DataSize );
+ * BytesEdit->setOverWriteOnly( true );
+ * \endcode
+ *
+ * <li> as an editor for a given array of bytes with a limited size
+ * \code
+ * BytesEdit->setData( Data, DataSize, -1, false );
+ * BytesEdit->setMaxDataSize( MaxDataSize );
+ * BytesEdit->setOverWriteMode( false );
+ * \endcode
+ *
+ * <li> as an editor for a new to be created array of chars, max. with MaxDataSize
+ * \code
+ * BytesEdit->setMaxDataSize( MaxDataSize );
+ * ...
+ * QByteArray BA;
+ * BA.setRawData( BytesEdit->data(), BytesEdit->dataSize() );
+ * \endcode
+ * </ul>
+ *
+ * @author Friedrich W. H. Kossebau <Friedrich.W.H@Kossebau.de>
+ * @see createBytesEditWidget(), bytesEditInterface()
+ * @since 3.2
+ */
+class BytesEditInterface
+{
+ public:
+ //static const char Name[] = "KHE::BytesEditInterface";
+
+ public: // set methods
+ /** hands over to the editor a new byte array.
+ * If there exists an old one and autodelete is set the old one gets deleted.
+ * @param D pointer to memory
+ * @param S size of used memory
+ * @param RS real size of the memory, -1 means S is the real size
+ * @param KM keep the memory on resize (RS is the maximum size)
+ */
+ virtual void setData( char *D, int S, int RS = -1, bool KM = true ) = 0;
+ /** sets whether the given array should be handled read only or not. Default is false. */
+ virtual void setReadOnly( bool RO = true ) = 0;
+ /** sets the maximal size of the actual byte array. If the actual array is already larger
+ * it will not be modified but there can be only done non-inserting actions
+ * until the array's is below the limit
+ * If the flag KeepsMemory is set MaxDataSize is limited to the real size of the array.
+ * MaxDataSize == -1 means no limit.
+ * Default is -1.
+ * @param MS new maximal data size
+ */
+ virtual void setMaxDataSize( int MS ) = 0;
+ /** sets whether the array should be deleted on the widget's end or if a new array is set.
+ * Default is false
+ */
+ virtual void setAutoDelete( bool AD = true ) = 0;
+ /** switches the array */
+// virtual void resetData( char *D, int S, bool Repaint ) = 0;
+ /** sets whether the actual memory used to store the data
+ * (as given by setData or in the constructor, or allocated by the class)
+ * should be kept on resize.
+ * If MaxDataSize is set and greater than the raw size of the memory
+ * it is limited to the raw size.
+ * Default is false.
+ */
+ virtual void setKeepsMemory( bool KM = true ) = 0;
+ //
+ /** sets whether the widget is overwriteonly or not. Default is false. */
+ virtual void setOverwriteOnly( bool b ) = 0;
+ /** sets whether the widget is in overwrite mode or not. Default is true. */
+ virtual void setOverwriteMode( bool b ) = 0;
+ /** sets whether the data should be treated modified or not */
+ virtual void setModified( bool b ) = 0;
+
+
+ public: // get methods
+ /** @return a pointer to the actual byte array */
+ virtual char *data() const = 0;
+ /** @return the size of the actual byte array */
+ virtual int dataSize() const = 0;
+ /** @return the maximal allowed size for the byte array */
+ virtual int maxDataSize () const = 0;
+ /** @return whether autodelete is set for the byte array */
+ virtual bool isAutoDelete() const = 0;
+ /** @return @c true if the memory of the byte array is kept, otherwise @c false */
+ virtual bool keepsMemory() const = 0;
+
+ /** @return @c true if the edit mode is overwrite, otherwise @c false for insert mode*/
+ virtual bool isOverwriteMode() const = 0;
+ /** @return @c true if the memory of the byte array is kept, otherwise @c false */
+ virtual bool isOverwriteOnly() const = 0;
+ /** @return @c true if the ReadOnly flag is set, otherwise @c false */
+ virtual bool isReadOnly() const = 0;
+ /** @return @c true if the Modified flag is set, otherwise @c false */
+ virtual bool isModified() const = 0;
+
+ public: // call for action
+ /** repaint the indizes from i1 to i2 */
+ virtual void repaintRange( int i1, int i2 ) = 0;
+};
+
+
+/** tries to get the bytesedit interface of t
+ * @return a pointer to the interface, otherwise 0
+ * @author Friedrich W. H. Kossebau <Friedrich.W.H@Kossebau.de>
+ * @since 3.2
+*/
+template<class T>
+inline BytesEditInterface *bytesEditInterface( T *t )
+{
+ if( !t )
+ return 0;
+
+ return static_cast<BytesEditInterface*>( t->qt_cast("KHE::BytesEditInterface") );
+}
+
+/** tries to create an instance of a hexedit widget for arrays of chars (char[])
+ *
+ * Usage:
+ *
+ * \code
+ * #include <khexedit/byteseditinterface.h>
+ * #include <khexedit/valuecolumninterface.h>
+ * #include <khexedit/charcolumninterface.h>
+ * #include <khexedit/clipboardinterface.h>
+ * ...
+ *
+ * QWidget *BytesEditWidget = KHE::createBytesEditWidget( this, "BytesEditWidget" );
+ * // is e.g. kdeutils (incl. khexedit2) installed, so a widget could be found and created?
+ * if( BytesEditWidget )
+ * {
+ *   // fetch the editor interface
+ *   KHE::BytesEditInterface *BytesEdit = KHE::bytesEditInterface( BytesEditWidget );
+ *   Q_ASSERT( BytesEdit ); // This should not fail!
+ *
+ *   // now use the editor.
+ *   BytesEdit->setData( Buffer, BufferSize, -1 );
+ *   BytesEdit->setMaxDataSize( BufferSize );
+ *   BytesEdit->setReadOnly( false );
+ *   BytesEdit->setAutoDelete( true );
+ *
+ *   KHE::ValueColumnInterface *ValueColumn = KHE::valueColumnInterface( BytesEditWidget );
+ *   if( ValueColumn )
+ *   {
+ *     ValueColumn->setCoding( KHE::ValueColumnInterface::BinaryCoding );
+ *     ValueColumn->setByteSpacingWidth( 2 );
+ *     ValueColumn->setNoOfGroupedBytes( 4 );
+ *     ValueColumn->setGroupSpacingWidth( 12 );
+ *   }
+ *
+ *   KHE::CharColumnInterface *CharColumn = KHE::charColumnInterface( BytesEditWidget );
+ *   if( CharColumn )
+ *   {
+ *     CharColumn->setShowUnprintable( false );
+ *     CharColumn->setSubstituteChar( '*' );
+ *   }
+ *   KHE::ClipboardInterface *Clipboard = KHE::clipboardInterface( BytesEditWidget );
+ *   if( Clipboard )
+ *   {
+ *     // Yes, use BytesEditWidget, not Clipboard, because that's the QObject, indeed hacky...
+ *     connect( BytesEditWidget, SIGNAL(copyAvailable(bool)), this, SLOT(offerCopy(bool)) );
+ *   }
+ * }
+ * \endcode
+ *
+ * @param Parent parent widget
+ * @param Name identifier
+ * @return a pointer to the widget, otherwise 0
+ * @author Friedrich W. H. Kossebau <Friedrich.W.H@Kossebau.de>
+ * @see BytesEditInterface, ValueColumnInterface, CharColumnInterface, ZoomInterface, ClipboardInterface
+ * @since 3.2
+ */
+inline QWidget *createBytesEditWidget( QWidget *Parent = 0, const char *Name = 0 )
+{
+ return KParts::ComponentFactory::createInstanceFromQuery<QWidget>
+ ( QString::fromLatin1("KHexEdit/KBytesEdit"), QString::null, Parent, Name );
+}
+
+}
+
+#endif
diff --git a/interfaces/khexedit/charcolumninterface.h b/interfaces/khexedit/charcolumninterface.h
new file mode 100644
index 000000000..aef282fdc
--- /dev/null
+++ b/interfaces/khexedit/charcolumninterface.h
@@ -0,0 +1,105 @@
+/***************************************************************************
+ charcolumninterface.h - description
+ -------------------
+ begin : Fri Sep 12 2003
+ copyright : (C) 2003 by Friedrich W. H. Kossebau
+ email : Friedrich.W.H@Kossebau.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef CHARCOLUMNINTERFACE_H
+#define CHARCOLUMNINTERFACE_H
+
+#include <qstring.h>
+
+namespace KHE
+{
+
+/**
+ * @short A simple interface for the access to the char column of a hex edit widget
+ *
+ * @author Friedrich W. H. Kossebau <Friedrich.W.H@Kossebau.de>
+ * @see createBytesEditWidget(), charColumnInterface()
+ * @since 3.2
+ */
+class CharColumnInterface
+{
+ public:
+ /** encoding used to display the symbols in the text column */
+ enum KEncoding
+ {
+ /** the encoding of your shell. If that is a multibyte encoding this will default to Latin1. */
+ LocalEncoding=0,
+ /** extended ASCII encoding, also known as Latin1 */
+ ISO8859_1Encoding=1,
+ /** @internal not implemented: the most common EBCDIC codepage */
+ CECP1047Encoding=2,
+ /** @internal enables extension without breaking binary compatibility */
+ MaxEncodingId=0xFFFF
+ };
+
+ public: // set methods
+ /** sets whether "unprintable" chars (value<32) should be displayed in the text column
+ * with their corresponding character.
+ * Default is @c false.
+ * @param SU
+ * @see showUnprintable()
+ */
+ virtual void setShowUnprintable( bool SU = true ) = 0;
+ /** sets the substitute character for "unprintable" chars
+ * Default is '.'.
+ * @param SC new character
+ * @see substituteChar()
+ */
+ virtual void setSubstituteChar( QChar SC ) = 0;
+ /** sets the encoding of the text column.
+ * If the encoding is not available the format will not be changed.
+ * Default is @c LocalEncoding.
+ * @param C the new encoding
+ * @see encoding()
+ */
+ virtual void setEncoding( KEncoding C ) = 0;
+
+
+ public: // get methods
+ /** @return @c true if "unprintable" chars (value<32) are displayed in the text column
+ * with their corresponding character, @c false otherwise
+ * @see setShowUnprintable()
+ */
+ virtual bool showUnprintable() const = 0;
+ /** @return the currently used substitute character for "unprintable" chars.
+ * @see setSubstituteChar()
+ */
+ virtual QChar substituteChar() const = 0;
+ /** @return the currently used encoding
+ * @see setEncoding()
+ */
+ virtual KEncoding encoding() const = 0;
+};
+
+
+/** tries to get the charcolumn interface of t
+ * @return a pointer to the interface, otherwise 0
+ * @author Friedrich W. H. Kossebau <Friedrich.W.H@Kossebau.de>
+ * @since 3.2
+ */
+template<class T>
+CharColumnInterface *charColumnInterface( T *t )
+{
+ if( !t )
+ return 0;
+
+ return static_cast<CharColumnInterface*>( t->qt_cast("KHE::CharColumnInterface") );
+}
+
+}
+
+#endif
diff --git a/interfaces/khexedit/clipboardinterface.h b/interfaces/khexedit/clipboardinterface.h
new file mode 100644
index 000000000..9edab8521
--- /dev/null
+++ b/interfaces/khexedit/clipboardinterface.h
@@ -0,0 +1,86 @@
+/***************************************************************************
+ clipboardinterface.h - description
+ -------------------
+ begin : Sat Sep 13 2003
+ copyright : (C) 2003 by Friedrich W. H. Kossebau
+ email : Friedrich.W.H@Kossebau.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef CLIPBOARDINTERFACE_H
+#define CLIPBOARDINTERFACE_H
+
+namespace KHE
+{
+
+/**
+ * @short A simple interface for interaction with the clipboard
+ *
+ * This interface enables the interaction with the clipboard. It relies on the
+ * possibilities of signal/slot so a class B that implements this interface
+ * should be derived from QObject. When connecting to a signal or a slot
+ * the class B has to be used, not the interface.
+ * <p>
+ * Example:
+ * \code
+ * KHE::ClipboardInterface *Clipboard = KHE::clipboardInterface( BytesEditWidget );
+ * if( Clipboard )
+ * {
+ *   // Yes, use BytesEditWidget, not Clipboard, because that's the QObject, indeed hacky...
+ *   connect( BytesEditWidget, SIGNAL(copyAvailable(bool)), this, SLOT(offerCopy(bool)) );
+ * }
+ * \endcode
+ *
+ * @author Friedrich W. H. Kossebau <Friedrich.W.H@Kossebau.de>
+ * @see createBytesEditWidget(), clipboardInterface()
+ * @since 3.2
+ */
+class ClipboardInterface
+{
+ public: // slots
+ /** tries to copy. If there is nothing to copy this call is a noop. */
+ virtual void copy() = 0;
+ /** tries to cut. If there is nothing to cut this call is a noop. */
+ virtual void cut() = 0;
+ /** tries to paste.
+ * If there is nothing to paste or paste is not possible this call is a noop.
+ * Use BytesEditInterface::isReadOnly() to find out if you can paste at all.
+ */
+ virtual void paste() = 0;
+
+ public: // signals
+ /** signal: tells whether copy is possible or not.
+ * Remember to use the created object, not the interface for connecting
+ * Use BytesEditInterface::isReadOnly() to find out if you can also cut
+ * As this function symbol serves as a signal, this is a noop. Don't use it
+ * for anything else.
+ */
+ virtual void copyAvailable( bool Really ) = 0;
+};
+
+
+/** tries to get the clipboard interface of t
+ * @return a pointer to the interface, otherwise 0
+ * @author Friedrich W. H. Kossebau <Friedrich.W.H@Kossebau.de>
+ * @since 3.2
+*/
+template<class T>
+ClipboardInterface *clipboardInterface( T *t )
+{
+ if( !t )
+ return 0;
+
+ return static_cast<ClipboardInterface*>( t->qt_cast("KHE::ClipboardInterface") );
+}
+
+}
+
+#endif
diff --git a/interfaces/khexedit/kbytesedit.desktop b/interfaces/khexedit/kbytesedit.desktop
new file mode 100644
index 000000000..4c5b39ec0
--- /dev/null
+++ b/interfaces/khexedit/kbytesedit.desktop
@@ -0,0 +1,4 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KHexEdit/KBytesEdit
+
diff --git a/interfaces/khexedit/valuecolumninterface.h b/interfaces/khexedit/valuecolumninterface.h
new file mode 100644
index 000000000..7dafa7d42
--- /dev/null
+++ b/interfaces/khexedit/valuecolumninterface.h
@@ -0,0 +1,170 @@
+/***************************************************************************
+ valuecolumninterface.h - description
+ -------------------
+ begin : Fri Sep 12 2003
+ copyright : (C) 2003 by Friedrich W. H. Kossebau
+ email : Friedrich.W.H@Kossebau.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef VALUECOLUMNINTERFACE_H
+#define VALUECOLUMNINTERFACE_H
+
+namespace KHE
+{
+
+/**
+ * Interface for the value displaying column of a hexedit widget
+ *
+ * @author Friedrich W. H. Kossebau <Friedrich.W.H@Kossebau.de>
+ * @see createBytesEditWidget(), valueColumnInterface()
+ * @since 3.2
+ */
+
+class ValueColumnInterface
+{
+ public:
+ /** collection of ids for the different numeric codings of a byte */
+ enum KCoding
+ {
+ /** hexadecimal encoding */
+ HexadecimalCoding=0,
+ /** decimal encoding */
+ DecimalCoding=1,
+ /** octal encoding */
+ OctalCoding=2,
+ /** bit by bit coding */
+ BinaryCoding=3,
+ /** @internal enables extension without breaking binary compatibility */
+ MaxCodingId=0xFFFF
+ };
+
+ /** collection of ids for the fitting of the layout into the available widget's width */
+ enum KResizeStyle
+ {
+ /** we don't care about the actual sizing of the widget
+ * but stick to the given NoOfBytesPerLine
+ */
+ NoResize=0,
+ /** we try to fit the layout to the available width
+ * but only with full groups like set in NoOfGroupedBytes
+ * with minimum of one full group
+ */
+ LockGrouping=1,
+ /** we try to fit as many bytes into the width as possible, with minimum of 1 byte
+ */
+ FullSizeUsage=2,
+ /** @internal enables extension without breaking binary compatibility */
+ MaxResizeStyleId=0xFF
+ };
+
+
+ public: // get methods
+ /** @return the current resize style
+ * @see setResizeStyle()
+ */
+ virtual KResizeStyle resizeStyle() const = 0;
+ /** @return the current number of bytes per line
+ * @see setNoOfBytesPerLine()
+ */
+ virtual int noOfBytesPerLine() const = 0;
+
+ /** @return the current coding
+ * @see setCoding()
+ */
+ virtual KCoding coding() const = 0;
+ /** @return the spacing between bytes (in pixels)
+ * @see setByteSpacingWidth()
+ */
+ virtual int byteSpacingWidth() const = 0;
+
+ /** @return the current number of bytes per group
+ * @see setNoOfGroupedBytes()
+ */
+ virtual int noOfGroupedBytes() const = 0;
+ /** @return the spacing between groups of bytes (in pixels)
+ * @see setGroupSpacingWidth()
+ */
+ virtual int groupSpacingWidth() const = 0;
+
+ /** @return the gap in the middle of a binary (in pixels)
+ * @see setBinaryGapWidth()
+ */
+ virtual int binaryGapWidth() const = 0;
+
+
+ public: // set methods
+ /** sets the resize style for the hex column.
+ * Default is @c FullSizeUsage
+ * @param Style new style
+ * @see resizeStyle()
+ */
+ virtual void setResizeStyle( KResizeStyle Style ) = 0;
+ /** sets the number of bytes per line, switching the resize style to @c NoResize
+ * Default is 16.
+ * @param NoCpL new number of bytes per line
+ * @see noOfBytesPerLine()
+ */
+ virtual void setNoOfBytesPerLine( int NoCpL ) = 0;
+
+ /** sets the format of the hex column.
+ * If the coding is not available the format will not be changed.
+ * Default is @c HexadecimalCoding.
+ * @param C
+ * @see coding()
+ */
+ virtual void setCoding( KCoding C ) = 0;
+ /** sets the spacing between the bytes.
+ * Default is 3.
+ * @param BSW new spacing between bytes (in pixels)
+ * @see byteSpacingWidth()
+ */
+ virtual void setByteSpacingWidth( int BSW ) = 0;
+
+ /** sets the numbers of grouped bytes, 0 means no grouping.
+ * Default is 4.
+ * @param NoGB new number of bytes per group
+ * @see noOfGroupedBytes()
+ */
+ virtual void setNoOfGroupedBytes( int NoGB ) = 0;
+ /** sets the spacing between the groups.
+ * Default is 9.
+ * @param GSW new spacing width (in pixels)
+ * @see groupSpacingWidth()
+ */
+ virtual void setGroupSpacingWidth( int GSW ) = 0;
+
+ /** sets the spacing in the middle of a binary encoded byte.
+ * Default is 1.
+ * @param BGW spacing in the middle of a binary (in pixels)
+ * @see binaryGapWidth()
+ */
+ virtual void setBinaryGapWidth( int BGW ) = 0;
+};
+
+
+/** tries to get the valuecolumn interface of t
+ * @return a pointer to the interface, otherwise 0
+ * @author Friedrich W. H. Kossebau <Friedrich.W.H@Kossebau.de>
+ * @since 3.2
+*/
+template<class T>
+ValueColumnInterface *valueColumnInterface( T *t )
+{
+ if( !t )
+ return 0;
+
+ return static_cast<ValueColumnInterface*>( t->qt_cast("KHE::ValueColumnInterface") );
+}
+
+}
+
+#endif
diff --git a/interfaces/khexedit/zoominterface.h b/interfaces/khexedit/zoominterface.h
new file mode 100644
index 000000000..494fbfd86
--- /dev/null
+++ b/interfaces/khexedit/zoominterface.h
@@ -0,0 +1,79 @@
+/***************************************************************************
+ zoominterface.h - description
+ -------------------
+ begin : Fri Sep 12 2003
+ copyright : (C) 2003 by Friedrich W. H. Kossebau
+ email : Friedrich.W.H@Kossebau.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License version 2 as published by the Free Software Foundation. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef ZOOMINTERFACE_H
+#define ZOOMINTERFACE_H
+
+
+namespace KHE
+{
+
+/**
+ * @short A simple interface for zooming
+ *
+ * This interface enables abstract linear zooming.
+ * It operates in sizes of font point size.
+ *
+ * @author Friedrich W. H. Kossebau <Friedrich.W.H@Kossebau.de>
+ * @see createBytesEditWidget(), zoomInterface()
+ * @since 3.2
+ */
+class ZoomInterface
+{
+ public:
+ /** enlarges the display
+ * @param PointInc increment to the display size (in font point size)
+ */
+ virtual void zoomIn( int PointInc ) = 0;
+ /** increases the display size by an arbitrary value, usually 1 font point
+ * @see zoomOut()
+ */
+ virtual void zoomIn() = 0;
+ /** makes the display smaller
+ * @param PointDec decrement to the display size (in font point size)
+ */
+ virtual void zoomOut( int PointDec ) = 0;
+ /** decreases the display size by an arbitrary value, usually 1 font point
+ * @see zoomIn()
+ */
+ virtual void zoomOut() = 0;
+ /** sets the display size
+ * @param PointSize new display size (in font point size)
+ */
+ virtual void zoomTo( int PointSize ) = 0;
+ /** resets the display to the default size */
+ virtual void unZoom() = 0;
+};
+
+
+/** tries to get the zoom interface of t
+ * @return a pointer to the interface, otherwise 0
+ * @author Friedrich W. H. Kossebau <Friedrich.W.H@Kossebau.de>
+ * @since 3.2
+*/
+template<class T>
+ZoomInterface *zoomInterface( T *t )
+{
+ if( !t )
+ return 0;
+
+ return static_cast<ZoomInterface*>( t->qt_cast("KHE::ZoomInterface") );
+}
+
+}
+
+#endif