xoreos  0.0.5
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Engines::NWN::DialogBox Class Reference

#include <dialog.h>

Inheritance diagram for Engines::NWN::DialogBox:
Inheritance graph
[legend]
Collaboration diagram for Engines::NWN::DialogBox:
Collaboration graph
[legend]

Classes

struct  Reply
 A PC reply. More...
 
struct  ReplyLine
 A line of a PC reply. More...
 

Public Member Functions

 DialogBox (float width, float height)
 
 ~DialogBox ()
 
void show ()
 Show the box. More...
 
void hide ()
 Hide the box. More...
 
float getWidth () const
 Return the box's width. More...
 
float getHeight () const
 Return the box's height. More...
 
void getPosition (float &x, float &y, float &z) const
 Return the box's position. More...
 
void setPosition (float x, float y, float z)
 Set the box's position. More...
 
void clear ()
 Clear the complete contents. More...
 
void setPortrait (const Common::UString &portrait)
 Set the current speaker's portrait. More...
 
void setName (const Common::UString &name)
 Set the current speaker's name. More...
 
void clearEntry ()
 Clear the NPC entry. More...
 
void setEntry (const Common::UString &entry)
 Set the NPC entry. More...
 
void clearReplies ()
 Clear the PC replies. More...
 
void addReply (const Common::UString &reply, uint32 id)
 Add a PC reply. More...
 
void finishReplies ()
 Finished adding PC replies. More...
 
void mouseMove (int x, int y)
 Notify the box that the mouse was moved. More...
 
void mouseClick (int x, int y)
 Notify the box that the mouse was clicked. More...
 
void pickReply (uint32 n)
 Pick the reply number n. More...
 
uint32 getPickedID () const
 Return the reply ID that was clicked. More...
 
void calculateDistance ()
 Calculate the object's distance. More...
 
void render (Graphics::RenderPass pass)
 Render the object. More...
 
- Public Member Functions inherited from Graphics::GUIElement
 GUIElement (GUIElementType type)
 
 ~GUIElement ()
 
- Public Member Functions inherited from Graphics::Renderable
 Renderable (RenderableType type)
 
 ~Renderable ()
 
bool operator< (const Queueable &q) const
 
virtual void advanceTime (float dt)
 Advance time (used by renderables with animations). More...
 
virtual void renderImmediate (const glm::mat4 &parentTransform)
 For shader based systems, don't sort anything, render this right_now. More...
 
virtual void queueRender (const glm::mat4 &parentTransform)
 Queue the object for later rendering. More...
 
double getDistance () const
 Get the distance of the object from the viewer. More...
 
uint32 getID () const
 Get the object's unique ID. More...
 
bool isClickable () const
 Is the object clickable? More...
 
void setClickable (bool clickable)
 Set the object's clickable state. More...
 
const Common::UStringgetTag () const
 Get the object's tag. More...
 
void setTag (const Common::UString &tag)
 Set the object's tag. More...
 
bool isVisible () const
 Is the object visible? More...
 
virtual bool isIn (float x, float y, float z) const
 Is that point within the object? More...
 
virtual bool isIn (float x1, float y1, float z1, float x2, float y2, float z2) const
 Does the line from x1.y1.z1 to x2.y2.z2 intersect with the object? More...
 
- Public Member Functions inherited from Graphics::Queueable
 Queueable ()
 
virtual ~Queueable ()
 

Private Member Functions

void showEntry ()
 Show the entry. More...
 
void hideEntry ()
 Hide the entry. More...
 
void showReplies ()
 Show the replies. More...
 
void hideReplies ()
 Hide the replies. More...
 
bool isIn (float x, float y) const
 Are the coordinates inside the box? More...
 
void setHighlight (const std::list< ReplyLine >::iterator &h)
 Set the highlighted reply. More...
 

Private Attributes

float _width
 The box's width. More...
 
float _height
 The box's height. More...
 
float _x
 The box's X position. More...
 
float _y
 The box's Y position. More...
 
float _z
 The box's Z position. More...
 
Common::ScopedPtr< Portrait_portrait
 The current speaker's portrait. More...
 
Common::ScopedPtr< Graphics::Aurora::Text_name
 The current speaker's name. More...
 
Graphics::Aurora::FontHandle _font
 The dialog font. More...
 
Common::UString _entry
 The NPC entry. More...
 
