Files
pineapple-notepad/sciedit.h

44 lines
1.0 KiB
C
Raw Normal View History

2024-07-02 23:47:26 +08:00
#pragma once
#include <ScintillaEdit.h>
#include <ILexer.h>
#include <QFont>
#include <QString>
2024-07-02 23:47:26 +08:00
class SciEdit : public ScintillaEdit
{
Q_OBJECT
public:
explicit SciEdit(QWidget * parent = nullptr);
enum FoldType {
NoFoldType,
BoxFoldType,
};
Q_ENUMS(FoldType)
void setStyleFont(const QFont & font, int style = STYLE_DEFAULT);
void setFolding(FoldType foldType, int margin = 2);
void setLexer(Scintilla::ILexer5 * lexer);
void setLineNumbersEnabled(bool enabled);
void setEditorFont(const QFont &font);
void applyTheme(bool dark);
2024-07-02 23:47:26 +08:00
void sendColor(unsigned int iMessage, uptr_t wParam, const QColor &col) const;
signals:
void cursorPosChanged(int line, int index);
2025-10-12 15:42:17 +08:00
void textChanged();
2024-07-02 23:47:26 +08:00
private:
void setMarkerDefine(int markerNumber, int markerSymbol);
void updateLineNumberMarginWidth();
void applyLexerStyles();
bool m_lineNumbersEnabled = false;
int m_lastLineNumberDigits = 0;
bool m_isDarkTheme = false;
QFont m_editorFont;
QString m_lexerName;
2024-07-02 23:47:26 +08:00
};