blob: e83cf85e56c7dd72aeb0c8338c962791d7d53ec9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/*
* File: qt_widget.hpp
* Purpose: Minimal text editor widget example using tproc rope.
* Author: Amlal El Mahrouss (amlal@nekernel.org)
* Copyright 2026, Amlal El Mahrouss, licensed under the Boost Software License.
*/
#ifndef TPROC_EXAMPLE_QT_WIDGET_HPP
#define TPROC_EXAMPLE_QT_WIDGET_HPP
#include <ocl/tproc/rope.hpp>
#include <iostream>
#include <string>
#include <string_view>
#include <QtWidgets>
#include <QApplication>
#ifndef STANDALONE
using namespace ocl;
using namespace boost;
#else
using namespace boost;
#endif
class TTextEditor;
class TTextEditor : public QMainWindow
{
Q_OBJECT
public:
using rope_type = tproc::crope;
using size_type = rope_type::size_type;
using string_view = std::string_view;
TTextEditorWidget() = delete;
TTextEditor(string_view text, TTextEditorDelegate* del)
: buffer_(text), delegate_(del)
{
}
virtual ~TTextEditor() = default;
private:
rope_type buffer_;
};
#endif
|