omgui::TextRange Struct Reference

#include <omgui/types.h>

List of all members.


Detailed Description

Specifies a range of text in a TextWidget.

Members: 'first' specifies the beginning of the selection unless documented otherwise in a given function 'second' specifies the the end of the selection unless documented otherwise in a given function

Any function that returns a TextRange object will return a normalized object unless documented otherwise in a given function. Any function that accepts a TextRange argument will normalize() that argument before using it, so you do not need to normalize the TextRange yourself. Note however that calling many range functions with an TextRange that is not normalized will be less efficient that if you normalize the range before hand.

If either first or second is negative, indexing will be carried out from the end of the control instead of the front. Consider this art identifying cursor positions for given index values in a string: 0: "|hello" 1: "h|ello" 2: "he|llo" END: "hello|" -1: "hell|o" -2: "hel|lo"

The same applies for selected ranges of text. (| is the beginning of the selection, || is the end) (0, -2): "|hel||lo" (1, END): "h|ello||" (-2, END): "hel|lo||" (-1, END): "hell|o||" (-3, -1): "he|ll||o"

Public Member Functions

void normalize ()
TextRangeoperator= (const TextRange &other)
 TextRange (const TextRange &other, text_range_t length)
 TextRange (const TextRange &other)
 TextRange (text_range_t begin, text_range_t end=END)
 TextRange ()

Public Attributes

text_range_t first
text_range_t second

Static Public Attributes

static const text_range_t END = std::numeric_limits<text_range_t>::max()


Constructor & Destructor Documentation

omgui::TextRange::TextRange (  )  [inline]

omgui::TextRange::TextRange ( text_range_t  begin,
text_range_t  end = END 
) [inline]

omgui::TextRange::TextRange ( const TextRange other  )  [inline]

omgui::TextRange::TextRange ( const TextRange other,
text_range_t  length 
) [inline]

Creates a copy of a TextRange but converts negative values into their postive equivilants based on the given length. This function is primarily used by library implementors.


Member Function Documentation

void omgui::TextRange::normalize (  )  [inline]

Normalizes the TextRange so that first < second.

TextRange& omgui::TextRange::operator= ( const TextRange other  )  [inline]


Member Data Documentation

const text_range_t omgui::TextRange::END = std::numeric_limits<text_range_t>::max() [static]


doxygen SourceForge.net Logo