diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch) | |
tree | 5ac38a06f3dde268dc7927dc155896926aaf7012 /interfaces/khexedit/valuecolumninterface.h | |
download | tdelibs-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/valuecolumninterface.h')
-rw-r--r-- | interfaces/khexedit/valuecolumninterface.h | 170 |
1 files changed, 170 insertions, 0 deletions
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 : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 <[email protected]> + * @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 <[email protected]> + * @since 3.2 +*/ +template<class T> +ValueColumnInterface *valueColumnInterface( T *t ) +{ + if( !t ) + return 0; + + return static_cast<ValueColumnInterface*>( t->qt_cast("KHE::ValueColumnInterface") ); +} + +} + +#endif |