TextWidget Class Reference

#include <TextWidget.h>

Inheritance diagram for TextWidget:

Gump Object List of all members.

Public Member Functions

 ENABLE_RUNTIME_CLASSTYPE ()
 TextWidget ()
 TextWidget (int X, int Y, std::string txt, bool gamefont, int fontnum, int width=0, int height=0, Font::TextAlign align=Font::TEXT_LEFT)
virtual ~TextWidget (void)
virtual void InitGump (Gump *newparent, bool take_focus=true)
virtual void PaintThis (RenderSurface *, sint32 lerp_factor, bool scaled)
virtual void PaintComposited (RenderSurface *surf, sint32 lerp_factor, sint32 scalex, sint32 scaley)
virtual GumpOnMouseMotion (int mx, int my)
bool setupNextText ()
void rewind ()
void getCurrentText (unsigned int &start, unsigned int &end) const
void setBlendColour (uint32 col)
int getVlead ()
bool loadData (IDataSource *ids, uint32 version)

Protected Member Functions

void renderText ()
Pentagram::FontgetFont () const
virtual void saveData (ODataSource *ods)

Protected Attributes

std::string text
bool gamefont
int fontnum
uint32 blendColour
int tx
int ty
unsigned int current_start
unsigned int current_end
int targetwidth
int targetheight
RenderedTextcached_text
Font::TextAlign textalign

Detailed Description

Definition at line 34 of file TextWidget.h.


Constructor & Destructor Documentation

TextWidget::TextWidget (  ) 

Definition at line 33 of file TextWidget.cpp.

TextWidget::TextWidget ( int  X,
int  Y,
std::string  txt,
bool  gamefont,
int  fontnum,
int  width = 0,
int  height = 0,
Font::TextAlign  align = Font::TEXT_LEFT 
)

Definition at line 39 of file TextWidget.cpp.

TextWidget::~TextWidget ( void   )  [virtual]

Definition at line 48 of file TextWidget.cpp.

References cached_text.


Member Function Documentation

TextWidget::ENABLE_RUNTIME_CLASSTYPE (  ) 

Reimplemented from Gump.

void TextWidget::getCurrentText ( unsigned int &  start,
unsigned int &  end 
) const [inline]

get the text that's currently being displayed

Parameters:
start Returns the start of the text
end Returns the start of the remaining text

Definition at line 79 of file TextWidget.h.

References current_end, and current_start.

Pentagram::Font * TextWidget::getFont (  )  const [protected]

Definition at line 103 of file TextWidget.cpp.

References fontnum, gamefont, FontManager::get_instance(), FontManager::getGameFont(), and FontManager::getTTFont().

Referenced by getVlead(), InitGump(), loadData(), PaintComposited(), PaintThis(), renderText(), and setupNextText().

int TextWidget::getVlead (  ) 

get the RenderedText's vlead

Definition at line 88 of file TextWidget.cpp.

References cached_text, gamefont, getFont(), RenderedText::getVlead(), renderText(), Gump::ROUND_OUTSIDE, Gump::ScreenSpaceToGumpRect(), Gump::x, and Gump::y.

void TextWidget::InitGump ( Gump newparent,
bool  take_focus = true 
) [virtual]

Init the gump and add it to parent; call after construction When newparent is 0, this will call GUIApp::addGump().

Parameters:
newparent The Gump's new parent or 0.
takefocus If true, set parent's focus_child to this

Reimplemented from Gump.

Definition at line 55 of file TextWidget.cpp.

References Gump::dims, font, gamefont, getFont(), Gump::GumpRectToScreenSpace(), Pentagram::Rect::h, Gump::InitGump(), Gump::ROUND_OUTSIDE, Gump::ScreenSpaceToGumpRect(), setupNextText(), targetheight, targetwidth, tx, ty, Pentagram::Rect::w, Gump::x, Pentagram::Rect::x, Gump::y, and Pentagram::Rect::y.

Referenced by BookGump::InitGump(), and BarkGump::InitGump().

bool TextWidget::loadData ( IDataSource ids,
uint32  version 
)

Reimplemented from Gump.

Definition at line 237 of file TextWidget.cpp.

References blendColour, current_end, current_start, Gump::dims, font, fontnum, gamefont, getFont(), Pentagram::Rect::h, Gump::loadData(), targetheight, targetwidth, text, textalign, tx, ty, Pentagram::Rect::w, and Pentagram::Rect::y.

Gump * TextWidget::OnMouseMotion ( int  mx,
int  my 
) [virtual]

Reimplemented from Gump.

Definition at line 215 of file TextWidget.cpp.

void TextWidget::PaintComposited ( RenderSurface surf,
sint32  lerp_factor,
sint32  scalex,
sint32  scaley 
) [virtual]

Overloadable method to Paint just this gumps unscaled components that require compositing (RenderSurface is relative to parent).

Reimplemented from Gump.

Definition at line 190 of file TextWidget.cpp.

