|
Planeshift
|
A basic text box widget. More...
#include <pawstextbox.h>
Public Types | |
| enum | pawsHorizAdjust { horizLEFT, horizRIGHT, horizCENTRE } |
Various positions to center the text on horizontally. More... | |
| enum | pawsVertAdjust { vertTOP, vertBOTTOM, vertCENTRE } |
Various positions to center the text on vertically. More... | |
Public Member Functions | |
| void | Adjust (pawsHorizAdjust horiz, pawsVertAdjust vert) |
| Alters how the text box is laid out in its container. | |
| void | Draw () |
| Draws the text box. | |
| void | FormatText (const char *fmt,...) |
| Sets the text to display using formatting. | |
| virtual int | GetBorderStyle () |
| Gets the border style for the text box. | |
| virtual int | GetFontColour () |
| Gets the font color based on the set colour and if grayed is set. | |
| const char * | GetText () const |
| Gets the text that is displayed by this text box. | |
| void | Grayed (bool g) |
| Sets if the text box is having its text grayed. | |
| void | HorizAdjust (pawsHorizAdjust horiz) |
| Alters how the text box is laid out horizontally in its container. | |
| virtual bool | OnGainFocus (bool) |
| Normal text boxes should not be focused. | |
| virtual void | OnUpdateData (const char *dataname, PAWSData &data) |
| Called whenever subscribed data gets updated Sets the text to either the data's string value or a properly formatted float representation. | |
| pawsTextBox (const pawsTextBox &origin) | |
| Copy constructor. | |
| pawsTextBox () | |
| Basic constructor. | |
| bool | SelfPopulate (iDocumentNode *node) |
| Sets the text from the node using either the text attribute or the node's content. | |
| void | SetSizeByText (int padX, int padY) |
| Sets the size of the widget to fit the text that it displays. | |
| void | SetText (const char *text) |
| Sets the text to display. | |
| bool | Setup (iDocumentNode *node) |
| Sets up the text box from a document node Possible attributes in the node: | |
| void | SetVertical (bool vertical) |
| Sets if this text box should be rendered vertically (top to bottom) | |
| void | VertAdjust (pawsVertAdjust vert) |
| Alters how the text box is laid out vertically in its container. | |
| virtual | ~pawsTextBox () |
| Basic deconstructor. | |
Static Public Member Functions | |
| static int | CountCodePoints (const char *text, int start=0, int len=-1) |
| Utility function to calculate number of code points in a substring. | |
| static int | RewindCodePoints (const char *text, int start, int count) |
| Utility function to rewind a UTF-8 string by a certain number of codepoints. | |
| static int | SkipCodePoints (const char *text, int start, int count) |
| Utility function to skip a UTF-8 string by a certain number of codepoints. | |
Protected Member Functions | |
| void | CalcLetterSizes () |
| Fills 'letterSizes' array. | |
| void | CalcTextPos () |
| Calculates textX and textY attributes. | |
| void | CalcTextSize (int &width, int &height) |
| Calculates size of text. | |
Protected Attributes | |
| int | colour |
| The colour of the text. | |
| bool | grayed |
| Whether the text is currently being grayed out. | |
| pawsHorizAdjust | horizAdjust |
| The current horizontal alignment for the text box. | |
| psPoint * | letterSizes |
| Array containing the size of each letter in text (only used when vertical is true) | |
| csString | text |
| The text for this box. | |
| int | textWidth |
| Width of vertical column of letters (only used when vertical is true) | |
| int | textX |
| X-Position of text inside the widget (relative to adjustment) | |
| int | textY |
| X-Position of text inside the widget (relative to adjustment) | |
| pawsVertAdjust | vertAdjust |
| The current vertical alignment for the text box. | |
| bool | vertical |
| Whether the text box is rendering vertically (up-down rather than left-right) | |
A basic text box widget.
Useful for simply displaying text.
Definition at line 42 of file pawstextbox.h.
Various positions to center the text on horizontally.
| horizLEFT |
Adjusted to left. |
| horizRIGHT |
Adjusted to right. |
| horizCENTRE |
Adjusted to centre. |
Definition at line 58 of file pawstextbox.h.
Various positions to center the text on vertically.
Definition at line 48 of file pawstextbox.h.
| pawsTextBox::pawsTextBox | ( | ) |
Basic constructor.
| virtual pawsTextBox::~pawsTextBox | ( | ) | [virtual] |
Basic deconstructor.
| pawsTextBox::pawsTextBox | ( | const pawsTextBox & | origin | ) |
Copy constructor.
| void pawsTextBox::Adjust | ( | pawsHorizAdjust | horiz, |
| pawsVertAdjust | vert | ||
| ) |
Alters how the text box is laid out in its container.
| horiz | Sets the horizontal alignment for the text |
| vert | Sets the vertical alignment for the text |
| void pawsTextBox::CalcLetterSizes | ( | ) | [protected] |
Fills 'letterSizes' array.
Can be called only when vertical==true
| void pawsTextBox::CalcTextPos | ( | ) | [protected] |
Calculates textX and textY attributes.
Calculates size of text.
| width | Target to store width of text into |
| height | Target to store height of text into |
Utility function to calculate number of code points in a substring.
| text | Text to calculate on |
| start | Index to start on |
| len | Length to perform calculation on or -1 for start to end |
| void pawsTextBox::Draw | ( | ) | [virtual] |
Draws the text box.
Reimplemented from pawsWidget.
| void pawsTextBox::FormatText | ( | const char * | fmt, |
| ... | |||
| ) |
Sets the text to display using formatting.
| fmt | The format to use to format the string to display |
| virtual int pawsTextBox::GetBorderStyle | ( | ) | [inline, virtual] |
Gets the border style for the text box.
Reimplemented from pawsWidget.
Definition at line 167 of file pawstextbox.h.
| virtual int pawsTextBox::GetFontColour | ( | ) | [virtual] |
Gets the font color based on the set colour and if grayed is set.
Reimplemented from pawsWidget.
| const char* pawsTextBox::GetText | ( | ) | const [inline] |
Gets the text that is displayed by this text box.
Definition at line 119 of file pawstextbox.h.
| void pawsTextBox::Grayed | ( | bool | g | ) | [inline] |
Sets if the text box is having its text grayed.
| g | Overwrites grayed |
Definition at line 176 of file pawstextbox.h.
| void pawsTextBox::HorizAdjust | ( | pawsHorizAdjust | horiz | ) |
Alters how the text box is laid out horizontally in its container.
| horiz | Sets the horizontal alignment for the text |
| virtual bool pawsTextBox::OnGainFocus | ( | bool | ) | [inline, virtual] |
Normal text boxes should not be focused.
Does nothing
Reimplemented from pawsWidget.
Definition at line 158 of file pawstextbox.h.
| virtual void pawsTextBox::OnUpdateData | ( | const char * | dataname, |
| PAWSData & | data | ||
| ) | [virtual] |
Called whenever subscribed data gets updated Sets the text to either the data's string value or a properly formatted float representation.
| dataname | Unused |
| data | The data to update the text with |
Reimplemented from pawsWidget.
Utility function to rewind a UTF-8 string by a certain number of codepoints.
| text | Text to calculate on |
| start | Index to begin rewinding at |
| count | Number of code points to rewind by |
| bool pawsTextBox::SelfPopulate | ( | iDocumentNode * | node | ) | [virtual] |
Sets the text from the node using either the text attribute or the node's content.
| node | The node to pull the text from |
Reimplemented from pawsWidget.
Sets the size of the widget to fit the text that it displays.
| padX | Horizontal padding |
| padY | Vertical padding |
| void pawsTextBox::SetText | ( | const char * | text | ) |
Sets the text to display.
| text | The string |
| bool pawsTextBox::Setup | ( | iDocumentNode * | node | ) | [virtual] |
Sets up the text box from a document node
Possible attributes in the node:
| node | The node to pull the attributes from |
Reimplemented from pawsWidget.
| void pawsTextBox::SetVertical | ( | bool | vertical | ) |
Sets if this text box should be rendered vertically (top to bottom)
| vertical | Whether it should be rendered vertically |
Utility function to skip a UTF-8 string by a certain number of codepoints.
| text | Text to calculate on |
| start | Index to begin rewinding at |
| count | Number of code points to rewind by |
| void pawsTextBox::VertAdjust | ( | pawsVertAdjust | vert | ) |
Alters how the text box is laid out vertically in its container.
| vert | Sets the vertical alignment for the text |
int pawsTextBox::colour [protected] |
The colour of the text.
Definition at line 245 of file pawstextbox.h.
bool pawsTextBox::grayed [protected] |
Whether the text is currently being grayed out.
Definition at line 248 of file pawstextbox.h.
pawsHorizAdjust pawsTextBox::horizAdjust [protected] |
The current horizontal alignment for the text box.
Definition at line 251 of file pawstextbox.h.
psPoint* pawsTextBox::letterSizes [protected] |
Array containing the size of each letter in text (only used when vertical is true)
Definition at line 269 of file pawstextbox.h.
csString pawsTextBox::text [protected] |
The text for this box.
Definition at line 242 of file pawstextbox.h.
int pawsTextBox::textWidth [protected] |
Width of vertical column of letters (only used when vertical is true)
Definition at line 266 of file pawstextbox.h.
int pawsTextBox::textX [protected] |
X-Position of text inside the widget (relative to adjustment)
Definition at line 260 of file pawstextbox.h.
int pawsTextBox::textY [protected] |
X-Position of text inside the widget (relative to adjustment)
Definition at line 263 of file pawstextbox.h.
pawsVertAdjust pawsTextBox::vertAdjust [protected] |
The current vertical alignment for the text box.
Definition at line 254 of file pawstextbox.h.
bool pawsTextBox::vertical [protected] |
Whether the text box is rendering vertically (up-down rather than left-right)
Definition at line 257 of file pawstextbox.h.
1.7.3