(Horizontal) TextAlignment in Listboxes

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

User avatar
Emmeran
Quite a regular
Quite a regular
Posts: 46
Joined: Wed Jan 12, 2005 12:06
Location: Germany, near Nuremberg
Contact:

(Horizontal) TextAlignment in Listboxes

Postby Emmeran » Sun Dec 26, 2004 20:12

Hi there,
I made some changes in my CE-Code to provide horizontal text alignment in Listboxes. It works perfectly for me.
@CE: maybe you want to merge this into your project

The changes:
In CEGUIListboxTextItem.h I added this public members to ListboxTextItem class:

Code: Select all

   enum HorzFormatting
   {
      LeftAligned,         
      RightAligned,      
      HorzCentred,      
      WordWrapLeftAligned,
      WordWrapRightAligned,
      WordWrapCentred,   
   };

   HorzFormatting   d_horzFormatting;
   void   setHorizontalFormatting(HorzFormatting h_fmt) { d_horzFormatting = h_fmt; }


I added the parameters z and absarea to the draw member of ListboxItem and ListboxTextItem:

Code: Select all

virtual   void   draw(const Vector3& position, float alpha, const Rect& clipper, const Rect& absarea, float z) const;



and made some changes in CEGUIListboxTextItem.cpp, in the function draw:

Code: Select all

if (fnt != NULL)
{
   Rect area = absarea;
   area.setPosition(Point(position.d_x, position.d_y));
   fnt->drawText(d_itemText, area, z - 0.001, clipper, (CEGUI::TextFormatting)d_horzFormatting, getModulateAlphaColourRect(d_textCols, alpha));
}


That's all

Greetings,
Emmeran

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

(Horizontal) TextAlignment in Listboxes

Postby CrazyEddie » Wed Dec 29, 2004 10:19

The ListboxTextItem is really just a simple example, though is probably too simple for may peoples needs ;)

It was always my intention that people needing more functionality should use their own sub-class. Your extenstions are pretty generic though, so I'll see if I can get them added in shortly.

Thanks,

CE.


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 13 guests