File indexing completed on 2024-04-14 05:45:52

0001 /*
0002     This file is part of the Okteta Gui library, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2003, 2007-2010 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef OKTETA_BYTEARRAYCOLUMNVIEW_HPP
0010 #define OKTETA_BYTEARRAYCOLUMNVIEW_HPP
0011 
0012 // lib
0013 #include "abstractbytearrayview.hpp"
0014 
0015 namespace Okteta {
0016 class ByteArrayColumnViewPrivate;
0017 
0018 /** the main widget
0019  *
0020  * The functions split up in helper functions and those that are complete.
0021  *
0022  * Complete functions can be called from the outside and leave the widget in
0023  * a consistent state. They care for exceptions so one can safely call them in all
0024  * situations (like empty buffer, cursor behind end etc.)
0025  *
0026  * Helper functions do only partial tasks and need to be completed. They often do not
0027  * check for exceptions so one has to care for this.
0028  *
0029  * @author Friedrich W. H. Kossebau
0030  */
0031 
0032 class OKTETAGUI_EXPORT ByteArrayColumnView : public AbstractByteArrayView
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037     explicit ByteArrayColumnView(QWidget* parent = nullptr);
0038     ~ByteArrayColumnView() override;
0039 
0040 public: // AbstractByteArrayView API
0041     // value column
0042     int /*PixelX*/ byteSpacingWidth() const override;
0043     int noOfGroupedBytes() const override;
0044     int /*PixelX*/ groupSpacingWidth() const override;
0045     int /*PixelX*/ binaryGapWidth() const override;
0046 
0047     // char column
0048     bool showsNonprinting() const override;
0049     QChar substituteChar() const override;
0050     QChar undefinedChar() const override;
0051 
0052     bool isByteTypeColored() const override;
0053 
0054     void setByteArrayModel(AbstractByteArrayModel* byteArrayModel) override;
0055     void setByteSpacingWidth(int /*PixelX*/ byteSpacingWidth) override;
0056     void setNoOfGroupedBytes(int noOfGroupedBytes) override;
0057     void setGroupSpacingWidth(int /*PixelX*/ groupSpacingWidth) override;
0058     void setBinaryGapWidth(int binaryGapWidth) override;
0059     void setBufferSpacing(int /*PixelX*/ byteSpacingWidth, int noOfGroupedBytes = 0, int /*PixelX*/ groupSpacingWidth = 0) override;
0060     void setValueCoding(ValueCoding valueCoding) override;
0061     // char column parameters
0062     void setShowsNonprinting(bool showsNonprinting = true) override;
0063     void setSubstituteChar(QChar substituteChar) override;
0064     void setUndefinedChar(QChar undefinedChar) override;
0065     void setCharCoding(CharCoding charCoding) override;
0066     void setCharCoding(const QString& charCodingName) override;
0067     void setByteTypeColored(bool isColored) override;
0068 
0069 public: // ColumnsView API
0070     void renderColumns(QPainter* painter, int cx, int cy, int cw, int ch) override;
0071 
0072 public: // QWidget API
0073     QSize minimumSizeHint() const override;
0074 
0075 public: // logic value service
0076     /** calculates the number of bytes per line that fit into a widget with the given size
0077      * tests whether a vertical scroll bar is needed at all or not due to the given width
0078      * takes the frame width into account
0079      * @param TestSize Size the widget might have
0080      * @return number of bytes per line that fit into a widget with the given size
0081      */
0082 //     int fittingBytesPerLine() const;
0083 
0084 public: // modification access
0085 //    void repaintByte( int row, int column, bool Erase = true );
0086 //    void updateByte( int row, int column );
0087 //    void ensureByteVisible( int row, int column );
0088 
0089 protected: // Q_SLOTS QWidget API
0090     void changeEvent(QEvent* event) override;
0091 
0092 private:
0093     Q_DECLARE_PRIVATE(ByteArrayColumnView)
0094 };
0095 
0096 }
0097 
0098 #endif