Commit 9ee9422a authored by cutealien's avatar cutealien

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-e03cc46cb475
parent b37ff9f6
-------------------------- --------------------------
Changes in 1.9 (not yet released) 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) - 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) - 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) - .x meshloader regards now AnimTicksPerSecond (thx @qian for a test-model and bugreport)
......
...@@ -253,6 +253,19 @@ namespace gui ...@@ -253,6 +253,19 @@ namespace gui
*/ */
virtual void setIconFont( IGUIFont* font ) = 0; 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. //! Sets the image list which should be used for the image and selected image of every node.
/** The default is 0 (no images). */ /** The default is 0 (no images). */
virtual void setImageList( IGUIImageList* imageList ) = 0; virtual void setImageList( IGUIImageList* imageList ) = 0;
......
...@@ -433,6 +433,7 @@ CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent, ...@@ -433,6 +433,7 @@ CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
TotalItemHeight( 0 ), TotalItemHeight( 0 ),
TotalItemWidth ( 0 ), TotalItemWidth ( 0 ),
Font( 0 ), Font( 0 ),
OverrideFont( 0 ),
IconFont( 0 ), IconFont( 0 ),
ScrollBarH( 0 ), ScrollBarH( 0 ),
ScrollBarV( 0 ), ScrollBarV( 0 ),
...@@ -522,19 +523,50 @@ CGUITreeView::~CGUITreeView() ...@@ -522,19 +523,50 @@ CGUITreeView::~CGUITreeView()
} }
} }
void CGUITreeView::recalculateItemHeight() //! 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(); IGUISkin* skin = Environment->getSkin();
IGUITreeViewNode* node; if (skin)
return skin->getFont();
return 0;
}
if( Font != skin->getFont() ) void CGUITreeView::recalculateItemHeight()
{
if( Font != getActiveFont() )
{ {
if( Font ) if( Font )
{ {
Font->drop(); Font->drop();
} }
Font = skin->getFont(); Font = getActiveFont();
ItemHeight = 0; ItemHeight = 0;
if( Font ) if( Font )
...@@ -579,7 +611,7 @@ void CGUITreeView::recalculateItemHeight() ...@@ -579,7 +611,7 @@ void CGUITreeView::recalculateItemHeight()
TotalItemHeight = 0; TotalItemHeight = 0;
TotalItemWidth = AbsoluteRect.getWidth() * 2; TotalItemWidth = AbsoluteRect.getWidth() * 2;
node = Root->getFirstChild(); IGUITreeViewNode* node = Root->getFirstChild();
while( node ) while( node )
{ {
TotalItemHeight += ItemHeight; TotalItemHeight += ItemHeight;
......
...@@ -277,6 +277,19 @@ namespace gui ...@@ -277,6 +277,19 @@ namespace gui
//! Irrlicht engine as icon font, the icon strings defined in GUIIcons.h can be used. //! Irrlicht engine as icon font, the icon strings defined in GUIIcons.h can be used.
virtual void setIconFont( IGUIFont* font ) _IRR_OVERRIDE_; 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. //! Sets the image list which should be used for the image and selected image of every node.
//! The default is 0 (no images). //! The default is 0 (no images).
virtual void setImageList( IGUIImageList* imageList ) _IRR_OVERRIDE_; virtual void setImageList( IGUIImageList* imageList ) _IRR_OVERRIDE_;
...@@ -317,6 +330,7 @@ namespace gui ...@@ -317,6 +330,7 @@ namespace gui
s32 TotalItemHeight; s32 TotalItemHeight;
s32 TotalItemWidth; s32 TotalItemWidth;
IGUIFont* Font; IGUIFont* Font;
gui::IGUIFont* OverrideFont;
IGUIFont* IconFont; IGUIFont* IconFont;
IGUIScrollBar* ScrollBarH; IGUIScrollBar* ScrollBarH;
IGUIScrollBar* ScrollBarV; IGUIScrollBar* ScrollBarV;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment