1 /* 2 This file is part of the Okteta Gui library, made within the KDE community. 3 4 SPDX-FileCopyrightText: 2003, 2007-2010 Friedrich W. H. Kossebau <kossebau@kde.org> 5 6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 7 */ 8 9 #ifndef OKTETA_BYTEARRAYCOLUMNVIEW_HPP 10 #define OKTETA_BYTEARRAYCOLUMNVIEW_HPP 11 12 // lib 13 #include "abstractbytearrayview.hpp" 14 15 namespace Okteta { 16 class ByteArrayColumnViewPrivate; 17 18 /** the main widget 19 * 20 * The functions split up in helper functions and those that are complete. 21 * 22 * Complete functions can be called from the outside and leave the widget in 23 * a consistent state. They care for exceptions so one can safely call them in all 24 * situations (like empty buffer, cursor behind end etc.) 25 * 26 * Helper functions do only partial tasks and need to be completed. They often do not 27 * check for exceptions so one has to care for this. 28 * 29 * @author Friedrich W. H. Kossebau 30 */ 31 32 class OKTETAGUI_EXPORT ByteArrayColumnView : public AbstractByteArrayView 33 { 34 Q_OBJECT 35 36 public: 37 explicit ByteArrayColumnView(QWidget* parent = nullptr); 38 ~ByteArrayColumnView() override; 39 40 public: // AbstractByteArrayView API 41 // value column 42 int /*PixelX*/ byteSpacingWidth() const override; 43 int noOfGroupedBytes() const override; 44 int /*PixelX*/ groupSpacingWidth() const override; 45 int /*PixelX*/ binaryGapWidth() const override; 46 47 // char column 48 bool showsNonprinting() const override; 49 QChar substituteChar() const override; 50 QChar undefinedChar() const override; 51 52 bool isByteTypeColored() const override; 53 54 void setByteArrayModel(AbstractByteArrayModel* byteArrayModel) override; 55 void setByteSpacingWidth(int /*PixelX*/ byteSpacingWidth) override; 56 void setNoOfGroupedBytes(int noOfGroupedBytes) override; 57 void setGroupSpacingWidth(int /*PixelX*/ groupSpacingWidth) override; 58 void setBinaryGapWidth(int binaryGapWidth) override; 59 void setBufferSpacing(int /*PixelX*/ byteSpacingWidth, int noOfGroupedBytes = 0, int /*PixelX*/ groupSpacingWidth = 0) override; 60 void setValueCoding(ValueCoding valueCoding) override; 61 // char column parameters 62 void setShowsNonprinting(bool showsNonprinting = true) override; 63 void setSubstituteChar(QChar substituteChar) override; 64 void setUndefinedChar(QChar undefinedChar) override; 65 void setCharCoding(CharCoding charCoding) override; 66 void setCharCoding(const QString& charCodingName) override; 67 void setByteTypeColored(bool isColored) override; 68 69 public: // ColumnsView API 70 void renderColumns(QPainter* painter, int cx, int cy, int cw, int ch) override; 71 72 public: // QWidget API 73 QSize minimumSizeHint() const override; 74 75 public: // logic value service 76 /** calculates the number of bytes per line that fit into a widget with the given size 77 * tests whether a vertical scroll bar is needed at all or not due to the given width 78 * takes the frame width into account 79 * @param TestSize Size the widget might have 80 * @return number of bytes per line that fit into a widget with the given size 81 */ 82 // int fittingBytesPerLine() const; 83 84 public: // modification access 85 // void repaintByte( int row, int column, bool Erase = true ); 86 // void updateByte( int row, int column ); 87 // void ensureByteVisible( int row, int column ); 88 89 protected: // Q_SLOTS QWidget API 90 void changeEvent(QEvent* event) override; 91 92 private: 93 Q_DECLARE_PRIVATE(ByteArrayColumnView) 94 }; 95 96 } 97 98 #endif 99