Led 3.0 Class Library Documentation

Module StyledTextImager


Classes and Global Functions Index

Module Description:

Basic foundations of display of 'styled', or marked up, text. The central class of this module is StyledTextImager


Class: SimpleStyleMarkerByFontSpec < BASECLASS > [public]

Base Classes: BASECLASS = StyledTextImager::StyleMarker
Description:

Very frequently, you will want to implement a style-marker which just uses some Led_FontSpecification

and applies that to the given text, in a maner vaguely similar to what StandardStyledTextImager::StandardStyleMarker does.

This class is an abstract class, where you must specify the particular Led_FontSpecification by overriding the pure-virtual SimpleStyleMarkerByFontSpec::MakeFontSpec. That font-spec is then used in the various DrawSegemnt () etc overrides.

This class is not intended to be an abstract interface one programs to, but rather a helper class for subclasses of the abstract StyledTextImager::StyleMarker class. So you are not encouraged to declare variables of the type SimpleStyleMarkerByFontSpec<>*. Just use the class as a helper.

See TrivialFontSpecStyleMarker for an even simpler class to use.

Member Details

SimpleStyleMarkerByFontSpec < BASECLASS > ::MakeFontSpec [public]

virtual Led_FontSpecification MakeFontSpec (const StyledTextImager* imager, const RunElement& runElement) const;

Virtual method which subclasses override to specify how they want to have the given text displayed. Hopefully enough context is passed into this function to make this helper class widely applicable. All it must do is return a simple Led_FontSpecification result, and that will be used for all measurements and display of this marker.

By default, it just returns the default font associated with the imager.


Class: SimpleStyleMarkerByIncrementalFontSpec < BASECLASS > [public]

Base Classes: BASECLASS (which should be a subclass of SimpleStyleMarkerByFontSpec < BASECLASS > )
Description:

This helper can be used to avoid manually subclassing SimpleStyleMarkerByFontSpec and instead, just takes an Led_IncrementalFontSpecification and does the right thing - mapping that into what is displayed.


Class: SimpleStyleMarkerWithExtraDraw < BASECLASS > [public]

Base Classes: SimpleStyleMarkerByFontSpec < BASECLASS > with BASECLASS defaulting to StyledTextImager::StyleMarker
Description:

Very frequently, you will want to implement a style-marker which just draws some extra stuff drawn at the end.

This class is an abstract class, where you must specify the particular extra drawing in the SimpleStyleMarkerWithExtraDraw::DrawExtra method.

See also SimpleStyleMarkerWithLightUnderline.

Member Details

SimpleStyleMarkerWithExtraDraw < BASECLASS > ::DrawExtra [public]

