VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Public Attributes | Protected Slots | Protected Member Functions | Protected Attributes
makVrf::DtToolButtonWrapperWidget Class Reference

This class will try and space out items such that they will wrap to multiple rows if buttons (or text) of actions are wider than the width of the widget. Each row will be broken up into chunks of icon width wide items + spacing. If there is text it will take up that many columns on a line. If it is widget than a whole line it will be on it's own line, cut off at the maximum length.

Inheritance diagram for makVrf::DtToolButtonWrapperWidget:
Inheritance graph
[legend]

Classes

struct  Layout
 

Public Types

enum  SizeMode { FillAtEnd = 1, SizeToFit = 2, SingleColumn = 3 }
 

Public Member Functions

 DtToolButtonWrapperWidget (makVrv::DtDe &de, QWidget *parent, const Qt::WindowFlags &flags=0)
 
virtual ~DtToolButtonWrapperWidget ()
 
template<typename T >
T * createPrototype ()
 
template<typename T >
T * createButton ()
 
template<typename T >
T * addAction (const QString &action, bool resetLayout=true)
 
template<typename T >
T * addActionWithIcon (const std::string &icon, bool resetLayout=true)
 
template<typename T >
T * addAction (const QIcon &icon, bool resetLayout=true)
 
template<typename T >
T * addAction (QAction *act, bool resetLayout=true)
 
virtual int rightMarginForLine (int) const
 
virtual void setRightMarginForLine (int margin, int line=-1)
 
virtual void removeRightMarginForLine (int line=-1)
 
virtual void removeButton (QAbstractButton *, bool resetLayout=true)
 
virtual void layoutButtons (bool force=false)
 
virtual void setButtons (const std::vector< QAbstractButton * > &buttons, bool deleteCurrentButtons=false)
 
virtual void setRightToLeftLayout (bool)
 
bool setRightToLeftLayout () const
 
bool needsLayout () const
 
virtual void setSizeMode (SizeMode)
 
SizeMode sizeMode () const
 
int buttonsShown () const
 
const std::vector
< QAbstractButton * > & 
buttons () const
 
std::vector< QAbstractButton * > & buttons ()
 
virtual bool hasButton (QAbstractButton *) const
 
virtual void setIconSize (const QSize &)
 
const QSize & iconSize () const
 
virtual void setIconSpacing (int)
 
int iconSpacing () const
 
virtual void clear ()
 
virtual void setUseFixedWidth (bool)
 
bool useFixedWidth () const
 
virtual void fixWidth ()
 
virtual void fixHeight ()
 
virtual void setFixedButtonWidth (int)
 
int fixedButtonWidth () const
 
virtual void setFixedButtonHeight (int)
 
int fixedButtonHeight () const
 
int layoutHeight () const
 
virtual void setShowMaximum (int)
 
int showMaximum () const
 
virtual void setMaximumLines (int)
 
int maximumLines () const
 
bool reachedMaximum () const
 
virtual bool buttonsLeftToDisplay () const
 
int numRows () const
 
const std::vector< Layout > & layouts () const
 
std::vector< Layout > & layouts ()
 
virtual void setBlockResizeLayout (bool)
 
bool blockResizeLayout () const
 
virtual void setSignalResizeLayout (bool)
 
bool signalResizeLayout () const
 
virtual void setCreateDefaultIcon (bool b)
 
bool createDefaultIcon () const
 
virtual void setSetToolTipToText (bool)
 
bool setToolTipToText () const
 
virtual void setSizeHeightToLayout (bool)
 
bool sizeHeightToLayout () const
 

Public Attributes

boost::signals2::signal< void()> signal_resizeLayout
 
boost::signals2::signal< void(bool)> signal_maximumReached
 
boost::signals2::signal< void()> signal_buttonsLayedOut
 
boost::signals2::signal< void(Layout
&, QAbstractButton *)> 
signal_buttonLayedOut
 

Protected Slots

virtual void layoutFromTimer ()
 

Protected Member Functions

virtual QPixmap createDefaultIcon (const QString &) const
 
virtual void resizeEvent (QResizeEvent *)
 
