2
* This file is part of Konsole, a terminal emulator for KDE.
4
* Copyright 2012 Frederik Gladhorn <gladhorn@kde.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22
#ifndef TERMINALDISPLAYACCESSIBLE_H
23
#define TERMINALDISPLAYACCESSIBLE_H
25
#include <QtGui/qaccessible.h>
26
#include <QtGui/qaccessible2.h>
27
#include <QtGui/qaccessiblewidget.h>
29
#include "TerminalDisplay.h"
30
#include "ScreenWindow.h"
36
* Class implementing the QAccessibleInterface for the terminal display.
37
* This exposes information about the display to assistive technology using the QAccessible framework.
39
* Most functions are re-implemented from QAccessibleTextInterface.
41
class TerminalDisplayAccessible
42
: public QAccessibleWidgetEx, public QAccessibleTextInterface, public QAccessibleSimpleEditableTextInterface
47
explicit TerminalDisplayAccessible(TerminalDisplay *display);
49
QString text(QAccessible::Text t, int child) const;
51
QString text(int startOffset, int endOffset);
52
QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType, int* startOffset, int* endOffset);
53
QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType, int* startOffset, int* endOffset);
54
QString textBeforeOffset(int offset, QAccessible2::BoundaryType boundaryType, int* startOffset, int* endOffset);
58
void selection(int selectionIndex, int *startOffset, int *endOffset);
59
void addSelection(int startOffset, int endOffset);
60
void setSelection(int selectionIndex, int startOffset, int endOffset);
61
void removeSelection(int selectionIndex);
63
QRect characterRect(int offset, QAccessible2::CoordinateType coordType);
64
int offsetAtPoint(const QPoint& point, QAccessible2::CoordinateType coordType);
65
void scrollToSubstring(int startIndex, int endIndex);
67
QString attributes(int offset, int* startOffset, int* endOffset);
70
void setCursorPosition(int position);
73
Konsole::TerminalDisplay *display();
75
inline int positionToOffset(int column, int line)
77
return line * display()->_usedColumns + column;
80
inline int lineForOffset(int offset)
82
return offset / display()->_usedColumns;
85
inline int columnForOffset(int offset)
87
return offset % display()->_usedColumns;
90
QString visibleText() const;
96
#endif // TERMINALDISPLAYACCESSIBLE_H