• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

okteta

  • sources
  • kde-4.12
  • kdesdk
  • okteta
  • gui
abstractbytearrayview.h
Go to the documentation of this file.
1 /*
2  This file is part of the Okteta Gui library, made within the KDE community.
3 
4  Copyright 2008-2010 Friedrich W. H. Kossebau <kossebau@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) version 3, or any
10  later version accepted by the membership of KDE e.V. (or its
11  successor approved by the membership of KDE e.V.), which shall
12  act as a proxy defined in Section 6 of version 3 of the license.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #ifndef OKTETA_ABSTRACTBYTEARRAYVIEW_H
24 #define OKTETA_ABSTRACTBYTEARRAYVIEW_H
25 
26 // lib
27 #include "columnsview.h"
28 // Okteta core
29 #include "addressrange.h"
30 // Qt
31 #include <QtGui/QClipboard>
32 
33 class QMimeData;
34 class QByteArray;
35 
36 namespace Okteta
37 {
38 class Bookmark;
39 class ValueCodec;
40 class CharCodec;
41 class AbstractByteArrayModel;
42 class ArrayChangeMetricsList;
43 
44 class KController;
45 class AbstractWheelController;
46 class ByteArrayTableLayout;
47 class ByteArrayTableCursor;
48 class ByteArrayTableRanges;
49 
50 
51 class AbstractByteArrayViewPrivate;
52 
53 // TODO: for now inherit from ColumnsView, but later on invert this,
54 // so it's AbstractByteArrayView < ColumnsView < {ByteArrayRowView,ByteArrayColumnView}
55 class OKTETAGUI_EXPORT AbstractByteArrayView : public ColumnsView
56 {
57  friend class KTabController;
58  friend class KNavigator;
59  friend class KEditor;
60  friend class KValueEditor;
61  friend class KCharEditor;
62  friend class Dropper;
63  friend class MouseNavigator;
64  friend class MousePaster;
65  friend class Dragger;
66 
67  Q_OBJECT
68  Q_PROPERTY( bool OverwriteMode READ isOverwriteMode WRITE setOverwriteMode )
69  Q_PROPERTY( bool OverwriteOnly READ isOverwriteOnly WRITE setOverwriteOnly )
70  Q_PROPERTY( bool Modified READ isModified WRITE setModified DESIGNABLE false )
71  Q_PROPERTY( bool ReadOnly READ isReadOnly WRITE setReadOnly )
72 
73  //Q_PROPERTY( bool hasSelectedData READ hasSelectedData )
74  //Q_PROPERTY( QByteArray SelectedData READ selectedData )
75  Q_PROPERTY( bool TabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus )
76  Q_PROPERTY( LayoutStyle LayoutStyle READ layoutStyle WRITE setLayoutStyle )
77  Q_PROPERTY( int NoOfBytesPerLine READ noOfBytesPerLine WRITE setNoOfBytesPerLine )
78  Q_PROPERTY( int StartOffset READ startOffset WRITE setStartOffset )
79  Q_PROPERTY( int FirstLineOffset READ firstLineOffset WRITE setFirstLineOffset )
80  Q_PROPERTY( bool OffsetColumnVisible READ offsetColumnVisible WRITE toggleOffsetColumn )
81  Q_PROPERTY( OffsetCoding OffsetCoding READ offsetCoding WRITE setOffsetCoding )
82  Q_PROPERTY( CodingTypes VisibleCodings READ visibleCodings WRITE setVisibleCodings )
83  Q_ENUMS( OffsetCoding ValueCoding CharCoding LayoutStyle CodingTypes )
84 
85  Q_PROPERTY( bool ByteTypeColored READ isByteTypeColored WRITE setByteTypeColored )
86  // value column
87  Q_PROPERTY( ValueCoding Coding READ valueCoding WRITE setValueCoding )
88  Q_PROPERTY( int ByteSpacingWidth READ byteSpacingWidth WRITE setByteSpacingWidth )
89  Q_PROPERTY( int NoOfGroupedBytes READ noOfGroupedBytes WRITE setNoOfGroupedBytes )
90  Q_PROPERTY( int GroupSpacingWidth READ groupSpacingWidth WRITE setGroupSpacingWidth )
91  Q_PROPERTY( int BinaryGapWidth READ binaryGapWidth WRITE setBinaryGapWidth )
92  // char column
93  Q_PROPERTY( bool ShowNonprinting READ showsNonprinting WRITE setShowsNonprinting )
94  Q_PROPERTY( QChar SubstituteChar READ substituteChar WRITE setSubstituteChar )
95 
96  public:
97  enum OffsetCoding { HexadecimalOffset=0, DecimalOffset=1, MaxOffsetCodingId=0xFF };
98  enum ValueCoding { HexadecimalCoding=0, DecimalCoding=1, OctalCoding=2, BinaryCoding=3, MaxCodingId=0xFFFF };
99  enum CharCoding { LocalEncoding=0, ISO8859_1Encoding=1, EBCDIC1047Encoding=2,
100  StartOfOwnEncoding=0x8000, MaxEncodingId=0xFFFF };
101  enum LayoutStyle { FixedLayoutStyle=0, WrapOnlyByteGroupsLayoutStyle=1, FullSizeLayoutStyle=2, LastUserLayout=0xFF };
102 
103  enum CodingTypeId { NoCodingId=0, ValueCodingId=1, CharCodingId=2 };
104  enum CodingTypes { OnlyValueCoding = ValueCodingId, OnlyCharCoding = CharCodingId, ValueAndCharCodings=ValueCodingId|CharCodingId };
105 
106  public:
107  virtual ~AbstractByteArrayView();
108 
109  public: // value access
110  Okteta::AbstractByteArrayModel* byteArrayModel() const;
111  bool isModified() const;
112 
113  bool isOverwriteMode() const;
114  bool isOverwriteOnly() const;
115  bool isReadOnly() const;
116 
118  Address cursorPosition() const;
119  /***/
120  bool isCursorBehind() const;
121 
122  Address startOffset() const;
123  Address firstLineOffset() const;
124  int noOfBytesPerLine() const;
125 
126  LayoutStyle layoutStyle() const;
127 
128  bool tabChangesFocus() const;
129 
130  CodingTypes visibleCodings() const;
131  CodingTypeId activeCoding() const;
132 
133  bool offsetColumnVisible() const;
134  OffsetCoding offsetCoding() const;
135 
137  bool hasSelectedData() const;
138  AddressRange selection() const;
139 
140  AddressRange marking() const;
141 
142  ValueCoding valueCoding() const;
146  CharCoding charCoding() const;
150  const QString& charCodingName() const;
151 
152  double zoomLevel() const;
153 
154  public: // value access API
155  // value column
156  virtual int/*PixelX*/ byteSpacingWidth() const = 0;
157  virtual int noOfGroupedBytes() const = 0;
158  virtual int/*PixelX*/ groupSpacingWidth() const = 0;
159  virtual int/*PixelX*/ binaryGapWidth() const = 0;
160 
161  // char column
166  virtual bool showsNonprinting() const = 0;
170  virtual QChar substituteChar() const = 0;
172  virtual QChar undefinedChar() const = 0;
173 
174  virtual bool isByteTypeColored() const = 0;
175 
176 
177  public:
178  virtual void setByteArrayModel( Okteta::AbstractByteArrayModel* byteArrayModel );
179 
180  // setting parameters
181  // value column parameters
186  virtual void setByteSpacingWidth( int/*PixelX*/ byteSpacingWidth ) = 0;
191  virtual void setNoOfGroupedBytes( int noOfGroupedBytes ) = 0;
196  virtual void setGroupSpacingWidth( int/*PixelX*/ groupSpacingWidth ) = 0;
201  virtual void setBinaryGapWidth( int binaryGapWidth ) = 0;
208  virtual void setBufferSpacing( int/*PixelX*/ byteSpacingWidth, int noOfGroupedBytes = 0, int/*PixelX*/ groupSpacingWidth = 0 ) = 0;
210  virtual void setValueCoding( ValueCoding valueCoding ) = 0;
211  // char column parameters
218  virtual void setShowsNonprinting( bool showsNonprinting = true ) = 0;
222  virtual void setSubstituteChar( QChar substituteChar ) = 0;
226  virtual void setUndefinedChar( QChar undefinedChar ) = 0;
229  virtual void setCharCoding( CharCoding charCoding ) = 0;
234  virtual void setCharCoding( const QString& charCodingName ) = 0;
235  virtual void setByteTypeColored( bool isColored ) = 0;
236 
237  public:
239  void setModified( bool modified );
240 
242  void setLayoutStyle( LayoutStyle layoutStyle );
246  void setReadOnly( bool readOnly );
248  void setOverwriteOnly( bool overwriteOnly );
250  void setOverwriteMode( bool overwriteMode );
251 
253  void setNoOfBytesPerLine( int noOfBytesPerLine );
255  void setStartOffset( Address startOffset );
257  void setFirstLineOffset( Address firstLineOffset );
258 
262  void setTabChangesFocus( bool tabChangesFocus = true );
263 
264  /***/
265  void setActiveCoding( CodingTypeId codingId );
267  void setVisibleCodings( int visibleCodings );
268 
270  void toggleOffsetColumn( bool offsetColumnVisible );
272  void setOffsetCoding( OffsetCoding offsetCoding );
273 
274  public:
278  QByteArray selectedData() const;
279  QMimeData* selectionAsMimeData() const;
280 
281  public: // modification access
282  void pasteData( const QMimeData* data );
284  void removeSelectedData();
286  void insert( const QByteArray& data );
287 
292  void setCursorPosition( Address index, bool isBehind = false );
293  void setSelectionCursorPosition( Address index );
294 
296  void selectAll( bool select );
297 
298  void setSelection( Address start, Address end );
299  void setSelection( const AddressRange& selection );
301  bool selectWord( /*unsigned*/ Address index /*, Chartype*/ );
302 
303  void setMarking( Address start, Address end );
304  void setMarking( const AddressRange& marking );
305 
309  void ensureVisible( const AddressRange& range, bool ensureStartVisible = false );
311  void ensureCursorVisible();
313  void placeCursor( const QPoint& point );
314 
315  public:
316  bool canReadData( const QMimeData* data ) const;
317 
318  public: // zooming
319  void zoomIn( int pointInc );
320  void zoomIn();
321  void zoomOut( int pointDec );
322  void zoomOut();
323  void zoomTo( int pointSize );
324  void unZoom();
325  void setZoomLevel( double level );
326 
327  public: // cursor control
329  void startCursor();
331  void stopCursor();
333  void pauseCursor();
335  void unpauseCursor();
336 
337  public:
338  // clipboard interaction
339  virtual void copy();
340  virtual void cut();
341  virtual void paste();
342 
343  public:
344  QRect cursorRect() const;
345 
346  public: // QWidget API
347  virtual QSize sizeHint() const;
348 
349  public: // logic value service
354  Address indexByPoint( const QPoint& point ) const;
355 
356  Q_SIGNALS:
358  void clicked( Okteta::Address index );
360  void doubleClicked( Okteta::Address index );
361 
362  void cursorPositionChanged( Okteta::Address index );
364  void overwriteModeChanged( bool newOverwriteMode );
366  void readOnlyChanged( bool isReadOnly );
368  void hasSelectedDataChanged( bool hasSelectedData );
369  void selectionChanged( const Okteta::AddressRange& selection );
371  void cutAvailable( bool Really );
373  void copyAvailable( bool Really );
375  void charCodecChanged( const QString& codecName );
377  void valueCodingChanged( int valueCoding );
378  void focusChanged( bool hasFocus );
379 
380  void offsetColumnVisibleChanged( bool visible );
381  void offsetCodingChanged( int offsetCoding );
382  void visibleByteArrayCodingsChanged( int columns );
383  void layoutStyleChanged( int layoutStyle );
384  void noOfBytesPerLineChanged( int noOfBytesPerLine );
385  void showsNonprintingChanged( bool showsNonprinting );
386  void substituteCharChanged( QChar substituteChar );
387  void undefinedCharChanged( QChar undefinedChar );
388  void noOfGroupedBytesChanged( int noOfGroupedBytes );
389 
390  protected:
391  void finishByteEdit();
392  void emitSelectionSignals();
393  void updateChanged();
394  void copyToClipboard( QClipboard::Mode mode ) const;
395  void pasteFromClipboard( QClipboard::Mode mode );
396 
397  protected:
398  const Okteta::ValueCodec* valueCodec() const;
399  const Okteta::CharCodec* charCodec() const;
400  ByteArrayTableCursor* tableCursor() const;
401  ByteArrayTableRanges* tableRanges() const;
402  ByteArrayTableLayout* layout() const;
403 
404  protected: // QWidget API
405  virtual void keyPressEvent( QKeyEvent* keyEvent );
406  virtual void mousePressEvent( QMouseEvent* mousePressEvent );
407  virtual void mouseReleaseEvent( QMouseEvent* mouseReleaseEvent );
408  virtual void mouseMoveEvent( QMouseEvent* mouseMoveEvent );
409  virtual void mouseDoubleClickEvent( QMouseEvent* mouseDoubleClickEvent );
411  virtual bool event( QEvent* event );
412  virtual void showEvent( QShowEvent* showEvent );
413  virtual void focusInEvent( QFocusEvent* focusEvent );
414  virtual void focusOutEvent( QFocusEvent* focusEvent );
415  virtual void resizeEvent( QResizeEvent* resizeEvent );
416  virtual void dragEnterEvent( QDragEnterEvent* dragEnterEvent );
417  virtual void dragMoveEvent( QDragMoveEvent* dragMoveEvent) ;
418  virtual void dragLeaveEvent( QDragLeaveEvent* dragLeaveEvent );
419  virtual void dropEvent( QDropEvent* dropEvent );
420 // virtual void contextMenuEvent( QContextMenuEvent* contextMenuEvent );
421 
422  protected: // QAbstractScrollArea API
423  virtual void wheelEvent( QWheelEvent *e );
424  virtual bool viewportEvent( QEvent* event );
425 
426  protected: // ColumnsView API
427  virtual void setNoOfLines( int newNoOfLines );
428 
429  protected: // Q_SLOTS QWidget API
430  virtual void changeEvent( QEvent* event );
431 
432  protected:
433  AbstractByteArrayViewPrivate* const d_ptr;
434  AbstractByteArrayView( AbstractByteArrayViewPrivate* d, QWidget* parent );
435  private:
436  Q_DECLARE_PRIVATE( AbstractByteArrayView )
437  Q_PRIVATE_SLOT( d_func(), void adaptController() )
438  Q_PRIVATE_SLOT( d_func(), void blinkCursor() )
439  Q_PRIVATE_SLOT( d_func(), void onByteArrayReadOnlyChange(bool isByteArrayReadOnly) )
440  Q_PRIVATE_SLOT( d_func(), void onContentsChanged( const Okteta::ArrayChangeMetricsList& changeList ) )
441  Q_PRIVATE_SLOT( d_func(), void onBookmarksChange( const QList<Okteta::Bookmark>& bookmarks ) )
442  Q_PRIVATE_SLOT( d_func(), void onRevertedToVersionIndex( int versionIndex ) )
443 // Q_PRIVATE_SLOT( d_func(), void onClipboardChanged() )
444 };
445 
446 }
447 
448 #endif
Okteta::KValueEditor
Definition: kvalueeditor.h:40
OKTETAGUI_EXPORT
#define OKTETAGUI_EXPORT
Definition: oktetagui_export.h:36
Okteta::Address
qint32 Address
Definition: address.h:34
Okteta::AbstractByteArrayModel
could it be useful to hide the data access behind an iterator? * class KDataBufferIterator { public: ...
Definition: abstractbytearraymodel.h:79
Okteta::AbstractByteArrayView::LayoutStyle
LayoutStyle
Definition: abstractbytearrayview.h:101
Okteta::AbstractByteArrayView::OffsetCoding
OffsetCoding
Definition: abstractbytearrayview.h:97
Okteta::ByteArrayTableRanges
a class to control all the ranges like marking and selections holds also all modified ranges and merg...
Definition: bytearraytableranges.h:45
Okteta::StartOfOwnEncoding
Offset for own encodings which are bound in by plugins.
Definition: oktetacore.h:104
Okteta::MaxEncodingId
this should enable extension without breaking binary compatibility
Definition: oktetacore.h:107
columnsview.h
Okteta::CharCoding
CharCoding
Definition: oktetacore.h:39
Okteta::AbstractByteArrayView::CharCoding
CharCoding
Definition: abstractbytearrayview.h:99
Okteta::Bookmark
Definition: bookmark.h:38
QWidget
KDE::NumberRange< Address, Size >
Okteta::KTabController
Definition: ktabcontroller.h:36
FixedLayoutStyle
Definition: bytearrayframerenderer.h:51
Okteta::KCharEditor
Definition: kchareditor.h:34
Okteta::ISO8859_1Encoding
ASCII encoding, also known as Latin1.
Definition: oktetacore.h:44
LayoutStyle
LayoutStyle
Definition: bytearrayframerenderer.h:51
Okteta::AbstractByteArrayView::CodingTypeId
CodingTypeId
Definition: abstractbytearrayview.h:103
Okteta::AbstractByteArrayView
Definition: abstractbytearrayview.h:55
KPieceTable::ArrayChangeMetricsList
Okteta::ArrayChangeMetricsList ArrayChangeMetricsList
Definition: grouppiecetablechange.h:42
Okteta::ByteArrayTableLayout
the logical layout of a byte array table for a view
Definition: bytearraytablelayout.h:61
Okteta::KNavigator
Definition: knavigator.h:36
Okteta::OctalCoding
Definition: oktetacore.h:34
addressrange.h
Okteta::KEditor
Definition: keditor.h:36
Okteta::CharCodec
Definition: charcodec.h:42
Okteta::MaxCodingId
Definition: oktetacore.h:35
Okteta::ValueCodec
Class that is able to convert codings to and from hexadecimal, decimal, octal, and binary...
Definition: valuecodec.h:45
Okteta::EBCDIC1047Encoding
the most common EBCDIC codepage
Definition: oktetacore.h:102
Okteta::ArrayChangeMetricsList
Definition: arraychangemetricslist.h:36
WrapOnlyByteGroupsLayoutStyle
Definition: bytearrayframerenderer.h:51
Okteta::DecimalCoding
Definition: oktetacore.h:34
Okteta::BinaryCoding
Definition: oktetacore.h:34
Okteta::ByteArrayTableCursor
navigates through the buffer in an abstract way, based on the layout
Definition: bytearraytablecursor.h:60
Okteta::ColumnsView
general class for widgets with columns that display different aspects of the same data with the same ...
Definition: columnsview.h:47
Okteta::MouseNavigator
Definition: mousenavigator.h:39
Okteta::AbstractByteArrayViewPrivate
Definition: abstractbytearrayview_p.h:59
Okteta::Dropper
Definition: dropper.h:41
Okteta::AbstractByteArrayView::ValueCoding
ValueCoding
Definition: abstractbytearrayview.h:98
Okteta::ValueCoding
ValueCoding
Definition: oktetacore.h:34
Okteta::LocalEncoding
the coding of your shell
Definition: oktetacore.h:42
Okteta::MousePaster
Definition: mousepaster.h:33
LastUserLayout
Definition: bytearrayframerenderer.h:51
Okteta::AbstractByteArrayView::d_ptr
AbstractByteArrayViewPrivate *const d_ptr
Definition: abstractbytearrayview.h:433
FullSizeLayoutStyle
Definition: bytearrayframerenderer.h:51
Okteta::HexadecimalCoding
Definition: oktetacore.h:34
QList
Definition: bookmarkable.h:29
Okteta::AbstractByteArrayView::CodingTypes
CodingTypes
Definition: abstractbytearrayview.h:104
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:06 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okteta

Skip menu "okteta"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal