新增sql连接,目前支持mysql、sqlite、oracle连接以及相关数据库操作
This commit is contained in:
commit
903d805f31
|
|
@ -0,0 +1,35 @@
|
|||
# Build artifacts
|
||||
debug/
|
||||
release/
|
||||
build/
|
||||
bin/
|
||||
*.o
|
||||
*.obj
|
||||
*.exe
|
||||
*.dll
|
||||
*.a
|
||||
*.lib
|
||||
*.so
|
||||
*.dylib
|
||||
moc_*.cpp
|
||||
qrc_*.cpp
|
||||
ui_*.h
|
||||
|
||||
# Qt/QMake
|
||||
Makefile
|
||||
Makefile.Debug
|
||||
Makefile.Release
|
||||
.qmake.stash
|
||||
*.pro.user
|
||||
|
||||
# IDE
|
||||
.vs/
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# OS
|
||||
Thumbs.db
|
||||
.DS_Store
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef ELAACRYLICURLCARD_H
|
||||
#define ELAACRYLICURLCARD_H
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
class ElaAcrylicUrlCardPrivate;
|
||||
class ELA_EXPORT ElaAcrylicUrlCard : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaAcrylicUrlCard);
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, MainOpacity)
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, NoiseOpacity)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BrushAlpha)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, Title);
|
||||
Q_PROPERTY_CREATE_Q_H(QString, SubTitle);
|
||||
Q_PROPERTY_CREATE_Q_H(int, TitlePixelSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, SubTitlePixelSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, TitleSpacing);
|
||||
Q_PROPERTY_CREATE_Q_H(int, SubTitleSpacing);
|
||||
Q_PROPERTY_CREATE_Q_H(QPixmap, CardPixmap);
|
||||
Q_PROPERTY_CREATE_Q_H(QSize, CardPixmapSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, CardPixmapBorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaCardPixType::PixMode, CardPixMode);
|
||||
Q_PROPERTY_CREATE_Q_H(QString, Url);
|
||||
|
||||
public:
|
||||
explicit ElaAcrylicUrlCard(QWidget* parent = nullptr);
|
||||
~ElaAcrylicUrlCard() override;
|
||||
void setCardPixmapSize(int width, int height);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAACRYLICURLCARD_H
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef ELAACTIONCOMMANDER_H
|
||||
#define ELAACTIONCOMMANDER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaSingleton.h"
|
||||
|
||||
class ELA_EXPORT ElaActionCommand : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ElaActionCommand(QObject* parent = nullptr);
|
||||
~ElaActionCommand() override;
|
||||
|
||||
virtual void undo() = 0;
|
||||
virtual void redo() = 0;
|
||||
};
|
||||
|
||||
class ElaActionCommanderPrivate;
|
||||
class ELA_EXPORT ElaActionCommander : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaActionCommander)
|
||||
Q_SINGLETON_CREATE_H(ElaActionCommander)
|
||||
Q_PROPERTY_CREATE_Q_H(int, MaxRouteCount)
|
||||
private:
|
||||
explicit ElaActionCommander(QObject* parent = nullptr);
|
||||
~ElaActionCommander() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void commanderStateChanged(const QString& domainName, ElaActionCommanderType::CommanderState state);
|
||||
|
||||
public:
|
||||
void recordCommand(const QString& domainName, ElaActionCommand* command, bool isRedo = true);
|
||||
void clearCommand(const QString& domainName);
|
||||
void undoCommand(const QString& domainName);
|
||||
void redoCommand(const QString& domainName);
|
||||
|
||||
ElaActionCommanderType::CommanderState getCommanderUndoState(const QString& domainName) const;
|
||||
ElaActionCommanderType::CommanderState getCommanderRedoState(const QString& domainName) const;
|
||||
};
|
||||
|
||||
#endif // ELAACTIONCOMMANDER_H
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
#ifndef ELAAPPBAR_H
|
||||
#define ELAAPPBAR_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaDef.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#define Q_TAKEOVER_NATIVEEVENT_H virtual bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result) override;
|
||||
#else
|
||||
#define Q_TAKEOVER_NATIVEEVENT_H virtual bool nativeEvent(const QByteArray& eventType, void* message, long* result) override;
|
||||
#endif
|
||||
#else
|
||||
#define Q_TAKEOVER_NATIVEEVENT_H
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#define ELAAPPBAR_HANDLE(ElaAppBar) \
|
||||
if (ElaAppBar) \
|
||||
{ \
|
||||
int ret = ElaAppBar->takeOverNativeEvent(eventType, message, result); \
|
||||
if (ret == -1) \
|
||||
{ \
|
||||
return QWidget::nativeEvent(eventType, message, result); \
|
||||
} \
|
||||
return (bool)ret; \
|
||||
} \
|
||||
return QWidget::nativeEvent(eventType, message, result);
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#define Q_TAKEOVER_NATIVEEVENT_CPP(CLASS, ElaAppBar) \
|
||||
bool CLASS::nativeEvent(const QByteArray& eventType, void* message, qintptr* result) \
|
||||
{ \
|
||||
ELAAPPBAR_HANDLE(ElaAppBar) \
|
||||
}
|
||||
#else
|
||||
#define Q_TAKEOVER_NATIVEEVENT_CPP(CLASS, ElaAppBar) \
|
||||
bool CLASS::nativeEvent(const QByteArray& eventType, void* message, long* result) \
|
||||
{ \
|
||||
ELAAPPBAR_HANDLE(ElaAppBar) \
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#define Q_TAKEOVER_NATIVEEVENT_CPP(CLASS, ElaAppBar)
|
||||
#endif
|
||||
|
||||
class QMenu;
|
||||
class ElaAppBarPrivate;
|
||||
class ELA_EXPORT ElaAppBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaAppBar)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsStayTop)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsFixedSize)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsDefaultClosed)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsOnlyAllowMinAndClose)
|
||||
Q_PROPERTY_CREATE_Q_H(int, AppBarHeight)
|
||||
public:
|
||||
explicit ElaAppBar(QWidget* parent = nullptr);
|
||||
~ElaAppBar() override;
|
||||
|
||||
void setCustomWidget(ElaAppBarType::CustomArea customArea, QWidget* customWidget, QObject* hitTestObject = nullptr, const QString& hitTestFunctionName = "");
|
||||
QWidget* getCustomWidget(ElaAppBarType::CustomArea customArea) const;
|
||||
|
||||
void setCustomMenu(QMenu* customMenu);
|
||||
QMenu* getCustomMenu() const;
|
||||
|
||||
void setWindowButtonFlag(ElaAppBarType::ButtonType buttonFlag, bool isEnable = true);
|
||||
void setWindowButtonFlags(ElaAppBarType::ButtonFlags buttonFlags);
|
||||
ElaAppBarType::ButtonFlags getWindowButtonFlags() const;
|
||||
|
||||
void setRouteBackButtonEnable(bool isEnable);
|
||||
void setRouteForwardButtonEnable(bool isEnable);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
int takeOverNativeEvent(const QByteArray& eventType, void* message, qintptr* result);
|
||||
#else
|
||||
int takeOverNativeEvent(const QByteArray& eventType, void* message, long* result);
|
||||
#endif
|
||||
#endif
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void routeBackButtonClicked();
|
||||
Q_SIGNAL void routeForwardButtonClicked();
|
||||
Q_SIGNAL void navigationButtonClicked();
|
||||
Q_SIGNAL void themeChangeButtonClicked();
|
||||
Q_SIGNAL void closeButtonClicked();
|
||||
Q_SIGNAL void customWidgetChanged();
|
||||
Q_SIGNAL void customMenuChanged();
|
||||
|
||||
protected:
|
||||
virtual bool eventFilter(QObject* obj, QEvent* event) override;
|
||||
#ifdef Q_OS_WIN
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // ELAAPPBAR_H
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef ELAAPPLICATION_H
|
||||
#define ELAAPPLICATION_H
|
||||
|
||||
#include <QIcon>
|
||||
#include <QObject>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaSingleton.h"
|
||||
#define eApp ElaApplication::getInstance()
|
||||
class ElaApplicationPrivate;
|
||||
class ELA_EXPORT ElaApplication : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaApplication)
|
||||
Q_SINGLETON_CREATE_H(ElaApplication)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaApplicationType::WindowDisplayMode, WindowDisplayMode)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, ElaMicaImagePath)
|
||||
private:
|
||||
explicit ElaApplication(QObject* parent = nullptr);
|
||||
~ElaApplication() override;
|
||||
|
||||
public:
|
||||
void init();
|
||||
void syncWindowDisplayMode(QWidget* widget, bool isSync = true);
|
||||
static bool containsCursorToItem(QWidget* item);
|
||||
};
|
||||
|
||||
#endif // ELAAPPLICATION_H
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef ELABREADCRUMBBAR_H
|
||||
#define ELABREADCRUMBBAR_H
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaBreadcrumbBarPrivate;
|
||||
class ELA_EXPORT ElaBreadcrumbBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaBreadcrumbBar)
|
||||
Q_PROPERTY_CREATE_Q_H(int, TextPixelSize)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsAutoRemove)
|
||||
public:
|
||||
explicit ElaBreadcrumbBar(QWidget* parent = nullptr);
|
||||
~ElaBreadcrumbBar() override;
|
||||
void setBreadcrumbList(QStringList breadcrumbList);
|
||||
QStringList appendBreadcrumb(QString breadcrumb);
|
||||
QStringList removeBreadcrumb(QString breadcrumb);
|
||||
|
||||
int getBreadcrumbListCount() const;
|
||||
QStringList getBreadcrumbList() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void breadcrumbClicked(QString breadcrumb, QStringList lastBreadcrumbList);
|
||||
};
|
||||
|
||||
#endif // ELABREADCRUMBBAR_H
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef ELACALENDAR_H
|
||||
#define ELACALENDAR_H
|
||||
|
||||
#include "ElaProperty.h"
|
||||
#include <QDate>
|
||||
#include <QWidget>
|
||||
class ElaCalendarPrivate;
|
||||
class ELA_EXPORT ElaCalendar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaCalendar)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRaiuds)
|
||||
Q_PROPERTY_CREATE_Q_H(QDate, SelectedDate)
|
||||
Q_PROPERTY_CREATE_Q_H(QDate, MinimumDate)
|
||||
Q_PROPERTY_CREATE_Q_H(QDate, MaximumDate)
|
||||
public:
|
||||
explicit ElaCalendar(QWidget* parent = nullptr);
|
||||
~ElaCalendar() override;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void clicked(QDate date);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELACALENDAR_H
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef ELACALENDARPICKER_H
|
||||
#define ELACALENDARPICKER_H
|
||||
|
||||
#include "ElaProperty.h"
|
||||
#include <QDate>
|
||||
#include <QPushButton>
|
||||
class ElaCalendarPickerPrivate;
|
||||
class ELA_EXPORT ElaCalendarPicker : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaCalendarPicker)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PRIVATE_CREATE_Q_H(QDate, SelectedDate)
|
||||
public:
|
||||
explicit ElaCalendarPicker(QWidget* parent = nullptr);
|
||||
~ElaCalendarPicker() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void selectedDateChanged(QDate date);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELACALENDARPICKER_H
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef ELACHECKBOX_H
|
||||
#define ELACHECKBOX_H
|
||||
|
||||
#include <QCheckBox>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ELA_EXPORT ElaCheckBox : public QCheckBox
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY_CREATE(int, BorderRadius)
|
||||
public:
|
||||
explicit ElaCheckBox(QWidget* parent = nullptr);
|
||||
explicit ElaCheckBox(const QString& text, QWidget* parent = nullptr);
|
||||
~ElaCheckBox() override;
|
||||
};
|
||||
|
||||
#endif // ELACHECKBOX_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ELACOLORDIALOG_H
|
||||
#define ELACOLORDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "ElaAppBar.h"
|
||||
#include "ElaProperty.h"
|
||||
class ElaColorDialogPrivate;
|
||||
class ELA_EXPORT ElaColorDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaColorDialog)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, CurrentColor)
|
||||
Q_TAKEOVER_NATIVEEVENT_H
|
||||
public:
|
||||
explicit ElaColorDialog(QWidget* parent = nullptr);
|
||||
~ElaColorDialog() override;
|
||||
|
||||
QList<QColor> getCustomColorList() const;
|
||||
QColor getCustomColor(int index) const;
|
||||
QString getCurrentColorRGB() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void colorSelected(const QColor& color);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELACOLORDIALOG_H
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef ELACOMBOBOX_H
|
||||
#define ELACOMBOBOX_H
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaComboBoxPrivate;
|
||||
class ELA_EXPORT ElaComboBox : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaComboBox);
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
public:
|
||||
explicit ElaComboBox(QWidget* parent = nullptr);
|
||||
~ElaComboBox() override;
|
||||
|
||||
void setEditable(bool editable);
|
||||
|
||||
protected:
|
||||
virtual void showPopup() override;
|
||||
virtual void hidePopup() override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELACOMBOBOX_H
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
#ifndef ELACONTENTDIALOG_H
|
||||
#define ELACONTENTDIALOG_H
|
||||
#include <QAbstractNativeEventFilter>
|
||||
#include <QDialog>
|
||||
|
||||
#include "ElaAppBar.h"
|
||||
#include "ElaProperty.h"
|
||||
class ElaContentDialogPrivate;
|
||||
class ELA_EXPORT ElaContentDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaContentDialog)
|
||||
Q_TAKEOVER_NATIVEEVENT_H
|
||||
public:
|
||||
explicit ElaContentDialog(QWidget* parent);
|
||||
~ElaContentDialog() override;
|
||||
Q_SLOT virtual void onLeftButtonClicked();
|
||||
Q_SLOT virtual void onMiddleButtonClicked();
|
||||
Q_SLOT virtual void onRightButtonClicked();
|
||||
void setCentralWidget(QWidget* centralWidget);
|
||||
|
||||
void setLeftButtonText(QString text);
|
||||
void setMiddleButtonText(QString text);
|
||||
void setRightButtonText(QString text);
|
||||
|
||||
void close();
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void leftButtonClicked();
|
||||
Q_SIGNAL void middleButtonClicked();
|
||||
Q_SIGNAL void rightButtonClicked();
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
virtual void keyPressEvent(QKeyEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELACONTENTDIALOG_H
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef ELAFRAMEWORK_ELADIALOG_H
|
||||
#define ELAFRAMEWORK_ELADIALOG_H
|
||||
|
||||
#include "ElaAppBar.h"
|
||||
#include "ElaDef.h"
|
||||
#include <QDialog>
|
||||
|
||||
class ElaDialogPrivate;
|
||||
class ELA_EXPORT ElaDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaDialog)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsStayTop)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsFixedSize)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsDefaultClosed)
|
||||
Q_PROPERTY_CREATE_Q_H(int, AppBarHeight)
|
||||
Q_TAKEOVER_NATIVEEVENT_H
|
||||
public:
|
||||
explicit ElaDialog(QWidget* parent = nullptr);
|
||||
~ElaDialog() override;
|
||||
void moveToCenter();
|
||||
|
||||
void setWindowButtonFlag(ElaAppBarType::ButtonType buttonFlag, bool isEnable = true);
|
||||
void setWindowButtonFlags(ElaAppBarType::ButtonFlags buttonFlags);
|
||||
ElaAppBarType::ButtonFlags getWindowButtonFlags() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void routeBackButtonClicked();
|
||||
Q_SIGNAL void navigationButtonClicked();
|
||||
Q_SIGNAL void themeChangeButtonClicked();
|
||||
Q_SIGNAL void closeButtonClicked();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif //ELAFRAMEWORK_ELADIALOG_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ELADOCKWIDGET_H
|
||||
#define ELADOCKWIDGET_H
|
||||
|
||||
#include <QDockWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaDockWidgetPrivate;
|
||||
class ELA_EXPORT ElaDockWidget : public QDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaDockWidget)
|
||||
public:
|
||||
explicit ElaDockWidget(QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||
explicit ElaDockWidget(const QString& title, QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||
~ElaDockWidget() override;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
#ifdef Q_OS_WIN
|
||||
virtual bool event(QEvent* event) override;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
virtual bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result) override;
|
||||
#else
|
||||
virtual bool nativeEvent(const QByteArray& eventType, void* message, long* result) override;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // ELADOCKWIDGET_H
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef ELADOUBLESPINBOX_H
|
||||
#define ELADOUBLESPINBOX_H
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
#include "ElaDef.h"
|
||||
|
||||
class ElaDoubleSpinBoxPrivate;
|
||||
class ELA_EXPORT ElaDoubleSpinBox : public QDoubleSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaDoubleSpinBox)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaSpinBoxType::ButtonMode, ButtonMode)
|
||||
public:
|
||||
explicit ElaDoubleSpinBox(QWidget* parent = nullptr);
|
||||
~ElaDoubleSpinBox() override;
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent* event) override;
|
||||
void focusOutEvent(QFocusEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELADOUBLESPINBOX_H
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELADRAWERAREA_H_
|
||||
#define ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELADRAWERAREA_H_
|
||||
|
||||
#include "ElaProperty.h"
|
||||
#include <QWidget>
|
||||
|
||||
class ElaDrawerAreaPrivate;
|
||||
class ELA_EXPORT ElaDrawerArea : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaDrawerArea)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(int, HeaderHeight)
|
||||
public:
|
||||
explicit ElaDrawerArea(QWidget* parent = nullptr);
|
||||
~ElaDrawerArea() override;
|
||||
|
||||
void setDrawerHeader(QWidget* widget);
|
||||
|
||||
void addDrawer(QWidget* widget);
|
||||
void removeDrawer(QWidget* widget);
|
||||
|
||||
void expand();
|
||||
void collapse();
|
||||
|
||||
bool getIsExpand() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void expandStateChanged(bool isExpand);
|
||||
};
|
||||
|
||||
#endif //ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELADRAWERAREA_H_
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
#ifndef ELADXGIMANAGER_H
|
||||
#define ELADXGIMANAGER_H
|
||||
|
||||
#include <QWidget>
|
||||
#ifdef Q_OS_WIN
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSingleton.h"
|
||||
|
||||
class ElaDxgiManagerPrivate;
|
||||
class ELA_EXPORT ElaDxgiManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaDxgiManager)
|
||||
Q_SINGLETON_CREATE_H(ElaDxgiManager);
|
||||
|
||||
private:
|
||||
explicit ElaDxgiManager(QObject* parent = nullptr);
|
||||
~ElaDxgiManager() override;
|
||||
|
||||
public:
|
||||
QStringList getDxDeviceList() const;
|
||||
QStringList getOutputDeviceList() const;
|
||||
QImage grabScreenToImage() const;
|
||||
void startGrabScreen();
|
||||
void stopGrabScreen();
|
||||
bool getIsGrabScreen() const;
|
||||
bool setDxDeviceID(int dxID);
|
||||
int getDxDeviceID() const;
|
||||
bool setOutputDeviceID(int deviceID);
|
||||
int getOutputDeviceID() const;
|
||||
void setGrabArea(int width, int height); //从屏幕中心向外延伸
|
||||
void setGrabArea(int x, int y, int width, int height);
|
||||
QRect getGrabArea() const;
|
||||
void setGrabFrameRate(int frameRateValue);
|
||||
int getGrabFrameRate() const;
|
||||
void setTimeoutMsValue(int timeoutValue);
|
||||
int getTimeoutMsValue() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void grabImageUpdate(QImage img);
|
||||
};
|
||||
|
||||
class ElaDxgiScreenPrivate;
|
||||
class ELA_EXPORT ElaDxgiScreen : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaDxgiScreen)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
public:
|
||||
explicit ElaDxgiScreen(QWidget* parent = nullptr);
|
||||
~ElaDxgiScreen();
|
||||
void setIsSyncGrabSize(bool isSyncGrabSize);
|
||||
bool getIsSyncGrabSize() const;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
#endif
|
||||
#endif // ELADXGIMANAGER_H
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef ELAEVENTBUS_H
|
||||
#define ELAEVENTBUS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSingleton.h"
|
||||
class ElaEventPrivate;
|
||||
class ELA_EXPORT ElaEvent : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaEvent)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, EventName);
|
||||
Q_PROPERTY_CREATE_Q_H(QString, FunctionName);
|
||||
Q_PROPERTY_CREATE_Q_H(Qt::ConnectionType, ConnectionType);
|
||||
|
||||
public:
|
||||
explicit ElaEvent(QObject* parent = nullptr);
|
||||
explicit ElaEvent(QString eventName, QString functionName, QObject* parent = nullptr);
|
||||
~ElaEvent() override;
|
||||
ElaEventBusType::EventBusReturnType registerAndInit();
|
||||
};
|
||||
|
||||
class ElaEventBusPrivate;
|
||||
class ELA_EXPORT ElaEventBus : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaEventBus)
|
||||
Q_SINGLETON_CREATE_H(ElaEventBus);
|
||||
|
||||
private:
|
||||
explicit ElaEventBus(QObject* parent = nullptr);
|
||||
~ElaEventBus() override;
|
||||
|
||||
public:
|
||||
ElaEventBusType::EventBusReturnType post(const QString& eventName, const QVariantMap& data = {});
|
||||
QStringList getRegisteredEventsName() const;
|
||||
|
||||
private:
|
||||
friend class ElaEvent;
|
||||
};
|
||||
|
||||
#endif // ELAEVENTBUS_H
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef ELAEXPONENTIALBLUR_H
|
||||
#define ELAEXPONENTIALBLUR_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSingleton.h"
|
||||
|
||||
class ElaExponentialBlurPrivate;
|
||||
class ELA_EXPORT ElaExponentialBlur : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SINGLETON_CREATE_H(ElaExponentialBlur)
|
||||
Q_Q_CREATE(ElaExponentialBlur)
|
||||
private:
|
||||
explicit ElaExponentialBlur(QObject* parent = nullptr);
|
||||
~ElaExponentialBlur();
|
||||
|
||||
public:
|
||||
static QPixmap doExponentialBlur(QImage img, const quint16& blurRadius);
|
||||
};
|
||||
|
||||
#endif // ELAEXPONENTIALBLUR_H
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef ELAFLOWLAYOUT_H
|
||||
#define ELAFLOWLAYOUT_H
|
||||
|
||||
#include <QLayout>
|
||||
#include <QMap>
|
||||
#include <QStyle>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaFlowLayoutPrivate;
|
||||
class ELA_EXPORT ElaFlowLayout : public QLayout
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaFlowLayout)
|
||||
public:
|
||||
explicit ElaFlowLayout(QWidget* parent, int margin = -1, int hSpacing = -1, int vSpacing = -1);
|
||||
explicit ElaFlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1);
|
||||
~ElaFlowLayout() override;
|
||||
|
||||
void addItem(QLayoutItem* item) override;
|
||||
int horizontalSpacing() const;
|
||||
int verticalSpacing() const;
|
||||
Qt::Orientations expandingDirections() const override;
|
||||
bool hasHeightForWidth() const override;
|
||||
int heightForWidth(int) const override;
|
||||
int count() const override;
|
||||
QLayoutItem* itemAt(int index) const override;
|
||||
QSize minimumSize() const override;
|
||||
void setGeometry(const QRect& rect) override;
|
||||
QSize sizeHint() const override;
|
||||
QLayoutItem* takeAt(int index) override;
|
||||
|
||||
void setIsAnimation(bool isAnimation);
|
||||
};
|
||||
|
||||
#endif // ELAFLOWLAYOUT_H
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
#ifndef ELAGRAPHICSITEM_H
|
||||
#define ELAGRAPHICSITEM_H
|
||||
|
||||
#include <QGraphicsObject>
|
||||
#include <QJsonObject>
|
||||
#include <QObject>
|
||||
#include <QPainter>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaGraphicsScene;
|
||||
class ElaGraphicsItemPrivate;
|
||||
class ELA_EXPORT ElaGraphicsItem : public QGraphicsObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaGraphicsItem)
|
||||
Q_PROPERTY_CREATE_Q_H(int, Width)
|
||||
Q_PROPERTY_CREATE_Q_H(int, Height)
|
||||
Q_PROPERTY_CREATE_Q_H(QImage, ItemImage)
|
||||
Q_PROPERTY_CREATE_Q_H(QImage, ItemSelectedImage)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, ItemName)
|
||||
Q_PROPERTY_CREATE_Q_H(QVariantMap, DataRoutes)
|
||||
Q_PROPERTY_CREATE_Q_H(int, MaxLinkPortCount)
|
||||
public:
|
||||
explicit ElaGraphicsItem(QGraphicsItem* parent = nullptr);
|
||||
explicit ElaGraphicsItem(int width, int height, QGraphicsItem* parent = nullptr);
|
||||
~ElaGraphicsItem();
|
||||
|
||||
QString getItemUID() const;
|
||||
|
||||
void setLinkPortState(bool isFullLink);
|
||||
void setLinkPortState(bool isLink, int portIndex);
|
||||
|
||||
bool getLinkPortState(int portIndex) const;
|
||||
QVector<bool> getLinkPortState() const;
|
||||
|
||||
int getUsedLinkPortCount() const;
|
||||
QVector<int> getUsedLinkPort() const;
|
||||
int getUnusedLinkPortCount() const;
|
||||
QVector<int> getUnusedLinkPort() const;
|
||||
|
||||
protected:
|
||||
virtual QRectF boundingRect() const override;
|
||||
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
|
||||
friend QDataStream& operator<<(QDataStream& stream, const ElaGraphicsItem* item);
|
||||
friend QDataStream& operator>>(QDataStream& stream, ElaGraphicsItem* item);
|
||||
};
|
||||
|
||||
#endif // ELAGRAPHICSITEM_H
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef ELAGRAPHICSLINEITEM_H
|
||||
#define ELAGRAPHICSLINEITEM_H
|
||||
|
||||
#include <QGraphicsPathItem>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaGraphicsItem;
|
||||
class ElaGraphicsLineItemPrivate;
|
||||
class ELA_EXPORT ElaGraphicsLineItem : public QGraphicsPathItem
|
||||
{
|
||||
Q_Q_CREATE(ElaGraphicsLineItem)
|
||||
Q_PRIVATE_CREATE_Q_H(QPointF, StartPoint);
|
||||
Q_PRIVATE_CREATE_Q_H(QPointF, EndPoint);
|
||||
Q_PRIVATE_CREATE_Q_H(ElaGraphicsItem*, StartItem);
|
||||
Q_PRIVATE_CREATE_Q_H(ElaGraphicsItem*, EndItem);
|
||||
Q_PRIVATE_CREATE_Q_H(int, StartItemPort);
|
||||
Q_PRIVATE_CREATE_Q_H(int, EndItemPort);
|
||||
|
||||
public:
|
||||
explicit ElaGraphicsLineItem(ElaGraphicsItem* startItem, ElaGraphicsItem* endItem, int startItemPort, int endItemPort, QGraphicsItem* parent = nullptr);
|
||||
explicit ElaGraphicsLineItem(QPointF startPoint, QPointF endPoint, QGraphicsItem* parent = nullptr);
|
||||
~ElaGraphicsLineItem();
|
||||
|
||||
bool isTargetLink(ElaGraphicsItem* item) const;
|
||||
bool isTargetLink(ElaGraphicsItem* item1, ElaGraphicsItem* item2) const;
|
||||
bool isTargetLink(ElaGraphicsItem* item1, ElaGraphicsItem* item2, int port1, int port2) const;
|
||||
|
||||
protected:
|
||||
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
|
||||
QRectF boundingRect() const override;
|
||||
};
|
||||
|
||||
#endif // ELAGRAPHICSLINEITEM_H
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
#ifndef ELAGRAPHICSSCENE_H
|
||||
#define ELAGRAPHICSSCENE_H
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QEvent>
|
||||
#include <QGraphicsScene>
|
||||
#include <QJsonObject>
|
||||
#include <QObject>
|
||||
#include <QPainter>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaGraphicsItem;
|
||||
class ElaGraphicsScenePrivate;
|
||||
class ELA_EXPORT ElaGraphicsScene : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaGraphicsScene)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsCheckLinkPort)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, SerializePath)
|
||||
public:
|
||||
explicit ElaGraphicsScene(QObject* parent = nullptr);
|
||||
~ElaGraphicsScene();
|
||||
void addItem(ElaGraphicsItem* item);
|
||||
void removeItem(ElaGraphicsItem* item);
|
||||
void removeSelectedItems();
|
||||
void clear();
|
||||
|
||||
QList<ElaGraphicsItem*> createAndAddItem(int width, int height, int count = 1);
|
||||
QList<ElaGraphicsItem*> getSelectedElaItems() const;
|
||||
QList<ElaGraphicsItem*> getElaItems();
|
||||
QList<ElaGraphicsItem*> getElaItems(QPoint pos);
|
||||
QList<ElaGraphicsItem*> getElaItems(QPointF pos);
|
||||
QList<ElaGraphicsItem*> getElaItems(QRect rect);
|
||||
QList<ElaGraphicsItem*> getElaItems(QRectF rect);
|
||||
|
||||
void setSceneMode(ElaGraphicsSceneType::SceneMode mode);
|
||||
ElaGraphicsSceneType::SceneMode getSceneMode() const;
|
||||
|
||||
void selectAllItems();
|
||||
|
||||
QList<QVariantMap> getItemLinkList() const;
|
||||
bool addItemLink(ElaGraphicsItem* item1, ElaGraphicsItem* item2, int port1 = 0, int port2 = 0);
|
||||
bool removeItemLink(ElaGraphicsItem* item1);
|
||||
bool removeItemLink(ElaGraphicsItem* item1, ElaGraphicsItem* item2, int port1 = 0, int port2 = 0);
|
||||
|
||||
QVector<QVariantMap> getItemsDataRoute() const;
|
||||
|
||||
// 序列化 反序列化
|
||||
void serialize();
|
||||
void deserialize();
|
||||
|
||||
Q_SIGNALS:
|
||||
void showItemLink();
|
||||
void mouseLeftClickedItem(ElaGraphicsItem* item);
|
||||
void mouseRightClickedItem(ElaGraphicsItem* item);
|
||||
void mouseDoubleClickedItem(ElaGraphicsItem* item);
|
||||
|
||||
protected:
|
||||
virtual void focusOutEvent(QFocusEvent* event) override;
|
||||
virtual void keyPressEvent(QKeyEvent* event) override;
|
||||
virtual void keyReleaseEvent(QKeyEvent* event) override;
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
|
||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
|
||||
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAGRAPHICSSCENE_H
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef ELAGRAPHICSVIEW_H
|
||||
#define ELAGRAPHICSVIEW_H
|
||||
|
||||
#include <QGraphicsView>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaGraphicsViewPrivate;
|
||||
class ELA_EXPORT ElaGraphicsView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaGraphicsView)
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, MaxTransform);
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, MinTransform);
|
||||
|
||||
public:
|
||||
explicit ElaGraphicsView(QWidget* parent = nullptr);
|
||||
explicit ElaGraphicsView(QGraphicsScene* scene, QWidget* parent = nullptr);
|
||||
~ElaGraphicsView();
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAGRAPHICSVIEW_H
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef ELAICON_H
|
||||
#define ELAICON_H
|
||||
#include <QIcon>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSingleton.h"
|
||||
class ELA_EXPORT ElaIcon
|
||||
{
|
||||
Q_SINGLETON_CREATE_H(ElaIcon)
|
||||
private:
|
||||
explicit ElaIcon();
|
||||
~ElaIcon();
|
||||
|
||||
public:
|
||||
QIcon getElaIcon(ElaIconType::IconName awesome);
|
||||
QIcon getElaIcon(ElaIconType::IconName awesome, QColor iconColor);
|
||||
QIcon getElaIcon(ElaIconType::IconName awesome, int pixelSize);
|
||||
QIcon getElaIcon(ElaIconType::IconName awesome, int pixelSize, QColor iconColor);
|
||||
QIcon getElaIcon(ElaIconType::IconName awesome, int pixelSize, int fixedWidth, int fixedHeight);
|
||||
QIcon getElaIcon(ElaIconType::IconName awesome, int pixelSize, int fixedWidth, int fixedHeight, QColor iconColor);
|
||||
};
|
||||
|
||||
#endif // ELAICON_H
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef ELAICONBUTTON_H
|
||||
#define ELAICONBUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
class ElaIconButtonPrivate;
|
||||
class ELA_EXPORT ElaIconButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaIconButton)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, Opacity);
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, LightHoverColor);
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, DarkHoverColor);
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, LightIconColor);
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, DarkIconColor);
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, LightHoverIconColor);
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, DarkHoverIconColor);
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsSelected);
|
||||
|
||||
public:
|
||||
ElaIconButton(QPixmap pix, QWidget* parent = nullptr);
|
||||
ElaIconButton(ElaIconType::IconName awesome, QWidget* parent = nullptr);
|
||||
ElaIconButton(ElaIconType::IconName awesome, int pixelSize, QWidget* parent = nullptr);
|
||||
ElaIconButton(ElaIconType::IconName awesome, int pixelSize, int fixedWidth, int fixedHeight, QWidget* parent = nullptr);
|
||||
~ElaIconButton();
|
||||
void setAwesome(ElaIconType::IconName awesome);
|
||||
ElaIconType::IconName getAwesome() const;
|
||||
|
||||
void setPixmap(QPixmap pix);
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAICONBUTTON_H
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef ELAIMAGECARD_H
|
||||
#define ELAIMAGECARD_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaImageCardPrivate;
|
||||
class ELA_EXPORT ElaImageCard : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaImageCard)
|
||||
Q_PROPERTY_CREATE_Q_H(QImage, CardImage);
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsPreserveAspectCrop)
|
||||
public:
|
||||
explicit ElaImageCard(QWidget* parent = nullptr);
|
||||
~ElaImageCard() override;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAIMAGECARD_H
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef ELAINTERACTIVECARD_H
|
||||
#define ELAINTERACTIVECARD_H
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaInteractiveCardPrivate;
|
||||
class ELA_EXPORT ElaInteractiveCard : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaInteractiveCard)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, Title);
|
||||
Q_PROPERTY_CREATE_Q_H(QString, SubTitle);
|
||||
Q_PROPERTY_CREATE_Q_H(int, TitlePixelSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, SubTitlePixelSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, TitleSpacing);
|
||||
Q_PROPERTY_CREATE_Q_H(QPixmap, CardPixmap);
|
||||
Q_PROPERTY_CREATE_Q_H(QSize, CardPixmapSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, CardPixmapBorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaCardPixType::PixMode, CardPixMode);
|
||||
|
||||
public:
|
||||
explicit ElaInteractiveCard(QWidget* parent = nullptr);
|
||||
~ElaInteractiveCard();
|
||||
void setCardPixmapSize(int width, int height);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAINTERACTIVECARD_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ELAWIDGETTOOLS_SRC_ELAKEYBINDER_H_
|
||||
#define ELAWIDGETTOOLS_SRC_ELAKEYBINDER_H_
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include <QLabel>
|
||||
|
||||
class ElaKeyBinderPrivate;
|
||||
class ELA_EXPORT ElaKeyBinder : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaKeyBinder)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, BinderKeyText)
|
||||
Q_PROPERTY_CREATE_Q_H(quint32, NativeVirtualBinderKey)
|
||||
public:
|
||||
explicit ElaKeyBinder(QWidget* parent = nullptr);
|
||||
~ElaKeyBinder();
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void binderKeyTextChanged(QString binderKeyText);
|
||||
Q_SIGNAL void nativeVirtualBinderKeyChanged(quint32 binderKey);
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif //ELAWIDGETTOOLS_SRC_ELAKEYBINDER_H_
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef ELAWIDGETTOOLS_ELALCDNUMBER_H
|
||||
#define ELAWIDGETTOOLS_ELALCDNUMBER_H
|
||||
|
||||
#include <QLCDNumber>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaLCDNumberPrivate;
|
||||
class ELA_EXPORT ElaLCDNumber : public QLCDNumber
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaLCDNumber)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsUseAutoClock)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, AutoClockFormat)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsTransparent)
|
||||
|
||||
public:
|
||||
explicit ElaLCDNumber(QWidget* parent = nullptr);
|
||||
explicit ElaLCDNumber(uint numDigits, QWidget* parent = nullptr);
|
||||
~ElaLCDNumber() override;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif //ELAWIDGETTOOLS_ELALCDNUMBER_H
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef ELALINEEDIT_H
|
||||
#define ELALINEEDIT_H
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaLineEditPrivate;
|
||||
class ELA_EXPORT ElaLineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaLineEdit)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsClearButtonEnable)
|
||||
public:
|
||||
explicit ElaLineEdit(QWidget* parent = nullptr);
|
||||
~ElaLineEdit() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void focusIn(QString text);
|
||||
Q_SIGNAL void focusOut(QString text);
|
||||
Q_SIGNAL void wmFocusOut(QString text);
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent* event) override;
|
||||
void focusOutEvent(QFocusEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELALINEEDIT_H
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef ELALISTVIEW_H
|
||||
#define ELALISTVIEW_H
|
||||
|
||||
#include <QListView>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaListViewPrivate;
|
||||
class ELA_EXPORT ElaListView : public QListView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaListView)
|
||||
Q_PROPERTY_CREATE_Q_H(int, ItemHeight)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsTransparent)
|
||||
public:
|
||||
explicit ElaListView(QWidget* parent = nullptr);
|
||||
~ElaListView();
|
||||
};
|
||||
|
||||
#endif // ELALISTVIEW_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ELALOG_H
|
||||
#define ELALOG_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSingleton.h"
|
||||
|
||||
class ElaLogPrivate;
|
||||
class ELA_EXPORT ElaLog : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaLog)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, LogSavePath)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, LogFileName)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsLogFileNameWithTime)
|
||||
Q_SINGLETON_CREATE_H(ElaLog);
|
||||
|
||||
private:
|
||||
explicit ElaLog(QObject* parent = nullptr);
|
||||
~ElaLog();
|
||||
|
||||
public:
|
||||
void initMessageLog(bool isEnable);
|
||||
Q_SIGNALS:
|
||||
void logMessage(QString log);
|
||||
};
|
||||
|
||||
#endif // ELALOG_H
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#ifndef ELAMENU_H
|
||||
#define ELAMENU_H
|
||||
|
||||
#include <QMenu>
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
class ElaMenuPrivate;
|
||||
class ELA_EXPORT ElaMenu : public QMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaMenu)
|
||||
|
||||
public:
|
||||
explicit ElaMenu(QWidget* parent = nullptr);
|
||||
explicit ElaMenu(const QString& title, QWidget* parent = nullptr);
|
||||
~ElaMenu();
|
||||
void setMenuItemHeight(int menuItemHeight);
|
||||
int getMenuItemHeight() const;
|
||||
|
||||
QAction* addMenu(QMenu* menu);
|
||||
ElaMenu* addMenu(const QString& title);
|
||||
ElaMenu* addMenu(const QIcon& icon, const QString& title);
|
||||
ElaMenu* addMenu(ElaIconType::IconName icon, const QString& title);
|
||||
|
||||
QAction* addElaIconAction(ElaIconType::IconName icon, const QString& text);
|
||||
QAction* addElaIconAction(ElaIconType::IconName icon, const QString& text, const QKeySequence& shortcut);
|
||||
|
||||
bool isHasChildMenu() const;
|
||||
bool isHasIcon() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void menuShow();
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAMENU_H
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef ELAMENUBAR_H
|
||||
#define ELAMENUBAR_H
|
||||
|
||||
#include <QMenuBar>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaMenu;
|
||||
class ELA_EXPORT ElaMenuBar : public QMenuBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ElaMenuBar(QWidget* parent = nullptr);
|
||||
~ElaMenuBar();
|
||||
|
||||
QAction* addMenu(QMenu* menu);
|
||||
ElaMenu* addMenu(const QString& title);
|
||||
ElaMenu* addMenu(const QIcon& icon, const QString& title);
|
||||
ElaMenu* addMenu(ElaIconType::IconName, const QString& title);
|
||||
|
||||
QAction* addElaIconAction(ElaIconType::IconName icon, const QString& text);
|
||||
QAction* addElaIconAction(ElaIconType::IconName icon, const QString& text, const QKeySequence& shortcut);
|
||||
};
|
||||
|
||||
#endif // ELAMENUBAR_H
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef ELAMESSAGEBAR_H
|
||||
#define ELAMESSAGEBAR_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaMessageBarPrivate;
|
||||
class ELA_EXPORT ElaMessageBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaMessageBar)
|
||||
|
||||
public:
|
||||
static void success(ElaMessageBarType::PositionPolicy policy, QString title, QString text, int displayMsec, QWidget* parent = nullptr);
|
||||
static void warning(ElaMessageBarType::PositionPolicy policy, QString title, QString text, int displayMsec, QWidget* parent = nullptr);
|
||||
static void information(ElaMessageBarType::PositionPolicy policy, QString title, QString text, int displayMsec, QWidget* parent = nullptr);
|
||||
static void error(ElaMessageBarType::PositionPolicy policy, QString title, QString text, int displayMsec, QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
|
||||
private:
|
||||
explicit ElaMessageBar(ElaMessageBarType::PositionPolicy policy, ElaMessageBarType::MessageMode messageMode, QString& title, QString& text, int displayMsec, QWidget* parent = nullptr);
|
||||
~ElaMessageBar() override;
|
||||
};
|
||||
|
||||
#endif // ELAMESSAGEBAR_H
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef ELAMESSAGEBUTTON_H
|
||||
#define ELAMESSAGEBUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
class ElaMessageButtonPrivate;
|
||||
class ELA_EXPORT ElaMessageButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaMessageButton)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, BarTitle);
|
||||
Q_PROPERTY_CREATE_Q_H(QString, BarText);
|
||||
Q_PROPERTY_CREATE_Q_H(int, DisplayMsec);
|
||||
Q_PROPERTY_CREATE_Q_H(QWidget*, MessageTargetWidget)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaMessageBarType::MessageMode, MessageMode);
|
||||
Q_PROPERTY_CREATE_Q_H(ElaMessageBarType::PositionPolicy, PositionPolicy);
|
||||
|
||||
public:
|
||||
explicit ElaMessageButton(QWidget* parent = nullptr);
|
||||
explicit ElaMessageButton(QString text, QWidget* parent = nullptr);
|
||||
~ElaMessageButton();
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAMESSAGEBUTTON_H
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef ELAMULTISELECTCOMBOBOX_H
|
||||
#define ELAMULTISELECTCOMBOBOX_H
|
||||
#include <QComboBox>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaMultiSelectComboBoxPrivate;
|
||||
class ELA_EXPORT ElaMultiSelectComboBox : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaMultiSelectComboBox)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
public:
|
||||
explicit ElaMultiSelectComboBox(QWidget* parent = nullptr);
|
||||
~ElaMultiSelectComboBox();
|
||||
void setCurrentSelection(QString selection);
|
||||
void setCurrentSelection(QStringList selection);
|
||||
void setCurrentSelection(int index);
|
||||
void setCurrentSelection(QList<int> selectionIndex);
|
||||
QStringList getCurrentSelection() const;
|
||||
QList<int> getCurrentSelectionIndex() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void itemSelectionChanged(QVector<bool> itemSelection);
|
||||
Q_SIGNAL void currentTextListChanged(QStringList selectedTextList);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* e) override;
|
||||
void showPopup() override;
|
||||
void hidePopup() override;
|
||||
};
|
||||
|
||||
#endif // ELAMULTISELECTCOMBOBOX_H
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
#ifndef ELANAVIGATIONBAR_H
|
||||
#define ELANAVIGATIONBAR_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSuggestBox.h"
|
||||
class ElaNavigationBarPrivate;
|
||||
class ELA_EXPORT ElaNavigationBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaNavigationBar)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsTransparent)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsAllowPageOpenInNewWindow)
|
||||
Q_PROPERTY_CREATE_Q_H(int, NavigationBarWidth)
|
||||
public:
|
||||
explicit ElaNavigationBar(QWidget* parent = nullptr);
|
||||
~ElaNavigationBar() override;
|
||||
void setUserInfoCardVisible(bool isVisible);
|
||||
void setUserInfoCardPixmap(QPixmap pix);
|
||||
void setUserInfoCardTitle(QString title);
|
||||
void setUserInfoCardSubTitle(QString subTitle);
|
||||
|
||||
ElaNavigationType::NodeResult addExpanderNode(const QString& expanderTitle, QString& expanderKey, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addExpanderNode(const QString& expanderTitle, QString& expanderKey, const QString& targetExpanderKey, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, int keyPoints, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, const QString& targetExpanderKey, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, const QString& targetExpanderKey, int keyPoints, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addFooterNode(const QString& footerTitle, QString& footerKey, int keyPoints = 0, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addFooterNode(const QString& footerTitle, QWidget* page, QString& footerKey, int keyPoints = 0, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addCategoryNode(const QString& categoryTitle, QString& categoryKey);
|
||||
ElaNavigationType::NodeResult addCategoryNode(const QString& categoryTitle, QString& categoryKey, const QString& targetExpanderKey);
|
||||
|
||||
bool getNodeIsExpanded(QString expanderKey) const;
|
||||
void expandNode(QString expanderKey);
|
||||
void collapseNode(QString expanderKey);
|
||||
void removeNode(QString nodeKey);
|
||||
|
||||
void setNodeKeyPoints(QString nodeKey, int keyPoints);
|
||||
int getNodeKeyPoints(QString nodeKey) const;
|
||||
|
||||
void setNodeTitle(QString nodeKey, QString nodeTitle);
|
||||
QString getNodeTitle(QString nodeKey) const;
|
||||
|
||||
void navigation(QString pageKey, bool isLogClicked = true, bool isRouteBack = false);
|
||||
void setDisplayMode(ElaNavigationType::NavigationDisplayMode displayMode, bool isAnimation = true);
|
||||
ElaNavigationType::NavigationDisplayMode getDisplayMode() const;
|
||||
|
||||
int getPageOpenInNewWindowCount(QString nodeKey) const;
|
||||
|
||||
QList<ElaSuggestBox::SuggestData> getSuggestDataList() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void pageOpenInNewWindow(QString nodeKey);
|
||||
Q_SIGNAL void userInfoCardClicked();
|
||||
Q_SIGNAL void navigationNodeClicked(ElaNavigationType::NavigationNodeType nodeType, QString nodeKey, bool isRouteBack);
|
||||
Q_SIGNAL void navigationNodeAdded(ElaNavigationType::NavigationNodeType nodeType, QString nodeKey, QWidget* page);
|
||||
Q_SIGNAL void navigationNodeRemoved(ElaNavigationType::NavigationNodeType nodeType, QString nodeKey);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELANAVIGATIONBAR_H
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef ELAPIVOT_H
|
||||
#define ELAPIVOT_H
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaPivotPrivate;
|
||||
class ELA_EXPORT ElaPivot : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaPivot)
|
||||
Q_PROPERTY_CREATE_Q_H(int, TextPixelSize)
|
||||
Q_PROPERTY_CREATE_Q_H(int, CurrentIndex)
|
||||
Q_PROPERTY_CREATE_Q_H(int, PivotSpacing)
|
||||
Q_PROPERTY_CREATE_Q_H(int, MarkWidth)
|
||||
public:
|
||||
explicit ElaPivot(QWidget* parent = nullptr);
|
||||
~ElaPivot();
|
||||
|
||||
void appendPivot(QString pivotTitle);
|
||||
void removePivot(QString pivotTitle);
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void pivotClicked(int index);
|
||||
Q_SIGNAL void pivotDoubleClicked(int index);
|
||||
};
|
||||
|
||||
#endif // ELAPIVOT_H
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef ELAPLAINTEXTEDIT_H
|
||||
#define ELAPLAINTEXTEDIT_H
|
||||
|
||||
#include <QPlainTextEdit>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaPlainTextEditPrivate;
|
||||
class ELA_EXPORT ElaPlainTextEdit : public QPlainTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaPlainTextEdit)
|
||||
public:
|
||||
explicit ElaPlainTextEdit(QWidget* parent = nullptr);
|
||||
explicit ElaPlainTextEdit(const QString& text, QWidget* parent = nullptr);
|
||||
~ElaPlainTextEdit() override;
|
||||
|
||||
protected:
|
||||
virtual void focusInEvent(QFocusEvent* event) override;
|
||||
virtual void focusOutEvent(QFocusEvent* event) override;
|
||||
virtual void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAPLAINTEXTEDIT_H
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef ELAPOPULARCARD_H
|
||||
#define ELAPOPULARCARD_H
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaPopularCardPrivate;
|
||||
class ELA_EXPORT ElaPopularCard : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaPopularCard)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QPixmap, CardPixmap)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, Title)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, SubTitle)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, InteractiveTips)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, DetailedText)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, CardButtonText)
|
||||
Q_PROPERTY_CREATE_Q_H(QWidget*, CardFloatArea)
|
||||
Q_PROPERTY_CREATE_Q_H(QPixmap, CardFloatPixmap)
|
||||
public:
|
||||
explicit ElaPopularCard(QWidget* parent = nullptr);
|
||||
~ElaPopularCard() override;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void popularCardClicked();
|
||||
Q_SIGNAL void popularCardButtonClicked();
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAPOPULARCARD_H
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef ELAPROGRESSBAR_H
|
||||
#define ELAPROGRESSBAR_H
|
||||
|
||||
#include <QProgressBar>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaProgressBarPrivate;
|
||||
class ELA_EXPORT ElaProgressBar : public QProgressBar
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaProgressBar)
|
||||
public:
|
||||
explicit ElaProgressBar(QWidget* parent = nullptr);
|
||||
~ElaProgressBar() override;
|
||||
void setMinimum(int minimum);
|
||||
void setMaximum(int maximum);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
virtual void resizeEvent(QResizeEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAPROGRESSBAR_H
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELAPROGRESSRING_H_
|
||||
#define ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELAPROGRESSRING_H_
|
||||
|
||||
#include "ElaDef.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class ElaProgressRingPrivate;
|
||||
class ELA_EXPORT ElaProgressRing : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaProgressRing);
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsBusying)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsTransparent)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsDisplayValue)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaProgressRingType::ValueDisplayMode, ValueDisplayMode)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BusyingWidth)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BusyingDurationTime)
|
||||
Q_PROPERTY_CREATE_Q_H(int, Minimum)
|
||||
Q_PROPERTY_CREATE_Q_H(int, Maximum)
|
||||
Q_PROPERTY_CREATE_Q_H(int, Value)
|
||||
Q_PROPERTY_CREATE_Q_H(int, ValuePixelSize)
|
||||
public:
|
||||
explicit ElaProgressRing(QWidget* parent = nullptr);
|
||||
~ElaProgressRing() override;
|
||||
|
||||
void setRange(int min, int max);
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void rangeChanged(int min, int max);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif //ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELAPROGRESSRING_H_
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef ELAPROMOTIONCARD_H
|
||||
#define ELAPROMOTIONCARD_H
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaPromotionCardPrivate;
|
||||
class ELA_EXPORT ElaPromotionCard : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaPromotionCard)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QPixmap, CardPixmap)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, CardTitle)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, PromotionTitle)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, Title)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, SubTitle)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, CardTitleColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, PromotionTitleColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, PromotionTitleBaseColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, TitleColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, SubTitleColor)
|
||||
Q_PROPERTY_CREATE_Q_H(int, CardTitlePixelSize)
|
||||
Q_PROPERTY_CREATE_Q_H(int, PromotionTitlePixelSize)
|
||||
Q_PROPERTY_CREATE_Q_H(int, TitlePixelSize)
|
||||
Q_PROPERTY_CREATE_Q_H(int, SubTitlePixelSize)
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, HorizontalCardPixmapRatio)
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, VerticalCardPixmapRatio)
|
||||
public:
|
||||
explicit ElaPromotionCard(QWidget* parent = nullptr);
|
||||
~ElaPromotionCard();
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void promotionCardClicked();
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAPROMOTIONCARD_H
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef ELAPROMOTIONVIEW_H
|
||||
#define ELAPROMOTIONVIEW_H
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaPromotionCard;
|
||||
class ElaPromotionViewPrivate;
|
||||
class ELA_EXPORT ElaPromotionView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaPromotionView)
|
||||
Q_PROPERTY_CREATE_Q_H(int, CardExpandWidth)
|
||||
Q_PROPERTY_CREATE_Q_H(int, CardCollapseWidth)
|
||||
Q_PROPERTY_CREATE_Q_H(int, CurrentIndex)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsAutoScroll)
|
||||
Q_PROPERTY_CREATE_Q_H(int, AutoScrollInterval)
|
||||
public:
|
||||
explicit ElaPromotionView(QWidget* parent = nullptr);
|
||||
~ElaPromotionView();
|
||||
|
||||
void appendPromotionCard(ElaPromotionCard* card);
|
||||
|
||||
protected:
|
||||
virtual void wheelEvent(QWheelEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAPROMOTIONVIEW_H
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
#ifndef ELAFRAMEWORK_ELAWIDGETTOOLS_ELAPROPERTY_H_
|
||||
#define ELAFRAMEWORK_ELAWIDGETTOOLS_ELAPROPERTY_H_
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#ifdef ELAWIDGETTOOLS_LIBRARY
|
||||
#define ELA_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
#define ELA_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#define Q_PROPERTY_CREATE(TYPE, M) \
|
||||
Q_PROPERTY(TYPE p##M MEMBER _p##M NOTIFY p##M##Changed) \
|
||||
public: \
|
||||
Q_SIGNAL void p##M##Changed(); \
|
||||
void set##M(TYPE M) \
|
||||
{ \
|
||||
_p##M = std::move(M); \
|
||||
Q_EMIT p##M##Changed(); \
|
||||
} \
|
||||
TYPE get##M() const \
|
||||
{ \
|
||||
return _p##M; \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
TYPE _p##M;
|
||||
|
||||
#define Q_PROPERTY_REF_CREATE(TYPE, M) \
|
||||
Q_PROPERTY(TYPE p##M MEMBER _p##M NOTIFY p##M##Changed) \
|
||||
public: \
|
||||
Q_SIGNAL void p##M##Changed(); \
|
||||
void set##M(const TYPE& M) \
|
||||
{ \
|
||||
_p##M = M; \
|
||||
Q_EMIT p##M##Changed(); \
|
||||
} \
|
||||
const TYPE& get##M() const \
|
||||
{ \
|
||||
return _p##M; \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
TYPE _p##M;
|
||||
|
||||
#define Q_PROPERTY_CREATE_Q_H(TYPE, M) \
|
||||
Q_PROPERTY(TYPE p##M READ get##M WRITE set##M NOTIFY p##M##Changed) \
|
||||
public: \
|
||||
Q_SIGNAL void p##M##Changed(); \
|
||||
void set##M(TYPE M); \
|
||||
TYPE get##M() const;
|
||||
|
||||
#define Q_PROPERTY_REF_CREATE_Q_H(TYPE, M) \
|
||||
Q_PROPERTY(TYPE p##M READ get##M WRITE set##M NOTIFY p##M##Changed) \
|
||||
public: \
|
||||
Q_SIGNAL void p##M##Changed(); \
|
||||
void set##M(const TYPE& M); \
|
||||
const TYPE& get##M() const;
|
||||
|
||||
#define Q_PRIVATE_CREATE_Q_H(TYPE, M) \
|
||||
public: \
|
||||
void set##M(TYPE M); \
|
||||
TYPE get##M() const;
|
||||
|
||||
#define Q_PRIVATE_REF_CREATE_Q_H(TYPE, M) \
|
||||
public: \
|
||||
void set##M(const TYPE& M); \
|
||||
const TYPE& get##M() const;
|
||||
|
||||
#define Q_PROPERTY_CREATE_Q_CPP(CLASS, TYPE, M) \
|
||||
void CLASS::set##M(TYPE M) \
|
||||
{ \
|
||||
Q_D(CLASS); \
|
||||
d->_p##M = std::move(M); \
|
||||
Q_EMIT p##M##Changed(); \
|
||||
} \
|
||||
TYPE CLASS::get##M() const \
|
||||
{ \
|
||||
return d_ptr->_p##M; \
|
||||
}
|
||||
|
||||
#define Q_PROPERTY_REF_CREATE_Q_CPP(CLASS, TYPE, M) \
|
||||
void CLASS::set##M(const TYPE& M) \
|
||||
{ \
|
||||
Q_D(CLASS); \
|
||||
d->_p##M = M; \
|
||||
Q_EMIT p##M##Changed(); \
|
||||
} \
|
||||
const TYPE& CLASS::get##M() const \
|
||||
{ \
|
||||
return d_ptr->_p##M; \
|
||||
}
|
||||
|
||||
#define Q_PRIVATE_CREATE_Q_CPP(CLASS, TYPE, M) \
|
||||
void CLASS::set##M(TYPE M) \
|
||||
{ \
|
||||
Q_D(CLASS); \
|
||||
d->_p##M = std::move(M); \
|
||||
} \
|
||||
TYPE CLASS::get##M() const \
|
||||
{ \
|
||||
return d_ptr->_p##M; \
|
||||
}
|
||||
|
||||
#define Q_PRIVATE_REF_CREATE_Q_CPP(CLASS, TYPE, M) \
|
||||
void CLASS::set##M(const TYPE& M) \
|
||||
{ \
|
||||
Q_D(CLASS); \
|
||||
d->_p##M = M; \
|
||||
} \
|
||||
const TYPE& CLASS::get##M() const \
|
||||
{ \
|
||||
return d_ptr->_p##M; \
|
||||
}
|
||||
|
||||
#define Q_PROPERTY_CREATE_D(TYPE, M) \
|
||||
private: \
|
||||
TYPE _p##M;
|
||||
|
||||
#define Q_PRIVATE_CREATE_D(TYPE, M) \
|
||||
private: \
|
||||
TYPE _p##M;
|
||||
|
||||
#define Q_PRIVATE_CREATE(TYPE, M) \
|
||||
public: \
|
||||
void set##M(TYPE M) \
|
||||
{ \
|
||||
_p##M = std::move(M); \
|
||||
} \
|
||||
TYPE get##M() const \
|
||||
{ \
|
||||
return _p##M; \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
TYPE _p##M;
|
||||
|
||||
#define Q_PRIVATE_REF_CREATE(TYPE, M) \
|
||||
public: \
|
||||
void set##M(const TYPE& M) \
|
||||
{ \
|
||||
_p##M = M; \
|
||||
} \
|
||||
const TYPE& get##M() const \
|
||||
{ \
|
||||
return _p##M; \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
TYPE _p##M;
|
||||
|
||||
#define Q_Q_CREATE(CLASS) \
|
||||
protected: \
|
||||
explicit CLASS(CLASS##Private& dd, CLASS* parent = nullptr); \
|
||||
QScopedPointer<CLASS##Private> d_ptr; \
|
||||
\
|
||||
private: \
|
||||
Q_DISABLE_COPY(CLASS) \
|
||||
Q_DECLARE_PRIVATE(CLASS);
|
||||
|
||||
#define Q_D_CREATE(CLASS) \
|
||||
protected: \
|
||||
CLASS* q_ptr; \
|
||||
\
|
||||
private: \
|
||||
Q_DECLARE_PUBLIC(CLASS);
|
||||
|
||||
#endif // ELAFRAMEWORK_ELAWIDGETTOOLS_ELAPROPERTY_H_
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef ELAPUSHBUTTON_H
|
||||
#define ELAPUSHBUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaPushButtonPrivate;
|
||||
class ELA_EXPORT ElaPushButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaPushButton)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, LightDefaultColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, DarkDefaultColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, LightHoverColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, DarkHoverColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, LightPressColor)
|
||||
Q_PROPERTY_CREATE_Q_H(QColor, DarkPressColor)
|
||||
public:
|
||||
explicit ElaPushButton(QWidget* parent = nullptr);
|
||||
explicit ElaPushButton(QString text, QWidget* parent = nullptr);
|
||||
~ElaPushButton();
|
||||
|
||||
void setLightTextColor(QColor color);
|
||||
QColor getLightTextColor() const;
|
||||
|
||||
void setDarkTextColor(QColor color);
|
||||
QColor getDarkTextColor() const;
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAPUSHBUTTON_H
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef ELARADIOBUTTON_H
|
||||
#define ELARADIOBUTTON_H
|
||||
|
||||
#include <QRadioButton>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaRadioButtonPrivate;
|
||||
class ELA_EXPORT ElaRadioButton : public QRadioButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaRadioButton)
|
||||
public:
|
||||
explicit ElaRadioButton(QWidget* parent = nullptr);
|
||||
explicit ElaRadioButton(const QString& text, QWidget* parent = nullptr);
|
||||
~ElaRadioButton() override;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELARADIOBUTTON_H
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef ELAREMINDERCARD_H
|
||||
#define ELAREMINDERCARD_H
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "ElaDef.h"
|
||||
class ElaReminderCardPrivate;
|
||||
class ELA_EXPORT ElaReminderCard : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaReminderCard)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, Title);
|
||||
Q_PROPERTY_CREATE_Q_H(QString, SubTitle);
|
||||
Q_PROPERTY_CREATE_Q_H(int, TitlePixelSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, SubTitlePixelSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, TitleSpacing);
|
||||
Q_PROPERTY_CREATE_Q_H(QPixmap, CardPixmap);
|
||||
Q_PROPERTY_CREATE_Q_H(QSize, CardPixmapSize);
|
||||
Q_PROPERTY_CREATE_Q_H(int, CardPixmapBorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaCardPixType::PixMode, CardPixMode);
|
||||
|
||||
public:
|
||||
explicit ElaReminderCard(QWidget* parent = nullptr);
|
||||
~ElaReminderCard();
|
||||
void setCardPixmapSize(int width, int height);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAREMINDERCARD_H
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELAROLLER_H_
|
||||
#define ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELAROLLER_H_
|
||||
|
||||
#include "ElaProperty.h"
|
||||
#include <QWidget>
|
||||
|
||||
class ElaRollerPrivate;
|
||||
class ELA_EXPORT ElaRoller : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaRoller)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QStringList, ItemList)
|
||||
Q_PROPERTY_CREATE_Q_H(int, ItemHeight)
|
||||
Q_PROPERTY_CREATE_Q_H(int, MaxVisibleItems)
|
||||
Q_PROPERTY_CREATE_Q_H(int, CurrentIndex)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsContainer)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsEnableLoop)
|
||||
public:
|
||||
explicit ElaRoller(QWidget* parent = nullptr);
|
||||
~ElaRoller() override;
|
||||
|
||||
void setCurrentData(const QString& data);
|
||||
QString getCurrentData() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void currentDataChanged(const QString& data);
|
||||
|
||||
protected:
|
||||
virtual void wheelEvent(QWheelEvent* event) override;
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent* event);
|
||||
virtual void leaveEvent(QEvent* event);
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif //ELAFRAMEWORK_ELAWIDGETTOOLS_INCLUDE_ELAROLLER_H_
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef ELAFRAMEWORK_ELAROLLERPICKER_H
|
||||
#define ELAFRAMEWORK_ELAROLLERPICKER_H
|
||||
|
||||
#include "ElaProperty.h"
|
||||
#include <QPushButton>
|
||||
|
||||
class ElaRollerPickerPrivate;
|
||||
class ELA_EXPORT ElaRollerPicker : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaRollerPicker)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
public:
|
||||
explicit ElaRollerPicker(QWidget* parent = nullptr);
|
||||
~ElaRollerPicker() override;
|
||||
|
||||
void addRoller(const QStringList& itemList, bool isEnableLoop = true);
|
||||
void removeRoller(int index);
|
||||
|
||||
void setRollerItemList(int index, const QStringList& itemList);
|
||||
void setRollerWidth(int index, int width);
|
||||
|
||||
void setCurrentData(int index, const QString& data);
|
||||
void setCurrentData(const QStringList& dataList);
|
||||
QString getCurrentData(int index) const;
|
||||
QStringList getCurrentData() const;
|
||||
|
||||
void setCurrentIndex(int rollerIndex, int index);
|
||||
void setCurrentIndex(const QList<int>& indexList);
|
||||
int getCurrentIndex(int rollerIndex) const;
|
||||
QList<int> getCurrentIndex() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void currentDataChanged(const QStringList& dataList);
|
||||
Q_SIGNAL void currentDataSelectionChanged(const QStringList& dataList);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif //ELAFRAMEWORK_ELAROLLERPICKER_H
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef ELASCROLLAREA_H
|
||||
#define ELASCROLLAREA_H
|
||||
|
||||
#include <QScrollArea>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaScrollAreaPrivate;
|
||||
class ELA_EXPORT ElaScrollArea : public QScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaScrollArea)
|
||||
public:
|
||||
explicit ElaScrollArea(QWidget* parent = nullptr);
|
||||
~ElaScrollArea();
|
||||
|
||||
void setIsGrabGesture(bool isEnable, qreal mousePressEventDelay = 0.5);
|
||||
|
||||
void setIsOverShoot(Qt::Orientation orientation, bool isEnable);
|
||||
bool getIsOverShoot(Qt::Orientation orientation) const;
|
||||
|
||||
void setIsAnimation(Qt::Orientation orientation, bool isAnimation);
|
||||
bool getIsAnimation(Qt::Orientation orientation) const;
|
||||
};
|
||||
|
||||
#endif // ELASCROLLAREA_H
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef ELASCROLLBAR_H
|
||||
#define ELASCROLLBAR_H
|
||||
|
||||
#include <QAbstractScrollArea>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaScrollBarPrivate;
|
||||
class ELA_EXPORT ElaScrollBar : public QScrollBar
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaScrollBar)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsAnimation)
|
||||
Q_PROPERTY_CREATE_Q_H(qreal, SpeedLimit)
|
||||
public:
|
||||
explicit ElaScrollBar(QWidget* parent = nullptr);
|
||||
explicit ElaScrollBar(Qt::Orientation orientation, QWidget* parent = nullptr);
|
||||
explicit ElaScrollBar(QScrollBar* originScrollBar, QAbstractScrollArea* parent = nullptr);
|
||||
~ElaScrollBar() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void rangeAnimationFinished();
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event) override;
|
||||
virtual bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent* event) override;
|
||||
virtual void wheelEvent(QWheelEvent* event) override;
|
||||
virtual void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELASCROLLBAR_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ELASCROLLPAGE_H
|
||||
#define ELASCROLLPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaScrollArea;
|
||||
class ElaText;
|
||||
class QHBoxLayout;
|
||||
class ElaScrollPagePrivate;
|
||||
class ELA_EXPORT ElaScrollPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaScrollPage)
|
||||
Q_PROPERTY_CREATE_Q_H(QWidget*, CustomWidget)
|
||||
public:
|
||||
explicit ElaScrollPage(QWidget* parent = nullptr);
|
||||
~ElaScrollPage() override;
|
||||
|
||||
void addCentralWidget(QWidget* centralWidget, bool isWidgetResizeable = true, bool isVerticalGrabGesture = true, qreal mousePressEventDelay = 0.5);
|
||||
|
||||
void navigation(int widgetIndex, bool isLogRoute = true);
|
||||
|
||||
void setPageTitleSpacing(int spacing);
|
||||
int getPageTitleSpacing() const;
|
||||
void setTitleVisible(bool isVisible);
|
||||
};
|
||||
|
||||
#endif // ELASCROLLPAGE_H
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef ELASCROLLPAGEAREA_H
|
||||
#define ELASCROLLPAGEAREA_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaScrollPageAreaPrivate;
|
||||
class ELA_EXPORT ElaScrollPageArea : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaScrollPageArea)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
public:
|
||||
explicit ElaScrollPageArea(QWidget* parent = nullptr);
|
||||
~ElaScrollPageArea() override;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELASCROLLPAGEAREA_H
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
#ifndef ELASINGLETON_H
|
||||
#define ELASINGLETON_H
|
||||
|
||||
#include <QMutex>
|
||||
|
||||
#ifndef Q_SINGLETON_CREATE_H
|
||||
template <typename T>
|
||||
class Singleton
|
||||
{
|
||||
public:
|
||||
static T* getInstance();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(Singleton)
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
T* Singleton<T>::getInstance()
|
||||
{
|
||||
static QMutex mutex;
|
||||
QMutexLocker locker(&mutex);
|
||||
static T* instance = nullptr;
|
||||
if (instance == nullptr)
|
||||
{
|
||||
instance = new T();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
#define Q_SINGLETON_CREATE(Class) \
|
||||
private: \
|
||||
friend class Singleton<Class>; \
|
||||
\
|
||||
public: \
|
||||
static Class* getInstance() \
|
||||
{ \
|
||||
return Singleton<Class>::getInstance(); \
|
||||
}
|
||||
|
||||
#define Q_SINGLETON_CREATE_H(Class) \
|
||||
private: \
|
||||
static Class* _instance; \
|
||||
\
|
||||
public: \
|
||||
static Class* getInstance();
|
||||
|
||||
#define Q_SINGLETON_CREATE_CPP(Class) \
|
||||
Class* Class::_instance = nullptr; \
|
||||
Class* Class::getInstance() \
|
||||
{ \
|
||||
static QMutex mutex; \
|
||||
QMutexLocker locker(&mutex); \
|
||||
if (_instance == nullptr) \
|
||||
{ \
|
||||
_instance = new Class(); \
|
||||
} \
|
||||
return _instance; \
|
||||
}
|
||||
#endif
|
||||
#endif // ELASINGLETON_H
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef ELASLIDER_H
|
||||
#define ELASLIDER_H
|
||||
|
||||
#include <QSlider>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ELA_EXPORT ElaSlider : public QSlider
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ElaSlider(QWidget* parent = nullptr);
|
||||
explicit ElaSlider(Qt::Orientation orientation, QWidget* parent = nullptr);
|
||||
~ElaSlider();
|
||||
};
|
||||
|
||||
#endif // ELASLIDER_H
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef ELASPINBOX_H
|
||||
#define ELASPINBOX_H
|
||||
|
||||
#include <QSpinBox>
|
||||
|
||||
#include "ElaDef.h"
|
||||
|
||||
class ElaSpinBoxPrivate;
|
||||
class ELA_EXPORT ElaSpinBox : public QSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaSpinBox)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaSpinBoxType::ButtonMode, ButtonMode)
|
||||
public:
|
||||
explicit ElaSpinBox(QWidget* parent = nullptr);
|
||||
~ElaSpinBox() override;
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent* event) override;
|
||||
void focusOutEvent(QFocusEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELASPINBOX_H
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef ELASTATUSBAR_H
|
||||
#define ELASTATUSBAR_H
|
||||
|
||||
#include <QStatusBar>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ELA_EXPORT ElaStatusBar : public QStatusBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ElaStatusBar(QWidget* parent = nullptr);
|
||||
~ElaStatusBar() override;
|
||||
};
|
||||
|
||||
#endif // ELASTATUSBAR_H
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
#ifndef ELASUGGESTBOX_H
|
||||
#define ELASUGGESTBOX_H
|
||||
|
||||
#include <QVariantMap>
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaSuggestBoxPrivate;
|
||||
class ELA_EXPORT ElaSuggestBox : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaSuggestBox)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(Qt::CaseSensitivity, CaseSensitivity)
|
||||
public:
|
||||
explicit ElaSuggestBox(QWidget* parent = nullptr);
|
||||
~ElaSuggestBox() override;
|
||||
void setPlaceholderText(const QString& placeholderText);
|
||||
void setFixedSize(const QSize& size);
|
||||
void setFixedSize(int w, int h);
|
||||
void setFixedHeight(int h);
|
||||
|
||||
struct ELA_EXPORT SuggestData {
|
||||
Q_PRIVATE_CREATE(ElaIconType::IconName, ElaIcon)
|
||||
Q_PRIVATE_CREATE(QString, SuggestText)
|
||||
Q_PRIVATE_CREATE(QString, SuggestKey)
|
||||
Q_PRIVATE_CREATE(QVariantMap, SuggestData)
|
||||
public:
|
||||
explicit SuggestData();
|
||||
explicit SuggestData(ElaIconType::IconName icon, const QString& suggestText, const QVariantMap& suggestData = {});
|
||||
~SuggestData();
|
||||
};
|
||||
QString addSuggestion(const QString& suggestText, const QVariantMap& suggestData = {});
|
||||
QString addSuggestion(ElaIconType::IconName icon, const QString& suggestText, const QVariantMap& suggestData = {});
|
||||
QString addSuggestion(const ElaSuggestBox::SuggestData& suggestData);
|
||||
QStringList addSuggestion(const QList<ElaSuggestBox::SuggestData>& suggestDataList);
|
||||
|
||||
void removeSuggestion(const QString& suggestKey);
|
||||
void removeSuggestion(int index);
|
||||
void clearSuggestion();
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void suggestionClicked(const ElaSuggestBox::SuggestData& suggestData);
|
||||
};
|
||||
|
||||
#endif // ELASUGGESTBOX_H
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef ELATABBAR_H
|
||||
#define ELATABBAR_H
|
||||
|
||||
#include <QDrag>
|
||||
#include <QTabBar>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaTabBarPrivate;
|
||||
class ELA_EXPORT ElaTabBar : public QTabBar
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaTabBar)
|
||||
Q_PROPERTY_CREATE_Q_H(QSize, TabSize)
|
||||
public:
|
||||
explicit ElaTabBar(QWidget* parent = nullptr);
|
||||
~ElaTabBar() override;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void tabDragCreate(QMimeData* mimeData);
|
||||
Q_SIGNAL void tabDragEnter(QMimeData* mimeData);
|
||||
Q_SIGNAL void tabDragLeave(QMimeData* mimeData);
|
||||
Q_SIGNAL void tabDragDrop(QMimeData* mimeData);
|
||||
|
||||
protected:
|
||||
QSize sizeHint() const;
|
||||
virtual void mouseMoveEvent(QMouseEvent* event) override;
|
||||
virtual void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
virtual void dragMoveEvent(QDragMoveEvent* event) override;
|
||||
virtual void dragLeaveEvent(QDragLeaveEvent* event) override;
|
||||
virtual void dropEvent(QDropEvent* event) override;
|
||||
virtual void wheelEvent(QWheelEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELATABBAR_H
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef ELATABWIDGET_H
|
||||
#define ELATABWIDGET_H
|
||||
|
||||
#include <QTabWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaTabWidgetPrivate;
|
||||
class ELA_EXPORT ElaTabWidget : public QTabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaTabWidget)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsTabTransparent);
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsContainerAcceptDrops);
|
||||
Q_PROPERTY_CREATE_Q_H(QSize, TabSize)
|
||||
public:
|
||||
explicit ElaTabWidget(QWidget* parent = nullptr);
|
||||
~ElaTabWidget() override;
|
||||
void setTabPosition(TabPosition position);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
virtual void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
virtual void dropEvent(QDropEvent* event) override;
|
||||
virtual void tabInserted(int index);
|
||||
|
||||
private:
|
||||
friend class ElaCustomTabWidget;
|
||||
};
|
||||
|
||||
#endif // ELATABWIDGET_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ELATABLEVIEW_H
|
||||
#define ELATABLEVIEW_H
|
||||
|
||||
#include <QTableView>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaTableViewPrivate;
|
||||
class ELA_EXPORT ElaTableView : public QTableView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaTableView)
|
||||
Q_PROPERTY_CREATE_Q_H(int, HeaderMargin)
|
||||
public:
|
||||
explicit ElaTableView(QWidget* parent = nullptr);
|
||||
~ElaTableView();
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void tableViewShow();
|
||||
Q_SIGNAL void tableViewHide();
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent* event) override;
|
||||
virtual void hideEvent(QHideEvent* event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent* event) override;
|
||||
virtual void leaveEvent(QEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELATABLEVIEW_H
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef ELATEXT_H
|
||||
#define ELATEXT_H
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
class ElaTextPrivate;
|
||||
class ELA_EXPORT ElaText : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaText)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsWrapAnywhere)
|
||||
Q_PROPERTY_CREATE_Q_H(int, TextPixelSize)
|
||||
Q_PROPERTY_CREATE_Q_H(int, TextPointSize)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaTextType::TextStyle, TextStyle)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaIconType::IconName, ElaIcon)
|
||||
public:
|
||||
explicit ElaText(QWidget* parent = nullptr);
|
||||
explicit ElaText(QString text, QWidget* parent = nullptr);
|
||||
explicit ElaText(QString text, int pixelSize, QWidget* parent = nullptr);
|
||||
~ElaText() override;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELATEXT_H
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef ELATHEME_H
|
||||
#define ELATHEME_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSingleton.h"
|
||||
|
||||
#define eTheme ElaTheme::getInstance()
|
||||
#define ElaThemeColor(themeMode, themeColor) eTheme->getThemeColor(themeMode, ElaThemeType::themeColor)
|
||||
class QPainter;
|
||||
class ElaThemePrivate;
|
||||
class ELA_EXPORT ElaTheme : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaTheme)
|
||||
Q_SINGLETON_CREATE_H(ElaTheme)
|
||||
private:
|
||||
explicit ElaTheme(QObject* parent = nullptr);
|
||||
~ElaTheme();
|
||||
|
||||
public:
|
||||
void setThemeMode(ElaThemeType::ThemeMode themeMode);
|
||||
ElaThemeType::ThemeMode getThemeMode() const;
|
||||
|
||||
void drawEffectShadow(QPainter* painter, QRect widgetRect, int shadowBorderWidth, int borderRadius);
|
||||
|
||||
void setThemeColor(ElaThemeType::ThemeMode themeMode, ElaThemeType::ThemeColor themeColor, QColor newColor);
|
||||
const QColor& getThemeColor(ElaThemeType::ThemeMode themeMode, ElaThemeType::ThemeColor themeColor);
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void themeModeChanged(ElaThemeType::ThemeMode themeMode);
|
||||
};
|
||||
|
||||
#endif // ELATHEME_H
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef ELATOGGLEBUTTON_H
|
||||
#define ELATOGGLEBUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaToggleButtonPrivate;
|
||||
class ELA_EXPORT ElaToggleButton : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaToggleButton)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, Text)
|
||||
public:
|
||||
explicit ElaToggleButton(QWidget* parent = nullptr);
|
||||
explicit ElaToggleButton(QString text, QWidget* parent = nullptr);
|
||||
~ElaToggleButton();
|
||||
|
||||
void setIsToggled(bool isToggled);
|
||||
bool getIsToggled() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void toggled(bool checked);
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event) override;
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELATOGGLEBUTTON_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ELATOGGLESWITCH_H
|
||||
#define ELATOGGLESWITCH_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaToggleSwitchPrivate;
|
||||
class ELA_EXPORT ElaToggleSwitch : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaToggleSwitch);
|
||||
|
||||
public:
|
||||
explicit ElaToggleSwitch(QWidget* parent = nullptr);
|
||||
~ElaToggleSwitch() override;
|
||||
void setIsToggled(bool isToggled);
|
||||
bool getIsToggled() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void toggled(bool checked);
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event) override;
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELATOGGLESWITCH_H
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef ELATOOLBAR_H
|
||||
#define ELATOOLBAR_H
|
||||
|
||||
#include <QToolBar>
|
||||
|
||||
#include "ElaDef.h"
|
||||
class ElaToolBarPrivate;
|
||||
class ELA_EXPORT ElaToolBar : public QToolBar
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaToolBar)
|
||||
public:
|
||||
explicit ElaToolBar(QWidget* parent = nullptr);
|
||||
explicit ElaToolBar(const QString& title, QWidget* parent = nullptr);
|
||||
~ElaToolBar() override;
|
||||
|
||||
void setToolBarSpacing(int spacing);
|
||||
int getToolBarSpacing() const;
|
||||
|
||||
void setToolButtonSize(const QSize& size);
|
||||
const QSize& getToolButtonSize() const;
|
||||
|
||||
QAction* addElaIconAction(ElaIconType::IconName icon, const QString& text);
|
||||
QAction* addElaIconAction(ElaIconType::IconName icon, const QString& text, const QKeySequence& shortcut);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELATOOLBAR_H
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef ELATOOLBUTTON_H
|
||||
#define ELATOOLBUTTON_H
|
||||
|
||||
#include <QToolButton>
|
||||
|
||||
#include "ElaDef.h"
|
||||
class ElaMenu;
|
||||
class ElaToolButtonPrivate;
|
||||
class ELA_EXPORT ElaToolButton : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaToolButton)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius);
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsSelected);
|
||||
|
||||
public:
|
||||
explicit ElaToolButton(QWidget* parent = nullptr);
|
||||
~ElaToolButton() override;
|
||||
|
||||
void setIsTransparent(bool isTransparent);
|
||||
bool getIsTransparent() const;
|
||||
|
||||
void setMenu(ElaMenu* menu);
|
||||
void setElaIcon(ElaIconType::IconName icon);
|
||||
void setElaIcon(ElaIconType::IconName icon, int rotate);
|
||||
|
||||
protected:
|
||||
virtual bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELATOOLBUTTON_H
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef ELATOOLTIP_H
|
||||
#define ELATOOLTIP_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
class ElaToolTipPrivate;
|
||||
class ELA_EXPORT ElaToolTip : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaToolTip)
|
||||
Q_PROPERTY_CREATE_Q_H(int, BorderRadius)
|
||||
Q_PROPERTY_CREATE_Q_H(int, DisplayMsec)
|
||||
Q_PROPERTY_CREATE_Q_H(int, ShowDelayMsec)
|
||||
Q_PROPERTY_CREATE_Q_H(int, HideDelayMsec)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, ToolTip)
|
||||
Q_PROPERTY_CREATE_Q_H(QWidget*, CustomWidget)
|
||||
public:
|
||||
explicit ElaToolTip(QWidget* parent = nullptr);
|
||||
~ElaToolTip() override;
|
||||
|
||||
void updatePos();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
};
|
||||
|
||||
#endif // ELATOOLTIP_H
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef ELATREEVIEW_H
|
||||
#define ELATREEVIEW_H
|
||||
|
||||
#include <QTreeView>
|
||||
|
||||
#include "ElaProperty.h"
|
||||
|
||||
class ElaTreeViewPrivate;
|
||||
class ELA_EXPORT ElaTreeView : public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaTreeView)
|
||||
Q_PROPERTY_CREATE_Q_H(int, ItemHeight)
|
||||
Q_PROPERTY_CREATE_Q_H(int, HeaderMargin)
|
||||
public:
|
||||
explicit ElaTreeView(QWidget* parent = nullptr);
|
||||
~ElaTreeView();
|
||||
};
|
||||
|
||||
#endif // ELATREEVIEW_H
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef ELAWIDGET_H
|
||||
#define ELAWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "ElaAppBar.h"
|
||||
#include "ElaDef.h"
|
||||
class ElaWidgetPrivate;
|
||||
class ELA_EXPORT ElaWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaWidget)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsStayTop)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsFixedSize)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsDefaultClosed)
|
||||
Q_PROPERTY_CREATE_Q_H(int, AppBarHeight)
|
||||
Q_TAKEOVER_NATIVEEVENT_H
|
||||
public:
|
||||
explicit ElaWidget(QWidget* parent = nullptr);
|
||||
~ElaWidget() override;
|
||||
void moveToCenter();
|
||||
|
||||
void setWindowButtonFlag(ElaAppBarType::ButtonType buttonFlag, bool isEnable = true);
|
||||
void setWindowButtonFlags(ElaAppBarType::ButtonFlags buttonFlags);
|
||||
ElaAppBarType::ButtonFlags getWindowButtonFlags() const;
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void routeBackButtonClicked();
|
||||
Q_SIGNAL void navigationButtonClicked();
|
||||
Q_SIGNAL void themeChangeButtonClicked();
|
||||
Q_SIGNAL void closeButtonClicked();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // ELAWIDGET_H
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
#ifndef ELAWINDOW_H
|
||||
#define ELAWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "ElaAppBar.h"
|
||||
#include "ElaDef.h"
|
||||
#include "ElaSuggestBox.h"
|
||||
class ElaWindowPrivate;
|
||||
class ELA_EXPORT ElaWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaWindow)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsStayTop)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsFixedSize)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsDefaultClosed)
|
||||
Q_PROPERTY_CREATE_Q_H(int, AppBarHeight)
|
||||
Q_PROPERTY_CREATE_Q_H(int, ThemeChangeTime)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsCentralStackedWidgetTransparent)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsAllowPageOpenInNewWindow)
|
||||
Q_PROPERTY_CREATE_Q_H(bool, IsNavigationBarEnable)
|
||||
Q_PROPERTY_CREATE_Q_H(int, NavigationBarWidth)
|
||||
Q_PROPERTY_CREATE_Q_H(int, CurrentStackIndex)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaNavigationType::NavigationDisplayMode, NavigationBarDisplayMode)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaWindowType::StackSwitchMode, StackSwitchMode)
|
||||
Q_PROPERTY_CREATE_Q_H(ElaWindowType::PaintMode, WindowPaintMode)
|
||||
Q_TAKEOVER_NATIVEEVENT_H
|
||||
public:
|
||||
Q_INVOKABLE explicit ElaWindow(QWidget* parent = nullptr);
|
||||
~ElaWindow() override;
|
||||
|
||||
void moveToCenter();
|
||||
|
||||
void setCustomWidget(ElaAppBarType::CustomArea customArea, QWidget* customWidget, QObject* hitTestObject = nullptr, const QString& hitTestFunctionName = "");
|
||||
QWidget* getCustomWidget(ElaAppBarType::CustomArea customArea) const;
|
||||
|
||||
void setCentralCustomWidget(QWidget* customWidget);
|
||||
QWidget* getCentralCustomWidget() const;
|
||||
|
||||
void setCustomMenu(QMenu* customMenu);
|
||||
QMenu* getCustomMenu() const;
|
||||
|
||||
void setUserInfoCardVisible(bool isVisible);
|
||||
void setUserInfoCardPixmap(QPixmap pix);
|
||||
void setUserInfoCardTitle(QString title);
|
||||
void setUserInfoCardSubTitle(QString subTitle);
|
||||
ElaNavigationType::NodeResult addExpanderNode(const QString& expanderTitle, QString& expanderKey, ElaIconType::IconName awesome = ElaIconType::None) const;
|
||||
ElaNavigationType::NodeResult addExpanderNode(const QString& expanderTitle, QString& expanderKey, const QString& targetExpanderKey, ElaIconType::IconName awesome = ElaIconType::None) const;
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, int keyPoints, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, const QString& targetExpanderKey, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addPageNode(const QString& pageTitle, QWidget* page, const QString& targetExpanderKey, int keyPoints, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addFooterNode(const QString& footerTitle, QString& footerKey, int keyPoints = 0, ElaIconType::IconName awesome = ElaIconType::None) const;
|
||||
ElaNavigationType::NodeResult addFooterNode(const QString& footerTitle, QWidget* page, QString& footerKey, int keyPoints = 0, ElaIconType::IconName awesome = ElaIconType::None);
|
||||
ElaNavigationType::NodeResult addCategoryNode(const QString& categoryTitle, QString& categoryKey);
|
||||
ElaNavigationType::NodeResult addCategoryNode(const QString& categoryTitle, QString& categoryKey, const QString& targetExpanderKey);
|
||||
|
||||
void addCentralWidget(QWidget* centralWidget);
|
||||
QWidget* getCentralWidget(int index) const;
|
||||
|
||||
bool getNavigationNodeIsExpanded(QString expanderKey) const;
|
||||
void expandNavigationNode(QString expanderKey);
|
||||
void collapseNavigationNode(QString expanderKey);
|
||||
void removeNavigationNode(QString nodeKey) const;
|
||||
int getPageOpenInNewWindowCount(QString nodeKey) const;
|
||||
void backtrackNavigationNode(QString nodeKey);
|
||||
|
||||
void setNodeKeyPoints(QString nodeKey, int keyPoints);
|
||||
int getNodeKeyPoints(QString nodeKey) const;
|
||||
|
||||
void setNavigationNodeTitle(QString nodeKey, QString nodeTitle);
|
||||
QString getNavigationNodeTitle(QString nodeKey) const;
|
||||
|
||||
void navigation(QString pageKey);
|
||||
int getCurrentNavigationIndex() const;
|
||||
QString getCurrentNavigationPageKey() const;
|
||||
|
||||
QList<ElaSuggestBox::SuggestData> getNavigationSuggestDataList() const;
|
||||
|
||||
void setWindowButtonFlag(ElaAppBarType::ButtonType buttonFlag, bool isEnable = true);
|
||||
void setWindowButtonFlags(ElaAppBarType::ButtonFlags buttonFlags);
|
||||
ElaAppBarType::ButtonFlags getWindowButtonFlags() const;
|
||||
|
||||
void setWindowMoviePath(ElaThemeType::ThemeMode themeMode, const QString& moviePath);
|
||||
QString getWindowMoviePath(ElaThemeType::ThemeMode themeMode) const;
|
||||
|
||||
void setWindowPixmap(ElaThemeType::ThemeMode themeMode, const QPixmap& pixmap);
|
||||
QPixmap getWindowPixmap(ElaThemeType::ThemeMode themeMode) const;
|
||||
|
||||
void setWindowMovieRate(qreal rate);
|
||||
qreal getWindowMovieRate() const;
|
||||
|
||||
void tabifyDockWidget(QDockWidget* targetDockWidget, QDockWidget* dockWidget);
|
||||
void tabifyDockWidget(Qt::DockWidgetArea area, const QString& targetDockTitle, QDockWidget* dockWidget);
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_SIGNAL void userInfoCardClicked();
|
||||
Q_SIGNAL void closeButtonClicked();
|
||||
Q_SIGNAL void navigationNodeClicked(ElaNavigationType::NavigationNodeType nodeType, QString nodeKey);
|
||||
Q_SIGNAL void customWidgetChanged();
|
||||
Q_SIGNAL void centralCustomWidgetChanged();
|
||||
Q_SIGNAL void customMenuChanged();
|
||||
Q_SIGNAL void pageOpenInNewWindow(QString nodeKey);
|
||||
|
||||
protected:
|
||||
virtual bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
virtual QMenu* createPopupMenu() override;
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
|
||||
private:
|
||||
QWidget* centralWidget() const;
|
||||
void setCentralWidget(QWidget* widget);
|
||||
};
|
||||
|
||||
#endif // ELAWINDOW_H
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
|
||||
####### Any changes to this file will be overwritten by the next CMake run ####
|
||||
####### The input file was ElaWidgetToolsConfig.cmake.in ########
|
||||
|
||||
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../" ABSOLUTE)
|
||||
|
||||
macro(set_and_check _var _file)
|
||||
set(${_var} "${_file}")
|
||||
if(NOT EXISTS "${_file}")
|
||||
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(check_required_components _NAME)
|
||||
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
||||
if(NOT ${_NAME}_${comp}_FOUND)
|
||||
if(${_NAME}_FIND_REQUIRED_${comp})
|
||||
set(${_NAME}_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
####################################################################################
|
||||
|
||||
set( ElaWidgetTools_LIBRARIES ElaWidgetTools)
|
||||
set( ElaWidgetTools_INCLUDE_DIRS ${PACKAGE_PREFIX_DIR}/include)
|
||||
set( ElaWidgetTools_LIBRARY_DIRS ${PACKAGE_PREFIX_DIR}/lib)
|
||||
|
||||
check_required_components(${PROJECT_NAME})
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
include(${PACKAGE_PREFIX_DIR}/lib/cmake/ElaWidgetToolsTargets.cmake)
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
# This is a basic version file for the Config-mode of find_package().
|
||||
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||
# to create a version-file which can be installed along a config.cmake file.
|
||||
#
|
||||
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||
# the requested version string are exactly the same and it sets
|
||||
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
|
||||
# but only if the requested major version is the same as the current one.
|
||||
# The variable CVF_VERSION must be set before calling configure_file().
|
||||
|
||||
|
||||
set(PACKAGE_VERSION "2.0.0")
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
||||
if("2.0.0" MATCHES "^([0-9]+)\\.")
|
||||
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
|
||||
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
|
||||
endif()
|
||||
else()
|
||||
set(CVF_VERSION_MAJOR "2.0.0")
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# both endpoints of the range must have the expected major version
|
||||
math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1")
|
||||
if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
else()
|
||||
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# if the installed project requested no architecture check, don't perform the check
|
||||
if("FALSE")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
|
||||
math(EXPR installedBits "8 * 8")
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file for configuration "Debug".
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Import target "ElaWidgetTools" for configuration "Debug"
|
||||
set_property(TARGET ElaWidgetTools APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(ElaWidgetTools PROPERTIES
|
||||
IMPORTED_IMPLIB_DEBUG "${_IMPORT_PREFIX}/ElaWidgetTools/lib/libElaWidgetTools.dll.a"
|
||||
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/ElaWidgetTools/bin/ElaWidgetTools.dll"
|
||||
)
|
||||
|
||||
list(APPEND _cmake_import_check_targets ElaWidgetTools )
|
||||
list(APPEND _cmake_import_check_files_for_ElaWidgetTools "${_IMPORT_PREFIX}/ElaWidgetTools/lib/libElaWidgetTools.dll.a" "${_IMPORT_PREFIX}/ElaWidgetTools/bin/ElaWidgetTools.dll" )
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
# Generated by CMake
|
||||
|
||||
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
|
||||
message(FATAL_ERROR "CMake >= 2.8.0 required")
|
||||
endif()
|
||||
if(CMAKE_VERSION VERSION_LESS "2.8.3")
|
||||
message(FATAL_ERROR "CMake >= 2.8.3 required")
|
||||
endif()
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(VERSION 2.8.3...3.22)
|
||||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file.
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
|
||||
set(_cmake_targets_defined "")
|
||||
set(_cmake_targets_not_defined "")
|
||||
set(_cmake_expected_targets "")
|
||||
foreach(_cmake_expected_target IN ITEMS ElaWidgetTools)
|
||||
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
|
||||
if(TARGET "${_cmake_expected_target}")
|
||||
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
|
||||
else()
|
||||
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_cmake_expected_target)
|
||||
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
unset(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
return()
|
||||
endif()
|
||||
if(NOT _cmake_targets_defined STREQUAL "")
|
||||
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
|
||||
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
|
||||
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
|
||||
endif()
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
|
||||
|
||||
# Compute the installation prefix relative to this file.
|
||||
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
if(_IMPORT_PREFIX STREQUAL "/")
|
||||
set(_IMPORT_PREFIX "")
|
||||
endif()
|
||||
|
||||
# Create imported target ElaWidgetTools
|
||||
add_library(ElaWidgetTools SHARED IMPORTED)
|
||||
|
||||
set_target_properties(ElaWidgetTools PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/ElaWidgetTools/include"
|
||||
INTERFACE_LINK_LIBRARIES "Qt6::Widgets;Qt6::WidgetsPrivate;D3D11;DXGI"
|
||||
)
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS 2.8.12)
|
||||
message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
|
||||
endif()
|
||||
|
||||
# Load information for each installed configuration.
|
||||
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/ElaWidgetToolsTargets-*.cmake")
|
||||
foreach(_cmake_config_file IN LISTS _cmake_config_files)
|
||||
include("${_cmake_config_file}")
|
||||
endforeach()
|
||||
unset(_cmake_config_file)
|
||||
unset(_cmake_config_files)
|
||||
|
||||
# Cleanup temporary variables.
|
||||
set(_IMPORT_PREFIX)
|
||||
|
||||
# Loop over all imported files and verify that they actually exist
|
||||
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
|
||||
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
|
||||
if(NOT EXISTS "${_cmake_file}")
|
||||
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
|
||||
\"${_cmake_file}\"
|
||||
but this file does not exist. Possible reasons include:
|
||||
* The file was deleted, renamed, or moved to another location.
|
||||
* An install or uninstall procedure did not complete successfully.
|
||||
* The installation package was faulty and contained
|
||||
\"${CMAKE_CURRENT_LIST_FILE}\"
|
||||
but not all the files it references.
|
||||
")
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_cmake_file)
|
||||
unset("_cmake_import_check_files_for_${_cmake_target}")
|
||||
endforeach()
|
||||
unset(_cmake_target)
|
||||
unset(_cmake_import_check_targets)
|
||||
|
||||
# This file does not depend on other imported targets which have
|
||||
# been exported from the same project but in a separate export set.
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
// This defines the specialisation of QListBox that handles the Scintilla
|
||||
// double-click callback.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#include <qmap.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qstring.h>
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
|
||||
class QsciSciListBox;
|
||||
|
||||
|
||||
// This is an internal class but it is referenced by a public class so it has
|
||||
// to have a Qsci prefix rather than being put in the Scintilla namespace.
|
||||
// However the reason for avoiding this no longer applies.
|
||||
class QsciListBoxQt : public Scintilla::ListBox
|
||||
{
|
||||
public:
|
||||
QsciListBoxQt();
|
||||
|
||||
virtual void SetFont(Scintilla::Font &font);
|
||||
virtual void Create(Scintilla::Window &parent, int, Scintilla::Point, int,
|
||||
bool unicodeMode, int);
|
||||
virtual void SetAverageCharWidth(int);
|
||||
virtual void SetVisibleRows(int);
|
||||
virtual int GetVisibleRows() const;
|
||||
virtual Scintilla::PRectangle GetDesiredRect();
|
||||
virtual int CaretFromEdge();
|
||||
virtual void Clear();
|
||||
virtual void Append(char *s, int type = -1);
|
||||
virtual int Length();
|
||||
virtual void Select(int n);
|
||||
virtual int GetSelection();
|
||||
virtual int Find(const char *prefix);
|
||||
virtual void GetValue(int n, char *value, int len);
|
||||
virtual void Sort();
|
||||
virtual void RegisterImage(int type, const char *xpm_data);
|
||||
virtual void RegisterRGBAImage(int type, int width, int height,
|
||||
const unsigned char *pixelsImage);
|
||||
virtual void ClearRegisteredImages();
|
||||
virtual void SetDelegate(Scintilla::IListBoxDelegate *lbDelegate);
|
||||
virtual void SetList(const char *list, char separator, char typesep);
|
||||
|
||||
void handleDoubleClick();
|
||||
void handleRelease();
|
||||
|
||||
private:
|
||||
QsciSciListBox *slb;
|
||||
int visible_rows;
|
||||
bool utf8;
|
||||
Scintilla::IListBoxDelegate *delegate;
|
||||
|
||||
typedef QMap<int, QPixmap> xpmMap;
|
||||
xpmMap xset;
|
||||
|
||||
void selectionChanged();
|
||||
};
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
// This module defines interface to the QsciAbstractAPIs class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCIABSTRACTAPIS_H
|
||||
#define QSCIABSTRACTAPIS_H
|
||||
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
#include <Qsci/qsciscintilla.h>
|
||||
|
||||
|
||||
class QsciLexer;
|
||||
|
||||
|
||||
//! \brief The QsciAbstractAPIs class represents the interface to the textual
|
||||
//! API information used in call tips and for auto-completion. A sub-class
|
||||
//! will provide the actual implementation of the interface.
|
||||
//!
|
||||
//! API information is specific to a particular language lexer but can be
|
||||
//! shared by multiple instances of the lexer.
|
||||
class QSCINTILLA_EXPORT QsciAbstractAPIs : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructs a QsciAbstractAPIs instance attached to lexer \a lexer. \a
|
||||
//! lexer becomes the instance's parent object although the instance can
|
||||
//! also be subsequently attached to other lexers.
|
||||
QsciAbstractAPIs(QsciLexer *lexer);
|
||||
|
||||
//! Destroy the QsciAbstractAPIs instance.
|
||||
virtual ~QsciAbstractAPIs();
|
||||
|
||||
//! Return the lexer that the instance is attached to.
|
||||
QsciLexer *lexer() const;
|
||||
|
||||
//! Update the list \a list with API entries derived from \a context. \a
|
||||
//! context is the list of words in the text preceding the cursor position.
|
||||
//! The characters that make up a word and the characters that separate
|
||||
//! words are defined by the lexer. The last word is a partial word and
|
||||
//! may be empty if the user has just entered a word separator.
|
||||
virtual void updateAutoCompletionList(const QStringList &context,
|
||||
QStringList &list) = 0;
|
||||
|
||||
//! This is called when the user selects the entry \a selection from the
|
||||
//! auto-completion list. A sub-class can use this as a hint to provide
|
||||
//! more specific API entries in future calls to
|
||||
//! updateAutoCompletionList(). The default implementation does nothing.
|
||||
virtual void autoCompletionSelected(const QString &selection);
|
||||
|
||||
//! Return the call tips valid for the context \a context. (Note that the
|
||||
//! last word of the context will always be empty.) \a commas is the number
|
||||
//! of commas the user has typed after the context and before the cursor
|
||||
//! position. The exact position of the list of call tips can be adjusted
|
||||
//! by specifying a corresponding left character shift in \a shifts. This
|
||||
//! is normally done to correct for any displayed context according to \a
|
||||
//! style.
|
||||
//!
|
||||
//! \sa updateAutoCompletionList()
|
||||
virtual QStringList callTips(const QStringList &context, int commas,
|
||||
QsciScintilla::CallTipsStyle style, QList<int> &shifts) = 0;
|
||||
|
||||
private:
|
||||
QsciLexer *lex;
|
||||
|
||||
QsciAbstractAPIs(const QsciAbstractAPIs &);
|
||||
QsciAbstractAPIs &operator=(const QsciAbstractAPIs &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,213 @@
|
|||
// This module defines interface to the QsciAPIs class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCIAPIS_H
|
||||
#define QSCIAPIS_H
|
||||
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QPair>
|
||||
#include <QStringList>
|
||||
|
||||
#include <Qsci/qsciabstractapis.h>
|
||||
#include <Qsci/qsciglobal.h>
|
||||
#include <Qsci/qsciscintilla.h>
|
||||
|
||||
|
||||
class QsciAPIsPrepared;
|
||||
class QsciAPIsWorker;
|
||||
class QsciLexer;
|
||||
|
||||
|
||||
//! \brief The QsciAPIs class provies an implementation of the textual API
|
||||
//! information used in call tips and for auto-completion.
|
||||
//!
|
||||
//! Raw API information is read from one or more files. Each API function is
|
||||
//! described by a single line of text comprising the function's name, followed
|
||||
//! by the function's optional comma separated parameters enclosed in
|
||||
//! parenthesis, and finally followed by optional explanatory text.
|
||||
//!
|
||||
//! A function name may be followed by a `?' and a number. The number is used
|
||||
//! by auto-completion to display a registered QPixmap with the function name.
|
||||
//!
|
||||
//! All function names are used by auto-completion, but only those that include
|
||||
//! function parameters are used in call tips.
|
||||
//!
|
||||
//! QScintilla only deals with prepared API information and not the raw
|
||||
//! information described above. This is done so that large APIs can be
|
||||
//! handled while still being responsive to user input. The conversion of raw
|
||||
//! information to prepared information is time consuming (think tens of
|
||||
//! seconds) and implemented in a separate thread. Prepared information can
|
||||
//! be quickly saved to and loaded from files. Such files are portable between
|
||||
//! different architectures.
|
||||
//!
|
||||
//! QScintilla based applications that want to support large APIs would
|
||||
//! normally provide the user with the ability to specify a set of, possibly
|
||||
//! project specific, raw API files and convert them to prepared files that are
|
||||
//! loaded quickly when the application is invoked.
|
||||
class QSCINTILLA_EXPORT QsciAPIs : public QsciAbstractAPIs
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructs a QsciAPIs instance attached to lexer \a lexer. \a lexer
|
||||
//! becomes the instance's parent object although the instance can also be
|
||||
//! subsequently attached to other lexers.
|
||||
QsciAPIs(QsciLexer *lexer);
|
||||
|
||||
//! Destroy the QsciAPIs instance.
|
||||
virtual ~QsciAPIs();
|
||||
|
||||
//! Add the single raw API entry \a entry to the current set.
|
||||
//!
|
||||
//! \sa clear(), load(), remove()
|
||||
void add(const QString &entry);
|
||||
|
||||
//! Deletes all raw API information.
|
||||
//!
|
||||
//! \sa add(), load(), remove()
|
||||
void clear();
|
||||
|
||||
//! Load the API information from the file named \a filename, adding it to
|
||||
//! the current set. Returns true if successful, otherwise false.
|
||||
bool load(const QString &filename);
|
||||
|
||||
//! Remove the single raw API entry \a entry from the current set.
|
||||
//!
|
||||
//! \sa add(), clear(), load()
|
||||
void remove(const QString &entry);
|
||||
|
||||
//! Convert the current raw API information to prepared API information.
|
||||
//! This is implemented by a separate thread.
|
||||
//!
|
||||
//! \sa cancelPreparation()
|
||||
void prepare();
|
||||
|
||||
//! Cancel the conversion of the current raw API information to prepared
|
||||
//! API information.
|
||||
//!
|
||||
//! \sa prepare()
|
||||
void cancelPreparation();
|
||||
|
||||
//! Return the default name of the prepared API information file. It is
|
||||
//! based on the name of the associated lexer and in the directory defined
|
||||
//! by the QSCIDIR environment variable. If the environment variable isn't
|
||||
//! set then $HOME/.qsci is used.
|
||||
QString defaultPreparedName() const;
|
||||
|
||||
//! Check to see is a prepared API information file named \a filename
|
||||
//! exists. If \a filename is empty then the value returned by
|
||||
//! defaultPreparedName() is used. Returns true if successful, otherwise
|
||||
//! false.
|
||||
//!
|
||||
//! \sa defaultPreparedName()
|
||||
bool isPrepared(const QString &filename = QString()) const;
|
||||
|
||||
//! Load the prepared API information from the file named \a filename. If
|
||||
//! \a filename is empty then a name is constructed based on the name of
|
||||
//! the associated lexer and saved in the directory defined by the QSCIDIR
|
||||
//! environment variable. If the environment variable isn't set then
|
||||
//! $HOME/.qsci is used. Returns true if successful, otherwise false.
|
||||
bool loadPrepared(const QString &filename = QString());
|
||||
|
||||
//! Save the prepared API information to the file named \a filename. If
|
||||
//! \a filename is empty then a name is constructed based on the name of
|
||||
//! the associated lexer and saved in the directory defined by the QSCIDIR
|
||||
//! environment variable. If the environment variable isn't set then
|
||||
//! $HOME/.qsci is used. Returns true if successful, otherwise false.
|
||||
bool savePrepared(const QString &filename = QString()) const;
|
||||
|
||||
//! \reimp
|
||||
virtual void updateAutoCompletionList(const QStringList &context,
|
||||
QStringList &list);
|
||||
|
||||
//! \reimp
|
||||
virtual void autoCompletionSelected(const QString &sel);
|
||||
|
||||
//! \reimp
|
||||
virtual QStringList callTips(const QStringList &context, int commas,
|
||||
QsciScintilla::CallTipsStyle style, QList<int> &shifts);
|
||||
|
||||
//! \internal Reimplemented to receive termination events from the worker
|
||||
//! thread.
|
||||
virtual bool event(QEvent *e);
|
||||
|
||||
//! Return a list of the installed raw API file names for the associated
|
||||
//! lexer.
|
||||
QStringList installedAPIFiles() const;
|
||||
|
||||
signals:
|
||||
//! This signal is emitted when the conversion of raw API information to
|
||||
//! prepared API information has been cancelled.
|
||||
//!
|
||||
//! \sa apiPreparationFinished(), apiPreparationStarted()
|
||||
void apiPreparationCancelled();
|
||||
|
||||
//! This signal is emitted when the conversion of raw API information to
|
||||
//! prepared API information starts and can be used to give some visual
|
||||
//! feedback to the user.
|
||||
//!
|
||||
//! \sa apiPreparationCancelled(), apiPreparationFinished()
|
||||
void apiPreparationStarted();
|
||||
|
||||
//! This signal is emitted when the conversion of raw API information to
|
||||
//! prepared API information has finished.
|
||||
//!
|
||||
//! \sa apiPreparationCancelled(), apiPreparationStarted()
|
||||
void apiPreparationFinished();
|
||||
|
||||
private:
|
||||
friend class QsciAPIsPrepared;
|
||||
friend class QsciAPIsWorker;
|
||||
|
||||
// This indexes a word in a set of raw APIs. The first part indexes the
|
||||
// entry in the set, the second part indexes the word within the entry.
|
||||
typedef QPair<quint32, quint32> WordIndex;
|
||||
|
||||
// This is a list of word indexes.
|
||||
typedef QList<WordIndex> WordIndexList;
|
||||
|
||||
QsciAPIsWorker *worker;
|
||||
QStringList old_context;
|
||||
QStringList::const_iterator origin;
|
||||
int origin_len;
|
||||
QString unambiguous_context;
|
||||
QStringList apis;
|
||||
QsciAPIsPrepared *prep;
|
||||
|
||||
static bool enoughCommas(const QString &s, int commas);
|
||||
|
||||
QStringList positionOrigin(const QStringList &context, QString &path);
|
||||
bool originStartsWith(const QString &path, const QString &wsep);
|
||||
const WordIndexList *wordIndexOf(const QString &word) const;
|
||||
void lastCompleteWord(const QString &word, QStringList &with_context,
|
||||
bool &unambig);
|
||||
void lastPartialWord(const QString &word, QStringList &with_context,
|
||||
bool &unambig);
|
||||
void addAPIEntries(const WordIndexList &wl, bool complete,
|
||||
QStringList &with_context, bool &unambig);
|
||||
QString prepName(const QString &filename, bool mkpath = false) const;
|
||||
void deleteWorker();
|
||||
|
||||
QsciAPIs(const QsciAPIs &);
|
||||
QsciAPIs &operator=(const QsciAPIs &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,408 @@
|
|||
// This defines the interface to the QsciCommand class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCICOMMAND_H
|
||||
#define QSCICOMMAND_H
|
||||
|
||||
#include <qstring.h>
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
#include <Qsci/qsciscintillabase.h>
|
||||
|
||||
|
||||
class QsciScintilla;
|
||||
|
||||
|
||||
//! \brief The QsciCommand class represents an internal editor command that may
|
||||
//! have one or two keys bound to it.
|
||||
//!
|
||||
//! Methods are provided to change the keys bound to the command and to remove
|
||||
//! a key binding. Each command has a user friendly description of the command
|
||||
//! for use in key mapping dialogs.
|
||||
class QSCINTILLA_EXPORT QsciCommand
|
||||
{
|
||||
public:
|
||||
//! This enum defines the different commands that can be assigned to a key.
|
||||
enum Command {
|
||||
//! Move down one line.
|
||||
LineDown = QsciScintillaBase::SCI_LINEDOWN,
|
||||
|
||||
//! Extend the selection down one line.
|
||||
LineDownExtend = QsciScintillaBase::SCI_LINEDOWNEXTEND,
|
||||
|
||||
//! Extend the rectangular selection down one line.
|
||||
LineDownRectExtend = QsciScintillaBase::SCI_LINEDOWNRECTEXTEND,
|
||||
|
||||
//! Scroll the view down one line.
|
||||
LineScrollDown = QsciScintillaBase::SCI_LINESCROLLDOWN,
|
||||
|
||||
//! Move up one line.
|
||||
LineUp = QsciScintillaBase::SCI_LINEUP,
|
||||
|
||||
//! Extend the selection up one line.
|
||||
LineUpExtend = QsciScintillaBase::SCI_LINEUPEXTEND,
|
||||
|
||||
//! Extend the rectangular selection up one line.
|
||||
LineUpRectExtend = QsciScintillaBase::SCI_LINEUPRECTEXTEND,
|
||||
|
||||
//! Scroll the view up one line.
|
||||
LineScrollUp = QsciScintillaBase::SCI_LINESCROLLUP,
|
||||
|
||||
//! Scroll to the start of the document.
|
||||
ScrollToStart = QsciScintillaBase::SCI_SCROLLTOSTART,
|
||||
|
||||
//! Scroll to the end of the document.
|
||||
ScrollToEnd = QsciScintillaBase::SCI_SCROLLTOEND,
|
||||
|
||||
//! Scroll vertically to centre the current line.
|
||||
VerticalCentreCaret = QsciScintillaBase::SCI_VERTICALCENTRECARET,
|
||||
|
||||
//! Move down one paragraph.
|
||||
ParaDown = QsciScintillaBase::SCI_PARADOWN,
|
||||
|
||||
//! Extend the selection down one paragraph.
|
||||
ParaDownExtend = QsciScintillaBase::SCI_PARADOWNEXTEND,
|
||||
|
||||
//! Move up one paragraph.
|
||||
ParaUp = QsciScintillaBase::SCI_PARAUP,
|
||||
|
||||
//! Extend the selection up one paragraph.
|
||||
ParaUpExtend = QsciScintillaBase::SCI_PARAUPEXTEND,
|
||||
|
||||
//! Move left one character.
|
||||
CharLeft = QsciScintillaBase::SCI_CHARLEFT,
|
||||
|
||||
//! Extend the selection left one character.
|
||||
CharLeftExtend = QsciScintillaBase::SCI_CHARLEFTEXTEND,
|
||||
|
||||
//! Extend the rectangular selection left one character.
|
||||
CharLeftRectExtend = QsciScintillaBase::SCI_CHARLEFTRECTEXTEND,
|
||||
|
||||
//! Move right one character.
|
||||
CharRight = QsciScintillaBase::SCI_CHARRIGHT,
|
||||
|
||||
//! Extend the selection right one character.
|
||||
CharRightExtend = QsciScintillaBase::SCI_CHARRIGHTEXTEND,
|
||||
|
||||
//! Extend the rectangular selection right one character.
|
||||
CharRightRectExtend = QsciScintillaBase::SCI_CHARRIGHTRECTEXTEND,
|
||||
|
||||
//! Move left one word.
|
||||
WordLeft = QsciScintillaBase::SCI_WORDLEFT,
|
||||
|
||||
//! Extend the selection left one word.
|
||||
WordLeftExtend = QsciScintillaBase::SCI_WORDLEFTEXTEND,
|
||||
|
||||
//! Move right one word.
|
||||
WordRight = QsciScintillaBase::SCI_WORDRIGHT,
|
||||
|
||||
//! Extend the selection right one word.
|
||||
WordRightExtend = QsciScintillaBase::SCI_WORDRIGHTEXTEND,
|
||||
|
||||
//! Move to the end of the previous word.
|
||||
WordLeftEnd = QsciScintillaBase::SCI_WORDLEFTEND,
|
||||
|
||||
//! Extend the selection to the end of the previous word.
|
||||
WordLeftEndExtend = QsciScintillaBase::SCI_WORDLEFTENDEXTEND,
|
||||
|
||||
//! Move to the end of the next word.
|
||||
WordRightEnd = QsciScintillaBase::SCI_WORDRIGHTEND,
|
||||
|
||||
//! Extend the selection to the end of the next word.
|
||||
WordRightEndExtend = QsciScintillaBase::SCI_WORDRIGHTENDEXTEND,
|
||||
|
||||
//! Move left one word part.
|
||||
WordPartLeft = QsciScintillaBase::SCI_WORDPARTLEFT,
|
||||
|
||||
//! Extend the selection left one word part.
|
||||
WordPartLeftExtend = QsciScintillaBase::SCI_WORDPARTLEFTEXTEND,
|
||||
|
||||
//! Move right one word part.
|
||||
WordPartRight = QsciScintillaBase::SCI_WORDPARTRIGHT,
|
||||
|
||||
//! Extend the selection right one word part.
|
||||
WordPartRightExtend = QsciScintillaBase::SCI_WORDPARTRIGHTEXTEND,
|
||||
|
||||
//! Move to the start of the document line.
|
||||
Home = QsciScintillaBase::SCI_HOME,
|
||||
|
||||
//! Extend the selection to the start of the document line.
|
||||
HomeExtend = QsciScintillaBase::SCI_HOMEEXTEND,
|
||||
|
||||
//! Extend the rectangular selection to the start of the document line.
|
||||
HomeRectExtend = QsciScintillaBase::SCI_HOMERECTEXTEND,
|
||||
|
||||
//! Move to the start of the displayed line.
|
||||
HomeDisplay = QsciScintillaBase::SCI_HOMEDISPLAY,
|
||||
|
||||
//! Extend the selection to the start of the displayed line.
|
||||
HomeDisplayExtend = QsciScintillaBase::SCI_HOMEDISPLAYEXTEND,
|
||||
|
||||
//! Move to the start of the displayed or document line.
|
||||
HomeWrap = QsciScintillaBase::SCI_HOMEWRAP,
|
||||
|
||||
//! Extend the selection to the start of the displayed or document
|
||||
//! line.
|
||||
HomeWrapExtend = QsciScintillaBase::SCI_HOMEWRAPEXTEND,
|
||||
|
||||
//! Move to the first visible character in the document line.
|
||||
VCHome = QsciScintillaBase::SCI_VCHOME,
|
||||
|
||||
//! Extend the selection to the first visible character in the document
|
||||
//! line.
|
||||
VCHomeExtend = QsciScintillaBase::SCI_VCHOMEEXTEND,
|
||||
|
||||
//! Extend the rectangular selection to the first visible character in
|
||||
//! the document line.
|
||||
VCHomeRectExtend = QsciScintillaBase::SCI_VCHOMERECTEXTEND,
|
||||
|
||||
//! Move to the first visible character of the displayed or document
|
||||
//! line.
|
||||
VCHomeWrap = QsciScintillaBase::SCI_VCHOMEWRAP,
|
||||
|
||||
//! Extend the selection to the first visible character of the
|
||||
//! displayed or document line.
|
||||
VCHomeWrapExtend = QsciScintillaBase::SCI_VCHOMEWRAPEXTEND,
|
||||
|
||||
//! Move to the end of the document line.
|
||||
LineEnd = QsciScintillaBase::SCI_LINEEND,
|
||||
|
||||
//! Extend the selection to the end of the document line.
|
||||
LineEndExtend = QsciScintillaBase::SCI_LINEENDEXTEND,
|
||||
|
||||
//! Extend the rectangular selection to the end of the document line.
|
||||
LineEndRectExtend = QsciScintillaBase::SCI_LINEENDRECTEXTEND,
|
||||
|
||||
//! Move to the end of the displayed line.
|
||||
LineEndDisplay = QsciScintillaBase::SCI_LINEENDDISPLAY,
|
||||
|
||||
//! Extend the selection to the end of the displayed line.
|
||||
LineEndDisplayExtend = QsciScintillaBase::SCI_LINEENDDISPLAYEXTEND,
|
||||
|
||||
//! Move to the end of the displayed or document line.
|
||||
LineEndWrap = QsciScintillaBase::SCI_LINEENDWRAP,
|
||||
|
||||
//! Extend the selection to the end of the displayed or document line.
|
||||
LineEndWrapExtend = QsciScintillaBase::SCI_LINEENDWRAPEXTEND,
|
||||
|
||||
//! Move to the start of the document.
|
||||
DocumentStart = QsciScintillaBase::SCI_DOCUMENTSTART,
|
||||
|
||||
//! Extend the selection to the start of the document.
|
||||
DocumentStartExtend = QsciScintillaBase::SCI_DOCUMENTSTARTEXTEND,
|
||||
|
||||
//! Move to the end of the document.
|
||||
DocumentEnd = QsciScintillaBase::SCI_DOCUMENTEND,
|
||||
|
||||
//! Extend the selection to the end of the document.
|
||||
DocumentEndExtend = QsciScintillaBase::SCI_DOCUMENTENDEXTEND,
|
||||
|
||||
//! Move up one page.
|
||||
PageUp = QsciScintillaBase::SCI_PAGEUP,
|
||||
|
||||
//! Extend the selection up one page.
|
||||
PageUpExtend = QsciScintillaBase::SCI_PAGEUPEXTEND,
|
||||
|
||||
//! Extend the rectangular selection up one page.
|
||||
PageUpRectExtend = QsciScintillaBase::SCI_PAGEUPRECTEXTEND,
|
||||
|
||||
//! Move down one page.
|
||||
PageDown = QsciScintillaBase::SCI_PAGEDOWN,
|
||||
|
||||
//! Extend the selection down one page.
|
||||
PageDownExtend = QsciScintillaBase::SCI_PAGEDOWNEXTEND,
|
||||
|
||||
//! Extend the rectangular selection down one page.
|
||||
PageDownRectExtend = QsciScintillaBase::SCI_PAGEDOWNRECTEXTEND,
|
||||
|
||||
//! Stuttered move up one page.
|
||||
StutteredPageUp = QsciScintillaBase::SCI_STUTTEREDPAGEUP,
|
||||
|
||||
//! Stuttered extend the selection up one page.
|
||||
StutteredPageUpExtend = QsciScintillaBase::SCI_STUTTEREDPAGEUPEXTEND,
|
||||
|
||||
//! Stuttered move down one page.
|
||||
StutteredPageDown = QsciScintillaBase::SCI_STUTTEREDPAGEDOWN,
|
||||
|
||||
//! Stuttered extend the selection down one page.
|
||||
StutteredPageDownExtend = QsciScintillaBase::SCI_STUTTEREDPAGEDOWNEXTEND,
|
||||
|
||||
//! Delete the current character.
|
||||
Delete = QsciScintillaBase::SCI_CLEAR,
|
||||
|
||||
//! Delete the previous character.
|
||||
DeleteBack = QsciScintillaBase::SCI_DELETEBACK,
|
||||
|
||||
//! Delete the previous character if not at start of line.
|
||||
DeleteBackNotLine = QsciScintillaBase::SCI_DELETEBACKNOTLINE,
|
||||
|
||||
//! Delete the word to the left.
|
||||
DeleteWordLeft = QsciScintillaBase::SCI_DELWORDLEFT,
|
||||
|
||||
//! Delete the word to the right.
|
||||
DeleteWordRight = QsciScintillaBase::SCI_DELWORDRIGHT,
|
||||
|
||||
//! Delete right to the end of the next word.
|
||||
DeleteWordRightEnd = QsciScintillaBase::SCI_DELWORDRIGHTEND,
|
||||
|
||||
//! Delete the line to the left.
|
||||
DeleteLineLeft = QsciScintillaBase::SCI_DELLINELEFT,
|
||||
|
||||
//! Delete the line to the right.
|
||||
DeleteLineRight = QsciScintillaBase::SCI_DELLINERIGHT,
|
||||
|
||||
//! Delete the current line.
|
||||
LineDelete = QsciScintillaBase::SCI_LINEDELETE,
|
||||
|
||||
//! Cut the current line to the clipboard.
|
||||
LineCut = QsciScintillaBase::SCI_LINECUT,
|
||||
|
||||
//! Copy the current line to the clipboard.
|
||||
LineCopy = QsciScintillaBase::SCI_LINECOPY,
|
||||
|
||||
//! Transpose the current and previous lines.
|
||||
LineTranspose = QsciScintillaBase::SCI_LINETRANSPOSE,
|
||||
|
||||
//! Duplicate the current line.
|
||||
LineDuplicate = QsciScintillaBase::SCI_LINEDUPLICATE,
|
||||
|
||||
//! Select the whole document.
|
||||
SelectAll = QsciScintillaBase::SCI_SELECTALL,
|
||||
|
||||
//! Move the selected lines up one line.
|
||||
MoveSelectedLinesUp = QsciScintillaBase::SCI_MOVESELECTEDLINESUP,
|
||||
|
||||
//! Move the selected lines down one line.
|
||||
MoveSelectedLinesDown = QsciScintillaBase::SCI_MOVESELECTEDLINESDOWN,
|
||||
|
||||
//! Duplicate the selection.
|
||||
SelectionDuplicate = QsciScintillaBase::SCI_SELECTIONDUPLICATE,
|
||||
|
||||
//! Convert the selection to lower case.
|
||||
SelectionLowerCase = QsciScintillaBase::SCI_LOWERCASE,
|
||||
|
||||
//! Convert the selection to upper case.
|
||||
SelectionUpperCase = QsciScintillaBase::SCI_UPPERCASE,
|
||||
|
||||
//! Cut the selection to the clipboard.
|
||||
SelectionCut = QsciScintillaBase::SCI_CUT,
|
||||
|
||||
//! Copy the selection to the clipboard.
|
||||
SelectionCopy = QsciScintillaBase::SCI_COPY,
|
||||
|
||||
//! Paste from the clipboard.
|
||||
Paste = QsciScintillaBase::SCI_PASTE,
|
||||
|
||||
//! Toggle insert/overtype.
|
||||
EditToggleOvertype = QsciScintillaBase::SCI_EDITTOGGLEOVERTYPE,
|
||||
|
||||
//! Insert a platform dependent newline.
|
||||
Newline = QsciScintillaBase::SCI_NEWLINE,
|
||||
|
||||
//! Insert a formfeed.
|
||||
Formfeed = QsciScintillaBase::SCI_FORMFEED,
|
||||
|
||||
//! Indent one level.
|
||||
Tab = QsciScintillaBase::SCI_TAB,
|
||||
|
||||
//! De-indent one level.
|
||||
Backtab = QsciScintillaBase::SCI_BACKTAB,
|
||||
|
||||
//! Cancel any current operation.
|
||||
Cancel = QsciScintillaBase::SCI_CANCEL,
|
||||
|
||||
//! Undo the last command.
|
||||
Undo = QsciScintillaBase::SCI_UNDO,
|
||||
|
||||
//! Redo the last command.
|
||||
Redo = QsciScintillaBase::SCI_REDO,
|
||||
|
||||
//! Zoom in.
|
||||
ZoomIn = QsciScintillaBase::SCI_ZOOMIN,
|
||||
|
||||
//! Zoom out.
|
||||
ZoomOut = QsciScintillaBase::SCI_ZOOMOUT,
|
||||
|
||||
//! Reverse the selected lines.
|
||||
ReverseLines = QsciScintillaBase::SCI_LINEREVERSE,
|
||||
};
|
||||
|
||||
//! Return the command that will be executed by this instance.
|
||||
Command command() const {return scicmd;}
|
||||
|
||||
//! Execute the command.
|
||||
void execute();
|
||||
|
||||
//! Binds the key \a key to the command. If \a key is 0 then the key
|
||||
//! binding is removed. If \a key is invalid then the key binding is
|
||||
//! unchanged. Valid keys are any visible or control character or any
|
||||
//! of \c Qt::Key_Down, \c Qt::Key_Up, \c Qt::Key_Left, \c Qt::Key_Right,
|
||||
//! \c Qt::Key_Home, \c Qt::Key_End, \c Qt::Key_PageUp,
|
||||
//! \c Qt::Key_PageDown, \c Qt::Key_Delete, \c Qt::Key_Insert,
|
||||
//! \c Qt::Key_Escape, \c Qt::Key_Backspace, \c Qt::Key_Tab,
|
||||
//! \c Qt::Key_Backtab, \c Qt::Key_Return, \c Qt::Key_Enter,
|
||||
//! \c Qt::Key_Super_L, \c Qt::Key_Super_R or \c Qt::Key_Menu. Keys may be
|
||||
//! modified with any combination of \c Qt::ShiftModifier,
|
||||
//! \c Qt::ControlModifier, \c Qt::AltModifier and \c Qt::MetaModifier.
|
||||
//!
|
||||
//! \sa key(), setAlternateKey(), validKey()
|
||||
void setKey(int key);
|
||||
|
||||
//! Binds the alternate key \a altkey to the command. If \a key is 0
|
||||
//! then the alternate key binding is removed.
|
||||
//!
|
||||
//! \sa alternateKey(), setKey(), validKey()
|
||||
void setAlternateKey(int altkey);
|
||||
|
||||
//! The key that is currently bound to the command is returned.
|
||||
//!
|
||||
//! \sa setKey(), alternateKey()
|
||||
int key() const {return qkey;}
|
||||
|
||||
//! The alternate key that is currently bound to the command is
|
||||
//! returned.
|
||||
//!
|
||||
//! \sa setAlternateKey(), key()
|
||||
int alternateKey() const {return qaltkey;}
|
||||
|
||||
//! If the key \a key is valid then true is returned.
|
||||
static bool validKey(int key);
|
||||
|
||||
//! The user friendly description of the command is returned.
|
||||
QString description() const;
|
||||
|
||||
private:
|
||||
friend class QsciCommandSet;
|
||||
|
||||
QsciCommand(QsciScintilla *qs, Command cmd, int key, int altkey,
|
||||
const char *desc);
|
||||
|
||||
void bindKey(int key,int &qk,int &scik);
|
||||
|
||||
QsciScintilla *qsCmd;
|
||||
Command scicmd;
|
||||
int qkey, scikey, qaltkey, scialtkey;
|
||||
const char *descCmd;
|
||||
|
||||
QsciCommand(const QsciCommand &);
|
||||
QsciCommand &operator=(const QsciCommand &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
// This defines the interface to the QsciCommandSet class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCICOMMANDSET_H
|
||||
#define QSCICOMMANDSET_H
|
||||
|
||||
#include <qglobal.h>
|
||||
|
||||
#include <QList>
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
#include <Qsci/qscicommand.h>
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSettings;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class QsciScintilla;
|
||||
|
||||
|
||||
//! \brief The QsciCommandSet class represents the set of all internal editor
|
||||
//! commands that may have keys bound.
|
||||
//!
|
||||
//! Methods are provided to access the individual commands and to read and
|
||||
//! write the current bindings from and to settings files.
|
||||
class QSCINTILLA_EXPORT QsciCommandSet
|
||||
{
|
||||
public:
|
||||
//! The key bindings for each command in the set are read from the
|
||||
//! settings \a qs. \a prefix is prepended to the key of each entry.
|
||||
//! true is returned if there was no error.
|
||||
//!
|
||||
//! \sa writeSettings()
|
||||
bool readSettings(QSettings &qs, const char *prefix = "/Scintilla");
|
||||
|
||||
//! The key bindings for each command in the set are written to the
|
||||
//! settings \a qs. \a prefix is prepended to the key of each entry.
|
||||
//! true is returned if there was no error.
|
||||
//!
|
||||
//! \sa readSettings()
|
||||
bool writeSettings(QSettings &qs, const char *prefix = "/Scintilla");
|
||||
|
||||
//! The commands in the set are returned as a list.
|
||||
QList<QsciCommand *> &commands() {return cmds;}
|
||||
|
||||
//! The primary keys bindings for all commands are removed.
|
||||
void clearKeys();
|
||||
|
||||
//! The alternate keys bindings for all commands are removed.
|
||||
void clearAlternateKeys();
|
||||
|
||||
// Find the command that is bound to \a key.
|
||||
QsciCommand *boundTo(int key) const;
|
||||
|
||||
// Find a specific command \a command.
|
||||
QsciCommand *find(QsciCommand::Command command) const;
|
||||
|
||||
private:
|
||||
friend class QsciScintilla;
|
||||
|
||||
QsciCommandSet(QsciScintilla *qs);
|
||||
~QsciCommandSet();
|
||||
|
||||
QsciScintilla *qsci;
|
||||
QList<QsciCommand *> cmds;
|
||||
|
||||
QsciCommandSet(const QsciCommandSet &);
|
||||
QsciCommandSet &operator=(const QsciCommandSet &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
// This defines the interface to the QsciDocument class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCIDOCUMENT_H
|
||||
#define QSCIDOCUMENT_H
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
|
||||
|
||||
class QsciScintillaBase;
|
||||
class QsciDocumentP;
|
||||
|
||||
|
||||
//! \brief The QsciDocument class represents a document to be edited.
|
||||
//!
|
||||
//! It is an opaque class that can be attached to multiple instances of
|
||||
//! QsciScintilla to create different simultaneous views of the same document.
|
||||
//! QsciDocument uses implicit sharing so that copying class instances is a
|
||||
//! cheap operation.
|
||||
class QSCINTILLA_EXPORT QsciDocument
|
||||
{
|
||||
public:
|
||||
//! Create a new unattached document.
|
||||
QsciDocument();
|
||||
virtual ~QsciDocument();
|
||||
|
||||
QsciDocument(const QsciDocument &);
|
||||
QsciDocument &operator=(const QsciDocument &);
|
||||
|
||||
private:
|
||||
friend class QsciScintilla;
|
||||
|
||||
void attach(const QsciDocument &that);
|
||||
void detach();
|
||||
void display(QsciScintillaBase *qsb, const QsciDocument *from);
|
||||
void undisplay(QsciScintillaBase *qsb);
|
||||
|
||||
bool isModified() const;
|
||||
void setModified(bool m);
|
||||
|
||||
QsciDocumentP *pdoc;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
// This module defines various things common to all of the Scintilla Qt port.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCIGLOBAL_H
|
||||
#define QSCIGLOBAL_H
|
||||
|
||||
#include <qglobal.h>
|
||||
|
||||
|
||||
#define QSCINTILLA_VERSION 0x020e01
|
||||
#define QSCINTILLA_VERSION_STR "2.14.1"
|
||||
|
||||
|
||||
// We only support Qt v5.11 and later.
|
||||
#if QT_VERSION < 0x050b00
|
||||
#error "Qt v5.11.0 or later is required"
|
||||
#endif
|
||||
|
||||
|
||||
// Define QSCINTILLA_MAKE_DLL to create a QScintilla shared library, or
|
||||
// define QSCINTILLA_DLL to link against a QScintilla shared library, or define
|
||||
// neither to either build or link against a static QScintilla library.
|
||||
#if defined(QSCINTILLA_DLL)
|
||||
#define QSCINTILLA_EXPORT Q_DECL_IMPORT
|
||||
#elif defined(QSCINTILLA_MAKE_DLL)
|
||||
#define QSCINTILLA_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
#define QSCINTILLA_EXPORT
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(QT_BEGIN_NAMESPACE)
|
||||
#define QT_BEGIN_NAMESPACE
|
||||
#define QT_END_NAMESPACE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,356 @@
|
|||
// This defines the interface to the QsciLexer class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCILEXER_H
|
||||
#define QSCILEXER_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSettings;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class QsciAbstractAPIs;
|
||||
class QsciScintilla;
|
||||
|
||||
|
||||
//! \brief The QsciLexer class is an abstract class used as a base for language
|
||||
//! lexers.
|
||||
//!
|
||||
//! A lexer scans the text breaking it up into separate language objects, e.g.
|
||||
//! keywords, strings, operators. The lexer then uses a different style to
|
||||
//! draw each object. A style is identified by a style number and has a number
|
||||
//! of attributes, including colour and font. A specific language lexer will
|
||||
//! implement appropriate default styles which can be overriden by an
|
||||
//! application by further sub-classing the specific language lexer.
|
||||
//!
|
||||
//! A lexer may provide one or more sets of words to be recognised as keywords.
|
||||
//! Most lexers only provide one set, but some may support languages embedded
|
||||
//! in other languages and provide several sets.
|
||||
//!
|
||||
//! QsciLexer provides convenience methods for saving and restoring user
|
||||
//! preferences for fonts and colours.
|
||||
//!
|
||||
//! If you want to write a lexer for a new language then you can add it to the
|
||||
//! underlying Scintilla code and implement a corresponding QsciLexer sub-class
|
||||
//! to manage the different styles used. Alternatively you can implement a
|
||||
//! sub-class of QsciLexerCustom.
|
||||
class QSCINTILLA_EXPORT QsciLexer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Construct a QsciLexer with parent \a parent. \a parent is typically
|
||||
//! the QsciScintilla instance.
|
||||
QsciLexer(QObject *parent = 0);
|
||||
|
||||
//! Destroy the QSciLexer.
|
||||
virtual ~QsciLexer();
|
||||
|
||||
//! Returns the name of the language. It must be re-implemented by a
|
||||
//! sub-class.
|
||||
virtual const char *language() const = 0;
|
||||
|
||||
//! Returns the name of the lexer. If 0 is returned then the lexer's
|
||||
//! numeric identifier is used. The default implementation returns 0.
|
||||
//!
|
||||
//! \sa lexerId()
|
||||
virtual const char *lexer() const;
|
||||
|
||||
//! Returns the identifier (i.e. a QsciScintillaBase::SCLEX_* value) of the
|
||||
//! lexer. This is only used if lexer() returns 0. The default
|
||||
//! implementation returns QsciScintillaBase::SCLEX_CONTAINER.
|
||||
//!
|
||||
//! \sa lexer()
|
||||
virtual int lexerId() const;
|
||||
|
||||
//! Returns the current API set or 0 if there isn't one.
|
||||
//!
|
||||
//! \sa setAPIs()
|
||||
QsciAbstractAPIs *apis() const;
|
||||
|
||||
//! Returns the characters that can fill up auto-completion.
|
||||
virtual const char *autoCompletionFillups() const;
|
||||
|
||||
//! Returns the list of character sequences that can separate
|
||||
//! auto-completion words. The first in the list is assumed to be the
|
||||
//! sequence used to separate words in the lexer's API files.
|
||||
virtual QStringList autoCompletionWordSeparators() const;
|
||||
|
||||
//! Returns the auto-indentation style. The default is 0 if the
|
||||
//! language is block structured, or QsciScintilla::AiMaintain if not.
|
||||
//!
|
||||
//! \sa setAutoIndentStyle(), QsciScintilla::AiMaintain,
|
||||
//! QsciScintilla::AiOpening, QsciScintilla::AiClosing
|
||||
int autoIndentStyle();
|
||||
|
||||
//! Returns a space separated list of words or characters in a particular
|
||||
//! style that define the end of a block for auto-indentation. The style
|
||||
//! is returned via \a style.
|
||||
virtual const char *blockEnd(int *style = 0) const;
|
||||
|
||||
//! Returns the number of lines prior to the current one when determining
|
||||
//! the scope of a block when auto-indenting.
|
||||
virtual int blockLookback() const;
|
||||
|
||||
//! Returns a space separated list of words or characters in a particular
|
||||
//! style that define the start of a block for auto-indentation. The style
|
||||
//! is returned via \a style.
|
||||
virtual const char *blockStart(int *style = 0) const;
|
||||
|
||||
//! Returns a space separated list of keywords in a particular style that
|
||||
//! define the start of a block for auto-indentation. The style is
|
||||
//! returned via \a style.
|
||||
virtual const char *blockStartKeyword(int *style = 0) const;
|
||||
|
||||
//! Returns the style used for braces for brace matching.
|
||||
virtual int braceStyle() const;
|
||||
|
||||
//! Returns true if the language is case sensitive. The default is true.
|
||||
virtual bool caseSensitive() const;
|
||||
|
||||
//! Returns the foreground colour of the text for style number \a style.
|
||||
//! The default colour is that returned by defaultColor().
|
||||
//!
|
||||
//! \sa defaultColor(), paper()
|
||||
virtual QColor color(int style) const;
|
||||
|
||||
//! Returns the end-of-line for style number \a style. The default is
|
||||
//! false.
|
||||
virtual bool eolFill(int style) const;
|
||||
|
||||
//! Returns the font for style number \a style. The default font is
|
||||
//! that returned by defaultFont().
|
||||
//!
|
||||
//! \sa defaultFont()
|
||||
virtual QFont font(int style) const;
|
||||
|
||||
//! Returns the view used for indentation guides.
|
||||
virtual int indentationGuideView() const;
|
||||
|
||||
//! Returns the set of keywords for the keyword set \a set recognised
|
||||
//! by the lexer as a space separated string. Keyword sets are numbered
|
||||
//! from 1. 0 is returned if there is no such set.
|
||||
virtual const char *keywords(int set) const;
|
||||
|
||||
//! Returns the number of the style used for whitespace. The default
|
||||
//! implementation returns 0 which is the convention adopted by most
|
||||
//! lexers.
|
||||
virtual int defaultStyle() const;
|
||||
|
||||
//! Returns the descriptive name for style number \a style. For a valid
|
||||
//! style number for this language a non-empty QString must be returned.
|
||||
//! If the style number is invalid then an empty QString must be returned.
|
||||
//! This is intended to be used in user preference dialogs.
|
||||
virtual QString description(int style) const = 0;
|
||||
|
||||
//! Returns the background colour of the text for style number
|
||||
//! \a style.
|
||||
//!
|
||||
//! \sa defaultPaper(), color()
|
||||
virtual QColor paper(int style) const;
|
||||
|
||||
//! Returns the default text colour.
|
||||
//!
|
||||
//! \sa setDefaultColor()
|
||||
QColor defaultColor() const;
|
||||
|
||||
//! Returns the default text colour for style number \a style.
|
||||
virtual QColor defaultColor(int style) const;
|
||||
|
||||
//! Returns the default end-of-line for style number \a style. The default
|
||||
//! is false.
|
||||
virtual bool defaultEolFill(int style) const;
|
||||
|
||||
//! Returns the default font.
|
||||
//!
|
||||
//! \sa setDefaultFont()
|
||||
QFont defaultFont() const;
|
||||
|
||||
//! Returns the default font for style number \a style.
|
||||
virtual QFont defaultFont(int style) const;
|
||||
|
||||
//! Returns the default paper colour.
|
||||
//!
|
||||
//! \sa setDefaultPaper()
|
||||
QColor defaultPaper() const;
|
||||
|
||||
//! Returns the default paper colour for style number \a style.
|
||||
virtual QColor defaultPaper(int style) const;
|
||||
|
||||
//! Returns the QsciScintilla instance that the lexer is currently attached
|
||||
//! to or 0 if it is unattached.
|
||||
QsciScintilla *editor() const {return attached_editor;}
|
||||
|
||||
//! The current set of APIs is set to \a apis. If \a apis is 0 then any
|
||||
//! existing APIs for this lexer are removed.
|
||||
//!
|
||||
//! \sa apis()
|
||||
void setAPIs(QsciAbstractAPIs *apis);
|
||||
|
||||
//! The default text colour is set to \a c.
|
||||
//!
|
||||
//! \sa defaultColor(), color()
|
||||
void setDefaultColor(const QColor &c);
|
||||
|
||||
//! The default font is set to \a f.
|
||||
//!
|
||||
//! \sa defaultFont(), font()
|
||||
void setDefaultFont(const QFont &f);
|
||||
|
||||
//! The default paper colour is set to \a c.
|
||||
//!
|
||||
//! \sa defaultPaper(), paper()
|
||||
void setDefaultPaper(const QColor &c);
|
||||
|
||||
//! \internal Set the QsciScintilla instance that the lexer is attached to.
|
||||
virtual void setEditor(QsciScintilla *editor);
|
||||
|
||||
//! The colour, paper, font and end-of-line for each style number, and
|
||||
//! all lexer specific properties are read from the settings \a qs.
|
||||
//! \a prefix is prepended to the key of each entry. true is returned
|
||||
//! if there was no error.
|
||||
//!
|
||||
//! \sa writeSettings(), QsciScintilla::setLexer()
|
||||
bool readSettings(QSettings &qs,const char *prefix = "/Scintilla");
|
||||
|
||||
//! Causes all properties to be refreshed by emitting the
|
||||
//! propertyChanged() signal as required.
|
||||
virtual void refreshProperties();
|
||||
|
||||
//! Returns the number of style bits needed by the lexer. Normally this
|
||||
//! should only be re-implemented by custom lexers. This is deprecated and
|
||||
//! no longer has any effect.
|
||||
virtual int styleBitsNeeded() const;
|
||||
|
||||
//! Returns the string of characters that comprise a word. The default is
|
||||
//! 0 which implies the upper and lower case alphabetic characters and
|
||||
//! underscore.
|
||||
virtual const char *wordCharacters() const;
|
||||
|
||||
//! The colour, paper, font and end-of-line for each style number, and
|
||||
//! all lexer specific properties are written to the settings \a qs.
|
||||
//! \a prefix is prepended to the key of each entry. true is returned
|
||||
//! if there was no error.
|
||||
//!
|
||||
//! \sa readSettings()
|
||||
bool writeSettings(QSettings &qs,
|
||||
const char *prefix = "/Scintilla") const;
|
||||
|
||||
public slots:
|
||||
//! The auto-indentation style is set to \a autoindentstyle.
|
||||
//!
|
||||
//! \sa autoIndentStyle(), QsciScintilla::AiMaintain,
|
||||
//! QsciScintilla::AiOpening, QsciScintilla::AiClosing
|
||||
virtual void setAutoIndentStyle(int autoindentstyle);
|
||||
|
||||
//! The foreground colour for style number \a style is set to \a c. If
|
||||
//! \a style is -1 then the colour is set for all styles.
|
||||
virtual void setColor(const QColor &c,int style = -1);
|
||||
|
||||
//! The end-of-line fill for style number \a style is set to
|
||||
//! \a eoffill. If \a style is -1 then the fill is set for all styles.
|
||||
virtual void setEolFill(bool eoffill,int style = -1);
|
||||
|
||||
//! The font for style number \a style is set to \a f. If \a style is
|
||||
//! -1 then the font is set for all styles.
|
||||
virtual void setFont(const QFont &f,int style = -1);
|
||||
|
||||
//! The background colour for style number \a style is set to \a c. If
|
||||
//! \a style is -1 then the colour is set for all styles.
|
||||
virtual void setPaper(const QColor &c,int style = -1);
|
||||
|
||||
signals:
|
||||
//! This signal is emitted when the foreground colour of style number
|
||||
//! \a style has changed. The new colour is \a c.
|
||||
void colorChanged(const QColor &c,int style);
|
||||
|
||||
//! This signal is emitted when the end-of-file fill of style number
|
||||
//! \a style has changed. The new fill is \a eolfilled.
|
||||
void eolFillChanged(bool eolfilled,int style);
|
||||
|
||||
//! This signal is emitted when the font of style number \a style has
|
||||
//! changed. The new font is \a f.
|
||||
void fontChanged(const QFont &f,int style);
|
||||
|
||||
//! This signal is emitted when the background colour of style number
|
||||
//! \a style has changed. The new colour is \a c.
|
||||
void paperChanged(const QColor &c,int style);
|
||||
|
||||
//! This signal is emitted when the value of the lexer property \a prop
|
||||
//! needs to be changed. The new value is \a val.
|
||||
void propertyChanged(const char *prop, const char *val);
|
||||
|
||||
protected:
|
||||
//! The lexer's properties are read from the settings \a qs. \a prefix
|
||||
//! (which has a trailing '/') should be used as a prefix to the key of
|
||||
//! each setting. true is returned if there is no error.
|
||||
//!
|
||||
virtual bool readProperties(QSettings &qs,const QString &prefix);
|
||||
|
||||
//! The lexer's properties are written to the settings \a qs.
|
||||
//! \a prefix (which has a trailing '/') should be used as a prefix to
|
||||
//! the key of each setting. true is returned if there is no error.
|
||||
//!
|
||||
virtual bool writeProperties(QSettings &qs,const QString &prefix) const;
|
||||
|
||||
//! \internal Convert a QString to encoded bytes.
|
||||
QByteArray textAsBytes(const QString &text) const;
|
||||
|
||||
//! \internal Convert encoded bytes to a QString.
|
||||
QString bytesAsText(const char *bytes, int size) const;
|
||||
|
||||
private:
|
||||
struct StyleData {
|
||||
QFont font;
|
||||
QColor color;
|
||||
QColor paper;
|
||||
bool eol_fill;
|
||||
};
|
||||
|
||||
struct StyleDataMap {
|
||||
bool style_data_set;
|
||||
QMap<int, StyleData> style_data;
|
||||
};
|
||||
|
||||
StyleDataMap *style_map;
|
||||
|
||||
int autoIndStyle;
|
||||
QFont defFont;
|
||||
QColor defColor;
|
||||
QColor defPaper;
|
||||
QsciAbstractAPIs *apiSet;
|
||||
QsciScintilla *attached_editor;
|
||||
|
||||
void setStyleDefaults() const;
|
||||
StyleData &styleData(int style) const;
|
||||
|
||||
QsciLexer(const QsciLexer &);
|
||||
QsciLexer &operator=(const QsciLexer &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,201 @@
|
|||
// This defines the interface to the abstract QsciLexerAsm class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCILEXERASM_H
|
||||
#define QSCILEXERASM_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QChar>
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
#include <Qsci/qscilexer.h>
|
||||
|
||||
|
||||
//! \brief The abstract QsciLexerAsm class encapsulates the Scintilla Asm
|
||||
//! lexer.
|
||||
class QSCINTILLA_EXPORT QsciLexerAsm : public QsciLexer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! This enum defines the meanings of the different styles used by the
|
||||
//! Asm lexer.
|
||||
enum {
|
||||
//! The default.
|
||||
Default = 0,
|
||||
|
||||
//! A comment.
|
||||
Comment = 1,
|
||||
|
||||
//! A number.
|
||||
Number = 2,
|
||||
|
||||
//! A double-quoted string.
|
||||
DoubleQuotedString = 3,
|
||||
|
||||
//! An operator.
|
||||
Operator = 4,
|
||||
|
||||
//! An identifier.
|
||||
Identifier = 5,
|
||||
|
||||
//! A CPU instruction.
|
||||
CPUInstruction = 6,
|
||||
|
||||
//! An FPU instruction.
|
||||
FPUInstruction = 7,
|
||||
|
||||
//! A register.
|
||||
Register = 8,
|
||||
|
||||
//! A directive.
|
||||
Directive = 9,
|
||||
|
||||
//! A directive operand.
|
||||
DirectiveOperand = 11,
|
||||
|
||||
//! A block comment.
|
||||
BlockComment = 12,
|
||||
|
||||
//! A single-quoted string.
|
||||
SingleQuotedString = 13,
|
||||
|
||||
//! The end of a line where a string is not closed.
|
||||
UnclosedString = 14,
|
||||
|
||||
//! An extended instruction.
|
||||
ExtendedInstruction = 16,
|
||||
|
||||
//! A comment directive.
|
||||
CommentDirective = 17,
|
||||
};
|
||||
|
||||
//! Construct a QsciLexerAsm with parent \a parent. \a parent is
|
||||
//! typically the QsciScintilla instance.
|
||||
QsciLexerAsm(QObject *parent = 0);
|
||||
|
||||
//! Destroys the QsciLexerAsm instance.
|
||||
virtual ~QsciLexerAsm();
|
||||
|
||||
//! Returns the foreground colour of the text for style number \a style.
|
||||
QColor defaultColor(int style) const;
|
||||
|
||||
//! Returns the end-of-line fill for style number \a style.
|
||||
bool defaultEolFill(int style) const;
|
||||
|
||||
//! Returns the font for style number \a style.
|
||||
QFont defaultFont(int style) const;
|
||||
|
||||
//! Returns the background colour of the text for style number \a style.
|
||||
//!
|
||||
//! \sa defaultColor()
|
||||
QColor defaultPaper(int style) const;
|
||||
|
||||
//! Returns the set of keywords for the keyword set \a set recognised
|
||||
//! by the lexer as a space separated string. Set 1 is normally used for
|
||||
//! CPU instructions. Set 2 is normally used for FPU instructions. Set 3
|
||||
//! is normally used for register names. Set 4 is normally used for
|
||||
//! directives. Set 5 is normally used for directive operands. Set 6 is
|
||||
//! normally used for extended instructions.
|
||||
const char *keywords(int set) const;
|
||||
|
||||
//! Returns the descriptive name for style number \a style. If the
|
||||
//! style is invalid for this language then an empty QString is returned.
|
||||
//! This is intended to be used in user preference dialogs.
|
||||
QString description(int style) const;
|
||||
|
||||
//! Causes all properties to be refreshed by emitting the propertyChanged()
|
||||
//! signal as required.
|
||||
void refreshProperties();
|
||||
|
||||
//! Returns true if multi-line comment blocks can be folded.
|
||||
//!
|
||||
//! \sa setFoldComments()
|
||||
bool foldComments() const;
|
||||
|
||||
//! Returns true if trailing blank lines are included in a fold block.
|
||||
//!
|
||||
//! \sa setFoldCompact()
|
||||
bool foldCompact() const;
|
||||
|
||||
//! Returns the delimiter used by the COMMENT directive.
|
||||
//!
|
||||
//! \sa setCommentDelimiter()
|
||||
QChar commentDelimiter() const;
|
||||
|
||||
//! Returns true if syntax-based folding is enabled.
|
||||
//!
|
||||
//! \sa setFoldSyntaxBased()
|
||||
bool foldSyntaxBased() const;
|
||||
|
||||
public slots:
|
||||
//! If \a fold is true then multi-line comment blocks can be folded.
|
||||
//! The default is true.
|
||||
//!
|
||||
//! \sa foldComments()
|
||||
virtual void setFoldComments(bool fold);
|
||||
|
||||
//! If \a fold is true then trailing blank lines are included in a fold
|
||||
//! block. The default is true.
|
||||
//!
|
||||
//! \sa foldCompact()
|
||||
virtual void setFoldCompact(bool fold);
|
||||
|
||||
//! \a delimiter is the character used for the COMMENT directive's
|
||||
//! delimiter. The default is '~'.
|
||||
//!
|
||||
//! \sa commentDelimiter()
|
||||
virtual void setCommentDelimiter(QChar delimeter);
|
||||
|
||||
//! If \a syntax_based is true then syntax-based folding is enabled. The
|
||||
//! default is true.
|
||||
//!
|
||||
//! \sa foldSyntaxBased()
|
||||
virtual void setFoldSyntaxBased(bool syntax_based);
|
||||
|
||||
protected:
|
||||
//! The lexer's properties are read from the settings \a qs. \a prefix
|
||||
//! (which has a trailing '/') should be used as a prefix to the key of
|
||||
//! each setting. true is returned if there is no error.
|
||||
//!
|
||||
bool readProperties(QSettings &qs, const QString &prefix);
|
||||
|
||||
//! The lexer's properties are written to the settings \a qs.
|
||||
//! \a prefix (which has a trailing '/') should be used as a prefix to
|
||||
//! the key of each setting. true is returned if there is no error.
|
||||
//!
|
||||
bool writeProperties(QSettings &qs, const QString &prefix) const;
|
||||
|
||||
private:
|
||||
void setCommentProp();
|
||||
void setCompactProp();
|
||||
void setCommentDelimiterProp();
|
||||
void setSyntaxBasedProp();
|
||||
|
||||
bool fold_comments;
|
||||
bool fold_compact;
|
||||
QChar comment_delimiter;
|
||||
bool fold_syntax_based;
|
||||
|
||||
QsciLexerAsm(const QsciLexerAsm &);
|
||||
QsciLexerAsm &operator=(const QsciLexerAsm &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
// This defines the interface to the QsciLexerAVS class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCILEXERAVS_H
|
||||
#define QSCILEXERAVS_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
#include <Qsci/qscilexer.h>
|
||||
|
||||
|
||||
//! \brief The QsciLexerAVS class encapsulates the Scintilla AVS lexer.
|
||||
class QSCINTILLA_EXPORT QsciLexerAVS : public QsciLexer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! This enum defines the meanings of the different styles used by the
|
||||
//! AVS lexer.
|
||||
enum {
|
||||
//! The default.
|
||||
Default = 0,
|
||||
|
||||
//! A block comment.
|
||||
BlockComment = 1,
|
||||
|
||||
//! A nested block comment.
|
||||
NestedBlockComment = 2,
|
||||
|
||||
//! A line comment.
|
||||
LineComment = 3,
|
||||
|
||||
//! A number.
|
||||
Number = 4,
|
||||
|
||||
//! An operator.
|
||||
Operator = 5,
|
||||
|
||||
//! An identifier
|
||||
Identifier = 6,
|
||||
|
||||
//! A string.
|
||||
String = 7,
|
||||
|
||||
//! A triple quoted string.
|
||||
TripleString = 8,
|
||||
|
||||
//! A keyword (as defined by keyword set number 1)..
|
||||
Keyword = 9,
|
||||
|
||||
//! A filter (as defined by keyword set number 2).
|
||||
Filter = 10,
|
||||
|
||||
//! A plugin (as defined by keyword set number 3).
|
||||
Plugin = 11,
|
||||
|
||||
//! A function (as defined by keyword set number 4).
|
||||
Function = 12,
|
||||
|
||||
//! A clip property (as defined by keyword set number 5).
|
||||
ClipProperty = 13,
|
||||
|
||||
//! A keyword defined in keyword set number 6. The class must be
|
||||
//! sub-classed and re-implement keywords() to make use of this style.
|
||||
KeywordSet6 = 14
|
||||
};
|
||||
|
||||
//! Construct a QsciLexerAVS with parent \a parent. \a parent is typically
|
||||
//! the QsciScintilla instance.
|
||||
QsciLexerAVS(QObject *parent = 0);
|
||||
|
||||
//! Destroys the QsciLexerAVS instance.
|
||||
virtual ~QsciLexerAVS();
|
||||
|
||||
//! Returns the name of the language.
|
||||
const char *language() const;
|
||||
|
||||
//! Returns the name of the lexer. Some lexers support a number of
|
||||
//! languages.
|
||||
const char *lexer() const;
|
||||
|
||||
//! \internal Returns the style used for braces for brace matching.
|
||||
int braceStyle() const;
|
||||
|
||||
//! Returns the string of characters that comprise a word.
|
||||
const char *wordCharacters() const;
|
||||
|
||||
//! Returns the foreground colour of the text for style number \a style.
|
||||
//!
|
||||
//! \sa defaultPaper()
|
||||
QColor defaultColor(int style) const;
|
||||
|
||||
//! Returns the font for style number \a style.
|
||||
QFont defaultFont(int style) const;
|
||||
|
||||
//! Returns the set of keywords for the keyword set \a set recognised
|
||||
//! by the lexer as a space separated string.
|
||||
const char *keywords(int set) const;
|
||||
|
||||
//! Returns the descriptive name for style number \a style. If the
|
||||
//! style is invalid for this language then an empty QString is returned.
|
||||
//! This is intended to be used in user preference dialogs.
|
||||
QString description(int style) const;
|
||||
|
||||
//! Causes all properties to be refreshed by emitting the propertyChanged()
|
||||
//! signal as required.
|
||||
void refreshProperties();
|
||||
|
||||
//! Returns true if multi-line comment blocks can be folded.
|
||||
//!
|
||||
//! \sa setFoldComments()
|
||||
bool foldComments() const;
|
||||
|
||||
//! Returns true if trailing blank lines are included in a fold block.
|
||||
//!
|
||||
//! \sa setFoldCompact()
|
||||
bool foldCompact() const;
|
||||
|
||||
public slots:
|
||||
//! If \a fold is true then multi-line comment blocks can be folded.
|
||||
//! The default is false.
|
||||
//!
|
||||
//! \sa foldComments()
|
||||
virtual void setFoldComments(bool fold);
|
||||
|
||||
//! If \a fold is true then trailing blank lines are included in a fold
|
||||
//! block. The default is true.
|
||||
//!
|
||||
//! \sa foldCompact()
|
||||
virtual void setFoldCompact(bool fold);
|
||||
|
||||
protected:
|
||||
//! The lexer's properties are read from the settings \a qs. \a prefix
|
||||
//! (which has a trailing '/') should be used as a prefix to the key of
|
||||
//! each setting. true is returned if there is no error.
|
||||
//!
|
||||
bool readProperties(QSettings &qs,const QString &prefix);
|
||||
|
||||
//! The lexer's properties are written to the settings \a qs.
|
||||
//! \a prefix (which has a trailing '/') should be used as a prefix to
|
||||
//! the key of each setting. true is returned if there is no error.
|
||||
//!
|
||||
bool writeProperties(QSettings &qs,const QString &prefix) const;
|
||||
|
||||
private:
|
||||
void setCommentProp();
|
||||
void setCompactProp();
|
||||
|
||||
bool fold_comments;
|
||||
bool fold_compact;
|
||||
|
||||
QsciLexerAVS(const QsciLexerAVS &);
|
||||
QsciLexerAVS &operator=(const QsciLexerAVS &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,178 @@
|
|||
// This defines the interface to the QsciLexerBash class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCILEXERBASH_H
|
||||
#define QSCILEXERBASH_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
#include <Qsci/qscilexer.h>
|
||||
|
||||
|
||||
//! \brief The QsciLexerBash class encapsulates the Scintilla Bash lexer.
|
||||
class QSCINTILLA_EXPORT QsciLexerBash : public QsciLexer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! This enum defines the meanings of the different styles used by the
|
||||
//! Bash lexer.
|
||||
enum {
|
||||
//! The default.
|
||||
Default = 0,
|
||||
|
||||
//! An error.
|
||||
Error = 1,
|
||||
|
||||
//! A comment.
|
||||
Comment = 2,
|
||||
|
||||
//! A number.
|
||||
Number = 3,
|
||||
|
||||
//! A keyword.
|
||||
Keyword = 4,
|
||||
|
||||
//! A double-quoted string.
|
||||
DoubleQuotedString = 5,
|
||||
|
||||
//! A single-quoted string.
|
||||
SingleQuotedString = 6,
|
||||
|
||||
//! An operator.
|
||||
Operator = 7,
|
||||
|
||||
//! An identifier
|
||||
Identifier = 8,
|
||||
|
||||
//! A scalar.
|
||||
Scalar = 9,
|
||||
|
||||
//! Parameter expansion.
|
||||
ParameterExpansion = 10,
|
||||
|
||||
//! Backticks.
|
||||
Backticks = 11,
|
||||
|
||||
//! A here document delimiter.
|
||||
HereDocumentDelimiter = 12,
|
||||
|
||||
//! A single quoted here document.
|
||||
SingleQuotedHereDocument = 13
|
||||
};
|
||||
|
||||
//! Construct a QsciLexerBash with parent \a parent. \a parent is
|
||||
//! typically the QsciScintilla instance.
|
||||
QsciLexerBash(QObject *parent = 0);
|
||||
|
||||
//! Destroys the QsciLexerBash instance.
|
||||
virtual ~QsciLexerBash();
|
||||
|
||||
//! Returns the name of the language.
|
||||
const char *language() const;
|
||||
|
||||
//! Returns the name of the lexer. Some lexers support a number of
|
||||
//! languages.
|
||||
const char *lexer() const;
|
||||
|
||||
//! \internal Returns the style used for braces for brace matching.
|
||||
int braceStyle() const;
|
||||
|
||||
//! Returns the string of characters that comprise a word.
|
||||
const char *wordCharacters() const;
|
||||
|
||||
//! Returns the foreground colour of the text for style number \a style.
|
||||
//!
|
||||
//! \sa defaultPaper()
|
||||
QColor defaultColor(int style) const;
|
||||
|
||||
//! Returns the end-of-line fill for style number \a style.
|
||||
bool defaultEolFill(int style) const;
|
||||
|
||||
//! Returns the font for style number \a style.
|
||||
QFont defaultFont(int style) const;
|
||||
|
||||
//! Returns the background colour of the text for style number \a style.
|
||||
//!
|
||||
//! \sa defaultColor()
|
||||
QColor defaultPaper(int style) const;
|
||||
|
||||
//! Returns the set of keywords for the keyword set \a set recognised
|
||||
//! by the lexer as a space separated string.
|
||||
const char *keywords(int set) const;
|
||||
|
||||
//! Returns the descriptive name for style number \a style. If the
|
||||
//! style is invalid for this language then an empty QString is returned.
|
||||
//! This is intended to be used in user preference dialogs.
|
||||
QString description(int style) const;
|
||||
|
||||
//! Causes all properties to be refreshed by emitting the
|
||||
//! propertyChanged() signal as required.
|
||||
void refreshProperties();
|
||||
|
||||
//! Returns true if multi-line comment blocks can be folded.
|
||||
//!
|
||||
//! \sa setFoldComments()
|
||||
bool foldComments() const;
|
||||
|
||||
//! Returns true if trailing blank lines are included in a fold block.
|
||||
//!
|
||||
//! \sa setFoldCompact()
|
||||
bool foldCompact() const;
|
||||
|
||||
public slots:
|
||||
//! If \a fold is true then multi-line comment blocks can be folded.
|
||||
//! The default is false.
|
||||
//!
|
||||
//! \sa foldComments()
|
||||
virtual void setFoldComments(bool fold);
|
||||
|
||||
//! If \a fold is true then trailing blank lines are included in a fold
|
||||
//! block. The default is true.
|
||||
//!
|
||||
//! \sa foldCompact()
|
||||
virtual void setFoldCompact(bool fold);
|
||||
|
||||
protected:
|
||||
//! The lexer's properties are read from the settings \a qs. \a prefix
|
||||
//! (which has a trailing '/') should be used as a prefix to the key of
|
||||
//! each setting. true is returned if there is no error.
|
||||
//!
|
||||
bool readProperties(QSettings &qs,const QString &prefix);
|
||||
|
||||
//! The lexer's properties are written to the settings \a qs.
|
||||
//! \a prefix (which has a trailing '/') should be used as a prefix to
|
||||
//! the key of each setting. true is returned if there is no error.
|
||||
//!
|
||||
bool writeProperties(QSettings &qs,const QString &prefix) const;
|
||||
|
||||
private:
|
||||
void setCommentProp();
|
||||
void setCompactProp();
|
||||
|
||||
bool fold_comments;
|
||||
bool fold_compact;
|
||||
|
||||
QsciLexerBash(const QsciLexerBash &);
|
||||
QsciLexerBash &operator=(const QsciLexerBash &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
// This defines the interface to the QsciLexerBatch class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCILEXERBATCH_H
|
||||
#define QSCILEXERBATCH_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
#include <Qsci/qscilexer.h>
|
||||
|
||||
|
||||
//! \brief The QsciLexerBatch class encapsulates the Scintilla batch file
|
||||
//! lexer.
|
||||
class QSCINTILLA_EXPORT QsciLexerBatch : public QsciLexer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! This enum defines the meanings of the different styles used by the
|
||||
//! batch file lexer.
|
||||
enum {
|
||||
//! The default.
|
||||
Default = 0,
|
||||
|
||||
//! A comment.
|
||||
Comment = 1,
|
||||
|
||||
//! A keyword.
|
||||
Keyword = 2,
|
||||
|
||||
//! A label.
|
||||
Label = 3,
|
||||
|
||||
//! An hide command character.
|
||||
HideCommandChar = 4,
|
||||
|
||||
//! An external command .
|
||||
ExternalCommand = 5,
|
||||
|
||||
//! A variable.
|
||||
Variable = 6,
|
||||
|
||||
//! An operator
|
||||
Operator = 7
|
||||
};
|
||||
|
||||
//! Construct a QsciLexerBatch with parent \a parent. \a parent is
|
||||
//! typically the QsciScintilla instance.
|
||||
QsciLexerBatch(QObject *parent = 0);
|
||||
|
||||
//! Destroys the QsciLexerBatch instance.
|
||||
virtual ~QsciLexerBatch();
|
||||
|
||||
//! Returns the name of the language.
|
||||
const char *language() const;
|
||||
|
||||
//! Returns the name of the lexer. Some lexers support a number of
|
||||
//! languages.
|
||||
const char *lexer() const;
|
||||
|
||||
//! Returns the string of characters that comprise a word.
|
||||
const char *wordCharacters() const;
|
||||
|
||||
//! \internal Returns true if the language is case sensitive.
|
||||
bool caseSensitive() const;
|
||||
|
||||
//! Returns the foreground colour of the text for style number \a style.
|
||||
//!
|
||||
//! \sa defaultPaper()
|
||||
QColor defaultColor(int style) const;
|
||||
|
||||
//! Returns the end-of-line fill for style number \a style.
|
||||
bool defaultEolFill(int style) const;
|
||||
|
||||
//! Returns the font for style number \a style.
|
||||
QFont defaultFont(int style) const;
|
||||
|
||||
//! Returns the background colour of the text for style number \a style.
|
||||
//!
|
||||
//! \sa defaultColor()
|
||||
QColor defaultPaper(int style) const;
|
||||
|
||||
//! Returns the set of keywords for the keyword set \a set recognised
|
||||
//! by the lexer as a space separated string.
|
||||
const char *keywords(int set) const;
|
||||
|
||||
//! Returns the descriptive name for style number \a style. If the
|
||||
//! style is invalid for this language then an empty QString is returned.
|
||||
//! This is intended to be used in user preference dialogs.
|
||||
QString description(int style) const;
|
||||
|
||||
private:
|
||||
QsciLexerBatch(const QsciLexerBatch &);
|
||||
QsciLexerBatch &operator=(const QsciLexerBatch &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
// This defines the interface to the QsciLexerCMake class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCILEXERCMAKE_H
|
||||
#define QSCILEXERCMAKE_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
#include <Qsci/qscilexer.h>
|
||||
|
||||
|
||||
//! \brief The QsciLexerCMake class encapsulates the Scintilla CMake lexer.
|
||||
class QSCINTILLA_EXPORT QsciLexerCMake : public QsciLexer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! This enum defines the meanings of the different styles used by the
|
||||
//! CMake lexer.
|
||||
enum {
|
||||
//! The default.
|
||||
Default = 0,
|
||||
|
||||
//! A comment.
|
||||
Comment = 1,
|
||||
|
||||
//! A string.
|
||||
String = 2,
|
||||
|
||||
//! A left quoted string.
|
||||
StringLeftQuote = 3,
|
||||
|
||||
//! A right quoted string.
|
||||
StringRightQuote = 4,
|
||||
|
||||
//! A function. (Defined by keyword set number 1.)
|
||||
Function = 5,
|
||||
|
||||
//! A variable. (Defined by keyword set number 2.)
|
||||
Variable = 6,
|
||||
|
||||
//! A label.
|
||||
Label = 7,
|
||||
|
||||
//! A keyword defined in keyword set number 3. The class must be
|
||||
//! sub-classed and re-implement keywords() to make use of this style.
|
||||
KeywordSet3 = 8,
|
||||
|
||||
//! A WHILE block.
|
||||
BlockWhile = 9,
|
||||
|
||||
//! A FOREACH block.
|
||||
BlockForeach = 10,
|
||||
|
||||
//! An IF block.
|
||||
BlockIf = 11,
|
||||
|
||||
//! A MACRO block.
|
||||
BlockMacro = 12,
|
||||
|
||||
//! A variable within a string.
|
||||
StringVariable = 13,
|
||||
|
||||
//! A number.
|
||||
Number = 14
|
||||
};
|
||||
|
||||
//! Construct a QsciLexerCMake with parent \a parent. \a parent is
|
||||
//! typically the QsciScintilla instance.
|
||||
QsciLexerCMake(QObject *parent = 0);
|
||||
|
||||
//! Destroys the QsciLexerCMake instance.
|
||||
virtual ~QsciLexerCMake();
|
||||
|
||||
//! Returns the name of the language.
|
||||
const char *language() const;
|
||||
|
||||
//! Returns the name of the lexer. Some lexers support a number of
|
||||
//! languages.
|
||||
const char *lexer() const;
|
||||
|
||||
//! Returns the foreground colour of the text for style number \a style.
|
||||
//!
|
||||
//! \sa defaultPaper()
|
||||
QColor defaultColor(int style) const;
|
||||
|
||||
//! Returns the font for style number \a style.
|
||||
QFont defaultFont(int style) const;
|
||||
|
||||
//! Returns the background colour of the text for style number \a style.
|
||||
//!
|
||||
//! \sa defaultColor()
|
||||
QColor defaultPaper(int style) const;
|
||||
|
||||
//! Returns the set of keywords for the keyword set \a set recognised
|
||||
//! by the lexer as a space separated string.
|
||||
const char *keywords(int set) const;
|
||||
|
||||
//! Returns the descriptive name for style number \a style. If the
|
||||
//! style is invalid for this language then an empty QString is returned.
|
||||
//! This is intended to be used in user preference dialogs.
|
||||
QString description(int style) const;
|
||||
|
||||
//! Causes all properties to be refreshed by emitting the propertyChanged()
|
||||
//! signal as required.
|
||||
void refreshProperties();
|
||||
|
||||
//! Returns true if ELSE blocks can be folded.
|
||||
//!
|
||||
//! \sa setFoldAtElse()
|
||||
bool foldAtElse() const;
|
||||
|
||||
public slots:
|
||||
//! If \a fold is true then ELSE blocks can be folded. The default is
|
||||
//! false.
|
||||
//!
|
||||
//! \sa foldAtElse()
|
||||
virtual void setFoldAtElse(bool fold);
|
||||
|
||||
protected:
|
||||
//! The lexer's properties are read from the settings \a qs. \a prefix
|
||||
//! (which has a trailing '/') should be used as a prefix to the key of
|
||||
//! each setting. true is returned if there is no error.
|
||||
//!
|
||||
bool readProperties(QSettings &qs,const QString &prefix);
|
||||
|
||||
//! The lexer's properties are written to the settings \a qs.
|
||||
//! \a prefix (which has a trailing '/') should be used as a prefix to
|
||||
//! the key of each setting. true is returned if there is no error.
|
||||
//!
|
||||
bool writeProperties(QSettings &qs,const QString &prefix) const;
|
||||
|
||||
private:
|
||||
void setAtElseProp();
|
||||
|
||||
bool fold_atelse;
|
||||
|
||||
QsciLexerCMake(const QsciLexerCMake &);
|
||||
QsciLexerCMake &operator=(const QsciLexerCMake &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,264 @@
|
|||
// This defines the interface to the QsciLexerCoffeeScript class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCILEXERCOFFEESCRIPT_H
|
||||
#define QSCILEXERCOFFEESCRIPT_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
#include <Qsci/qscilexer.h>
|
||||
|
||||
|
||||
//! \brief The QsciLexerCoffeeScript class encapsulates the Scintilla
|
||||
//! CoffeeScript lexer.
|
||||
class QSCINTILLA_EXPORT QsciLexerCoffeeScript : public QsciLexer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! This enum defines the meanings of the different styles used by the
|
||||
//! C++ lexer.
|
||||
enum {
|
||||
//! The default.
|
||||
Default = 0,
|
||||
|
||||
//! A C-style comment.
|
||||
Comment = 1,
|
||||
|
||||
//! A C++-style comment line.
|
||||
CommentLine = 2,
|
||||
|
||||
//! A JavaDoc/Doxygen C-style comment.
|
||||
CommentDoc = 3,
|
||||
|
||||
//! A number.
|
||||
Number = 4,
|
||||
|
||||
//! A keyword.
|
||||
Keyword = 5,
|
||||
|
||||
//! A double-quoted string.
|
||||
DoubleQuotedString = 6,
|
||||
|
||||
//! A single-quoted string.
|
||||
SingleQuotedString = 7,
|
||||
|
||||
//! An IDL UUID.
|
||||
UUID = 8,
|
||||
|
||||
//! A pre-processor block.
|
||||
PreProcessor = 9,
|
||||
|
||||
//! An operator.
|
||||
Operator = 10,
|
||||
|
||||
//! An identifier
|
||||
Identifier = 11,
|
||||
|
||||
//! The end of a line where a string is not closed.
|
||||
UnclosedString = 12,
|
||||
|
||||
//! A C# verbatim string.
|
||||
VerbatimString = 13,
|
||||
|
||||
//! A regular expression.
|
||||
Regex = 14,
|
||||
|
||||
//! A JavaDoc/Doxygen C++-style comment line.
|
||||
CommentLineDoc = 15,
|
||||
|
||||
//! A keyword defined in keyword set number 2. The class must be
|
||||
//! sub-classed and re-implement keywords() to make use of this style.
|
||||
KeywordSet2 = 16,
|
||||
|
||||
//! A JavaDoc/Doxygen keyword.
|
||||
CommentDocKeyword = 17,
|
||||
|
||||
//! A JavaDoc/Doxygen keyword error defined in keyword set number 3.
|
||||
//! The class must be sub-classed and re-implement keywords() to make
|
||||
//! use of this style.
|
||||
CommentDocKeywordError = 18,
|
||||
|
||||
//! A global class defined in keyword set number 4. The class must be
|
||||
//! sub-classed and re-implement keywords() to make use of this style.
|
||||
GlobalClass = 19,
|
||||
|
||||
//! A block comment.
|
||||
CommentBlock = 22,
|
||||
|
||||
//! A block regular expression.
|
||||
BlockRegex = 23,
|
||||
|
||||
//! A block regular expression comment.
|
||||
BlockRegexComment = 24,
|
||||
|
||||
//! An instance property.
|
||||
InstanceProperty = 25,
|
||||
};
|
||||
|
||||
//! Construct a QsciLexerCoffeeScript with parent \a parent. \a parent is
|
||||
//! typically the QsciScintilla instance.
|
||||
QsciLexerCoffeeScript(QObject *parent = 0);
|
||||
|
||||
//! Destroys the QsciLexerCoffeeScript instance.
|
||||
virtual ~QsciLexerCoffeeScript();
|
||||
|
||||
//! Returns the name of the language.
|
||||
const char *language() const;
|
||||
|
||||
//! Returns the name of the lexer. Some lexers support a number of
|
||||
//! languages.
|
||||
const char *lexer() const;
|
||||
|
||||
//! \internal Returns the character sequences that can separate
|
||||
//! auto-completion words.
|
||||
QStringList autoCompletionWordSeparators() const;
|
||||
|
||||
//! \internal Returns a space separated list of words or characters in
|
||||
//! a particular style that define the end of a block for
|
||||
//! auto-indentation. The styles is returned via \a style.
|
||||
const char *blockEnd(int *style = 0) const;
|
||||
|
||||
//! \internal Returns a space separated list of words or characters in
|
||||
//! a particular style that define the start of a block for
|
||||
//! auto-indentation. The styles is returned via \a style.
|
||||
const char *blockStart(int *style = 0) const;
|
||||
|
||||
//! \internal Returns a space separated list of keywords in a
|
||||
//! particular style that define the start of a block for
|
||||
//! auto-indentation. The styles is returned via \a style.
|
||||
const char *blockStartKeyword(int *style = 0) const;
|
||||
|
||||
//! \internal Returns the style used for braces for brace matching.
|
||||
int braceStyle() const;
|
||||
|
||||
//! Returns the string of characters that comprise a word.
|
||||
const char *wordCharacters() const;
|
||||
|
||||
//! Returns the foreground colour of the text for style number \a style.
|
||||
//!
|
||||
//! \sa defaultPaper()
|
||||
QColor defaultColor(int style) const;
|
||||
|
||||
//! Returns the end-of-line fill for style number \a style.
|
||||
bool defaultEolFill(int style) const;
|
||||
|
||||
//! Returns the font for style number \a style.
|
||||
QFont defaultFont(int style) const;
|
||||
|
||||
//! Returns the background colour of the text for style number \a style.
|
||||
//!
|
||||
//! \sa defaultColor()
|
||||
QColor defaultPaper(int style) const;
|
||||
|
||||
//! Returns the set of keywords for the keyword set \a set recognised
|
||||
//! by the lexer as a space separated string. Set 1 is normally used for
|
||||
//! primary keywords and identifiers. Set 2 is normally used for secondary
|
||||
//! keywords and identifiers. Set 3 is normally used for documentation
|
||||
//! comment keywords. Set 4 is normally used for global classes and
|
||||
//! typedefs.
|
||||
const char *keywords(int set) const;
|
||||
|
||||
//! Returns the descriptive name for style number \a style. If the
|
||||
//! style is invalid for this language then an empty QString is returned.
|
||||
//! This is intended to be used in user preference dialogs.
|
||||
QString description(int style) const;
|
||||
|
||||
//! Causes all properties to be refreshed by emitting the
|
||||
//! propertyChanged() signal as required.
|
||||
void refreshProperties();
|
||||
|
||||
//! Returns true if '$' characters are allowed in identifier names.
|
||||
//!
|
||||
//! \sa setDollarsAllowed()
|
||||
bool dollarsAllowed() const {return dollars;}
|
||||
|
||||
//! If \a allowed is true then '$' characters are allowed in identifier
|
||||
//! names. The default is true.
|
||||
//!
|
||||
//! \sa dollarsAllowed()
|
||||
void setDollarsAllowed(bool allowed);
|
||||
|
||||
//! Returns true if multi-line comment blocks can be folded.
|
||||
//!
|
||||
//! \sa setFoldComments()
|
||||
bool foldComments() const {return fold_comments;}
|
||||
|
||||
//! If \a fold is true then multi-line comment blocks can be folded.
|
||||
//! The default is false.
|
||||
//!
|
||||
//! \sa foldComments()
|
||||
void setFoldComments(bool fold);
|
||||
|
||||
//! Returns true if trailing blank lines are included in a fold block.
|
||||
//!
|
||||
//! \sa setFoldCompact()
|
||||
bool foldCompact() const {return fold_compact;}
|
||||
|
||||
//! If \a fold is true then trailing blank lines are included in a fold
|
||||
//! block. The default is true.
|
||||
//!
|
||||
//! \sa foldCompact()
|
||||
void setFoldCompact(bool fold);
|
||||
|
||||
//! Returns true if preprocessor lines (after the preprocessor
|
||||
//! directive) are styled.
|
||||
//!
|
||||
//! \sa setStylePreprocessor()
|
||||
bool stylePreprocessor() const {return style_preproc;}
|
||||
|
||||
//! If \a style is true then preprocessor lines (after the preprocessor
|
||||
//! directive) are styled. The default is false.
|
||||
//!
|
||||
//! \sa stylePreprocessor()
|
||||
void setStylePreprocessor(bool style);
|
||||
|
||||
protected:
|
||||
//! The lexer's properties are read from the settings \a qs. \a prefix
|
||||
//! (which has a trailing '/') should be used as a prefix to the key of
|
||||
//! each setting. true is returned if there is no error.
|
||||
//!
|
||||
//! \sa writeProperties()
|
||||
bool readProperties(QSettings &qs,const QString &prefix);
|
||||
|
||||
//! The lexer's properties are written to the settings \a qs.
|
||||
//! \a prefix (which has a trailing '/') should be used as a prefix to
|
||||
//! the key of each setting. true is returned if there is no error.
|
||||
//!
|
||||
//! \sa readProperties()
|
||||
bool writeProperties(QSettings &qs,const QString &prefix) const;
|
||||
|
||||
private:
|
||||
void setCommentProp();
|
||||
void setCompactProp();
|
||||
void setStylePreprocProp();
|
||||
void setDollarsProp();
|
||||
|
||||
bool fold_comments;
|
||||
bool fold_compact;
|
||||
bool style_preproc;
|
||||
bool dollars;
|
||||
|
||||
QsciLexerCoffeeScript(const QsciLexerCoffeeScript &);
|
||||
QsciLexerCoffeeScript &operator=(const QsciLexerCoffeeScript &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,398 @@
|
|||
// This defines the interface to the QsciLexerCPP class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCILEXERCPP_H
|
||||
#define QSCILEXERCPP_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
#include <Qsci/qscilexer.h>
|
||||
|
||||
|
||||
//! \brief The QsciLexerCPP class encapsulates the Scintilla C++
|
||||
//! lexer.
|
||||
class QSCINTILLA_EXPORT QsciLexerCPP : public QsciLexer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! This enum defines the meanings of the different styles used by the
|
||||
//! C++ lexer.
|
||||
enum {
|
||||
//! The default.
|
||||
Default = 0,
|
||||
InactiveDefault = Default + 64,
|
||||
|
||||
//! A C comment.
|
||||
Comment = 1,
|
||||
InactiveComment = Comment + 64,
|
||||
|
||||
//! A C++ comment line.
|
||||
CommentLine = 2,
|
||||
InactiveCommentLine = CommentLine + 64,
|
||||
|
||||
//! A JavaDoc/Doxygen style C comment.
|
||||
CommentDoc = 3,
|
||||
InactiveCommentDoc = CommentDoc + 64,
|
||||
|
||||
//! A number.
|
||||
Number = 4,
|
||||
InactiveNumber = Number + 64,
|
||||
|
||||
//! A keyword.
|
||||
Keyword = 5,
|
||||
InactiveKeyword = Keyword + 64,
|
||||
|
||||
//! A double-quoted string.
|
||||
DoubleQuotedString = 6,
|
||||
InactiveDoubleQuotedString = DoubleQuotedString + 64,
|
||||
|
||||
//! A single-quoted string.
|
||||
SingleQuotedString = 7,
|
||||
InactiveSingleQuotedString = SingleQuotedString + 64,
|
||||
|
||||
//! An IDL UUID.
|
||||
UUID = 8,
|
||||
InactiveUUID = UUID + 64,
|
||||
|
||||
//! A pre-processor block.
|
||||
PreProcessor = 9,
|
||||
InactivePreProcessor = PreProcessor + 64,
|
||||
|
||||
//! An operator.
|
||||
Operator = 10,
|
||||
InactiveOperator = Operator + 64,
|
||||
|
||||
//! An identifier
|
||||
Identifier = 11,
|
||||
InactiveIdentifier = Identifier + 64,
|
||||
|
||||
//! The end of a line where a string is not closed.
|
||||
UnclosedString = 12,
|
||||
InactiveUnclosedString = UnclosedString + 64,
|
||||
|
||||
//! A C# verbatim string.
|
||||
VerbatimString = 13,
|
||||
InactiveVerbatimString = VerbatimString + 64,
|
||||
|
||||
//! A JavaScript regular expression.
|
||||
Regex = 14,
|
||||
InactiveRegex = Regex + 64,
|
||||
|
||||
//! A JavaDoc/Doxygen style C++ comment line.
|
||||
CommentLineDoc = 15,
|
||||
InactiveCommentLineDoc = CommentLineDoc + 64,
|
||||
|
||||
//! A keyword defined in keyword set number 2. The class must be
|
||||
//! sub-classed and re-implement keywords() to make use of this style.
|
||||
KeywordSet2 = 16,
|
||||
InactiveKeywordSet2 = KeywordSet2 + 64,
|
||||
|
||||
//! A JavaDoc/Doxygen keyword.
|
||||
CommentDocKeyword = 17,
|
||||
InactiveCommentDocKeyword = CommentDocKeyword + 64,
|
||||
|
||||
//! A JavaDoc/Doxygen keyword error.
|
||||
CommentDocKeywordError = 18,
|
||||
InactiveCommentDocKeywordError = CommentDocKeywordError + 64,
|
||||
|
||||
//! A global class or typedef defined in keyword set number 5. The
|
||||
//! class must be sub-classed and re-implement keywords() to make use
|
||||
//! of this style.
|
||||
GlobalClass = 19,
|
||||
InactiveGlobalClass = GlobalClass + 64,
|
||||
|
||||
//! A C++ raw string.
|
||||
RawString = 20,
|
||||
InactiveRawString = RawString + 64,
|
||||
|
||||
//! A Vala triple-quoted verbatim string.
|
||||
TripleQuotedVerbatimString = 21,
|
||||
InactiveTripleQuotedVerbatimString = TripleQuotedVerbatimString + 64,
|
||||
|
||||
//! A Pike hash-quoted string.
|
||||
HashQuotedString = 22,
|
||||
InactiveHashQuotedString = HashQuotedString + 64,
|
||||
|
||||
//! A pre-processor stream comment.
|
||||
PreProcessorComment = 23,
|
||||
InactivePreProcessorComment = PreProcessorComment + 64,
|
||||
|
||||
//! A JavaDoc/Doxygen style pre-processor comment.
|
||||
PreProcessorCommentLineDoc = 24,
|
||||
InactivePreProcessorCommentLineDoc = PreProcessorCommentLineDoc + 64,
|
||||
|
||||
//! A user-defined literal.
|
||||
UserLiteral = 25,
|
||||
InactiveUserLiteral = UserLiteral + 64,
|
||||
|
||||
//! A task marker.
|
||||
TaskMarker = 26,
|
||||
InactiveTaskMarker = TaskMarker + 64,
|
||||
|
||||
//! An escape sequence.
|
||||
EscapeSequence = 27,
|
||||
InactiveEscapeSequence = EscapeSequence + 64,
|
||||
};
|
||||
|
||||
//! Construct a QsciLexerCPP with parent \a parent. \a parent is typically
|
||||
//! the QsciScintilla instance. \a caseInsensitiveKeywords is true if the
|
||||
//! lexer ignores the case of keywords.
|
||||
QsciLexerCPP(QObject *parent = 0, bool caseInsensitiveKeywords = false);
|
||||
|
||||
//! Destroys the QsciLexerCPP instance.
|
||||
virtual ~QsciLexerCPP();
|
||||
|
||||
//! Returns the name of the language.
|
||||
const char *language() const;
|
||||
|
||||
//! Returns the name of the lexer. Some lexers support a number of
|
||||
//! languages.
|
||||
const char *lexer() const;
|
||||
|
||||
//! \internal Returns the character sequences that can separate
|
||||
//! auto-completion words.
|
||||
QStringList autoCompletionWordSeparators() const;
|
||||
|
||||
//! \internal Returns a space separated list of words or characters in
|
||||
//! a particular style that define the end of a block for
|
||||
//! auto-indentation. The styles is returned via \a style.
|
||||
const char *blockEnd(int *style = 0) const;
|
||||
|
||||
//! \internal Returns a space separated list of words or characters in
|
||||
//! a particular style that define the start of a block for
|
||||
//! auto-indentation. The styles is returned via \a style.
|
||||
const char *blockStart(int *style = 0) const;
|
||||
|
||||
//! \internal Returns a space separated list of keywords in a
|
||||
//! particular style that define the start of a block for
|
||||
//! auto-indentation. The styles is returned via \a style.
|
||||
const char *blockStartKeyword(int *style = 0) const;
|
||||
|
||||
//! \internal Returns the style used for braces for brace matching.
|
||||
int braceStyle() const;
|
||||
|
||||
//! Returns the string of characters that comprise a word.
|
||||
const char *wordCharacters() const;
|
||||
|
||||
//! Returns the foreground colour of the text for style number \a style.
|
||||
//!
|
||||
//! \sa defaultPaper()
|
||||
QColor defaultColor(int style) const;
|
||||
|
||||
//! Returns the end-of-line fill for style number \a style.
|
||||
bool defaultEolFill(int style) const;
|
||||
|
||||
//! Returns the font for style number \a style.
|
||||
QFont defaultFont(int style) const;
|
||||
|
||||
//! Returns the background colour of the text for style number \a style.
|
||||
//!
|
||||
//! \sa defaultColor()
|
||||
QColor defaultPaper(int style) const;
|
||||
|
||||
//! Returns the set of keywords for the keyword set \a set recognised
|
||||
//! by the lexer as a space separated string. Set 1 is normally used for
|
||||
//! primary keywords and identifiers. Set 2 is normally used for secondary
|
||||
//! keywords and identifiers. Set 3 is normally used for documentation
|
||||
//! comment keywords. Set 4 is normally used for global classes and
|
||||
//! typedefs.
|
||||
const char *keywords(int set) const;
|
||||
|
||||
//! Returns the descriptive name for style number \a style. If the
|
||||
//! style is invalid for this language then an empty QString is returned.
|
||||
//! This is intended to be used in user preference dialogs.
|
||||
QString description(int style) const;
|
||||
|
||||
//! Causes all properties to be refreshed by emitting the
|
||||
//! propertyChanged() signal as required.
|
||||
void refreshProperties();
|
||||
|
||||
//! Returns true if "} else {" lines can be folded.
|
||||
//!
|
||||
//! \sa setFoldAtElse()
|
||||
bool foldAtElse() const {return fold_atelse;}
|
||||
|
||||
//! Returns true if multi-line comment blocks can be folded.
|
||||
//!
|
||||
//! \sa setFoldComments()
|
||||
bool foldComments() const {return fold_comments;}
|
||||
|
||||
//! Returns true if trailing blank lines are included in a fold block.
|
||||
//!
|
||||
//! \sa setFoldCompact()
|
||||
bool foldCompact() const {return fold_compact;}
|
||||
|
||||
//! Returns true if preprocessor blocks can be folded.
|
||||
//!
|
||||
//! \sa setFoldPreprocessor()
|
||||
bool foldPreprocessor() const {return fold_preproc;}
|
||||
|
||||
//! Returns true if preprocessor lines (after the preprocessor
|
||||
//! directive) are styled.
|
||||
//!
|
||||
//! \sa setStylePreprocessor()
|
||||
bool stylePreprocessor() const {return style_preproc;}
|
||||
|
||||
//! If \a allowed is true then '$' characters are allowed in identifier
|
||||
//! names. The default is true.
|
||||
//!
|
||||
//! \sa dollarsAllowed()
|
||||
void setDollarsAllowed(bool allowed);
|
||||
|
||||
//! Returns true if '$' characters are allowed in identifier names.
|
||||
//!
|
||||
//! \sa setDollarsAllowed()
|
||||
bool dollarsAllowed() const {return dollars;}
|
||||
|
||||
//! If \a enabled is true then triple quoted strings are highlighted. The
|
||||
//! default is false.
|
||||
//!
|
||||
//! \sa highlightTripleQuotedStrings()
|
||||
void setHighlightTripleQuotedStrings(bool enabled);
|
||||
|
||||
//! Returns true if triple quoted strings should be highlighted.
|
||||
//!
|
||||
//! \sa setHighlightTripleQuotedStrings()
|
||||
bool highlightTripleQuotedStrings() const {return highlight_triple;}
|
||||
|
||||
//! If \a enabled is true then hash quoted strings are highlighted. The
|
||||
//! default is false.
|
||||
//!
|
||||
//! \sa highlightHashQuotedStrings()
|
||||
void setHighlightHashQuotedStrings(bool enabled);
|
||||
|
||||
//! Returns true if hash quoted strings should be highlighted.
|
||||
//!
|
||||
//! \sa setHighlightHashQuotedStrings()
|
||||
bool highlightHashQuotedStrings() const {return highlight_hash;}
|
||||
|
||||
//! If \a enabled is true then back-quoted raw strings are highlighted.
|
||||
//! The default is false.
|
||||
//!
|
||||
//! \sa highlightBackQuotedStrings()
|
||||
void setHighlightBackQuotedStrings(bool enabled);
|
||||
|
||||
//! Returns true if back-quoted raw strings should be highlighted.
|
||||
//!
|
||||
//! \sa setHighlightBackQuotedStrings()
|
||||
bool highlightBackQuotedStrings() const {return highlight_back;}
|
||||
|
||||
//! If \a enabled is true then escape sequences in strings are highlighted.
|
||||
//! The default is false.
|
||||
//!
|
||||
//! \sa highlightEscapeSequences()
|
||||
void setHighlightEscapeSequences(bool enabled);
|
||||
|
||||
//! Returns true if escape sequences in strings should be highlighted.
|
||||
//!
|
||||
//! \sa setHighlightEscapeSequences()
|
||||
bool highlightEscapeSequences() const {return highlight_escape;}
|
||||
|
||||
//! If \a allowed is true then escape sequences are allowed in verbatim
|
||||
//! strings. The default is false.
|
||||
//!
|
||||
//! \sa verbatimStringEscapeSequencesAllowed()
|
||||
void setVerbatimStringEscapeSequencesAllowed(bool allowed);
|
||||
|
||||
//! Returns true if hash quoted strings should be highlighted.
|
||||
//!
|
||||
//! \sa setVerbatimStringEscapeSequencesAllowed()
|
||||
bool verbatimStringEscapeSequencesAllowed() const {return vs_escape;}
|
||||
|
||||
public slots:
|
||||
//! If \a fold is true then "} else {" lines can be folded. The
|
||||
//! default is false.
|
||||
//!
|
||||
//! \sa foldAtElse()
|
||||
virtual void setFoldAtElse(bool fold);
|
||||
|
||||
//! If \a fold is true then multi-line comment blocks can be folded.
|
||||
//! The default is false.
|
||||
//!
|
||||
//! \sa foldComments()
|
||||
virtual void setFoldComments(bool fold);
|
||||
|
||||
//! If \a fold is true then trailing blank lines are included in a fold
|
||||
//! block. The default is true.
|
||||
//!
|
||||
//! \sa foldCompact()
|
||||
virtual void setFoldCompact(bool fold);
|
||||
|
||||
//! If \a fold is true then preprocessor blocks can be folded. The
|
||||
//! default is true.
|
||||
//!
|
||||
//! \sa foldPreprocessor()
|
||||
virtual void setFoldPreprocessor(bool fold);
|
||||
|
||||
//! If \a style is true then preprocessor lines (after the preprocessor
|
||||
//! directive) are styled. The default is false.
|
||||
//!
|
||||
//! \sa stylePreprocessor()
|
||||
virtual void setStylePreprocessor(bool style);
|
||||
|
||||
protected:
|
||||
//! The lexer's properties are read from the settings \a qs. \a prefix
|
||||
//! (which has a trailing '/') should be used as a prefix to the key of
|
||||
//! each setting. true is returned if there is no error.
|
||||
//!
|
||||
//! \sa writeProperties()
|
||||
bool readProperties(QSettings &qs,const QString &prefix);
|
||||
|
||||
//! The lexer's properties are written to the settings \a qs.
|
||||
//! \a prefix (which has a trailing '/') should be used as a prefix to
|
||||
//! the key of each setting. true is returned if there is no error.
|
||||
//!
|
||||
//! \sa readProperties()
|
||||
bool writeProperties(QSettings &qs,const QString &prefix) const;
|
||||
|
||||
private:
|
||||
void setAtElseProp();
|
||||
void setCommentProp();
|
||||
void setCompactProp();
|
||||
void setPreprocProp();
|
||||
void setStylePreprocProp();
|
||||
void setDollarsProp();
|
||||
void setHighlightTripleProp();
|
||||
void setHighlightHashProp();
|
||||
void setHighlightBackProp();
|
||||
void setHighlightEscapeProp();
|
||||
void setVerbatimStringEscapeProp();
|
||||
|
||||
bool fold_atelse;
|
||||
bool fold_comments;
|
||||
bool fold_compact;
|
||||
bool fold_preproc;
|
||||
bool style_preproc;
|
||||
bool dollars;
|
||||
bool highlight_triple;
|
||||
bool highlight_hash;
|
||||
bool highlight_back;
|
||||
bool highlight_escape;
|
||||
bool vs_escape;
|
||||
|
||||
bool nocase;
|
||||
|
||||
QsciLexerCPP(const QsciLexerCPP &);
|
||||
QsciLexerCPP &operator=(const QsciLexerCPP &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
// This defines the interface to the QsciLexerCSharp class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCILEXERCSHARP_H
|
||||
#define QSCILEXERCSHARP_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
#include <Qsci/qscilexercpp.h>
|
||||
|
||||
|
||||
//! \brief The QsciLexerCSharp class encapsulates the Scintilla C#
|
||||
//! lexer.
|
||||
class QSCINTILLA_EXPORT QsciLexerCSharp : public QsciLexerCPP
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Construct a QsciLexerCSharp with parent \a parent. \a parent is
|
||||
//! typically the QsciScintilla instance.
|
||||
QsciLexerCSharp(QObject *parent = 0);
|
||||
|
||||
//! Destroys the QsciLexerCSharp instance.
|
||||
virtual ~QsciLexerCSharp();
|
||||
|
||||
//! Returns the name of the language.
|
||||
const char *language() const;
|
||||
|
||||
//! Returns the foreground colour of the text for style number \a style.
|
||||
//!
|
||||
//! \sa defaultPaper()
|
||||
QColor defaultColor(int style) const;
|
||||
|
||||
//! Returns the end-of-line fill for style number \a style.
|
||||
bool defaultEolFill(int style) const;
|
||||
|
||||
//! Returns the font for style number \a style.
|
||||
QFont defaultFont(int style) const;
|
||||
|
||||
//! Returns the background colour of the text for style number \a style.
|
||||
//!
|
||||
//! \sa defaultColor()
|
||||
QColor defaultPaper(int style) const;
|
||||
|
||||
//! Returns the set of keywords for the keyword set \a set recognised
|
||||
//! by the lexer as a space separated string.
|
||||
const char *keywords(int set) const;
|
||||
|
||||
//! Returns the descriptive name for style number \a style. If the
|
||||
//! style is invalid for this language then an empty QString is returned.
|
||||
//! This is intended to be used in user preference dialogs.
|
||||
QString description(int style) const;
|
||||
|
||||
private:
|
||||
QsciLexerCSharp(const QsciLexerCSharp &);
|
||||
QsciLexerCSharp &operator=(const QsciLexerCSharp &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,252 @@
|
|||
// This defines the interface to the QsciLexerCSS class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCILEXERCSS_H
|
||||
#define QSCILEXERCSS_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
#include <Qsci/qscilexer.h>
|
||||
|
||||
|
||||
//! \brief The QsciLexerCSS class encapsulates the Scintilla CSS lexer.
|
||||
class QSCINTILLA_EXPORT QsciLexerCSS : public QsciLexer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! This enum defines the meanings of the different styles used by the
|
||||
//! CSS lexer.
|
||||
enum {
|
||||
//! The default.
|
||||
Default = 0,
|
||||
|
||||
//! A tag.
|
||||
Tag = 1,
|
||||
|
||||
//! A class selector.
|
||||
ClassSelector = 2,
|
||||
|
||||
//! A pseudo class. The list of pseudo classes is defined by keyword
|
||||
//! set 2.
|
||||
PseudoClass = 3,
|
||||
|
||||
//! An unknown pseudo class.
|
||||
UnknownPseudoClass = 4,
|
||||
|
||||
//! An operator.
|
||||
Operator = 5,
|
||||
|
||||
//! A CSS1 property. The list of CSS1 properties is defined by keyword
|
||||
//! set 1.
|
||||
CSS1Property = 6,
|
||||
|
||||
//! An unknown property.
|
||||
UnknownProperty = 7,
|
||||
|
||||
//! A value.
|
||||
Value = 8,
|
||||
|
||||
//! A comment.
|
||||
Comment = 9,
|
||||
|
||||
//! An ID selector.
|
||||
IDSelector = 10,
|
||||
|
||||
//! An important value.
|
||||
Important = 11,
|
||||
|
||||
//! An @-rule.
|
||||
AtRule = 12,
|
||||
|
||||
//! A double-quoted string.
|
||||
DoubleQuotedString = 13,
|
||||
|
||||
//! A single-quoted string.
|
||||
SingleQuotedString = 14,
|
||||
|
||||
//! A CSS2 property. The list of CSS2 properties is defined by keyword
|
||||
//! set 3.
|
||||
CSS2Property = 15,
|
||||
|
||||
//! An attribute.
|
||||
Attribute = 16,
|
||||
|
||||
//! A CSS3 property. The list of CSS3 properties is defined by keyword
|
||||
//! set 4.
|
||||
CSS3Property = 17,
|
||||
|
||||
//! A pseudo element. The list of pseudo elements is defined by
|
||||
//! keyword set 5.
|
||||
PseudoElement = 18,
|
||||
|
||||
//! An extended (browser specific) CSS property. The list of extended
|
||||
//! CSS properties is defined by keyword set 6.
|
||||
ExtendedCSSProperty = 19,
|
||||
|
||||
//! An extended (browser specific) pseudo class. The list of extended
|
||||
//! pseudo classes is defined by keyword set 7.
|
||||
ExtendedPseudoClass = 20,
|
||||
|
||||
//! An extended (browser specific) pseudo element. The list of
|
||||
//! extended pseudo elements is defined by keyword set 8.
|
||||
ExtendedPseudoElement = 21,
|
||||
|
||||
//! A media rule.
|
||||
MediaRule = 22,
|
||||
|
||||
//! A variable.
|
||||
Variable = 23,
|
||||
};
|
||||
|
||||
//! Construct a QsciLexerCSS with parent \a parent. \a parent is typically
|
||||
//! the QsciScintilla instance.
|
||||
QsciLexerCSS(QObject *parent = 0);
|
||||
|
||||
//! Destroys the QsciLexerCSS instance.
|
||||
virtual ~QsciLexerCSS();
|
||||
|
||||
//! Returns the name of the language.
|
||||
const char *language() const;
|
||||
|
||||
//! Returns the name of the lexer. Some lexers support a number of
|
||||
//! languages.
|
||||
const char *lexer() const;
|
||||
|
||||
//! \internal Returns a space separated list of words or characters in
|
||||
//! a particular style that define the end of a block for
|
||||
//! auto-indentation. The styles is returned via \a style.
|
||||
const char *blockEnd(int *style = 0) const;
|
||||
|
||||
//! \internal Returns a space separated list of words or characters in
|
||||
//! a particular style that define the start of a block for
|
||||
//! auto-indentation. The styles is returned via \a style.
|
||||
const char *blockStart(int *style = 0) const;
|
||||
|
||||
//! Returns the string of characters that comprise a word.
|
||||
const char *wordCharacters() const;
|
||||
|
||||
//! Returns the foreground colour of the text for style number \a style.
|
||||
QColor defaultColor(int style) const;
|
||||
|
||||
//! Returns the font for style number \a style.
|
||||
QFont defaultFont(int style) const;
|
||||
|
||||
//! Returns the set of keywords for the keyword set \a set recognised
|
||||
//! by the lexer as a space separated string.
|
||||
const char *keywords(int set) const;
|
||||
|
||||
//! Returns the descriptive name for style number \a style. If the
|
||||
//! style is invalid for this language then an empty QString is returned.
|
||||
//! This is intended to be used in user preference dialogs.
|
||||
QString description(int style) const;
|
||||
|
||||
//! Causes all properties to be refreshed by emitting the
|
||||
//! propertyChanged() signal as required.
|
||||
void refreshProperties();
|
||||
|
||||
//! Returns true if multi-line comment blocks can be folded.
|
||||
//!
|
||||
//! \sa setFoldComments()
|
||||
bool foldComments() const;
|
||||
|
||||
//! Returns true if trailing blank lines are included in a fold block.
|
||||
//!
|
||||
//! \sa setFoldCompact()
|
||||
bool foldCompact() const;
|
||||
|
||||
//! If \a enabled is true then support for HSS is enabled. The default is
|
||||
//! false.
|
||||
//!
|
||||
//! \sa HSSLanguage()
|
||||
void setHSSLanguage(bool enabled);
|
||||
|
||||
//! Returns true if support for HSS is enabled.
|
||||
//!
|
||||
//! \sa setHSSLanguage()
|
||||
bool HSSLanguage() const {return hss_language;}
|
||||
|
||||
//! If \a enabled is true then support for Less CSS is enabled. The
|
||||
//! default is false.
|
||||
//!
|
||||
//! \sa LessLanguage()
|
||||
void setLessLanguage(bool enabled);
|
||||
|
||||
//! Returns true if support for Less CSS is enabled.
|
||||
//!
|
||||
//! \sa setLessLanguage()
|
||||
bool LessLanguage() const {return less_language;}
|
||||
|
||||
//! If \a enabled is true then support for Sassy CSS is enabled. The
|
||||
//! default is false.
|
||||
//!
|
||||
//! \sa SCSSLanguage()
|
||||
void setSCSSLanguage(bool enabled);
|
||||
|
||||
//! Returns true if support for Sassy CSS is enabled.
|
||||
//!
|
||||
//! \sa setSCSSLanguage()
|
||||
bool SCSSLanguage() const {return scss_language;}
|
||||
|
||||
public slots:
|
||||
//! If \a fold is true then multi-line comment blocks can be folded.
|
||||
//! The default is false.
|
||||
//!
|
||||
//! \sa foldComments()
|
||||
virtual void setFoldComments(bool fold);
|
||||
|
||||
//! If \a fold is true then trailing blank lines are included in a fold
|
||||
//! block. The default is true.
|
||||
//!
|
||||
//! \sa foldCompact()
|
||||
virtual void setFoldCompact(bool fold);
|
||||
|
||||
protected:
|
||||
//! The lexer's properties are read from the settings \a qs. \a prefix
|
||||
//! (which has a trailing '/') should be used as a prefix to the key of
|
||||
//! each setting. true is returned if there is no error.
|
||||
//!
|
||||
bool readProperties(QSettings &qs,const QString &prefix);
|
||||
|
||||
//! The lexer's properties are written to the settings \a qs.
|
||||
//! \a prefix (which has a trailing '/') should be used as a prefix to
|
||||
//! the key of each setting. true is returned if there is no error.
|
||||
//!
|
||||
bool writeProperties(QSettings &qs,const QString &prefix) const;
|
||||
|
||||
private:
|
||||
void setCommentProp();
|
||||
void setCompactProp();
|
||||
void setHSSProp();
|
||||
void setLessProp();
|
||||
void setSCSSProp();
|
||||
|
||||
bool fold_comments;
|
||||
bool fold_compact;
|
||||
bool hss_language;
|
||||
bool less_language;
|
||||
bool scss_language;
|
||||
|
||||
QsciLexerCSS(const QsciLexerCSS &);
|
||||
QsciLexerCSS &operator=(const QsciLexerCSS &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
// This defines the interface to the QsciLexerCustom class.
|
||||
//
|
||||
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
// This file is part of QScintilla.
|
||||
//
|
||||
// This file may be used under the terms of the GNU General Public License
|
||||
// version 3.0 as published by the Free Software Foundation and appearing in
|
||||
// the file LICENSE included in the packaging of this file. Please review the
|
||||
// following information to ensure the GNU General Public License version 3.0
|
||||
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
|
||||
//
|
||||
// If you do not wish to use this file under the terms of the GPL version 3.0
|
||||
// then you may purchase a commercial license. For more information contact
|
||||
// info@riverbankcomputing.com.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
#ifndef QSCILEXERCUSTOM_H
|
||||
#define QSCILEXERCUSTOM_H
|
||||
|
||||
#include <Qsci/qsciglobal.h>
|
||||
#include <Qsci/qscilexer.h>
|
||||
|
||||
|
||||
class QsciScintilla;
|
||||
class QsciStyle;
|
||||
|
||||
|
||||
//! \brief The QsciLexerCustom class is an abstract class used as a base for
|
||||
//! new language lexers.
|
||||
//!
|
||||
//! The advantage of implementing a new lexer this way (as opposed to adding
|
||||
//! the lexer to the underlying Scintilla code) is that it does not require the
|
||||
//! QScintilla library to be re-compiled. It also makes it possible to
|
||||
//! integrate external lexers.
|
||||
//!
|
||||
//! All that is necessary to implement a new lexer is to define appropriate
|
||||
//! styles and to re-implement the styleText() method.
|
||||
class QSCINTILLA_EXPORT QsciLexerCustom : public QsciLexer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Construct a QsciLexerCustom with parent \a parent. \a parent is
|
||||
//! typically the QsciScintilla instance.
|
||||
QsciLexerCustom(QObject *parent = 0);
|
||||
|
||||
//! Destroy the QSciLexerCustom.
|
||||
virtual ~QsciLexerCustom();
|
||||
|
||||
//! The next \a length characters starting from the current styling
|
||||
//! position have their style set to style number \a style. The current
|
||||
//! styling position is moved. The styling position is initially set by
|
||||
//! calling startStyling().
|
||||
//!
|
||||
//! \sa startStyling(), styleText()
|
||||
void setStyling(int length, int style);
|
||||
|
||||
//! The next \a length characters starting from the current styling
|
||||
//! position have their style set to style \a style. The current styling
|
||||
//! position is moved. The styling position is initially set by calling
|
||||
//! startStyling().
|
||||
//!
|
||||
//! \sa startStyling(), styleText()
|
||||
void setStyling(int length, const QsciStyle &style);
|
||||
|
||||
//! The styling position is set to \a start. \a styleBits is unused.
|
||||
//!
|
||||
//! \sa setStyling(), styleBitsNeeded(), styleText()
|
||||
void startStyling(int pos, int styleBits = 0);
|
||||
|
||||
//! This is called when the section of text beginning at position \a start
|
||||
//! and up to position \a end needs to be styled. \a start will always be
|
||||
//! at the start of a line. The text is styled by calling startStyling()
|
||||
//! followed by one or more calls to setStyling(). It must be
|
||||
//! re-implemented by a sub-class.
|
||||
//!
|
||||
//! \sa setStyling(), startStyling(), QsciScintilla::bytes(),
|
||||
//! QsciScintilla::text()
|
||||
virtual void styleText(int start, int end) = 0;
|
||||
|
||||
//! \reimp
|
||||
virtual void setEditor(QsciScintilla *editor);
|
||||
|
||||
//! \reimp This re-implementation returns 5 as the number of style bits
|
||||
//! needed.
|
||||
virtual int styleBitsNeeded() const;
|
||||
|
||||
private slots:
|
||||
void handleStyleNeeded(int pos);
|
||||
|
||||
private:
|
||||
QsciLexerCustom(const QsciLexerCustom &);
|
||||
QsciLexerCustom &operator=(const QsciLexerCustom &);
|
||||
};
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue