Mana
|
A simple browser box able to handle links and forward events to the parent conteiner. More...
#include <browserbox.h>
Public Types | |
enum | Mode { AUTO_SIZE , AUTO_WRAP } |
enum | LinkHighlightMode { UNDERLINE = 1 , BACKGROUND = 2 } |
Highlight modes for links. More... | |
Public Member Functions | |
BrowserBox (Mode mode=AUTO_SIZE) | |
~BrowserBox () override | |
void | setLinkHandler (LinkHandler *handler) |
Sets the handler for links. | |
void | setPalette (int palette) |
void | setHighlightMode (unsigned int mode) |
Sets the Highlight mode for links. | |
void | setWrapIndent (int indent) |
Sets the wrap indent for the browser box. | |
void | setShadowedText (bool shadows) |
Sets whether the font will use a shadow for text. | |
void | setOutlinedText (bool outline) |
Sets whether the font will use a shadow for text. | |
void | setMaxRows (unsigned maxRows) |
Sets the maximum numbers of rows in the browser box. | |
void | disableLinksAndUserColors () |
Disable links & user defined colors to be used in chat input. | |
void | setEnableKeys (bool enable) |
Enable or disable the replacement of keys. | |
void | addRows (std::string_view rows) |
Adds one or more text rows to the browser, separated by ' '. | |
void | addRow (std::string_view row) |
Adds a text row to the browser. | |
void | clearRows () |
Remove all rows. | |
void | mousePressed (gcn::MouseEvent &event) override |
Handles mouse actions. | |
void | mouseMoved (gcn::MouseEvent &event) override |
void | mouseExited (gcn::MouseEvent &event) override |
void | draw (gcn::Graphics *graphics) override |
Draws the browser box. | |
void | drawFrame (gcn::Graphics *) override |
Overridden to avoid drawing the default frame. | |
Private Member Functions | |
void | relayoutText () |
Relayouts all text rows and returns the new height of the BrowserBox. | |
void | layoutTextRow (TextRow &row, LayoutContext &context) |
Layers out the given row of text starting at the given context position. | |
void | updateHoveredLink (int x, int y) |
void | maybeRelayoutText () |
Private Attributes | |
std::deque< TextRow > | mTextRows |
LinkHandler * | mLinkHandler = nullptr |
int | mPalette = 0 |
Mode | mMode |
unsigned int | mHighlightMode = UNDERLINE | BACKGROUND |
int | mWrapIndent = 0 |
bool | mShadows = false |
bool | mOutline = false |
bool | mUseLinksAndUserColors = true |
bool | mEnableKeys = false |
std::optional< BrowserLink > | mHoveredLink |
unsigned int | mMaxRows = 0 |
int | mLastLayoutWidth = 0 |
Timer | mLayoutTimer |
A simple browser box able to handle links and forward events to the parent conteiner.
Definition at line 72 of file browserbox.h.
Highlight modes for links.
This can be used for a bitmask.
Enumerator | |
---|---|
UNDERLINE | |
BACKGROUND |
Definition at line 163 of file browserbox.h.
enum BrowserBox::Mode |
Enumerator | |
---|---|
AUTO_SIZE | |
AUTO_WRAP | Maybe it needs a fix or to be redone. |
Definition at line 76 of file browserbox.h.
Definition at line 122 of file browserbox.cpp.
|
overridedefault |
void BrowserBox::addRow | ( | std::string_view | row | ) |
Adds a text row to the browser.
Definition at line 143 of file browserbox.cpp.
void BrowserBox::addRows | ( | std::string_view | rows | ) |
Adds one or more text rows to the browser, separated by '
'.
Definition at line 131 of file browserbox.cpp.
void BrowserBox::clearRows | ( | ) |
Remove all rows.
Definition at line 227 of file browserbox.cpp.
|
inline |
Disable links & user defined colors to be used in chat input.
Definition at line 120 of file browserbox.h.
|
override |
Draws the browser box.
Definition at line 260 of file browserbox.cpp.
|
inlineoverride |
Overridden to avoid drawing the default frame.
Definition at line 157 of file browserbox.h.
|
private |
Layers out the given row of text starting at the given context position.
Definition at line 337 of file browserbox.cpp.
|
private |
Definition at line 539 of file browserbox.cpp.
|
override |
Definition at line 255 of file browserbox.cpp.
|
override |
Definition at line 248 of file browserbox.cpp.
|
override |
Handles mouse actions.
Definition at line 235 of file browserbox.cpp.
|
private |
Relayouts all text rows and returns the new height of the BrowserBox.
Definition at line 321 of file browserbox.cpp.
|
inline |
Enable or disable the replacement of keys.
Definition at line 125 of file browserbox.h.
|
inline |
Sets the Highlight mode for links.
Definition at line 95 of file browserbox.h.
|
inline |
Sets the handler for links.
Definition at line 88 of file browserbox.h.
|
inline |
Sets the maximum numbers of rows in the browser box.
0 = no limit.
Definition at line 115 of file browserbox.h.
|
inline |
Sets whether the font will use a shadow for text.
Definition at line 110 of file browserbox.h.
|
inline |
Definition at line 90 of file browserbox.h.
|
inline |
Sets whether the font will use a shadow for text.
Definition at line 105 of file browserbox.h.
|
inline |
Sets the wrap indent for the browser box.
Definition at line 100 of file browserbox.h.
|
private |
Definition at line 522 of file browserbox.cpp.
|
private |
Definition at line 185 of file browserbox.h.
|
private |
Definition at line 180 of file browserbox.h.
|
private |
Definition at line 186 of file browserbox.h.
|
private |
Definition at line 188 of file browserbox.h.
|
private |
Definition at line 189 of file browserbox.h.
|
private |
Definition at line 177 of file browserbox.h.
|
private |
Definition at line 187 of file browserbox.h.
|
private |
Definition at line 179 of file browserbox.h.
|
private |
Definition at line 183 of file browserbox.h.
|
private |
Definition at line 178 of file browserbox.h.
|
private |
Definition at line 182 of file browserbox.h.
|
private |
Definition at line 175 of file browserbox.h.
|
private |
Definition at line 184 of file browserbox.h.
|
private |
Definition at line 181 of file browserbox.h.