References blendColour, cached_text, Gump::dims, RenderedText::draw(), RenderedText::drawBlended(), font, gamefont, getFont(), Gump::GetParent(), Gump::GumpRectToScreenSpace(), Gump::GumpToScreenSpace(), Pentagram::Rect::h, Gump::parent, Gump::ROUND_BOTTOMRIGHT, Gump::ROUND_OUTSIDE, Pentagram::Rect::w, Pentagram::Rect::x, Gump::x, Pentagram::Rect::y, and Gump::y.

void TextWidget::PaintThis ( RenderSurface ,
sint32  lerp_factor,
bool  scaled 
) [virtual]

Overloadable method to Paint just this Gump (RenderSurface is relative to this).

Reimplemented from Gump.

Definition at line 171 of file TextWidget.cpp.

References blendColour, cached_text, Gump::dims, RenderedText::draw(), RenderedText::drawBlended(), RenderSurface::FillAlpha(), gamefont, getFont(), Pentagram::Rect::h, Gump::PaintThis(), renderText(), Pentagram::Rect::w, Pentagram::Rect::x, and Pentagram::Rect::y.

void TextWidget::renderText (  )  [protected]

Definition at line 157 of file TextWidget.cpp.

References cached_text, current_end, current_start, font, getFont(), targetheight, targetwidth, text, and textalign.

Referenced by getVlead(), and PaintThis().

void TextWidget::rewind (  ) 

reset the widget to the start of the text

Definition at line 150 of file TextWidget.cpp.

References current_end, current_start, and setupNextText().

Referenced by BarkGump::InitGump().

void TextWidget::saveData ( ODataSource ods  )  [protected, virtual]

save the actual Object data

Reimplemented from Gump.

Definition at line 221 of file TextWidget.cpp.

References blendColour, current_end, current_start, fontnum, gamefont, Gump::saveData(), targetheight, targetwidth, text, textalign, ODataSource::write(), ODataSource::write1(), ODataSource::write2(), and ODataSource::write4().

void TextWidget::setBlendColour ( uint32  col  )  [inline]

set the colour to blend the rendered text with. (0 to disable)

Definition at line 84 of file TextWidget.h.

References blendColour.

bool TextWidget::setupNextText (  ) 

display the next part of the text

Returns:
false if there is no more text to display

Definition at line 111 of file TextWidget.cpp.

References cached_text, current_end, current_start, Gump::dims, font, gamefont, getFont(), Pentagram::Rect::h, Gump::ROUND_OUTSIDE, Gump::ScreenSpaceToGumpRect(), targetheight, targetwidth, text, textalign, tx, ty, Pentagram::Rect::w, Gump::x, Pentagram::Rect::x, Gump::y, and Pentagram::Rect::y.

Referenced by InitGump(), BookGump::InitGump(), BarkGump::InitGump(), ScrollGump::NextText(), BookGump::NextText(), BarkGump::NextText(), and rewind().


Member Data Documentation

uint32 TextWidget::blendColour [protected]

Definition at line 40 of file TextWidget.h.

Referenced by loadData(), PaintComposited(), PaintThis(), saveData(), and setBlendColour().

RenderedText* TextWidget::cached_text [protected]

Definition at line 48 of file TextWidget.h.

Referenced by getVlead(), PaintComposited(), PaintThis(), renderText(), setupNextText(), and ~TextWidget().

unsigned int TextWidget::current_end [protected]

start of remaining text

Definition at line 44 of file TextWidget.h.

Referenced by getCurrentText(), loadData(), renderText(), rewind(), saveData(), and setupNextText().

unsigned int TextWidget::current_start [protected]

start of currently displaying text

Definition at line 43 of file TextWidget.h.

Referenced by getCurrentText(), loadData(), renderText(), rewind(), saveData(), and setupNextText().

int TextWidget::fontnum [protected]

Definition at line 39 of file TextWidget.h.

Referenced by getFont(), loadData(), and saveData().

bool TextWidget::gamefont [protected]

Definition at line 38 of file TextWidget.h.

Referenced by getFont(), getVlead(), InitGump(), loadData(), PaintComposited(), PaintThis(), saveData(), and setupNextText().

int TextWidget::targetheight [protected]

Definition at line 46 of file TextWidget.h.

Referenced by InitGump(), loadData(), renderText(), saveData(), and setupNextText().

int TextWidget::targetwidth [protected]

Definition at line 46 of file TextWidget.h.

Referenced by InitGump(), loadData(), renderText(), saveData(), and setupNextText().

std::string TextWidget::text [protected]

Definition at line 37 of file TextWidget.h.

Referenced by loadData(), renderText(), saveData(), and setupNextText().

Font::TextAlign TextWidget::textalign [protected]

Definition at line 49 of file TextWidget.h.

Referenced by loadData(), renderText(), saveData(), and setupNextText().

int TextWidget::tx [protected]

Definition at line 41 of file TextWidget.h.

Referenced by InitGump(), loadData(), and setupNextText().

int TextWidget::ty [protected]

Definition at line 41 of file TextWidget.h.

Referenced by InitGump(), loadData(), and setupNextText().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:30:02 2007 for pentagram by  doxygen 1.4.7