newspeoplefor developersdocumentationdownloads

nGuiTextView Class Reference
[Graphical User Interface]

#include <nguitextview.h>

Inheritance diagram for nGuiTextView:

nGuiFormLayout nGuiWidget nRoot nObject nNode nReferenced nSignalEmitter nGuiCmdEntry nGuiDirLister nGuiHardpointsLister List of all members.

Detailed Description

A multiline text viewing widgets, which can display lines of text.

This is the basis for more advanced widgets which need to display text in multiple lines.

(C) 2004 RadonLabs GmbH

Definition at line 21 of file nguitextview.h.


Public Member Functions

 nGuiTextView ()
 constructor
virtual ~nGuiTextView ()
 destructor
void SetFont (const nString &fontName)
 set the font to use (see nGuiServer::AddFont())
const nStringGetFont () const
 get the font definition
void SetTextColor (const vector4 &c)
 set text color
const vector4GetTextColor () const
 get text color
void SetBorder (float b)
 set horizontal border
float GetBorder () const
 get horizontal border
virtual void BeginAppend ()
 begin appending text
virtual void AppendLine (const nString &t)
 append a line of text (copies the text)
virtual void AppendColoredLine (const nString &t, const vector4 &color)
 append a colored line of text (copies the text)
virtual void AppendEmptyLine ()
 append a empty line
virtual void AppendText (const nString &t)
 append a text (copies the text), breaks into lines
virtual void AppendColoredText (const nString &t, const vector4 &color)
 append a text (copies the text), breaks into lines
void EndAppend ()
 finish appending text
const nStringGetLineAt (int i) const
 get line at index
void SetLineOffset (int i)
 set the line offset (the index of the first visible line)
int GetLineOffset () const
 get the line offset
void SetSelectionEnabled (bool b)
 enable/disable selection handling
bool GetSelectionEnabled () const
 get selection handling flag
void SetLookUpEnabled (bool b)
 set selection index
bool GetLookUpEnabled () const
 get selection handling flag
void SetSelectionIndex (int i)
 set selection index
int GetSelectionIndex () const
 get the selection index
const char * GetSelection () const
 get the currently selected text, or 0 if nothing selected
virtual int GetNumLines () const
 get overall number of lines
int GetNumVisibleLines ()
 get the number of lines that would currently fit into the text view
virtual void OnShow ()
 called when widget is becoming visible
virtual void OnHide ()
 called when widget is becoming invisible
virtual void OnRectChange (const rectangle &newRect)
 called when widget position or size changes
virtual void OnFrame ()
 called per frame when parent widget is visible
virtual void OnEvent (const nGuiEvent &event)
 notify widget of an event
virtual bool OnButtonDown (const vector2 &mousePos)
 handle button down
virtual bool OnKeyDown (nKey key)
 handle key down
virtual void ScrollToLastLine ()
 snap to the end
virtual bool Render ()
 rendering
void ActivateFont ()
 set the font in the gfxserver
void SetCalculateTextAlwaysWithSlider (bool enable)
 set if the textfield size will always take the slider into account
bool GetCalculateTextAlwaysWithSlider () const
 get if the textfield size will always take the slider into account

Protected Member Functions

void ValidateFont ()
 validate the font resource
void UpdateSliderValues ()
 update the slider range values
void UpdateSliderVisibility ()
 update slider visibility status
void ScrollUp (int numLines)
 scroll up one line
void ScrollDown (int numLines)
 scroll down one line

Protected Attributes

nRef< nFont2refFont
nRef< nGuiSlider2refSlider
nString fontName
float lineHeight
float border
vector4 textColor
nArray< nStringtextArray
nArray< vector4colorArray
bool selectionEnabled
bool lookupEnabled
int lineOffset
int selectionIndex
bool calculateTextAlwaysWithSlider

Constructor & Destructor Documentation

nGuiTextView::nGuiTextView  ) 
 

constructor

Definition at line 19 of file nguitextview_main.cc.

nGuiTextView::~nGuiTextView  )  [virtual]
 

destructor

Definition at line 37 of file nguitextview_main.cc.


Member Function Documentation

void nGuiTextView::SetFont const nString fontName  )  [inline]
 

set the font to use (see nGuiServer::AddFont())

Definition at line 348 of file nguitextview.h.

const nString & nGuiTextView::GetFont  )  const [inline]
 

get the font definition

Definition at line 358 of file nguitextview.h.

