Fixed some warnings.

git-svn-id: http://svn.code.sf.net/p/irrlicht/code/trunk@1144 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
hybrid 2007-12-31 00:28:51 +00:00
parent 18960d44f6
commit f2f2d0dcc1
4 changed files with 71 additions and 62 deletions

View File

@ -42,7 +42,7 @@ namespace gui
virtual void addColumn(const wchar_t* caption, s32 id=-1) = 0;
//! Returns the number of columns in the table control
virtual s32 getColumncount() const = 0;
virtual s32 getColumnCount() const = 0;
//! Makes a column active. This will trigger an ordering process.
/** \param idx: The id of the column to make active.
@ -68,7 +68,7 @@ namespace gui
virtual s32 getSelected() const = 0;
//! Returns amount of rows in the tabcontrol
virtual s32 getRowcount() const = 0;
virtual s32 getRowCount() const = 0;
//! adds a row to the table
/** \param rowIndex: zero based index of rows. The row will be inserted at this

View File

@ -339,6 +339,8 @@ bool CGUITabControl::OnEvent(const SEvent& event)
return true;
}
break;
default:
break;
}
break;

View File

@ -27,10 +27,11 @@ namespace gui
CGUITable::CGUITable(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle, bool clip,
bool drawBack, bool moveOverSelect)
: IGUITable(environment, parent, id, rectangle), ScrollBar(0),
ItemHeight(0), TotalItemHeight(0), Font(0), Selected(-1),
Clip(clip), DrawBack(drawBack), Selecting(false), ActiveTab(-1),
MoveOverSelect(moveOverSelect), CellHeightPadding(2), CellWidthPadding(5), m_CurrentOrdering(EGOM_ASCENDING)
: IGUITable(environment, parent, id, rectangle), Font(0), ScrollBar(0),
Clip(clip), DrawBack(drawBack), MoveOverSelect(moveOverSelect),
Selecting(false), ItemHeight(0), TotalItemHeight(0), Selected(-1),
CellHeightPadding(2), CellWidthPadding(5), ActiveTab(-1),
CurrentOrdering(EGOM_ASCENDING)
{
#ifdef _DEBUG
setDebugName("CGUITable");
@ -39,7 +40,7 @@ CGUITable::CGUITable(IGUIEnvironment* environment, IGUIElement* parent,
IGUISkin* skin = Environment->getSkin();
s32 s = skin->getSize(EGDS_SCROLLBAR_SIZE);
ScrollBar = Environment->addScrollBar(false,
ScrollBar = Environment->addScrollBar(false,
core::rect<s32>(RelativeRect.getWidth() - s, 0, RelativeRect.getWidth(), RelativeRect.getHeight()),
this, -1);
@ -47,7 +48,7 @@ CGUITable::CGUITable(IGUIEnvironment* environment, IGUIElement* parent,
{
ScrollBar->setPos(0);
ScrollBar->setNotClipped(clip);
ScrollBar->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
ScrollBar->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
ScrollBar->setSubElement(true);
ScrollBar->grab();
}
@ -86,12 +87,12 @@ void CGUITable::addColumn(const wchar_t* caption, s32 id)
ActiveTab = 0;
}
s32 CGUITable::getColumncount() const
s32 CGUITable::getColumnCount() const
{
return Columns.size();
}
s32 CGUITable::getRowcount() const
s32 CGUITable::getRowCount() const
{
return Rows.size();
}
@ -105,7 +106,7 @@ bool CGUITable::setActiveColumn(s32 idx)
ActiveTab = idx;
m_CurrentOrdering = EGOM_ASCENDING;
CurrentOrdering = EGOM_ASCENDING;
if ( !Columns[idx].useCustomOrdering )
orderRows();
@ -129,7 +130,7 @@ s32 CGUITable::getActiveColumn() const
EGUI_ORDERING_MODE CGUITable::getActiveColumnOrdering() const
{
return m_CurrentOrdering;
return CurrentOrdering;
}
void CGUITable::setColumnWidth(u32 columnIndex, u32 width)
@ -301,15 +302,18 @@ bool CGUITable::OnEvent(const SEvent& event)
case gui::EGET_SCROLL_BAR_CHANGED:
if (event.GUIEvent.Caller == ScrollBar)
{
s32 pos = ((gui::IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
const s32 pos = ((gui::IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
// TODO: Scrollbar update?
return true;
}
break;
break;
case gui::EGET_ELEMENT_FOCUS_LOST:
{
Selecting = false;
}
break;
break;
default:
break;
}
break;
case EET_MOUSE_INPUT_EVENT:
@ -359,21 +363,27 @@ bool CGUITable::OnEvent(const SEvent& event)
return true;
}
}
break;
default:
break;
}
}
break;
break;
default:
break;
}
return Parent ? Parent->OnEvent(event) : false;
}
void CGUITable::setColumnCustomOrdering(u32 columnIndex, bool state)
{
if ( columnIndex < Columns.size() )
Columns[columnIndex].useCustomOrdering = state;
}
void CGUITable::swapRows(u32 rowIndexA, u32 rowIndexB)
{
if ( rowIndexA >= Rows.size() )
@ -393,12 +403,12 @@ void CGUITable::swapRows(u32 rowIndexA, u32 rowIndexB)
}
bool CGUITable::selectColumnHeader(s32 xpos, s32 ypos)
{
if ( ypos > ( AbsoluteRect.UpperLeftCorner.Y + ItemHeight ) )
return false;
core::rect<s32> frameRect(AbsoluteRect);
s32 pos = frameRect.UpperLeftCorner.X;;
@ -412,15 +422,15 @@ bool CGUITable::selectColumnHeader(s32 xpos, s32 ypos)
{
if ( ActiveTab == s32(i) )
{
if ( m_CurrentOrdering == EGOM_ASCENDING )
m_CurrentOrdering = EGOM_DESCENDING;
if ( CurrentOrdering == EGOM_ASCENDING )
CurrentOrdering = EGOM_DESCENDING;
else
m_CurrentOrdering = EGOM_ASCENDING;
CurrentOrdering = EGOM_ASCENDING;
}
else
{
ActiveTab = i;
m_CurrentOrdering = EGOM_ASCENDING;
CurrentOrdering = EGOM_ASCENDING;
}
if ( !Columns[i].useCustomOrdering )
@ -451,7 +461,7 @@ void CGUITable::orderRows()
Row swap;
s32 columnIndex = getActiveColumn();
if ( m_CurrentOrdering == EGOM_ASCENDING )
if ( CurrentOrdering == EGOM_ASCENDING )
{
for ( s32 i = 0 ; i < s32(Rows.size()) - 1 ; ++i )
{
@ -525,6 +535,7 @@ void CGUITable::selectNew(s32 ypos, bool onlyHover)
}
}
//! draws the element and its children
void CGUITable::draw()
{
@ -586,7 +597,7 @@ void CGUITable::draw()
textRect.UpperLeftCorner.X = pos + CellWidthPadding;
textRect.LowerRightCorner.X = pos + Columns[j].width - CellWidthPadding;
s32 test = font->getDimension(Rows[i].Items[j].text.c_str()).Width;
// s32 test = font->getDimension(Rows[i].Items[j].text.c_str()).Width;
if ((s32)i == Selected)
{
@ -638,7 +649,7 @@ void CGUITable::draw()
if ( (s32)i == ActiveTab )
{
if ( m_CurrentOrdering == EGOM_ASCENDING )
if ( CurrentOrdering == EGOM_ASCENDING )
{
columnrect.UpperLeftCorner.X = columnrect.LowerRightCorner.X - CellWidthPadding - ARROW_PAD / 2 + 2;
columnrect.UpperLeftCorner.Y += 7;
@ -711,10 +722,8 @@ void CGUITable::breakText(core::stringw &text, u32 cellWidth )
}
//! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for
//! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes.
void CGUITable::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
@ -737,7 +746,7 @@ void CGUITable::serializeAttributes(io::IAttributes* out, io::SAttributeReadWrit
}
//! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for
//! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes.
void CGUITable::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{

View File

@ -23,7 +23,7 @@ namespace gui
{
public:
//! constructor
CGUITable(IGUIEnvironment* environment, IGUIElement* parent,
CGUITable(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle, bool clip=true,
bool drawBack=false, bool moveOverSelect=true);
@ -34,11 +34,11 @@ namespace gui
virtual void addColumn(const wchar_t* caption, s32 id=-1);
//! Returns the number of columns in the table control
virtual s32 getColumncount() const;
virtual s32 getColumnCount() const;
//! Makes a column active. This will trigger an ordering process.
/** \param idx: The id of the column to make active.
\return Returns true if successful. */
\return Returns true if successful. */
virtual bool setActiveColumn(s32 idx);
//! Returns which header is currently active
@ -50,44 +50,45 @@ namespace gui
//! set a column width
virtual void setColumnWidth(u32 columnIndex, u32 width);
//! This tells the table control wether is should send a EGET_TABLE_HEADER_CHANGED message or not when
//! a column header is clicked. If set to false, the table control will use a default alphabetical ordering scheme.
//! This tells the table control whether is should send an
//! EGET_TABLE_HEADER_CHANGED message or not when a column
//! header is clicked. If set to false, the table control will
//! use a default alphabetical ordering scheme.
/** \param columnIndex: The index of the column header.
\param state: If true, a EGET_TABLE_HEADER_CHANGED message will be sent and you can order the table data as you whish.*/
\param state: If true, an EGET_TABLE_HEADER_CHANGED message will be sent.*/
virtual void setColumnCustomOrdering(u32 columnIndex, bool state);
//! Returns which row is currently selected
virtual s32 getSelected() const;
//! Returns amount of rows in the tabcontrol
virtual s32 getRowcount() const;
virtual s32 getRowCount() const;
//! adds a row to the table
/** \param rowIndex: zero based index of rows. The row will be inserted at this
position, if a row already exist there, it will be placed after it. If the row
is larger than the actual number of row by more than one, it won't be created.
Note that if you create a row that's not at the end, there might be performance issues*/
/** \param rowIndex: zero based index of rows. The row will be
inserted at this position. If a row already exists
there, it will be placed after it. If the row is larger
than the actual number of rows by more than one, it
won't be created. Note that if you create a row that is
not at the end, there might be performance issues*/
virtual void addRow(u32 rowIndex);
//! Remove a row from the table
virtual void removeRow(u32 rowIndex);
//! clears the table rows, but keeps the columns intact
//! clear the table rows, but keep the columns intact
virtual void clearRows();
//! Swap two row positions. This is useful for a custom ordering algo.
virtual void swapRows(u32 rowIndexA, u32 rowIndexB);
//! This tells the table to start ordering all the rows. You need to explicitly
//! tell the table to re order the rows when a new row is added or the cells data is
//! changed. This makes the system more flexible and doesn't make you pay the cost of
//! ordering when adding a lot of rows.
//! This tells the table to start ordering all the rows. You
//! need to explicitly tell the table to reorder the rows when
//! a new row is added or the cells data is changed. This makes
//! the system more flexible and doesn't make you pay the cost
//! of ordering when adding a lot of rows.
virtual void orderRows();
//! Set the text of a cell
virtual void setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text);
@ -106,25 +107,22 @@ namespace gui
//! Get the data of a cell
virtual void* getCellData(u32 rowIndex, u32 columnIndex ) const;
//! clears the table, deletes all items in the table
virtual void clear();
//! called if an event happened.
virtual bool OnEvent(const SEvent& event);
//! draws the element and its children
virtual void draw();
//! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for
//! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
//! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for
//! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
@ -159,24 +157,24 @@ namespace gui
core::array< Column > Columns;
core::array< Row > Rows;
s32 ItemHeight;
s32 TotalItemHeight;
gui::IGUIFont* Font;
gui::IGUIScrollBar* ScrollBar;
bool Clip;
bool DrawBack;
bool MoveOverSelect;
s32 Selected;
s32 CellWidthPadding;
s32 CellHeightPadding;
s32 ActiveTab;
bool Selecting;
EGUI_ORDERING_MODE m_CurrentOrdering;
s32 ItemHeight;
s32 TotalItemHeight;
s32 Selected;
s32 CellHeightPadding;
s32 CellWidthPadding;
s32 ActiveTab;
EGUI_ORDERING_MODE CurrentOrdering;
};
} // end namespace gui
} // end namespace irr
#endif