virtual void showEvent (QShowEvent *)
 
virtual void addToLayout (QAbstractButton *, bool forceLayout=false)
 

Protected Attributes

std::vector< LayoutmyLayouts
 
std::vector< QAbstractButton * > myButtons
 
std::map< int, intmyRightMarginForLine
 
QSize myIconSize
 
int myIconSpacing
 
int myMaximumLines
 
bool myNeedsLayout
 
bool myReachedMaximum
 
int myFixedButtonWidth
 
int myFixedButtonHeight
 
bool myRightToLeftLayout
 
int myShowMaximum
 
int myButtonsShown
 
bool myInResize
 
bool mySetTimer
 
bool myBlockResizeLayout
 
bool mySignalResizeLayout
 
bool myUseFixedWidth
 
bool myCreateDefaultIcon
 
bool mySetToolTipToText
 
bool mySizeHeightToLayout = false
 
SizeMode mySizeMode
 
makVrv::DtDemyDe
 

Member Enumeration Documentation

Sets the mode of display. Default is FillByRank.

Enumerator
FillAtEnd 
SizeToFit 

This will add buttons to the last row of available buttons, and, add rows until the space is filled.

SingleColumn 

This will start at the beginning and fill in items, moving items off that don't fit (that might have fit before)

Constructor & Destructor Documentation

makVrf::DtToolButtonWrapperWidget::DtToolButtonWrapperWidget ( makVrv::DtDe de,
QWidget *  parent,
const Qt::WindowFlags &  flags = 0 
)
virtual makVrf::DtToolButtonWrapperWidget::~DtToolButtonWrapperWidget ( )
virtual

Member Function Documentation

template<typename T >
T* makVrf::DtToolButtonWrapperWidget::createPrototype ( )
inline
template<typename T >
T* makVrf::DtToolButtonWrapperWidget::createButton ( )
inline
template<typename T >
T* makVrf::DtToolButtonWrapperWidget::addAction ( const QString &  action,
bool  resetLayout = true 
)
inline

Adds a new button with text. Up to caller to determine what to do with the returned tool button.

template<typename T >
T* makVrf::DtToolButtonWrapperWidget::addActionWithIcon ( const std::string &  icon,
bool  resetLayout = true 
)
inline
template<typename T >
T* makVrf::DtToolButtonWrapperWidget::addAction ( const QIcon &  icon,
bool  resetLayout = true 
)
inline

Adds a new button with an icon.

template<typename T >
T* makVrf::DtToolButtonWrapperWidget::addAction ( QAction act,
bool  resetLayout = true 
)
inline

Adds a new action into the dialog for sizing.

virtual int makVrf::DtToolButtonWrapperWidget::rightMarginForLine ( int  ) const
virtual

If set, right margin for layout line.

virtual void makVrf::DtToolButtonWrapperWidget::setRightMarginForLine ( int  margin,
int  line = -1 
)
virtual

Sets the right margin for the given line. -1 means all lines. You can set -1 for all lines and then a line number for a specific line.

virtual void makVrf::DtToolButtonWrapperWidget::removeRightMarginForLine ( int  line = -1)
virtual

Removes the margin for the line.

virtual void makVrf::DtToolButtonWrapperWidget::removeButton ( QAbstractButton *  ,
bool  resetLayout = true 
)
virtual

Removes the button specified. Removing the button will also delete it.

virtual void makVrf::DtToolButtonWrapperWidget::layoutButtons ( bool  force = false)
virtual

Reworks given the the new sizes.

virtual void makVrf::DtToolButtonWrapperWidget::setButtons ( const std::vector< QAbstractButton * > &  buttons,
bool  deleteCurrentButtons = false 
)
virtual

Sets the buttons of this wrapper widget. This widget will take ownership of buttons. Note that setting these buttons will not delete the old buttons. If you wish to delete the old buttons have the deleteCurrentButtons as true.

virtual void makVrf::DtToolButtonWrapperWidget::setRightToLeftLayout ( bool  )
virtual

If this is true (default is false) the layout will start on the right and go to the left.

bool makVrf::DtToolButtonWrapperWidget::setRightToLeftLayout ( ) const
inline
bool makVrf::DtToolButtonWrapperWidget::needsLayout ( ) const
inline
virtual void makVrf::DtToolButtonWrapperWidget::setSizeMode ( SizeMode  )
virtual
SizeMode makVrf::DtToolButtonWrapperWidget::sizeMode ( ) const
inline
int makVrf::DtToolButtonWrapperWidget::buttonsShown ( ) const
inline
const std::vector<QAbstractButton*>& makVrf::DtToolButtonWrapperWidget::buttons ( ) const
inline
std::vector<QAbstractButton*>& makVrf::DtToolButtonWrapperWidget::buttons ( )
inline
virtual bool makVrf::DtToolButtonWrapperWidget::hasButton ( QAbstractButton *  ) const
virtual
virtual void makVrf::DtToolButtonWrapperWidget::setIconSize ( const QSize &  )
virtual

Sets the size of the icons (default is 20x20)

const QSize& makVrf::DtToolButtonWrapperWidget::iconSize ( ) const
inline
virtual void makVrf::DtToolButtonWrapperWidget::setIconSpacing ( int  )
virtual

Sets the spacing between icons. Default is 2.

int makVrf::DtToolButtonWrapperWidget::iconSpacing ( ) const
inline
virtual void makVrf::DtToolButtonWrapperWidget::clear ( )
virtual

Clears all items.

virtual void makVrf::DtToolButtonWrapperWidget::setUseFixedWidth ( bool  )
virtual

Fix the width of the container to be the maximum width of any row (default is false)

bool makVrf::DtToolButtonWrapperWidget::useFixedWidth ( ) const
inline
virtual void makVrf::DtToolButtonWrapperWidget::fixWidth ( )
virtual
virtual void makVrf::DtToolButtonWrapperWidget::fixHeight ( )
virtual
virtual void makVrf::DtToolButtonWrapperWidget::setFixedButtonWidth ( int  )
virtual

Regardless of size, the fixed button width. -1 will size to text or icon.

int makVrf::DtToolButtonWrapperWidget::fixedButtonWidth ( ) const
inline
virtual void makVrf::DtToolButtonWrapperWidget::setFixedButtonHeight ( int  )
virtual

Fixed button height. If -1 will use default. This is only valid for buttons that are used as text. For icons use icon size.

int makVrf::DtToolButtonWrapperWidget::fixedButtonHeight ( ) const
inline
int makVrf::DtToolButtonWrapperWidget::layoutHeight ( ) const
inline

The layout height is the number of layouts by the fixed button height.

virtual void makVrf::DtToolButtonWrapperWidget::setShowMaximum ( int  )
virtual

Regardless of the number of buttons that could be shown, do not show more than this many. -1 means show all (default)

int makVrf::DtToolButtonWrapperWidget::showMaximum ( ) const
inline
virtual void makVrf::DtToolButtonWrapperWidget::setMaximumLines ( int  )
virtual

Regardless of the number of buttons the maximum number of lines. -1 means show all (default).

int makVrf::DtToolButtonWrapperWidget::maximumLines ( ) const
inline
bool makVrf::DtToolButtonWrapperWidget::reachedMaximum ( ) const
inline
virtual bool makVrf::DtToolButtonWrapperWidget::buttonsLeftToDisplay ( ) const
virtual
int makVrf::DtToolButtonWrapperWidget::numRows ( ) const
inline
const std::vector<Layout>& makVrf::DtToolButtonWrapperWidget::layouts ( ) const
inline
std::vector<Layout>& makVrf::DtToolButtonWrapperWidget::layouts ( )
inline
virtual void makVrf::DtToolButtonWrapperWidget::setBlockResizeLayout ( bool  )
virtual

If set to true do not trigger a layout if resized. Default is false.

bool makVrf::DtToolButtonWrapperWidget::blockResizeLayout ( ) const
inline
virtual void makVrf::DtToolButtonWrapperWidget::setSignalResizeLayout ( bool  )
virtual

If set to true signal that the layout wants to be resized rather than laying it out. Default is false.

