Eclipse SUMO - Simulation of Urban MObility
MFXDynamicLabel Class Reference

A list item which allows for custom coloring. More...

#include <MFXDynamicLabel.h>

Inheritance diagram for MFXDynamicLabel:
[legend]
Collaboration diagram for MFXDynamicLabel:
[legend]

Public Types

enum  { MID_LABEL_WIDTHCHANGE }
 FOX declaration. More...
 

Public Member Functions

FXint getDefaultHeight ()
 
 MFXDynamicLabel (FXComposite *p, const FXString &text, FXIcon *ic=0, FXuint opts=LABEL_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD, std::string indent="- ")
 Construct label with given text and icon. More...
 
long onUpdate (FXObject *sender, FXSelector, void *)
 overload to be informed when the label text has to be reformatted due to width changes More...
 
void position (FXint x, FXint y, FXint w, FXint h)
 overload position to be informed when the parent has done the layout More...
 
void setText (const FXString &text)
 overload text label updates to store the original string as backup for when width changes again More...
 
virtual ~MFXDynamicLabel ()
 

Protected Member Functions

 MFXDynamicLabel ()
 fox needs this More...
 

Private Member Functions

void computeIndentation ()
 
void reformatLineBreaks (const int curWidth)
 

Private Attributes

int myIndent
 
std::string myIndentString
 
std::string myOriginalString
 
int myPreviousWidth
 

Detailed Description

A list item which allows for custom coloring.

Definition at line 27 of file MFXDynamicLabel.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

FOX declaration.

enum for events

Enumerator
MID_LABEL_WIDTHCHANGE 

Definition at line 33 of file MFXDynamicLabel.h.

Constructor & Destructor Documentation

◆ MFXDynamicLabel() [1/2]

MFXDynamicLabel::MFXDynamicLabel ( FXComposite *  p,
const FXString &  text,
FXIcon *  ic = 0,
FXuint  opts = LABEL_NORMAL,
FXint  x = 0,
FXint  y = 0,
FXint  w = 0,
FXint  h = 0,
FXint  pl = DEFAULT_PAD,
FXint  pr = DEFAULT_PAD,
FXint  pt = DEFAULT_PAD,
FXint  pb = DEFAULT_PAD,
std::string  indent = "- " 
)

Construct label with given text and icon.

Definition at line 42 of file MFXDynamicLabel.cpp.

◆ ~MFXDynamicLabel()

virtual MFXDynamicLabel::~MFXDynamicLabel ( )
inlinevirtual

Definition at line 40 of file MFXDynamicLabel.h.

◆ MFXDynamicLabel() [2/2]

MFXDynamicLabel::MFXDynamicLabel ( )
protected

fox needs this

Definition at line 164 of file MFXDynamicLabel.cpp.

Member Function Documentation

◆ computeIndentation()

void MFXDynamicLabel::computeIndentation ( )
private

Definition at line 90 of file MFXDynamicLabel.cpp.

References myIndent, myIndentString, and myOriginalString.

Referenced by setText().

Here is the caller graph for this function:

◆ getDefaultHeight()

FXint MFXDynamicLabel::getDefaultHeight ( )

Definition at line 75 of file MFXDynamicLabel.cpp.

References reformatLineBreaks().

◆ onUpdate()

long MFXDynamicLabel::onUpdate ( FXObject *  sender,
FXSelector  sel,
void *  ptr 
)

overload to be informed when the label text has to be reformatted due to width changes

Definition at line 49 of file MFXDynamicLabel.cpp.

References myPreviousWidth, and reformatLineBreaks().

Referenced by FXDEFMAP().

Here is the caller graph for this function:

◆ position()

void MFXDynamicLabel::position ( FXint  x,
FXint  y,
FXint  w,
FXint  h 
)

overload position to be informed when the parent has done the layout

Definition at line 68 of file MFXDynamicLabel.cpp.

References reformatLineBreaks().

◆ reformatLineBreaks()

void MFXDynamicLabel::reformatLineBreaks ( const int  curWidth)
private

Definition at line 100 of file MFXDynamicLabel.cpp.

References myIndent, myIndentString, and myOriginalString.

Referenced by getDefaultHeight(), onUpdate(), and position().

Here is the caller graph for this function:

◆ setText()

void MFXDynamicLabel::setText ( const FXString &  text)

overload text label updates to store the original string as backup for when width changes again

Definition at line 60 of file MFXDynamicLabel.cpp.

References computeIndentation(), and myOriginalString.

Field Documentation

◆ myIndent

int MFXDynamicLabel::myIndent
private

Definition at line 63 of file MFXDynamicLabel.h.

Referenced by computeIndentation(), and reformatLineBreaks().

◆ myIndentString

std::string MFXDynamicLabel::myIndentString
private

Definition at line 62 of file MFXDynamicLabel.h.

Referenced by computeIndentation(), and reformatLineBreaks().

◆ myOriginalString

std::string MFXDynamicLabel::myOriginalString
private

Definition at line 61 of file MFXDynamicLabel.h.

Referenced by computeIndentation(), reformatLineBreaks(), and setText().

◆ myPreviousWidth

int MFXDynamicLabel::myPreviousWidth
private

Definition at line 64 of file MFXDynamicLabel.h.

Referenced by onUpdate().


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