UFO: Alien Invasion
Loading...
Searching...
No Matches
uiTextNode Class Reference

#include <ui_node_text.h>

Inheritance diagram for uiTextNode:
Inheritance graph
Collaboration diagram for uiTextNode:
Collaboration graph

Public Member Functions

void draw (uiNode_t *node) override
 Draw a text node.
void onLeftClick (uiNode_t *node, int x, int y) override
 Calls the script command for a text node that is clickable.
void onRightClick (uiNode_t *node, int x, int y) override
 Calls the script command for a text node that is clickable via right mouse button.
bool onScroll (uiNode_t *node, int deltaX, int deltaY) override
void onMouseMove (uiNode_t *node, int x, int y) override
void onMouseDown (uiNode_t *node, int x, int y, int button) override
 Track mouse down/up events to implement drag&drop-like scrolling, for touchscreen devices.
void onMouseUp (uiNode_t *node, int x, int y, int button) override
void onCapturedMouseMove (uiNode_t *node, int x, int y) override
void onLoading (uiNode_t *node) override
void onLoaded (uiNode_t *node) override
int getCellHeight (uiNode_t *node) override
 Return size of the cell, which is the size (in virtual "pixel") which represent 1 in the scroll values. Here we guess the widget can scroll pixel per pixel.
void validateCache (uiNode_t *node)
void doLayout (uiNode_t *node) override
 Call to update the node layout. This common code revalidates the node tree.
Public Member Functions inherited from uiAbstractScrollableNode
void initNode (uiNode_t *node) override
bool isSizeChange (uiNode_t *node)
 return true if the node size change and update the cache
bool scrollY (uiNode_t *node, int offset)
 Scroll the Y scroll with a relative position, and call event if need.
bool setScrollY (uiNode_t *node, int viewPos, int viewSize, int fullSize)
 Set the Y scroll to a position, and call event if need.
void pageUp (uiNode_t *node)
void pageDown (uiNode_t *node)
void moveUp (uiNode_t *node)
void moveDown (uiNode_t *node)
void moveHome (uiNode_t *node)
void moveEnd (uiNode_t *node)
Public Member Functions inherited from uiLocatedNode
virtual void drawTooltip (const uiNode_t *node, int x, int y) const
virtual void drawOverWindow (uiNode_t *node)
virtual void onSizeChanged (uiNode_t *node)
 Callback stub.
virtual void onMiddleClick (uiNode_t *node, int x, int y)
virtual bool onMouseLongPress (uiNode_t *node, int x, int y, int button)
 Send mouse event when a pressed mouse button is dragged.
virtual void onMouseEnter (uiNode_t *node)
virtual void onMouseLeave (uiNode_t *node)
virtual void onCapturedMouseLost (uiNode_t *node)
virtual bool onStartDragging (uiNode_t *node, int startX, int startY, int currentX, int currentY, int button)
 Send mouse event when a pressed mouse button is dragged.
virtual bool onDndEnter (uiNode_t *node)
virtual bool onDndMove (uiNode_t *node, int x, int y)
virtual void onDndLeave (uiNode_t *node)
virtual bool onDndDrop (uiNode_t *node, int x, int y)
virtual bool onDndFinished (uiNode_t *node, bool isDropped)
virtual void onFocusGained (uiNode_t *node)
virtual void onFocusLost (uiNode_t *node)
virtual bool onKeyPressed (uiNode_t *node, unsigned int key, unsigned short unicode)
virtual bool onKeyReleased (uiNode_t *node, unsigned int key, unsigned short unicode)
virtual void getClientPosition (uiNode_t const *node, vec2_t position)
virtual int getCellWidth (uiNode_t *node)
Public Member Functions inherited from uiNode
virtual void clone (uiNode_t const *source, uiNode_t *clone)
virtual void initNodeDynamic (uiNode_t *node)
virtual void deleteNode (uiNode_t *node)
virtual void onWindowOpened (uiNode_t *node, linkedList_t *params)
virtual void onWindowClosed (uiNode_t *node)
virtual void onWindowActivate (uiNode_t *node)
virtual void onActivate (uiNode_t *node)
 Activate the node. Can be used without the mouse (ie. a button will execute onClick).
virtual void onPropertyChanged (uiNode_t *node, const value_t *property)
virtual ~uiNode ()

Protected Member Functions

void drawText (uiNode_t *node, const char *text, const linkedList_t *list, bool noDraw)
 Handles line breaks and drawing for shared data id.
virtual void updateCache (uiNode_t *node)

Detailed Description

Definition at line 29 of file ui_node_text.h.

Member Function Documentation

◆ doLayout()

void uiTextNode::doLayout ( uiNode_t * node)
overridevirtual

Call to update the node layout. This common code revalidates the node tree.

Called to update node layout

Reimplemented from uiLocatedNode.

Definition at line 158 of file ui_node_text.cpp.

References uiNode_t::box, Com_Error(), Com_Printf(), uiLocatedNode::doLayout(), ERR_DROP, EXTRADATA, uiBox_t::size, uiNode_t::text, TEXT_NULL, UI_FontGetHeight(), UI_GetFontFromNode(), UI_GetPath(), and UI_MAX_DATAID.

◆ draw()

◆ drawText()

void uiTextNode::drawText ( uiNode_t * node,
const char * text,
const linkedList_t * list,
bool noDraw )
protected

Handles line breaks and drawing for shared data id.

Parameters
[in]nodeThe context node
[in]textThe test to draw else nullptr
[in]listThe test to draw else nullptr
[in]noDrawIf true, calling of this function only update the cache (real number of lines)
Note
text or list but be used, not both