virtual void DrawExtra (const StyledTextImager* imager, const RunElement& runElement, Led_Tablet tablet,

Pure virtual method which subclasses override to specify how they want to draw (some additional markup - e.g. an underline).


Class: SimpleStyleMarkerWithLightUnderline < BASECLASS > [public]

Base Classes: BASECLASS
Description:

Very frequently, you will want to implement a style-marker which just draws some extra stuff drawn at the end.

This template is typically used with the default BASECLASS of SimpleStyleMarkerWithExtraDraw.


Class: StyledTextImager [public]

Base Classes: virtual TextImager
Description:

The class StyledTextImager is a TextImager which knows about special markers, either owned by itself, or the TextStore, which it uses to render and measure the text. It is intended that these special markers it uses to render the text (StyledTextImager::StyleMarker's) be general enough to support both standard style runs, as well as other fancier text adornments, like pictures, opendoc embeddings, etc.

You can add arbitrary, and overlapping StyleMarkers to this class, and it will simply render them. Since it must pick ONE StyleMarker to ask todo the drawing, it asks the one with the highest priority (StyledTextImager::StyleMarker::GetPriority ()). If you have some style marker which is smart enuf to pay attention to the overlapping of markers (RARE - IF EVER) it is up to your marker to find which other markers it overlaps with, and handle this combination itself.

This class is intended to make easy things like wrapping keywords with little markers which affect how they are displayed. It is ideal for something like a programming text editor which colors keywords, or a typical web browser that has to keep associated links with parts of the text anyhow (keep it in a marker that subclasses from SytleMarker, and then change the color, or font of your display).

For the more conventional Style-Run type API, see the class StandardStyledTextImager.

Member Details

StyledTextImager::SummarizeStyleMarkers [public]

vector < RunElement > StyledTextImager::SummarizeStyleMarkers (size_t from, size_t to) const

Create a summary of the style markers applied to a given range of text (by default using StyledTextImager::StyleMarkerSummarySink) into StyledTextImager::RunElements.


Class: StyledTextImager::RunElement [public]

Description:

A simple summary structure typically used from StandardStyledTextImager::SummarizeStyleMarkers, or subclasses, to represent the net effect of overlapping style runs.

	struct	StyledTextImager::RunElement {
		...
		StyleMarker*          fMarker;
		size_t                fLength;
		vector<StyleMarker*>  fSupercededMarkers;
		...
	};


Class: StyledTextImager::StyleMarker [public]

Base Classes: Marker
Description:

Abstract class - subclass this to provide custom style drawing. Managed by class StyledTextImager.

Member Details

StyledTextImager::StyleMarker::DrawSegment [public]

virtual void DrawSegment (const StyledTextImager* imager, const RunElement& runElement, Led_Tablet tablet,

This pure-virtual hook function is called when the given range of text needs to be drawn. (SHOULD EXPLAIN THIS ALOT MORE!!!)

StyledTextImager::StyleMarker::GetPriority [public]

int StyleMarker::GetPriority () const

Since we can have style markers overlap, we need someway to deal with conflicting style information. Since some style elements can be arbitrary drawing code, like an OpenDoc part, or a picture, we cannot genericly write code to merge styles. So we invoke a somewhat hackish priority scheme, where the marker with the highest priority is what is asked todo the drawing.

The priority of StandardStyleMarker is eBaselinePriority - ZERO - as a reference. So you can specify easily either markers that take precedence over, or are always superseded by the standard style markers. And this returns eBaselinePriority - ZERO - by default.

StyledTextImager::StyleMarker::MeasureSegmentBaseLine [public]

virtual Led_Distance MeasureSegmentBaseLine (const StyledTextImager* imager, const RunElement& runElement,

This pure-virtual hook function is called when the given range of text needs to be measured (baseline of text segment). (SHOULD EXPLAIN THIS ALOT MORE!!!)

StyledTextImager::StyleMarker::MeasureSegmentWidth [public]

virtual void MeasureSegmentWidth (const StyledTextImager* imager, const RunElement& runElement,

This pure-virtual hook function is called when the given range of text needs to be measured (character widths). (SHOULD EXPLAIN THIS ALOT MORE!!!)

StyledTextImager::StyleMarker::MeasureSegmentWidth (overload 1) [public]

virtual Led_Distance MeasureSegmentHeight (const StyledTextImager* imager, const RunElement& runElement,

This pure-virtual hook function is called when the given range of text needs to be measured (hieght of text segment). (SHOULD EXPLAIN THIS ALOT MORE!!!)


Class: StyledTextImager::StyleMarkerSummarySink [public]

Base Classes: TextStore::MarkerSink
Description:

A marker sink used in calls to TextStore::CollectAllMarkersInRangeInto to extract from the textstore the style marker information which applies to a given region of text. This is typically used from StandardStyledTextImager::SummarizeStyleMarkers, or subclasses. And you would override it (and that method) to provide an alternate mechanism for combining/interpretting style markers within a region (say when the overlap).

Member Details

StyledTextImager::StyleMarkerSummarySink::CombineElements [public]

void StyleMarkerSummarySink::CombineElements (StyledTextImager::RunElement* runElement, StyleMarker* newStyleMarker)

When two style markers overlap, which one gets todo the drawing? As part of the summarizing process (StyledTextImager::SummarizeStyleMarkers), we must chose how to combine markers.

This default algorithm simply chooses the one with the higher priority.

Subclassers can override this behavior, and, for instance, restrict paying attention to only a particular subtype of '@StyleMarker's, or maybe to set particular values into one (chosen subtype marker to connote the overlap, and allow this to effect the draw. Or, perhaps, a subclass might ingnore markers with a particular owner value.

Note that markers NOT used can be placed in the StyledTextImager::RunElements 'fSupercededMarkers' array, so that the eventual marker which does the drawing can delegate or combine the drawing behaviors of different kinds of markers.

StyledTextImager::StyleMarkerSummarySink::SplitIfNeededAt [public]

void StyleMarkerSummarySink::SplitIfNeededAt (size_t markerPos)

Private routine to split the current list of buckets at a particular position. Called with the endpoints of a new marker.


Class: StyledTextImager::StyleMarkerSummarySinkForSingleOwner [public]

Base Classes: StyledTextImager::StyleMarkerSummarySink
Description:

Ignore style markers from an owner other than the one given as argument in the constructor.

Member Details

StyledTextImager::StyleMarkerSummarySinkForSingleOwner::CombineElements [public]

void StyleMarkerSummarySinkForSingleOwner::CombineElements (StyledTextImager::RunElement* runElement, StyleMarker* newStyleMarker)

Like StyledTextImager::StyleMarkerSummarySink::CombineElements, except that matching the MarkerOwner is more important than the Marker Priority.


Class: TrivialFontSpecStyleMarker [public]

Base Classes: SimpleStyleMarkerByIncrementalFontSpec < BASECLASS > with BASECLASS = SimpleStyleMarkerByFontSpec < BASECLASS > .
Description:

This class just adds to SimpleStyleMarkerByFontSpec a field which is the Led_IncrementalFontSpecification. This is not intended to be subclassed. If you do subclass - beware the overload of operator new () and block-allocation usage. Or better yet, subclass SimpleStyleMarkerByIncrementalFontSpec instead.


Config Variable: qOldStyleMarkerBackCompatHelperCode [public]

Description:

See notes in SPR#0718. Defaults to qSupportLed23CompatAPI. Won't exist after Led 3.0.


Return to Led Page Return to Led ClassLib Documentation Index Return to Led Reference Manual Index
Last Updated 2001-10-20