KHexEdit
byteseditinterface.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 byteseditinterface.h - description 00003 ------------------- 00004 begin : Fri Sep 12 2003 00005 copyright : (C) 2003 by Friedrich W. H. Kossebau 00006 email : kossebau@kde.org 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of the GNU Library General Public * 00013 * License version 2 as published by the Free Software Foundation. * 00014 * * 00015 ***************************************************************************/ 00016 00017 00018 #ifndef KHE_BYTESEDITINTERFACE_H 00019 #define KHE_BYTESEDITINTERFACE_H 00020 00021 // KDE 00022 #include <kservicetypetrader.h> 00023 // Qt 00024 #include <QtGui/QWidget> 00025 00030 namespace KHE 00031 { 00032 00073 class BytesEditInterface 00074 { 00075 public: 00076 virtual ~BytesEditInterface() {} 00077 00078 public: // set methods 00086 virtual void setData( char *D, int S, int RS = -1, bool KM = true ) = 0; 00088 virtual void setReadOnly( bool RO = true ) = 0; 00097 virtual void setMaxDataSize( int MS ) = 0; 00101 virtual void setAutoDelete( bool AD = true ) = 0; 00103 // virtual void resetData( char *D, int S, bool Repaint ) = 0; 00111 virtual void setKeepsMemory( bool KM = true ) = 0; 00112 // 00114 virtual void setOverwriteOnly( bool b ) = 0; 00116 virtual void setOverwriteMode( bool b ) = 0; 00118 virtual void setModified( bool b ) = 0; 00119 00120 00121 public: // get methods 00123 virtual char *data() const = 0; 00125 virtual int dataSize() const = 0; 00127 virtual int maxDataSize () const = 0; 00129 virtual bool isAutoDelete() const = 0; 00131 virtual bool keepsMemory() const = 0; 00132 00134 virtual bool isOverwriteMode() const = 0; 00136 virtual bool isOverwriteOnly() const = 0; 00138 virtual bool isReadOnly() const = 0; 00140 virtual bool isModified() const = 0; 00141 00142 public: // call for action 00144 virtual void repaintRange( int i1, int i2 ) = 0; 00145 }; 00146 00147 00152 template<class T> 00153 inline BytesEditInterface *bytesEditInterface( T *t ) 00154 { 00155 return t ? qobject_cast<KHE::BytesEditInterface *>( t ) : 0; 00156 } 00157 00165 inline QWidget *createBytesEditWidget( QWidget *Parent = 0 ) 00166 { 00167 return KServiceTypeTrader::createInstanceFromQuery<QWidget> 00168 ( QString::fromLatin1("KHexEdit/KBytesEdit"), QString(), Parent ); 00169 } 00170 00171 } 00172 00173 Q_DECLARE_INTERFACE( KHE::BytesEditInterface, "org.kde.khe.byteseditinterface/1.0" ) 00174 00175 #endif