std::list< Reply_replies
 The PC replies. More...
 
Common::PtrList< Graphics::Aurora::Text_entryLines
 The NPC text lines. More...
 
std::list< ReplyLine_replyLines
 The PC text lines. More...
 
uint32 _replyCount
 The number of replies. More...
 
float _replyCountWidth
 The max width of a reply number text. More...
 
std::list< ReplyLine >::iterator _highlightedReply
 The currently highlighted reply. More...
 
std::list< Reply >::const_iterator _pickedReply
 The picked (clicked) reply. More...
 

Additional Inherited Members

- Public Types inherited from Graphics::GUIElement
enum  GUIElementType { kGUIElementFront = kRenderableTypeGUIFront, kGUIElementBack = kRenderableTypeGUIBack, kGUIElementConsole = kRenderableTypeConsole }
 
- Protected Member Functions inherited from Graphics::Renderable
void resort ()
 
void lockFrame ()
 
void unlockFrame ()
 
void lockFrameIfVisible ()
 
void unlockFrameIfVisible ()
 
- Protected Member Functions inherited from Graphics::Queueable
bool isInQueue (QueueType queue) const
 
void addToQueue (QueueType queue)
 
void removeFromQueue (QueueType queue)
 
void lockQueue (QueueType queue)
 
void unlockQueue (QueueType queue)
 
void sortQueue (QueueType queue)
 
- Protected Attributes inherited from Graphics::Renderable
QueueType _queueExists
 
QueueType _queueVisible
 
uint32 _id
 
bool _clickable
 
Common::UString _tag
 
double _distance
 The distance of the object from the viewer. More...
 

Detailed Description

Definition at line 70 of file dialog.h.

Constructor & Destructor Documentation

◆ DialogBox()

Engines::NWN::DialogBox::DialogBox ( float  width,
float  height 
)

◆ ~DialogBox()

Engines::NWN::DialogBox::~DialogBox ( )

Definition at line 101 of file dialog.cpp.

References clearEntry(), and clearReplies().

Here is the call graph for this function:

Member Function Documentation

◆ addReply()

void Engines::NWN::DialogBox::addReply ( const Common::UString reply,
uint32  id 
)

Add a PC reply.

Definition at line 330 of file dialog.cpp.

References _replies.

◆ calculateDistance()

void Engines::NWN::DialogBox::calculateDistance ( )
virtual

Calculate the object's distance.

Implements Graphics::Renderable.

Definition at line 483 of file dialog.cpp.

References Graphics::Renderable::_distance, and _z.

◆ clear()

void Engines::NWN::DialogBox::clear ( )

Clear the complete contents.

Definition at line 218 of file dialog.cpp.

References clearEntry(), clearReplies(), setName(), and setPortrait().

Here is the call graph for this function:

◆ clearEntry()

void Engines::NWN::DialogBox::clearEntry ( )

Clear the NPC entry.

Definition at line 248 of file dialog.cpp.

References _entry, _entryLines, Common::PtrList< T, Deallocator >::clear(), Common::UString::clear(), Common::UString::empty(), GfxMan, and hideEntry().

Referenced by clear(), setEntry(), and ~DialogBox().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearReplies()

void Engines::NWN::DialogBox::clearReplies ( )

Clear the PC replies.

Definition at line 312 of file dialog.cpp.

References _pickedReply, _replies, _replyCount, _replyCountWidth, _replyLines, hideReplies(), and setHighlight().

Referenced by clear(), and ~DialogBox().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finishReplies()

void Engines::NWN::DialogBox::finishReplies ( )

◆ getHeight()

float Engines::NWN::DialogBox::getHeight ( ) const

Return the box's height.

Definition at line 147 of file dialog.cpp.

References _height.

◆ getPickedID()

uint32 Engines::NWN::DialogBox::getPickedID ( ) const

Return the reply ID that was clicked.

Definition at line 430 of file dialog.cpp.

References _pickedReply, _replies, and Aurora::DLGFile::kInvalidLine.

◆ getPosition()

void Engines::NWN::DialogBox::getPosition ( float &  x,
float &  y,
float &  z 
) const

Return the box's position.

Definition at line 151 of file dialog.cpp.

References _x, _y, and _z.

◆ getWidth()

float Engines::NWN::DialogBox::getWidth ( ) const

Return the box's width.

Definition at line 143 of file dialog.cpp.

References _width.

◆ hide()

void Engines::NWN::DialogBox::hide ( )
virtual

Hide the box.

Reimplemented from Graphics::Renderable.

Definition at line 120 of file dialog.cpp.

References _name, _portrait, GfxMan, Graphics::Renderable::hide(), hideEntry(), and hideReplies().

Here is the call graph for this function:

◆ hideEntry()

void Engines::NWN::DialogBox::hideEntry ( )
private

Hide the entry.

Definition at line 242 of file dialog.cpp.

References _entryLines.

Referenced by clearEntry(), and hide().

Here is the caller graph for this function:

◆ hideReplies()

void Engines::NWN::DialogBox::hideReplies ( )
private

Hide the replies.

Definition at line 302 of file dialog.cpp.

References _replyLines.

Referenced by clearReplies(), and hide().

Here is the caller graph for this function:

◆ isIn()

bool Engines::NWN::DialogBox::isIn ( float  x,
float  y 
) const
privatevirtual

Are the coordinates inside the box?

Reimplemented from Graphics::Renderable.

Definition at line 134 of file dialog.cpp.

References _height, _width, _x, and _y.

Referenced by mouseMove().

Here is the caller graph for this function:

◆ mouseClick()

void Engines::NWN::DialogBox::mouseClick ( int  x,
int  y 
)

Notify the box that the mouse was clicked.

Definition at line 411 of file dialog.cpp.

References _highlightedReply, _pickedReply, _replies, _replyLines, and mouseMove().

Here is the call graph for this function:

◆ mouseMove()

void Engines::NWN::DialogBox::mouseMove ( int  x,
int  y 
)

Notify the box that the mouse was moved.

Definition at line 393 of file dialog.cpp.

References _replyLines, CursorMan, isIn(), and setHighlight().

Referenced by mouseClick().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pickReply()

void Engines::NWN::DialogBox::pickReply ( uint32  n)

Pick the reply number n.

Definition at line 420 of file dialog.cpp.

References _pickedReply, _replies, and _replyCount.

◆ render()

void Engines::NWN::DialogBox::render ( Graphics::RenderPass  pass)
virtual

Render the object.

Implements Graphics::Renderable.

Definition at line 487 of file dialog.cpp.

References _height, _width, _x, _y, Graphics::kRenderPassOpaque, pass, and TextureMan.

◆ setEntry()

void Engines::NWN::DialogBox::setEntry ( const Common::UString entry)

◆ setHighlight()

void Engines::NWN::DialogBox::setHighlight ( const std::list< ReplyLine >::iterator &  h)
private

Set the highlighted reply.

Definition at line 437 of file dialog.cpp.

References _highlightedReply, _replyLines, kLightBlueB, kLightBlueG, and kLightBlueR.

Referenced by clearReplies(), and mouseMove().

Here is the caller graph for this function:

◆ setName()

void Engines::NWN::DialogBox::setName ( const Common::UString name)

Set the current speaker's name.

Definition at line 230 of file dialog.cpp.

References _name.

Referenced by clear().

Here is the caller graph for this function:

◆ setPortrait()

void Engines::NWN::DialogBox::setPortrait ( const Common::UString portrait)

Set the current speaker's portrait.

Definition at line 226 of file dialog.cpp.

References _portrait.

Referenced by clear().

Here is the caller graph for this function:

◆ setPosition()

void Engines::NWN::DialogBox::setPosition ( float  x,
float  y,
float  z 
)

Set the box's position.

Definition at line 157 of file dialog.cpp.

References _entryLines, _font, _height, _name, _portrait, _replyCountWidth, _replyLines, _x, _y, _z, Graphics::Aurora::FontHandle::getFont(), Graphics::Font::getHeight(), Graphics::Font::getLineSpacing(), GfxMan, and Graphics::Renderable::resort().

Referenced by finishReplies(), and setEntry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ show()

void Engines::NWN::DialogBox::show ( )
virtual

Show the box.

Reimplemented from Graphics::Renderable.

Definition at line 106 of file dialog.cpp.

References _name, _portrait, GfxMan, Graphics::Renderable::show(), showEntry(), and showReplies().

Here is the call graph for this function:

◆ showEntry()

void Engines::NWN::DialogBox::showEntry ( )
private

Show the entry.

Definition at line 236 of file dialog.cpp.