< Nothing to draw

Todo
what about multiline text that should be highlighted completely?

Definition at line 210 of file ui_node_text.cpp.

References uiNode_t::box, CL_Translate(), uiNode_t::color, Com_sprintf(), uiNode_t::contentAlign, linkedList_t::data, EXTRADATA, uiAbstractScrollableNode::isSizeChange(), LONGLINES_PRETTYCHOP, MAX_VAR, linkedList_t::next, uiNode_t::padding, Q_strncpyz(), R_Color(), R_FontTextSize(), uiNode_t::selectedColor, uiAbstractScrollableNode::setScrollY(), uiBox_t::size, uiNode_t::state, UI_DrawString(), UI_FontGetHeight(), UI_GetFontFromNode(), UI_GetNodeAbsPos(), UI_TEXTNODE_BUFFERSIZE, and VectorScale.

Referenced by draw(), and updateCache().

◆ getCellHeight()

int uiTextNode::getCellHeight ( uiNode_t * node)
overridevirtual

Return size of the cell, which is the size (in virtual "pixel") which represent 1 in the scroll values. Here we guess the widget can scroll pixel per pixel.

Returns
Size in pixel.

Reimplemented from uiLocatedNode.

Definition at line 577 of file ui_node_text.cpp.

References EXTRADATA, UI_FontGetHeight(), and UI_GetFontFromNode().

Referenced by onCapturedMouseMove().

◆ onCapturedMouseMove()

void uiTextNode::onCapturedMouseMove ( uiNode_t * node,
int x,
int y )
overridevirtual

Mouse move event in the node when captured

Reimplemented from uiLocatedNode.

Definition at line 558 of file ui_node_text.cpp.

References getCellHeight(), mouseScrollX, mouseScrollY, onMouseMove(), and uiAbstractScrollableNode::scrollY().

◆ onLeftClick()

void uiTextNode::onLeftClick ( uiNode_t * node,
int x,
int y )
overridevirtual

Calls the script command for a text node that is clickable.

See also
UI_TextNodeRightClick

Reimplemented from uiLocatedNode.

Definition at line 465 of file ui_node_text.cpp.

References EXTRADATA, uiNode_t::lua_onClick, uiNode_t::onClick, UI_ExecuteEventActions(), UI_ExecuteLuaEventScript_XY(), UI_TextNodeGetLine(), and UI_TextNodeSelectLine().

◆ onLoaded()

void uiTextNode::onLoaded ( uiNode_t * node)
overridevirtual

only called one time, when node parsing was finished

Reimplemented from uiNode.

Definition at line 533 of file ui_node_text.cpp.

◆ onLoading()

void uiTextNode::onLoading ( uiNode_t * node)
overridevirtual

Called before script initialization, initialized default values

< Invalid/no line selected per default.

Reimplemented from uiNode.

Definition at line 525 of file ui_node_text.cpp.

References uiNode_t::color, EXTRADATA, uiNode_t::selectedColor, and Vector4Set.

◆ onMouseDown()

void uiTextNode::onMouseDown ( uiNode_t * node,
int x,
int y,
int button )
overridevirtual

Track mouse down/up events to implement drag&drop-like scrolling, for touchscreen devices.

See also
UI_TextNodeMouseUp, UI_TextNodeCapturedMouseMove

Reimplemented from uiLocatedNode.

Definition at line 542 of file ui_node_text.cpp.

References EXTRADATA, K_MOUSE1, mouseScrollX, mouseScrollY, UI_GetMouseCapture(), and UI_SetMouseCapture().

◆ onMouseMove()

void uiTextNode::onMouseMove ( uiNode_t * node,
int x,
int y )
overridevirtual

Mouse move event in the node

Reimplemented from uiLocatedNode.

Definition at line 153 of file ui_node_text.cpp.

References EXTRADATA, and UI_TextNodeGetLine().

Referenced by onCapturedMouseMove().

◆ onMouseUp()

void uiTextNode::onMouseUp ( uiNode_t * node,
int x,
int y,
int button )
overridevirtual

Mouse button up event in the node

Reimplemented from uiLocatedNode.

Definition at line 552 of file ui_node_text.cpp.

References UI_GetMouseCapture(), and UI_MouseRelease().

◆ onRightClick()

void uiTextNode::onRightClick ( uiNode_t * node,
int x,
int y )
overridevirtual

Calls the script command for a text node that is clickable via right mouse button.

See also
UI_TextNodeClick

Reimplemented from uiLocatedNode.

Definition at line 486 of file ui_node_text.cpp.

References EXTRADATA, uiNode_t::onRightClick, UI_ExecuteEventActions(), UI_TextNodeGetLine(), and UI_TextNodeSelectLine().

◆ onScroll()

bool uiTextNode::onScroll ( uiNode_t * node,
int deltaX,
int deltaY )
overridevirtual

Mouse wheel event in the node

Reimplemented from uiLocatedNode.

Definition at line 501 of file ui_node_text.cpp.

References down, uiNode_t::onWheel, uiNode_t::onWheelDown, uiNode_t::onWheelUp, uiAbstractScrollableNode::scrollY(), and UI_ExecuteEventActions().

◆ updateCache()

◆ validateCache()

void uiTextNode::validateCache ( uiNode_t * node)

Definition at line 52 of file ui_node_text.cpp.

References EXTRADATA, uiNode_t::text, TEXT_NULL, UI_GetDataVersion(), updateCache(), and v.

Referenced by uiText2Node::draw(), and UI_TextScrollEnd().


The documentation for this class was generated from the following files: