Merged from 1.7 branch, revisions 3421-3447. Fix for Attributes, documentation fixes, disabled menu handling, treeview disabling.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3448 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2010-11-22 22:57:26 +00:00
parent 5596d96da8
commit 22e391f814
8 changed files with 121 additions and 99 deletions

View File

@ -132,6 +132,13 @@ Changes in 1.8 (??.0?.2010)
- WM_SYSCOMMAND - SC_KEYMENU message is now ignored (F10 and ALT in Win32 windowed mode)
-----------------------------
Changes maybe still for 1.7.2 - or is that out already?
- Menu no longer sets highlight state when clicking disabled menu-item (reported by Mloren)
- Treeview can now be disabled
-----------------------------
Changes in 1.7.2 (??.??.2010)

View File

@ -66,7 +66,7 @@ public:
//! Searches for a file or folder in the list
/** Searches for a file by name
\param filename The name of the file to search for.
\param isFolder True if you are searching for a file, false if you want a dir.
\param isFolder True if you are searching for a directory path, false if you are searching for a file
\return Returns the index of the file in the file list, or -1 if
no matching name name was found. */
virtual s32 findFile(const io::path& filename, bool isFolder=false) const = 0;

View File

@ -37,20 +37,20 @@ public:
\param vertexShaderProgram: String containing the source of the vertex
shader program. This can be 0 if no vertex program shall be used.
\param vertexShaderEntryPointName: Name of the entry function of the
vertexShaderProgram
vertexShaderProgram (p.e. "main")
\param vsCompileTarget: Vertex shader version the high level shader
shall be compiled to.
\param pixelShaderProgram: String containing the source of the pixel
shader program. This can be 0 if no pixel shader shall be used.
\param pixelShaderEntryPointName: Entry name of the function of the
pixelShaderEntryPointName
pixelShaderProgram (p.e. "main")
\param psCompileTarget: Pixel shader version the high level shader
shall be compiled to.
\param geometryShaderProgram: String containing the source of the
geometry shader program. This can be 0 if no geometry shader shall be
used.
\param geometryShaderEntryPointName: Entry name of the function of the
geometryShaderEntryPointName
geometryShaderProgram (p.e. "main")
\param gsCompileTarget: Geometry shader version the high level shader
shall be compiled to.
\param inType Type of vertices passed to geometry shader
@ -116,21 +116,21 @@ public:
of the vertex shader program. Set to empty string if no vertex shader
shall be created.
\param vertexShaderEntryPointName: Name of the entry function of the
vertexShaderProgram
vertexShaderProgram (p.e. "main")
\param vsCompileTarget: Vertex shader version the high level shader
shall be compiled to.
\param pixelShaderProgramFileName: Text file containing the source of
the pixel shader program. Set to empty string if no pixel shader shall
be created.
\param pixelShaderEntryPointName: Entry name of the function of the
pixelShaderEntryPointName
pixelShaderProgram (p.e. "main")
\param psCompileTarget: Pixel shader version the high level shader
shall be compiled to.
\param geometryShaderProgramFileName: String containing the source of
\param geometryShaderProgramFileName: Name of the source of
the geometry shader program. Set to empty string if no geometry shader
shall be created.
\param geometryShaderEntryPointName: Entry name of the function of the
geometryShaderEntryPointName
geometryShaderProgram (p.e. "main")
\param gsCompileTarget: Geometry shader version the high level shader
shall be compiled to.
\param inType Type of vertices passed to geometry shader
@ -202,14 +202,14 @@ public:
\param pixelShaderProgram: Text file handle containing the source of
the pixel shader program. Set to 0 if no pixel shader shall be created.
\param pixelShaderEntryPointName: Entry name of the function of the
pixelShaderEntryPointName
pixelShaderProgram (p.e. "main")
\param psCompileTarget: Pixel shader version the high level shader
shall be compiled to.
\param geometryShaderProgram: Text file handle containing the source of
the geometry shader program. Set to 0 if no geometry shader shall be
created.
\param geometryShaderEntryPointName: Entry name of the function of the
geometryShaderEntryPointName
geometryShaderProgram (p.e. "main")
\param gsCompileTarget: Geometry shader version the high level shader
shall be compiled to.
\param inType Type of vertices passed to geometry shader

View File

@ -149,7 +149,7 @@ namespace gui
//! clears the table rows, but keeps the columns intact
virtual void clearRows() = 0;
//! Swap two row positions. This is useful for a custom ordering algo.
//! Swap two row positions.
virtual void swapRows(u32 rowIndexA, u32 rowIndexB) = 0;
//! This tells the table to start ordering all the rows.

View File

@ -87,7 +87,7 @@ public:
//! copies this surface into another
virtual void copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect=0) =0;
//! copies this surface into another, using the alpha mask, an cliprect and a color to add with
//! copies this surface into another, using the alpha mask and cliprect and a color to add with
virtual void copyToWithAlpha(IImage* target, const core::position2d<s32>& pos,
const core::rect<s32>& sourceRect, const SColor &color,
const core::rect<s32>* clipRect = 0) =0;
@ -129,7 +129,7 @@ public:
}
//! test if the color format is only viable for RenderTarget textures
/** Since we don't have support for e.g. floating point iimage formats
/** Since we don't have support for e.g. floating point IImage formats
one should test if the color format can be used for arbitrary usage, or
if it is restricted to RTTs. */
static bool isRenderTargetOnlyFormat(const ECOLOR_FORMAT format)

View File

@ -1630,7 +1630,7 @@ public:
virtual bool getBool()
{
if (IsStringW)
return Value.equals_ignore_case(L"true");
return ValueW.equals_ignore_case(L"true");
else
return Value.equals_ignore_case("true");
}

View File

@ -417,11 +417,16 @@ u32 CGUIContextMenu::sendClick(const core::position2d<s32>& p)
//! returns true, if an element was highligted
bool CGUIContextMenu::highlight(const core::position2d<s32>& p, bool canOpenSubMenu)
{
if (!isEnabled())
{
return false;
}
// get number of open submenu
s32 openmenu = -1;
s32 i;
for (i=0; i<(s32)Items.size(); ++i)
if (Items[i].SubMenu && Items[i].SubMenu->isVisible())
if (Items[i].Enabled && Items[i].SubMenu && Items[i].SubMenu->isVisible())
{
openmenu = i;
break;
@ -430,7 +435,7 @@ bool CGUIContextMenu::highlight(const core::position2d<s32>& p, bool canOpenSubM
// delegate highlight operation to submenu
if (openmenu != -1)
{
if (Items[openmenu].SubMenu->highlight(p, canOpenSubMenu))
if (Items[openmenu].Enabled && Items[openmenu].SubMenu->highlight(p, canOpenSubMenu))
{
HighLighted = openmenu;
ChangeTime = os::Timer::getTime();
@ -440,7 +445,8 @@ bool CGUIContextMenu::highlight(const core::position2d<s32>& p, bool canOpenSubM
// highlight myself
for (i=0; i<(s32)Items.size(); ++i)
if (getHRect(Items[i], AbsoluteRect).isPointInside(p))
{
if (Items[i].Enabled && getHRect(Items[i], AbsoluteRect).isPointInside(p))
{
HighLighted = i;
ChangeTime = os::Timer::getTime();
@ -456,6 +462,7 @@ bool CGUIContextMenu::highlight(const core::position2d<s32>& p, bool canOpenSubM
}
return true;
}
}
HighLighted = openmenu;
return false;

View File

@ -460,6 +460,7 @@ CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
!clip );
ScrollBarV->drop();
ScrollBarV->setSubElement(true);
ScrollBarV->setPos( 0 );
ScrollBarV->grab();
}
@ -471,6 +472,7 @@ CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
!clip );
ScrollBarH->drop();
ScrollBarH->setSubElement(true);
ScrollBarH->setPos( 0 );
ScrollBarH->grab();
}
@ -591,97 +593,99 @@ void CGUITreeView::recalculateItemHeight()
//! called if an event happened.
bool CGUITreeView::OnEvent( const SEvent &event )
{
switch( event.EventType )
if ( isEnabled() )
{
case EET_GUI_EVENT:
switch( event.GUIEvent.EventType )
switch( event.EventType )
{
case gui::EGET_SCROLL_BAR_CHANGED:
if( event.GUIEvent.Caller == ScrollBarV || event.GUIEvent.Caller == ScrollBarH )
case EET_GUI_EVENT:
switch( event.GUIEvent.EventType )
{
//s32 pos = ( ( gui::IGUIScrollBar* )event.GUIEvent.Caller )->getPos();
return true;
}
break;
case gui::EGET_ELEMENT_FOCUS_LOST:
{
Selecting = false;
return false;
}
break;
default:
break;
}
break;
case EET_MOUSE_INPUT_EVENT:
{
core::position2d<s32> p( event.MouseInput.X, event.MouseInput.Y );
switch( event.MouseInput.Event )
{
case EMIE_MOUSE_WHEEL:
if ( ScrollBarV )
ScrollBarV->setPos( ScrollBarV->getPos() + (s32)event.MouseInput.Wheel * -10 );
return true;
break;
case EMIE_LMOUSE_PRESSED_DOWN:
if (Environment->hasFocus(this) && !AbsoluteClippingRect.isPointInside(p) )
case gui::EGET_SCROLL_BAR_CHANGED:
if( event.GUIEvent.Caller == ScrollBarV || event.GUIEvent.Caller == ScrollBarH )
{
Environment->removeFocus(this);
//s32 pos = ( ( gui::IGUIScrollBar* )event.GUIEvent.Caller )->getPos();
return true;
}
break;
case gui::EGET_ELEMENT_FOCUS_LOST:
{
Selecting = false;
return false;
}
if( Environment->hasFocus( this ) &&
( ( ScrollBarV && ScrollBarV->getAbsolutePosition().isPointInside( p ) && ScrollBarV->OnEvent( event ) ) ||
( ScrollBarH && ScrollBarH->getAbsolutePosition().isPointInside( p ) && ScrollBarH->OnEvent( event ) )
)
)
{
return true;
}
Selecting = true;
Environment->setFocus( this );
return true;
break;
case EMIE_LMOUSE_LEFT_UP:
if( Environment->hasFocus( this ) &&
( ( ScrollBarV && ScrollBarV->getAbsolutePosition().isPointInside( p ) && ScrollBarV->OnEvent( event ) ) ||
( ScrollBarH && ScrollBarH->getAbsolutePosition().isPointInside( p ) && ScrollBarH->OnEvent( event ) )
)
)
{
return true;
}
Selecting = false;
Environment->removeFocus( this );
mouseAction( event.MouseInput.X, event.MouseInput.Y );
return true;
break;
case EMIE_MOUSE_MOVED:
if( Selecting )
{
if( getAbsolutePosition().isPointInside( p ) )
{
mouseAction( event.MouseInput.X, event.MouseInput.Y, true );
return true;
}
}
break;
default:
break;
}
}
break;
default:
break;
}
break;
case EET_MOUSE_INPUT_EVENT:
{
core::position2d<s32> p( event.MouseInput.X, event.MouseInput.Y );
switch( event.MouseInput.Event )
{
case EMIE_MOUSE_WHEEL:
if ( ScrollBarV )
ScrollBarV->setPos( ScrollBarV->getPos() + (s32)event.MouseInput.Wheel * -10 );
return true;
break;
case EMIE_LMOUSE_PRESSED_DOWN:
if (Environment->hasFocus(this) && !AbsoluteClippingRect.isPointInside(p) )
{
Environment->removeFocus(this);
return false;
}
if( Environment->hasFocus( this ) &&
( ( ScrollBarV && ScrollBarV->getAbsolutePosition().isPointInside( p ) && ScrollBarV->OnEvent( event ) ) ||
( ScrollBarH && ScrollBarH->getAbsolutePosition().isPointInside( p ) && ScrollBarH->OnEvent( event ) )
)
)
{
return true;
}
Selecting = true;
Environment->setFocus( this );
return true;
break;
case EMIE_LMOUSE_LEFT_UP:
if( Environment->hasFocus( this ) &&
( ( ScrollBarV && ScrollBarV->getAbsolutePosition().isPointInside( p ) && ScrollBarV->OnEvent( event ) ) ||
( ScrollBarH && ScrollBarH->getAbsolutePosition().isPointInside( p ) && ScrollBarH->OnEvent( event ) )
)
)
{
return true;
}
Selecting = false;
Environment->removeFocus( this );
mouseAction( event.MouseInput.X, event.MouseInput.Y );
return true;
break;
case EMIE_MOUSE_MOVED:
if( Selecting )
{
if( getAbsolutePosition().isPointInside( p ) )
{
mouseAction( event.MouseInput.X, event.MouseInput.Y, true );
return true;
}
}
break;
default:
break;
}
}
break;
default:
break;
}
}
return Parent ? Parent->OnEvent( event ) : false;
}
@ -940,6 +944,10 @@ void CGUITreeView::draw()
if( Font )
{
EGUI_DEFAULT_COLOR textCol = EGDC_GRAY_TEXT;
if ( isEnabled() )
textCol = ( node == Selected ) ? EGDC_HIGH_LIGHT_TEXT : EGDC_BUTTON_TEXT;
s32 iconWidth = 0;
for( s32 n = 0; n < 2; ++n )
{
@ -966,13 +974,13 @@ void CGUITreeView::draw()
&& ( ( ImageLeftOfIcon && n == 1 )
|| ( !ImageLeftOfIcon && n == 0 ) ) )
{
IconFont->draw( node->getIcon(), textRect, skin->getColor( ( node == Selected ) ? EGDC_HIGH_LIGHT_TEXT : EGDC_BUTTON_TEXT ), false, true, &clientClip );
IconFont->draw( node->getIcon(), textRect, skin->getColor(textCol), false, true, &clientClip );
iconWidth += IconFont->getDimension( node->getIcon() ).Width + 3;
textRect.UpperLeftCorner.X += IconFont->getDimension( node->getIcon() ).Width + 3;
}
}
Font->draw( node->getText(), textRect, skin->getColor( ( node == Selected ) ? EGDC_HIGH_LIGHT_TEXT : EGDC_BUTTON_TEXT ), false, true, &clientClip );
Font->draw( node->getText(), textRect, skin->getColor(textCol), false, true, &clientClip );
textRect.UpperLeftCorner.X -= iconWidth;
}