References _entryLines.

Referenced by setEntry(), and show().

Here is the caller graph for this function:

◆ showReplies()

void Engines::NWN::DialogBox::showReplies ( )
private

Show the replies.

Definition at line 292 of file dialog.cpp.

References _replyLines.

Referenced by finishReplies(), and show().

Here is the caller graph for this function:

Member Data Documentation

◆ _entry

Common::UString Engines::NWN::DialogBox::_entry
private

The NPC entry.

Definition at line 163 of file dialog.h.

Referenced by clearEntry(), and setEntry().

◆ _entryLines

Common::PtrList<Graphics::Aurora::Text> Engines::NWN::DialogBox::_entryLines
private

The NPC text lines.

Definition at line 166 of file dialog.h.

Referenced by clearEntry(), hideEntry(), setEntry(), setPosition(), and showEntry().

◆ _font

Graphics::Aurora::FontHandle Engines::NWN::DialogBox::_font
private

The dialog font.

Definition at line 161 of file dialog.h.

Referenced by DialogBox(), finishReplies(), setEntry(), and setPosition().

◆ _height

float Engines::NWN::DialogBox::_height
private

The box's height.

Definition at line 149 of file dialog.h.

Referenced by getHeight(), isIn(), render(), and setPosition().

◆ _highlightedReply

std::list<ReplyLine>::iterator Engines::NWN::DialogBox::_highlightedReply
private

The currently highlighted reply.

Definition at line 172 of file dialog.h.

Referenced by DialogBox(), mouseClick(), and setHighlight().

◆ _name

Common::ScopedPtr<Graphics::Aurora::Text> Engines::NWN::DialogBox::_name
private

The current speaker's name.

Definition at line 158 of file dialog.h.

Referenced by DialogBox(), hide(), setName(), setPosition(), and show().

◆ _pickedReply

std::list<Reply>::const_iterator Engines::NWN::DialogBox::_pickedReply
private

The picked (clicked) reply.

Definition at line 173 of file dialog.h.

Referenced by clearReplies(), DialogBox(), getPickedID(), mouseClick(), and pickReply().

◆ _portrait

Common::ScopedPtr<Portrait> Engines::NWN::DialogBox::_portrait
private

The current speaker's portrait.

Definition at line 156 of file dialog.h.

Referenced by DialogBox(), hide(), setEntry(), setPortrait(), setPosition(), and show().

◆ _replies

std::list<Reply> Engines::NWN::DialogBox::_replies
private

The PC replies.

Definition at line 164 of file dialog.h.

Referenced by addReply(), clearReplies(), DialogBox(), finishReplies(), getPickedID(), mouseClick(), and pickReply().

◆ _replyCount

uint32 Engines::NWN::DialogBox::_replyCount
private

The number of replies.

Definition at line 169 of file dialog.h.

Referenced by clearReplies(), finishReplies(), and pickReply().

◆ _replyCountWidth

float Engines::NWN::DialogBox::_replyCountWidth
private

The max width of a reply number text.

Definition at line 170 of file dialog.h.

Referenced by clearReplies(), finishReplies(), and setPosition().

◆ _replyLines

std::list<ReplyLine> Engines::NWN::DialogBox::_replyLines
private

The PC text lines.

Definition at line 167 of file dialog.h.

Referenced by clearReplies(), DialogBox(), finishReplies(), hideReplies(), mouseClick(), mouseMove(), setHighlight(), setPosition(), and showReplies().

◆ _width

float Engines::NWN::DialogBox::_width
private

The box's width.

Definition at line 148 of file dialog.h.

Referenced by finishReplies(), getWidth(), isIn(), render(), and setEntry().

◆ _x

float Engines::NWN::DialogBox::_x
private

The box's X position.

Definition at line 151 of file dialog.h.

Referenced by finishReplies(), getPosition(), isIn(), render(), setEntry(), and setPosition().

◆ _y

float Engines::NWN::DialogBox::_y
private

The box's Y position.

Definition at line 152 of file dialog.h.

Referenced by finishReplies(), getPosition(), isIn(), render(), setEntry(), and setPosition().

◆ _z

float Engines::NWN::DialogBox::_z
private

The box's Z position.

Definition at line 153 of file dialog.h.

Referenced by calculateDistance(), finishReplies(), getPosition(), setEntry(), and setPosition().


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