22 #ifndef _gbrowserpane_h 23 #define _gbrowserpane_h 26 #include <QTextBrowser> 28 #include "ginteractor.h" 30 class _Internal_QTextBrowser;
48 GBrowserPane(
const string& url =
"", QWidget* parent =
nullptr);
119 virtual string
getText()
const;
122 string
getType()
const override;
206 virtual void select(
int startIndex,
int length);
275 virtual void setText(
const string& text);
314 _Internal_QTextBrowser* _iqtextbrowser;
316 friend class _Internal_QTextBrowser;
323 class _Internal_QTextBrowser :
public QTextBrowser,
public _Internal_QWidget {
327 _Internal_QTextBrowser(
GBrowserPane* gbrowserpane, QWidget* parent =
nullptr);
328 void detach()
override;
329 QVariant loadResource(
int type,
const QUrl &url)
override;
330 void mousePressEvent(QMouseEvent* event)
override;
331 void mouseReleaseEvent(QMouseEvent* event)
override;
332 QSize sizeHint()
const override;
336 QString _clickedLink;
339 #endif // _gbrowserpane_h virtual int getSelectionLength() const
Returns the number of characters that are currently selected.
Definition: gbrowserpane.cpp:100
virtual void setLineWrap(bool wrap)
Sets whether the text pane wraps its text when a line becomes too long.
Definition: gbrowserpane.cpp:349
QWidget* getWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: gbrowserpane.cpp:126
GBrowserPane(string url="", QWidget* parent=nullptr)
Constructs a new browser pane.
Definition: gbrowserpane.cpp:31
_Internal_QWidget* getInternalWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: gbrowserpane.cpp:69
virtual string getSelectedText() const
Returns the text that is currently selected in the text pane.
Definition: gbrowserpane.cpp:77
virtual void setCursorPosition(int index, bool keepAnchor=false)
Moves the keyboard cursor to the given 0-based character index within the text.
Definition: gbrowserpane.cpp:323
virtual void setEditable(bool value)
Sets whether the text pane allows the user to modify its text.
Definition: gbrowserpane.cpp:333
virtual void setTextChangeListener(GEventListener func)
Sets a text change listener on this text pane so that it will be called when the user modifies the cu...
Definition: gbrowserpane.cpp:369
virtual void readTextFromUrl(string url)
Reads text from the given web page URL and displays the entire page's text as the contents of this fo...
Definition: gbrowserpane.cpp:270
virtual string getText() const
Returns the full text of the current page or file being displayed in the pane.
Definition: gbrowserpane.cpp:118
virtual string getContentType() const
Returns the MIME content type for the current page.
Definition: gbrowserpane.cpp:61
virtual void setText(string text)
Sets the pane to display to the given contents using its current content type.
Definition: gbrowserpane.cpp:363
virtual bool isEditable() const
Returns whether the text pane allows the user to modify its text.
Definition: gbrowserpane.cpp:130
virtual void removeTextChangeListener()
Removes the text change listener from this text pane so that it will no longer call it when the user ...
Definition: gbrowserpane.cpp:282
virtual int getSelectionStart() const
Returns the index of the start of the current selection of text as a 0-based character index within t...
Definition: gbrowserpane.cpp:107
virtual void readTextFromFile(std::istream &file)
Reads text from the given file and displays the entire file's text as the contents of this formatted ...
Definition: gbrowserpane.cpp:156
virtual void scrollToBottom()
Moves the visible scroll region of the text pane so that the bottom part of the text is visible...
Definition: gbrowserpane.cpp:286
This abstract class is the superclass for all graphical interactors.
Definition: ginteractor.h:48
virtual void removeLinkListener()
Removes the link listener from the canvas so that it will no longer call it when hyperlink events occ...
Definition: gbrowserpane.cpp:278
virtual void clearSelection()
Deselects any text that is currently selected in the pane.
Definition: gbrowserpane.cpp:47
virtual void select(int startIndex, int length)
Sets the given range of text to be selected, beginning with the given start index as a 0-based charac...
Definition: gbrowserpane.cpp:302
virtual bool isLineWrap() const
Returns whether the text pane wraps its text when a line becomes too long.
Definition: gbrowserpane.cpp:134
virtual void moveCursorToStart()
Sets the text pane's keyboard cursor position to the start of the current text.
Definition: gbrowserpane.cpp:147
virtual void moveCursorToEnd()
Sets the text pane's keyboard cursor position to the end of the current text.
Definition: gbrowserpane.cpp:138
virtual void selectAll()
Selects the entire text of the text pane.
Definition: gbrowserpane.cpp:313
virtual void clearText()
Sets the text in the pane to be empty.
Definition: gbrowserpane.cpp:55
virtual int getSelectionEnd() const
Returns the index just past the end of the current selection of text as a 0-based character index wit...
Definition: gbrowserpane.cpp:88
virtual void scrollToTop()
Moves the visible scroll region of the text pane so that the top part of the text is visible...
Definition: gbrowserpane.cpp:294
virtual int getCursorPosition() const
Returns the keyboard cursor's current position in the text pane as a 0-based character index within t...
Definition: gbrowserpane.cpp:65
A GBrowserPane is a graphical interactor that displays a web page.
Definition: gbrowserpane.h:41
~GBrowserPane() override
Frees memory allocated internally by the browser pane.
Definition: gbrowserpane.cpp:41
virtual void setContentType(string contentType)
Sets the MIME content type being used to display the current/future pages.
Definition: gbrowserpane.cpp:319
virtual void setLinkListener(GEventListener func)
Sets a link listener on this canvas so that it will be called when the user clicks on hyperlinks on t...
Definition: gbrowserpane.cpp:355
virtual string getPageUrl() const
Returns the URL of the web page or file name being currently viewed.
Definition: gbrowserpane.cpp:73
string getType() const override
Returns a string representing the class name of this interactor, such as "GButton" or "GCheckBox"...
Definition: gbrowserpane.cpp:122
void setMouseListener(GEventListener func) override
Sets a mouse listener on this text pane so that it will be called when the user moves or clicks the m...
Definition: gbrowserpane.cpp:339