CARMA C++
carma::ui::rtd::RtBox Class Reference

Container that handles layout of components with a "BoxLayout". More...

#include <carma/ui/rtd/common/RtDisplay.h>

Inheritance diagram for carma::ui::rtd::RtBox:
carma::ui::rtd::RtContainer carma::ui::rtd::RtTitledObj carma::ui::rtd::RtObject carma::ui::rtd::RtFolder carma::ui::rtd::RtHBox carma::ui::rtd::RtVBox

Public Types

enum  BoxType { BOX_HORIZONTAL, BOX_VERTICAL, BOX_FOLDER }
 
enum  StretchType { STRETCH_PROPORTIONAL, STRETCH_SPRING }
 

Public Member Functions

virtual void serialize (bool initialize, int fontSize,::rtdproto::RtObject *rtobj)
 Creates static description of container to stdout. More...
 
void setProp ()
 Set stretchType to proportional. More...
 
void setSpring ()
 Set stretchType to SPRING. More...
 
void setStretchFactor (double stretchFactor)
 Set stretch factor. More...
 
- Public Member Functions inherited from carma::ui::rtd::RtContainer
RtObjectPtr add (RtObjectPtr rtObject)
 Insert an object into the container. More...
 
Border getBorder () const
 
::size_t getNumObjects () const
 Get the number of objects in the container. More...
 
RtObjectPtr getObj (::size_t index) const
 Get object from the container by index. More...
 
RtObjectPtr replace (unsigned int i, RtObjectPtr rtObject)
 Replace an object in the container. More...
 
RtObjectPtr replace (RtObjectPtr oldObj, RtObjectPtr newObj)
 
void setBorder (Border border)
 Set the border code. More...
 
virtual void update ()
 Update all objects contained by container. More...
 
virtual ~RtContainer ()
 Destructor. More...
 
- Public Member Functions inherited from carma::ui::rtd::RtTitledObj
std::string getTitle ()
 Get title. More...
 
void setTitle (const std::string &title)
 Set title for object. More...
 
- Public Member Functions inherited from carma::ui::rtd::RtObject
void appendToolTipText (const std::string &text)
 Append more text to the existing tool tip text. More...
 
Layout getLayout () const
 Get the layout for this object. More...
 
std::string getToolTipText ()
 
void setFontSize (int fontSize)
 Set the absolute font size for this object. More...
 
void setLayout (Layout layout)
 Set the layout for this object. More...
 
void setToolTipText (const std::string &text)
 Set the tool tip text for this RtObject. More...
 
virtual ~RtObject ()
 Destructor. More...
 

Protected Member Functions

 RtBox (BoxType type, const std::string &title)
 Constructor. More...
 
 RtBox (BoxType type, Border border)
 Constructor. More...
 
 RtBox (BoxType type, const std::string &title, Border border)
 Constructor. More...
 
- Protected Member Functions inherited from carma::ui::rtd::RtContainer
 RtContainer ()
 Constructor. More...
 
 RtContainer (const ::std::string &title)
 Constructor. More...
 
 RtContainer (Border border)
 Constructor. More...
 
 RtContainer (const ::std::string &title, Border border)
 Constructor. More...
 
- Protected Member Functions inherited from carma::ui::rtd::RtTitledObj
 RtTitledObj (const std::string &title)
 Constructor. More...
 
- Protected Member Functions inherited from carma::ui::rtd::RtObject
int getFontSize (int parentFontSize) const
 Get the absolute font size for this object. More...
 
int getFontSize () const
 Get the absolute font size for this object. More...
 
 RtObject ()
 Constructor. More...
 

Additional Inherited Members

- Protected Types inherited from carma::ui::rtd::RtContainer
typedef ::std::vector
< RtObjectPtr > 
ObjectContainerType
 
- Protected Attributes inherited from carma::ui::rtd::RtContainer
size_t numObjects_
 
ObjectContainerType objects_
 
- Protected Attributes inherited from carma::ui::rtd::RtTitledObj
std::string title_
 Object title. More...
 

Detailed Description

Container that handles layout of components with a "BoxLayout".

Component layout is controlled by the types listed below, but an interface is not yet provided for all components.

The stretchType controls sizing of components in direction parallel to the layout. Proportional and springs should not be used in the same layout, as the springs will take all of the free space so the proportional will not get a chance to grow. If contraction is necessary because there is not enough space then all the components except INCOMPRESSIBLE ones will be scaled proportionally. In general, extra space is taken by the most agressive components in the layout first, leaving little or none to the others. Most agressive is SPRING followed by PROPORTIONAL, then FRACTIONAL. PROPORTIONAL and FRACTIONAL will split extra space with the FRACTIONALs being treated as having a weight of 1.

Summary of Stretch types:

  • 'p' PROPORTIONAL: Extra space divided according to width and weight (stretchFactor)
  • 's' SPRING: Takes extra in proportion to its springiness (stretchFactor)
  • INCOMPRESSIBLE: Will not be squeezed if short of space
  • FIXED: No expansion.
  • FIXED_GROUP: Width fixed to max width of all in FIXED_GROUP
  • FRACTIONAL: Extra space divided evenly between FRACTIONAL components
  • DISCRETE_SPRING: Takes extra in proportion to its springiness, tries to set component size, then accepts size component returns. This is for components whose size comes in discrete units.

Definition at line 1918 of file RtDisplay.h.

Constructor & Destructor Documentation

carma::ui::rtd::RtBox::RtBox ( BoxType  type,
const std::string &  title 
)
protected

Constructor.

Parameters
titletitle for box
See Also
RtContainer
carma::ui::rtd::RtBox::RtBox ( BoxType  type,
Border  border 
)
protected

Constructor.

Parameters
bordersingle character codes for the border.
See Also
RtContainer
carma::ui::rtd::RtBox::RtBox ( BoxType  type,
const std::string &  title,
Border  border 
)
protected

Constructor.

Parameters
titletitle for box
bordersingle character codes for the border.
See Also
RtContainer

Member Function Documentation

virtual void carma::ui::rtd::RtBox::serialize ( bool  initialize,
int  fontSize,
::rtdproto::RtObject *  rtobj 
)
virtual

Creates static description of container to stdout.

Implements carma::ui::rtd::RtContainer.

void carma::ui::rtd::RtBox::setProp ( )

Set stretchType to proportional.

void carma::ui::rtd::RtBox::setSpring ( )

Set stretchType to SPRING.

void carma::ui::rtd::RtBox::setStretchFactor ( double  stretchFactor)

Set stretch factor.


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