void nGuiTextView::SetTextColor const vector4 c  )  [inline]
 

set text color

Definition at line 328 of file nguitextview.h.

const vector4 & nGuiTextView::GetTextColor  )  const [inline]
 

get text color

Definition at line 338 of file nguitextview.h.

void nGuiTextView::SetBorder float  b  )  [inline]
 

set horizontal border

Definition at line 137 of file nguitextview.h.

float nGuiTextView::GetBorder  )  const [inline]
 

get horizontal border

Definition at line 147 of file nguitextview.h.

void nGuiTextView::BeginAppend  )  [inline, virtual]
 

begin appending text

Definition at line 251 of file nguitextview.h.

void nGuiTextView::AppendLine const nString t  )  [inline, virtual]
 

append a line of text (copies the text)

Definition at line 262 of file nguitextview.h.

void nGuiTextView::AppendColoredLine const nString t,
const vector4 color
[inline, virtual]
 

append a colored line of text (copies the text)

Definition at line 282 of file nguitextview.h.

void nGuiTextView::AppendEmptyLine  )  [inline, virtual]
 

append a empty line

Definition at line 272 of file nguitextview.h.

void nGuiTextView::AppendText const nString t  )  [inline, virtual]
 

append a text (copies the text), breaks into lines

Definition at line 293 of file nguitextview.h.

void nGuiTextView::AppendColoredText const nString t,
const vector4 color
[virtual]
 

append a text (copies the text), breaks into lines

Definition at line 486 of file nguitextview_main.cc.

void nGuiTextView::EndAppend  )  [inline]
 

finish appending text

Definition at line 318 of file nguitextview.h.

const nString & nGuiTextView::GetLineAt int  i  )  const [inline]
 

get line at index

Definition at line 368 of file nguitextview.h.

void nGuiTextView::SetLineOffset int  i  )  [inline]
 

set the line offset (the index of the first visible line)

Definition at line 227 of file nguitextview.h.

int nGuiTextView::GetLineOffset  )  const [inline]
 

get the line offset

Definition at line 241 of file nguitextview.h.

void nGuiTextView::SetSelectionEnabled bool  b  )  [inline]
 

enable/disable selection handling

Definition at line 157 of file nguitextview.h.

bool nGuiTextView::GetSelectionEnabled  )  const [inline]
 

get selection handling flag

Definition at line 167 of file nguitextview.h.

void nGuiTextView::SetLookUpEnabled bool  b  )  [inline]
 

set selection index

Definition at line 177 of file nguitextview.h.

bool nGuiTextView::GetLookUpEnabled  )  const [inline]
 

get selection handling flag

Definition at line 187 of file nguitextview.h.

void nGuiTextView::SetSelectionIndex int  i  )  [inline]
 

set selection index

Definition at line 197 of file nguitextview.h.

int nGuiTextView::GetSelectionIndex  )  const [inline]
 

get the selection index

Definition at line 207 of file nguitextview.h.

const char * nGuiTextView::GetSelection  )  const [inline]
 

get the currently selected text, or 0 if nothing selected

Returns a pointer to the selected text, or 0 if no valid selection exists.

Definition at line 380 of file nguitextview.h.

int nGuiTextView::GetNumLines  )  const [inline, virtual]
 

get overall number of lines

Definition at line 217 of file nguitextview.h.

int nGuiTextView::GetNumVisibleLines  ) 
 

get the number of lines that would currently fit into the text view

Compute the number of lines that would fully fit into this widget.

Definition at line 127 of file nguitextview_main.cc.

void nGuiTextView::OnShow  )  [virtual]
 

called when widget is becoming visible

Reimplemented from nGuiWidget.

Reimplemented in nGuiCmdEntry, nGuiDirLister, and nGuiHardpointsLister.

Definition at line 46 of file nguitextview_main.cc.

void nGuiTextView::OnHide  )  [virtual]
 

called when widget is becoming invisible

Reimplemented from nGuiWidget.

Definition at line 73 of file nguitextview_main.cc.

void nGuiTextView::OnRectChange const rectangle newRect  )  [virtual]
 

called when widget position or size changes

Reimplemented from nGuiFormLayout.

Definition at line 89 of file nguitextview_main.cc.

void nGuiTextView::OnFrame  )  [virtual]
 

called per frame when parent widget is visible

Check if full range of text is visible, and show/hide slider.

23-Nov-04 floh removed the HasFocus(), this doesn't make sense here...

Reimplemented from nGuiWidget.

Reimplemented in nGuiCmdEntry, nGuiDirLister, and nGuiHardpointsLister.

Definition at line 166 of file nguitextview_main.cc.

void nGuiTextView::OnEvent const nGuiEvent event  )  [virtual]
 

notify widget of an event

Listen to events from our slider.

Reimplemented from nGuiWidget.

Definition at line 189 of file nguitextview_main.cc.

bool nGuiTextView::OnButtonDown const vector2 mousePos  )  [virtual]
 

handle button down

If selection is enabled, the selection index will be updated with the entry under the mouse, and a SelectionChanged event will be thrown.

Reimplemented from nGuiWidget.

Definition at line 328 of file nguitextview_main.cc.

bool nGuiTextView::OnKeyDown nKey  key  )  [virtual]
 

handle key down

If selection is enabled, the selection index will be updated with the entry under the mouse, and a SelectionChanged event will be thrown.

Reimplemented from nGuiWidget.

Reimplemented in nGuiCmdEntry.

Definition at line 228 of file nguitextview_main.cc.

void nGuiTextView::ScrollToLastLine  )  [virtual]
 

snap to the end

Scroll down to last line

Definition at line 405 of file nguitextview_main.cc.

bool nGuiTextView::Render  )  [virtual]
 

rendering

Render the widget.

Reimplemented from nGuiWidget.

Definition at line 421 of file nguitextview_main.cc.

void nGuiTextView::ActivateFont  ) 
 

set the font in the gfxserver

Definition at line 476 of file nguitextview_main.cc.

void nGuiTextView::SetCalculateTextAlwaysWithSlider bool  enable  )  [inline]
 

set if the textfield size will always take the slider into account

Definition at line 398 of file nguitextview.h.

bool nGuiTextView::GetCalculateTextAlwaysWithSlider  )  const [inline]
 

get if the textfield size will always take the slider into account

Definition at line 408 of file nguitextview.h.

void nGuiTextView::ValidateFont  )  [protected]
 

validate the font resource

This validates the font resource if not happened yet.

Definition at line 104 of file nguitextview_main.cc.

void nGuiTextView::UpdateSliderValues  )  [inline, protected]
 

update the slider range values

Definition at line 303 of file nguitextview.h.

void nGuiTextView::UpdateSliderVisibility  )  [protected]
 

update slider visibility status

Show or hide the vertical slider, depending on number of visible lines versus overall number of lines.

Definition at line 139 of file nguitextview_main.cc.

void nGuiTextView::ScrollUp int  numLines  )  [protected]
 

scroll up one line

Scroll up one line.

Definition at line 368 of file nguitextview_main.cc.

void nGuiTextView::ScrollDown int  numLines  )  [protected]
 

scroll down one line

Scroll down one line.

Definition at line 388 of file nguitextview_main.cc.


Member Data Documentation

nRef<nFont2> nGuiTextView::refFont [protected]
 

Definition at line 116 of file nguitextview.h.

nRef<nGuiSlider2> nGuiTextView::refSlider [protected]
 

Definition at line 117 of file nguitextview.h.

nString nGuiTextView::fontName [protected]
 

Definition at line 119 of file nguitextview.h.

float nGuiTextView::lineHeight [protected]
 

Definition at line 120 of file nguitextview.h.

float nGuiTextView::border [protected]
 

Definition at line 121 of file nguitextview.h.

vector4 nGuiTextView::textColor [protected]
 

Definition at line 122 of file nguitextview.h.

nArray<nString> nGuiTextView::textArray [protected]
 

Definition at line 123 of file nguitextview.h.

nArray<vector4> nGuiTextView::colorArray [protected]
 

Definition at line 124 of file nguitextview.h.

bool nGuiTextView::selectionEnabled [protected]
 

Definition at line 125 of file nguitextview.h.

bool nGuiTextView::lookupEnabled [protected]
 

Definition at line 126 of file nguitextview.h.

int nGuiTextView::lineOffset [protected]
 

Definition at line 127 of file nguitextview.h.

int nGuiTextView::selectionIndex [protected]
 

Definition at line 128 of file nguitextview.h.

bool nGuiTextView::calculateTextAlwaysWithSlider [protected]
 

Definition at line 129 of file nguitextview.h.


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

Copyright © 1999-2005 by the contributing authors. Ideas, requests, problems: Send feedback.