Add override font to IGUITreeView (thx @Escen for reminder)
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5100 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
b37ff9f619
commit
9ee9422a1b
|
@ -1,6 +1,7 @@
|
|||
--------------------------
|
||||
Changes in 1.9 (not yet released)
|
||||
|
||||
- Add override font to IGUITreeView
|
||||
- CGUIComboBox now updates selection-list when font changes while it's open (thx @ rubixcuber for bugreport)
|
||||
- CAnimatedMeshSceneNode::setMesh does now set the animation speed again to that of the mesh (had been changed in 1.7, but not for obvious reasons)
|
||||
- .x meshloader regards now AnimTicksPerSecond (thx @qian for a test-model and bugreport)
|
||||
|
|
|
@ -253,6 +253,19 @@ namespace gui
|
|||
*/
|
||||
virtual void setIconFont( IGUIFont* font ) = 0;
|
||||
|
||||
//! Sets a skin independent font.
|
||||
/** \param font: New font to set or 0 to use the skin-font. */
|
||||
virtual void setOverrideFont(IGUIFont* font=0) = 0;
|
||||
|
||||
//! Gets the override font (if any)
|
||||
/** \return The override font (may be 0) */
|
||||
virtual IGUIFont* getOverrideFont(void) const = 0;
|
||||
|
||||
//! Get the font which is used for drawing
|
||||
/** This is the override font when one is set and the
|
||||
font of the skin otherwise. */
|
||||
virtual IGUIFont* getActiveFont() const = 0;
|
||||
|
||||
//! Sets the image list which should be used for the image and selected image of every node.
|
||||
/** The default is 0 (no images). */
|
||||
virtual void setImageList( IGUIImageList* imageList ) = 0;
|
||||
|
|
|
@ -433,6 +433,7 @@ CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
|
|||
TotalItemHeight( 0 ),
|
||||
TotalItemWidth ( 0 ),
|
||||
Font( 0 ),
|
||||
OverrideFont( 0 ),
|
||||
IconFont( 0 ),
|
||||
ScrollBarH( 0 ),
|
||||
ScrollBarV( 0 ),
|
||||
|
@ -522,19 +523,50 @@ CGUITreeView::~CGUITreeView()
|
|||
}
|
||||
}
|
||||
|
||||
//! Sets another skin independent font.
|
||||
void CGUITreeView::setOverrideFont(IGUIFont* font)
|
||||
{
|
||||
if (OverrideFont == font)
|
||||
return;
|
||||
|
||||
if (OverrideFont)
|
||||
OverrideFont->drop();
|
||||
|
||||
OverrideFont = font;
|
||||
|
||||
if (OverrideFont)
|
||||
OverrideFont->grab();
|
||||
|
||||
recalculateItemHeight();
|
||||
}
|
||||
|
||||
//! Gets the override font (if any)
|
||||
IGUIFont * CGUITreeView::getOverrideFont() const
|
||||
{
|
||||
return OverrideFont;
|
||||
}
|
||||
|
||||
//! Get the font which is used right now for drawing
|
||||
IGUIFont* CGUITreeView::getActiveFont() const
|
||||
{
|
||||
if ( OverrideFont )
|
||||
return OverrideFont;
|
||||
IGUISkin* skin = Environment->getSkin();
|
||||
if (skin)
|
||||
return skin->getFont();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CGUITreeView::recalculateItemHeight()
|
||||
{
|
||||
IGUISkin* skin = Environment->getSkin();
|
||||
IGUITreeViewNode* node;
|
||||
|
||||
if( Font != skin->getFont() )
|
||||
if( Font != getActiveFont() )
|
||||
{
|
||||
if( Font )
|
||||
{
|
||||
Font->drop();
|
||||
}
|
||||
|
||||
Font = skin->getFont();
|
||||
Font = getActiveFont();
|
||||
ItemHeight = 0;
|
||||
|
||||
if( Font )
|
||||
|
@ -579,7 +611,7 @@ void CGUITreeView::recalculateItemHeight()
|
|||
|
||||
TotalItemHeight = 0;
|
||||
TotalItemWidth = AbsoluteRect.getWidth() * 2;
|
||||
node = Root->getFirstChild();
|
||||
IGUITreeViewNode* node = Root->getFirstChild();
|
||||
while( node )
|
||||
{
|
||||
TotalItemHeight += ItemHeight;
|
||||
|
|
|
@ -277,6 +277,19 @@ namespace gui
|
|||
//! Irrlicht engine as icon font, the icon strings defined in GUIIcons.h can be used.
|
||||
virtual void setIconFont( IGUIFont* font ) _IRR_OVERRIDE_;
|
||||
|
||||
//! Sets a skin independent font.
|
||||
/** \param font: New font to set or 0 to use the skin-font. */
|
||||
virtual void setOverrideFont(IGUIFont* font=0) _IRR_OVERRIDE_;
|
||||
|
||||
//! Gets the override font (if any)
|
||||
/** \return The override font (may be 0) */
|
||||
virtual IGUIFont* getOverrideFont(void) const _IRR_OVERRIDE_;
|
||||
|
||||
//! Get the font which is used for drawing
|
||||
/** This is the override font when one is set and the
|
||||
font of the skin otherwise. */
|
||||
virtual IGUIFont* getActiveFont() const _IRR_OVERRIDE_;
|
||||
|
||||
//! Sets the image list which should be used for the image and selected image of every node.
|
||||
//! The default is 0 (no images).
|
||||
virtual void setImageList( IGUIImageList* imageList ) _IRR_OVERRIDE_;
|
||||
|
@ -317,6 +330,7 @@ namespace gui
|
|||
s32 TotalItemHeight;
|
||||
s32 TotalItemWidth;
|
||||
IGUIFont* Font;
|
||||
gui::IGUIFont* OverrideFont;
|
||||
IGUIFont* IconFont;
|
||||
IGUIScrollBar* ScrollBarH;
|
||||
IGUIScrollBar* ScrollBarV;
|
||||
|
|
Loading…
Reference in New Issue