• 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
abstractbytearraycolumnrenderer.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 2003,2007-2009 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_ABSTRACTBYTEARRAYCOLUMNRENDERER_H
24 #define OKTETA_ABSTRACTBYTEARRAYCOLUMNRENDERER_H
25 
26 // ColumnsView
27 #include "abstractcolumnrenderer.h"
28 #include "linepositionrange.h"
29 #include "linerange.h"
30 // Okteta core
31 #include "oktetacore.h"
32 #include "abstractbytearraymodel.h"
33 #include "character.h"
34 // Qt
35 #include <QtGui/QFontMetrics>
36 
37 class QPainter;
38 class QColor;
39 class QBrush;
40 class QRect;
41 
42 
43 namespace Okteta
44 {
45 class Coord;
46 class Bookmarkable;
47 class CharCodec;
48 
49 // class KByteArrayView;
50 class ByteArrayTableRanges;
51 class ByteArrayTableLayout;
52 
60 class OKTETAGUI_EXPORT AbstractByteArrayColumnRenderer : public AbstractColumnRenderer
61 {
62  public:
63  enum FrameStyle { Frame, Left, Right };
64  public:
65  AbstractByteArrayColumnRenderer( AbstractColumnStylist* stylist,
66  AbstractByteArrayModel* byteArrayModel, ByteArrayTableLayout* layout, ByteArrayTableRanges* ranges );
67  virtual ~AbstractByteArrayColumnRenderer();
68 
69 
70  public: // AbstractColumnRenderer API
71  virtual void renderFirstLine( QPainter* painter, const PixelXRange& Xs, Line firstLineIndex );
72  virtual void renderNextLine( QPainter* painter );
73 
74  public:
75  void prepareRendering( const PixelXRange& Xs );
76 
77  public:
78  //void renderLine( QPainter* painter, int lineIndex );
79  void renderLinePositions( QPainter* painter, Line lineIndex, const LineRange& linePositions );
83  void renderCursor( QPainter* painter, Address byteIndex );
87  void renderByte( QPainter* painter, Address byteIndex );
92  void renderFramedByte( QPainter* painter, Address byteIndex, FrameStyle style );
93 
94 
95  public: // modification access
102  bool setSpacing( PixelX byteSpacingWidth, int noOfGroupedBytes = 0, PixelX groupSpacingWidth = 0 );
107  bool setByteSpacingWidth( PixelX byteSpacingWidth );
112  bool setNoOfGroupedBytes( int noOfGroupedBytes );
117  bool setGroupSpacingWidth( PixelX groupSpacingWidth );
120  void setFontMetrics( const QFontMetrics& fontMetrics );
122  void set( AbstractByteArrayModel* byteArrayModel );
124  void resetXBuffer();
126  void setCharCodec( const CharCodec* charCodec );
127 
128  void setByteTypeColored( bool byteTypeColored );
129 
130 
131  public: // functional logic
133  LinePositionRange linePositionsOfX( PixelX x, PixelX width ) const;
135  LinePosition linePositionOfX( PixelX x ) const;
137  LinePosition magneticLinePositionOfX( PixelX x ) const;
139  PixelX xOfLinePosition( LinePosition posInLine ) const;
141  PixelX rightXOfLinePosition( LinePosition posInLine ) const;
143  LinePosition linePositionOfColumnX( PixelX x ) const;
145  LinePositionRange linePositionsOfColumnXs( PixelX x, PixelX width ) const;
147  PixelX columnXOfLinePosition( LinePosition posInLine ) const;
149  PixelX columnRightXOfLinePosition( LinePosition posInLine ) const;
151  LinePositionRange visibleLinePositions( PixelX x, PixelX width ) const;
153  PixelXRange xsOfLinePositionsInclSpaces( const LinePositionRange& linePositions ) const;
155  PixelXRange columnXsOfLinePositionsInclSpaces( const LinePositionRange& linePositions ) const;
156 
157  QRect byteRect( const Coord& coord ) const;
158 
159  public: // value access
160  PixelX byteWidth() const;
161  PixelX digitWidth() const;
162  PixelX groupSpacingWidth() const;
163  PixelX byteSpacingWidth() const;
164  int noOfGroupedBytes() const;
165 
166  LinePosition firstLinePos() const;
167  LinePosition lastLinePos() const;
168  LinePositionRange visibleLinePositions() const;
169  const ByteArrayTableLayout* layout() const;
170  bool isByteTypeColored() const;
171 
172 
173  protected: // API to be redefined
174  virtual void renderByteText( QPainter* painter, Byte byte, Character charByte, const QColor& color ) const = 0;
176  virtual void recalcByteWidth();
177 
178 
179  protected:
180  void renderPlain( QPainter* painter, const LinePositionRange& linePositions, Address byteIndex );
181  void renderSelection( QPainter* painter, const LinePositionRange& linePositions, Address byteIndex, int flag );
182  void renderMarking( QPainter* painter, const LinePositionRange& linePositions, Address byteIndex, int flag );
183  void renderRange( QPainter* painter, const QBrush& brush, const LinePositionRange& linePositions, int flag );
184  void renderSelectionSpaceBehind( QPainter* painter, LinePosition linePosition );
185  void renderSpaceBehind( QPainter* painter, const QBrush& brush, LinePosition linePosition );
186  void renderBookmark( QPainter* painter, const QBrush& brush );
187 
188  void recalcX();
189 
190  bool getNextSelectedAddressRange( AddressRange* selectedRange, unsigned int* flag, const AddressRange& range ) const;
191  bool getNextMarkedAddressRange( AddressRange* markedRange, unsigned int* flag, const AddressRange& range ) const;
192 
193  void setByteWidth( int byteWidth );
194 
195 
196  protected:
198  AbstractByteArrayModel* mByteArrayModel;
200  const ByteArrayTableLayout* mLayout;
202  ByteArrayTableRanges* mRanges;
204  Bookmarkable* mBookmarks;
206  const CharCodec* mCharCodec;
207 
209  PixelX mDigitWidth;
211  PixelY mDigitBaseLine;
212 
213  QFontMetrics mFontMetrics;
214 
215  protected: // individual data
217  PixelX mByteWidth;
219 // PixelX mCursorWidth;
221  PixelX mByteSpacingWidth;
223  PixelX mGroupSpacingWidth;
224 
226  int mNoOfGroupedBytes;
227 
231  PixelX* mLinePosLeftPixelX;
232  PixelX* mLinePosRightPixelX;
234  LinePosition mLastLinePos;
235 
237  bool mByteTypeColored;
238 
239 
240  protected: // buffering rendering data
241  LinePositionRange mRenderLinePositions;
242  Line mRenderLine;
243  PixelX mRenderX;
244  PixelX mRenderWidth;
245  int mSpacingTrigger;
246 };
247 
248 
249 inline PixelX AbstractByteArrayColumnRenderer::byteWidth() const { return mByteWidth; }
250 inline PixelX AbstractByteArrayColumnRenderer::digitWidth() const { return mDigitWidth; }
251 inline PixelX AbstractByteArrayColumnRenderer::byteSpacingWidth() const { return mByteSpacingWidth; }
252 inline PixelX AbstractByteArrayColumnRenderer::groupSpacingWidth() const { return mGroupSpacingWidth; }
253 
254 inline int AbstractByteArrayColumnRenderer::noOfGroupedBytes() const { return mNoOfGroupedBytes; }
255 
256 inline LinePosition AbstractByteArrayColumnRenderer::firstLinePos() const { return mRenderLinePositions.start(); }
257 inline LinePosition AbstractByteArrayColumnRenderer::lastLinePos() const { return mRenderLinePositions.end(); }
258 inline LinePositionRange AbstractByteArrayColumnRenderer::visibleLinePositions() const { return mRenderLinePositions; }
259 
260 inline const ByteArrayTableLayout* AbstractByteArrayColumnRenderer::layout() const { return mLayout; }
261 
262 inline void AbstractByteArrayColumnRenderer::setCharCodec( const CharCodec* charCodec )
263 {
264  mCharCodec = charCodec;
265 }
266 
267 inline void AbstractByteArrayColumnRenderer::setByteTypeColored( bool byteTypeColored )
268 {
269  mByteTypeColored = byteTypeColored;
270 }
271 inline bool AbstractByteArrayColumnRenderer::isByteTypeColored() const { return mByteTypeColored; }
272 
273 inline void AbstractByteArrayColumnRenderer::setByteWidth( int byteWidth ) { mByteWidth = byteWidth; }
274 
275 }
276 
277 #endif
character.h
Okteta::AbstractByteArrayColumnRenderer::lastLinePos
LinePosition lastLinePos() const
Definition: abstractbytearraycolumnrenderer.h:257
OKTETAGUI_EXPORT
#define OKTETAGUI_EXPORT
Definition: oktetagui_export.h:36
Okteta::AbstractByteArrayColumnRenderer::mByteTypeColored
bool mByteTypeColored
Definition: abstractbytearraycolumnrenderer.h:237
Okteta::AbstractByteArrayColumnRenderer::mLinePosLeftPixelX
PixelX * mLinePosLeftPixelX
pointer to array with buffered linePositions (relative to column position) a spacing gets assigned to...
Definition: abstractbytearraycolumnrenderer.h:231
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
abstractbytearraymodel.h
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::AbstractByteArrayColumnRenderer::mDigitWidth
PixelX mDigitWidth
Definition: abstractbytearraycolumnrenderer.h:209
KDE::NumberRange
describes a range of numbers which have a distance of 1 each
Definition: numberrange.h:37
KDE::Range::start
T start() const
Definition: range.h:86
Okteta::AbstractByteArrayColumnRenderer::mCharCodec
const CharCodec * mCharCodec
Definition: abstractbytearraycolumnrenderer.h:206
Okteta::Byte
unsigned char Byte
Definition: byte.h:29
Okteta::AbstractByteArrayColumnRenderer::groupSpacingWidth
PixelX groupSpacingWidth() const
Definition: abstractbytearraycolumnrenderer.h:252
Okteta::Coord
a class which represents a coord in a 2-dim.
Definition: coord.h:47
Okteta::AbstractByteArrayColumnRenderer::mLastLinePos
LinePosition mLastLinePos
index of right position
Definition: abstractbytearraycolumnrenderer.h:234
Okteta::Bookmarkable
Definition: bookmarkable.h:39
Okteta::Line
qint32 Line
Definition: line.h:33
Okteta::AbstractByteArrayColumnRenderer::mFontMetrics
QFontMetrics mFontMetrics
Definition: abstractbytearraycolumnrenderer.h:213
Okteta::AbstractByteArrayColumnRenderer::setByteTypeColored
void setByteTypeColored(bool byteTypeColored)
Definition: abstractbytearraycolumnrenderer.h:267
Okteta::AbstractColumnStylist
Definition: abstractcolumnstylist.h:38
Okteta::ByteArrayTableLayout
the logical layout of a byte array table for a view
Definition: bytearraytablelayout.h:61
Okteta::AbstractByteArrayColumnRenderer::mSpacingTrigger
int mSpacingTrigger
Definition: abstractbytearraycolumnrenderer.h:245
Okteta::AbstractByteArrayColumnRenderer::digitWidth
PixelX digitWidth() const
Definition: abstractbytearraycolumnrenderer.h:250
Okteta::PixelX
int PixelX
Definition: kadds.h:34
Okteta::AbstractByteArrayColumnRenderer::visibleLinePositions
LinePositionRange visibleLinePositions() const
Definition: abstractbytearraycolumnrenderer.h:258
Okteta::AbstractByteArrayColumnRenderer::mBookmarks
Bookmarkable * mBookmarks
Definition: abstractbytearraycolumnrenderer.h:204
Okteta::AbstractByteArrayColumnRenderer::setByteWidth
void setByteWidth(int byteWidth)
Definition: abstractbytearraycolumnrenderer.h:273
Okteta::AbstractByteArrayColumnRenderer::byteWidth
PixelX byteWidth() const
Definition: abstractbytearraycolumnrenderer.h:249
Okteta::AbstractByteArrayColumnRenderer::mRenderLinePositions
LinePositionRange mRenderLinePositions
Definition: abstractbytearraycolumnrenderer.h:241
Okteta::AbstractByteArrayColumnRenderer::mRenderWidth
PixelX mRenderWidth
Definition: abstractbytearraycolumnrenderer.h:244
Okteta::AbstractByteArrayColumnRenderer::mByteSpacingWidth
PixelX mByteSpacingWidth
width of inserting cursor in pixel
Definition: abstractbytearraycolumnrenderer.h:221
abstractcolumnrenderer.h
Okteta::CharCodec
Definition: charcodec.h:42
oktetacore.h
KDE::Range::end
T end() const
Definition: range.h:88
Okteta::AbstractByteArrayColumnRenderer::mRenderX
PixelX mRenderX
Definition: abstractbytearraycolumnrenderer.h:243
Okteta::AbstractByteArrayColumnRenderer::mByteArrayModel
AbstractByteArrayModel * mByteArrayModel
pointer to the buffer
Definition: abstractbytearraycolumnrenderer.h:198
linepositionrange.h
Okteta::AbstractByteArrayColumnRenderer::layout
const ByteArrayTableLayout * layout() const
Definition: abstractbytearraycolumnrenderer.h:260
linerange.h
Okteta::AbstractByteArrayColumnRenderer::mByteWidth
PixelX mByteWidth
total width of byte display in pixel
Definition: abstractbytearraycolumnrenderer.h:217
Okteta::AbstractByteArrayColumnRenderer
base class of all buffer column displayers holds all information about the vertical layout of a buffe...
Definition: abstractbytearraycolumnrenderer.h:60
Okteta::AbstractByteArrayColumnRenderer::mLinePosRightPixelX
PixelX * mLinePosRightPixelX
Definition: abstractbytearraycolumnrenderer.h:232
Okteta::LinePosition
qint32 LinePosition
Definition: lineposition.h:33
Okteta::AbstractByteArrayColumnRenderer::mNoOfGroupedBytes
int mNoOfGroupedBytes
number of grouped bytes
Definition: abstractbytearraycolumnrenderer.h:226
Okteta::AbstractByteArrayColumnRenderer::mRanges
ByteArrayTableRanges * mRanges
pointer to the ranges
Definition: abstractbytearraycolumnrenderer.h:202
Okteta::AbstractByteArrayColumnRenderer::firstLinePos
LinePosition firstLinePos() const
Definition: abstractbytearraycolumnrenderer.h:256
Okteta::AbstractColumnRenderer
base class for columns of the ColumnsView
Definition: abstractcolumnrenderer.h:46
Okteta::AbstractByteArrayColumnRenderer::mRenderLine
Line mRenderLine
Definition: abstractbytearraycolumnrenderer.h:242
Okteta::AbstractByteArrayColumnRenderer::mGroupSpacingWidth
PixelX mGroupSpacingWidth
width of spacing in pixel
Definition: abstractbytearraycolumnrenderer.h:223
Okteta::AbstractByteArrayColumnRenderer::noOfGroupedBytes
int noOfGroupedBytes() const
Definition: abstractbytearraycolumnrenderer.h:254
Okteta::Character
Definition: character.h:35
Okteta::AbstractByteArrayColumnRenderer::mLayout
const ByteArrayTableLayout * mLayout
pointer to the layout
Definition: abstractbytearraycolumnrenderer.h:200
Okteta::AbstractByteArrayColumnRenderer::byteSpacingWidth
PixelX byteSpacingWidth() const
Definition: abstractbytearraycolumnrenderer.h:251
Okteta::PixelY
int PixelY
Definition: kadds.h:35
Okteta::AbstractByteArrayColumnRenderer::setCharCodec
void setCharCodec(const CharCodec *charCodec)
sets the codec to be used by the char column.
Definition: abstractbytearraycolumnrenderer.h:262
Okteta::AbstractByteArrayColumnRenderer::mDigitBaseLine
PixelY mDigitBaseLine
Definition: abstractbytearraycolumnrenderer.h:211
Okteta::AbstractByteArrayColumnRenderer::isByteTypeColored
bool isByteTypeColored() const
Definition: abstractbytearraycolumnrenderer.h:271
Okteta::AbstractByteArrayColumnRenderer::FrameStyle
FrameStyle
Definition: abstractbytearraycolumnrenderer.h:63
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