bool makVrf::DtToolButtonWrapperWidget::signalResizeLayout ( ) const
inline
virtual void makVrf::DtToolButtonWrapperWidget::setCreateDefaultIcon ( bool  b)
virtual

If the action (or button) has no default icon, create a default icon which is a colored circle and the first two letters of the text. Default is false.

bool makVrf::DtToolButtonWrapperWidget::createDefaultIcon ( ) const
inline
virtual void makVrf::DtToolButtonWrapperWidget::setSetToolTipToText ( bool  )
virtual

When adding buttons, should it take the current tool tip or the text of the object as the tool tip. Default is current tool tip.

bool makVrf::DtToolButtonWrapperWidget::setToolTipToText ( ) const
inline
virtual void makVrf::DtToolButtonWrapperWidget::setSizeHeightToLayout ( bool  )
virtual
bool makVrf::DtToolButtonWrapperWidget::sizeHeightToLayout ( ) const
inline
virtual void makVrf::DtToolButtonWrapperWidget::layoutFromTimer ( )
protectedvirtualslot
virtual QPixmap makVrf::DtToolButtonWrapperWidget::createDefaultIcon ( const QString &  ) const
protectedvirtual
virtual void makVrf::DtToolButtonWrapperWidget::resizeEvent ( QResizeEvent *  )
protectedvirtual
virtual void makVrf::DtToolButtonWrapperWidget::showEvent ( QShowEvent *  )
protectedvirtual
virtual void makVrf::DtToolButtonWrapperWidget::addToLayout ( QAbstractButton *  ,
bool  forceLayout = false 
)
protectedvirtual

Member Data Documentation

boost::signals2::signal<void ()> makVrf::DtToolButtonWrapperWidget::signal_resizeLayout
boost::signals2::signal<void (bool)> makVrf::DtToolButtonWrapperWidget::signal_maximumReached
boost::signals2::signal<void ()> makVrf::DtToolButtonWrapperWidget::signal_buttonsLayedOut
boost::signals2::signal<void (Layout&, QAbstractButton*)> makVrf::DtToolButtonWrapperWidget::signal_buttonLayedOut
std::vector<Layout> makVrf::DtToolButtonWrapperWidget::myLayouts
protected
std::vector<QAbstractButton*> makVrf::DtToolButtonWrapperWidget::myButtons
protected
std::map<int, int> makVrf::DtToolButtonWrapperWidget::myRightMarginForLine
protected
QSize makVrf::DtToolButtonWrapperWidget::myIconSize
protected
int makVrf::DtToolButtonWrapperWidget::myIconSpacing
protected
int makVrf::DtToolButtonWrapperWidget::myMaximumLines
protected
bool makVrf::DtToolButtonWrapperWidget::myNeedsLayout
protected
bool makVrf::DtToolButtonWrapperWidget::myReachedMaximum
protected
int makVrf::DtToolButtonWrapperWidget::myFixedButtonWidth
protected
int makVrf::DtToolButtonWrapperWidget::myFixedButtonHeight
protected
bool makVrf::DtToolButtonWrapperWidget::myRightToLeftLayout
protected
int makVrf::DtToolButtonWrapperWidget::myShowMaximum
protected
int makVrf::DtToolButtonWrapperWidget::myButtonsShown
protected
bool makVrf::DtToolButtonWrapperWidget::myInResize
protected
bool makVrf::DtToolButtonWrapperWidget::mySetTimer
protected
bool makVrf::DtToolButtonWrapperWidget::myBlockResizeLayout
protected
bool makVrf::DtToolButtonWrapperWidget::mySignalResizeLayout
protected
bool makVrf::DtToolButtonWrapperWidget::myUseFixedWidth
protected
bool makVrf::DtToolButtonWrapperWidget::myCreateDefaultIcon
protected
bool makVrf::DtToolButtonWrapperWidget::mySetToolTipToText
protected
bool makVrf::DtToolButtonWrapperWidget::mySizeHeightToLayout = false
protected
SizeMode makVrf::DtToolButtonWrapperWidget::mySizeMode
protected
makVrv::DtDe& makVrf::DtToolButtonWrapperWidget::myDe
protected

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

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)