Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F633613
TextEditorWidget.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
TextEditorWidget.h
View Options
#ifndef OREWIDGET_H
#define OREWIDGET_H
#include
<QTextFormat>
#include
<QWidget>
#include
<vector>
#include
<stdint.h>
#include
<memory>
#include
"AbstractCharacterBasedApplication.h"
#include
"TextEditorTheme.h"
class
QScrollBar
;
struct
PreEditText
{
struct
Format
{
int
start
;
int
length
;
QTextFormat
format
;
Format
(
int
start
,
int
length
,
QTextFormat
const
&
f
)
:
start
(
start
)
,
length
(
length
)
,
format
(
f
)
{
}
};
QString
text
;
std
::
vector
<
Format
>
format
;
};
class
TextEditorWidget
:
public
QWidget
,
public
AbstractTextEditorApplication
{
Q_OBJECT
public
:
enum
RenderingMode
{
CharacterMode
,
DecoratedMode
,
};
private
:
struct
Private
;
Private
*
m
;
void
paintScreen
(
QPainter
*
painter
);
void
drawCursor
(
QPainter
*
pr
);
QRect
updateCursorRect
(
bool
auto_scroll
);
RenderingMode
renderingMode
()
const
;
QColor
defaultForegroundColor
();
QColor
defaultBackgroundColor
();
QColor
colorForIndex
(
int
index
,
bool
foreground
);
void
internalUpdateVisibility
(
bool
ensure_current_line_visible
,
bool
change_col
,
bool
auto_scroll
);
void
internalUpdateScrollBar
();
protected
:
void
paintEvent
(
QPaintEvent
*
);
void
mousePressEvent
(
QMouseEvent
*
event
);
void
mouseReleaseEvent
(
QMouseEvent
*
event
);
void
mouseMoveEvent
(
QMouseEvent
*
event
);
void
wheelEvent
(
QWheelEvent
*
event
);
void
resizeEvent
(
QResizeEvent
*
event
);
void
contextMenuEvent
(
QContextMenuEvent
*
event
);
QFont
textFont
();
void
drawText
(
QPainter
*
painter
,
int
px
,
int
py
,
const
QString
&
str
);
public
:
explicit
TextEditorWidget
(
QWidget
*
parent
=
0
);
~
TextEditorWidget
();
void
setTheme
(
TextEditorThemePtr
theme
);
TextEditorTheme
const
*
theme
()
const
;
int
latin1Width
()
const
;
int
lineHeight
()
const
;
void
setPreEditText
(
PreEditText
const
&
preedit
);
void
updateVisibility
(
bool
ensure_current_line_visible
,
bool
change_col
,
bool
auto_scroll
);
bool
event
(
QEvent
*
event
);
void
bindScrollBar
(
QScrollBar
*
vsb
,
QScrollBar
*
hsb
);
QPoint
mapFromPixel
(
const
QPoint
&
pt
);
QPoint
mapToPixel
(
const
QPoint
&
pt
);
void
moveCursor
(
const
QPoint
&
pt
,
bool
by_mouse
,
bool
auto_scroll
);
QVariant
inputMethodQuery
(
Qt
::
InputMethodQuery
q
)
const
;
void
inputMethodEvent
(
QInputMethodEvent
*
e
);
void
refrectScrollBar
();
void
setRenderingMode
(
RenderingMode
mode
);
void
move
(
int
cur_row
,
int
cur_col
,
int
scr_row
,
int
scr_col
,
bool
auto_scroll
);
void
layoutEditor
();
void
setFocusFrameVisible
(
bool
f
);
signals
:
void
moved
(
int
cur_row
,
int
cur_col
,
int
scr_row
,
int
scr_col
);
void
updateScrollBar
();
private
slots
:
// void onCustomContextMenuRequested(QPoint);
};
#endif
// OREWIDGET_H
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sun, Nov 15, 5:18 PM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
138648
Default Alt Text
TextEditorWidget.h (2 KB)
Attached To
Mode
R77 Guitar
Attached
Detach File
Event Timeline