24 #ifndef _gbrowserpane_h 25 #define _gbrowserpane_h 28 #include <QTextBrowser> 29 #include "ginteractor.h" 33 class _Internal_QTextBrowser;
51 GBrowserPane(
const string& url =
"", QWidget* parent =
nullptr);
122 virtual string
getText()
const;
125 string
getType()
const override;
209 virtual void select(
int startIndex,
int length);
278 virtual void setText(
const string& text);
317 _Internal_QTextBrowser* _iqtextbrowser;
319 friend class _Internal_QTextBrowser;
326 class _Internal_QTextBrowser :
public QTextBrowser,
public _Internal_QWidget {
330 _Internal_QTextBrowser(
GBrowserPane* gbrowserpane, QWidget* parent =
nullptr);
331 void detach()
override;
332 QVariant loadResource(
int type,
const QUrl &url)
override;
333 void mousePressEvent(QMouseEvent* event)
override;
334 void mouseReleaseEvent(QMouseEvent* event)
override;
335 QSize sizeHint()
const override;
339 QString _clickedLink;
344 #endif // _gbrowserpane_h QWidget* getWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: gbrowserpane.cpp:130
virtual bool isLineWrap() const
Returns whether the text pane wraps its text when a line becomes too long.
Definition: gbrowserpane.cpp:138
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:290
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:92
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:359
virtual string getPageUrl() const
Returns the URL of the web page or file name being currently viewed.
Definition: gbrowserpane.cpp:77
virtual void setText(string text)
Sets the pane to display to the given contents using its current content type.
Definition: gbrowserpane.cpp:367
virtual bool isEditable() const
Returns whether the text pane allows the user to modify its text.
Definition: gbrowserpane.cpp:134
string getType() const override
Returns a string representing the class name of this interactor, such as "GButton" or "GCheckBox"...
Definition: gbrowserpane.cpp:126
~GBrowserPane() override
Frees memory allocated internally by the browser pane.
Definition: gbrowserpane.cpp:45
virtual void moveCursorToEnd()
Sets the text pane's keyboard cursor position to the end of the current text.
Definition: gbrowserpane.cpp:142
virtual void setLineWrap(bool wrap)
Sets whether the text pane wraps its text when a line becomes too long.
Definition: gbrowserpane.cpp:353
std::function< void(GEvent)> GEventListener
Types for the event listener functions to be passed to various interactors.
Definition: gevent.h:38
GBrowserPane(string url="", QWidget* parent=nullptr)
Constructs a new browser pane.
Definition: gbrowserpane.cpp:35
_Internal_QWidget* getInternalWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: gbrowserpane.cpp:73
This abstract class is the superclass for all graphical interactors.
Definition: ginteractor.h:52
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:306
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:343
virtual void setEditable(bool value)
Sets whether the text pane allows the user to modify its text.
Definition: gbrowserpane.cpp:337
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:274
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:160
std::function< void()> GEventListenerVoid
Types for the event listener functions to be passed to various interactors.
Definition: gevent.h:44
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:282
virtual void clearText()
Sets the text in the pane to be empty.
Definition: gbrowserpane.cpp:59
virtual void setContentType(string contentType)
Sets the MIME content type being used to display the current/future pages.
Definition: gbrowserpane.cpp:323
virtual string getSelectedText() const
Returns the text that is currently selected in the text pane.
Definition: gbrowserpane.cpp:81
virtual void clearSelection()
Deselects any text that is currently selected in the pane.
Definition: gbrowserpane.cpp:51
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:327
virtual string getContentType() const
Returns the MIME content type for the current page.
Definition: gbrowserpane.cpp:65
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:69
virtual void selectAll()
Selects the entire text of the text pane.
Definition: gbrowserpane.cpp:317
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:286
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:298
virtual void moveCursorToStart()
Sets the text pane's keyboard cursor position to the start of the current text.
Definition: gbrowserpane.cpp:151
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:111
virtual int getSelectionLength() const
Returns the number of characters that are currently selected.
Definition: gbrowserpane.cpp:104
virtual string getText() const
Returns the full text of the current page or file being displayed in the pane.
Definition: gbrowserpane.cpp:122
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:373
A GBrowserPane is a graphical interactor that displays a web page.
Definition: gbrowserpane.h:44