Commit 05667475 authored by hybrid's avatar hybrid

Fixed some warnings.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1144 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 1f349d83
...@@ -42,7 +42,7 @@ namespace gui ...@@ -42,7 +42,7 @@ namespace gui
virtual void addColumn(const wchar_t* caption, s32 id=-1) = 0; virtual void addColumn(const wchar_t* caption, s32 id=-1) = 0;
//! Returns the number of columns in the table control //! 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. //! Makes a column active. This will trigger an ordering process.
/** \param idx: The id of the column to make active. /** \param idx: The id of the column to make active.
...@@ -68,7 +68,7 @@ namespace gui ...@@ -68,7 +68,7 @@ namespace gui
virtual s32 getSelected() const = 0; virtual s32 getSelected() const = 0;
//! Returns amount of rows in the tabcontrol //! Returns amount of rows in the tabcontrol
virtual s32 getRowcount() const = 0; virtual s32 getRowCount() const = 0;
//! adds a row to the table //! adds a row to the table
/** \param rowIndex: zero based index of rows. The row will be inserted at this /** \param rowIndex: zero based index of rows. The row will be inserted at this
......
...@@ -339,6 +339,8 @@ bool CGUITabControl::OnEvent(const SEvent& event) ...@@ -339,6 +339,8 @@ bool CGUITabControl::OnEvent(const SEvent& event)
return true; return true;
} }
break;
default:
break; break;
} }
break; break;
......
...@@ -27,10 +27,11 @@ namespace gui ...@@ -27,10 +27,11 @@ namespace gui
CGUITable::CGUITable(IGUIEnvironment* environment, IGUIElement* parent, CGUITable::CGUITable(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle, bool clip, s32 id, core::rect<s32> rectangle, bool clip,
bool drawBack, bool moveOverSelect) bool drawBack, bool moveOverSelect)
: IGUITable(environment, parent, id, rectangle), ScrollBar(0), : IGUITable(environment, parent, id, rectangle), Font(0), ScrollBar(0),
ItemHeight(0), TotalItemHeight(0), Font(0), Selected(-1), Clip(clip), DrawBack(drawBack), MoveOverSelect(moveOverSelect),
Clip(clip), DrawBack(drawBack), Selecting(false), ActiveTab(-1), Selecting(false), ItemHeight(0), TotalItemHeight(0), Selected(-1),
MoveOverSelect(moveOverSelect), CellHeightPadding(2), CellWidthPadding(5), m_CurrentOrdering(EGOM_ASCENDING) CellHeightPadding(2), CellWidthPadding(5), ActiveTab(-1),
CurrentOrdering(EGOM_ASCENDING)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CGUITable"); setDebugName("CGUITable");
...@@ -86,12 +87,12 @@ void CGUITable::addColumn(const wchar_t* caption, s32 id) ...@@ -86,12 +87,12 @@ void CGUITable::addColumn(const wchar_t* caption, s32 id)
ActiveTab = 0; ActiveTab = 0;
} }
s32 CGUITable::getColumncount() const s32 CGUITable::getColumnCount() const
{ {
return Columns.size(); return Columns.size();
} }
s32 CGUITable::getRowcount() const s32 CGUITable::getRowCount() const
{ {
return Rows.size(); return Rows.size();
} }
...@@ -105,7 +106,7 @@ bool CGUITable::setActiveColumn(s32 idx) ...@@ -105,7 +106,7 @@ bool CGUITable::setActiveColumn(s32 idx)
ActiveTab = idx; ActiveTab = idx;
m_CurrentOrdering = EGOM_ASCENDING; CurrentOrdering = EGOM_ASCENDING;
if ( !Columns[idx].useCustomOrdering ) if ( !Columns[idx].useCustomOrdering )
orderRows(); orderRows();
...@@ -129,7 +130,7 @@ s32 CGUITable::getActiveColumn() const ...@@ -129,7 +130,7 @@ s32 CGUITable::getActiveColumn() const
EGUI_ORDERING_MODE CGUITable::getActiveColumnOrdering() const EGUI_ORDERING_MODE CGUITable::getActiveColumnOrdering() const
{ {
return m_CurrentOrdering; return CurrentOrdering;
} }
void CGUITable::setColumnWidth(u32 columnIndex, u32 width) void CGUITable::setColumnWidth(u32 columnIndex, u32 width)
...@@ -301,7 +302,8 @@ bool CGUITable::OnEvent(const SEvent& event) ...@@ -301,7 +302,8 @@ bool CGUITable::OnEvent(const SEvent& event)
case gui::EGET_SCROLL_BAR_CHANGED: case gui::EGET_SCROLL_BAR_CHANGED:
if (event.GUIEvent.Caller == ScrollBar) 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; return true;
} }
break; break;
...@@ -310,6 +312,8 @@ bool CGUITable::OnEvent(const SEvent& event) ...@@ -310,6 +312,8 @@ bool CGUITable::OnEvent(const SEvent& event)
Selecting = false; Selecting = false;
} }
break; break;
default:
break;
} }
break; break;
case EET_MOUSE_INPUT_EVENT: case EET_MOUSE_INPUT_EVENT:
...@@ -359,21 +363,27 @@ bool CGUITable::OnEvent(const SEvent& event) ...@@ -359,21 +363,27 @@ bool CGUITable::OnEvent(const SEvent& event)
return true; return true;
} }
} }
break;
default:
break;
} }
} }
break; break;
default:
break;
} }
return Parent ? Parent->OnEvent(event) : false; return Parent ? Parent->OnEvent(event) : false;
} }
void CGUITable::setColumnCustomOrdering(u32 columnIndex, bool state) void CGUITable::setColumnCustomOrdering(u32 columnIndex, bool state)
{ {
if ( columnIndex < Columns.size() ) if ( columnIndex < Columns.size() )
Columns[columnIndex].useCustomOrdering = state; Columns[columnIndex].useCustomOrdering = state;
} }
void CGUITable::swapRows(u32 rowIndexA, u32 rowIndexB) void CGUITable::swapRows(u32 rowIndexA, u32 rowIndexB)
{ {
if ( rowIndexA >= Rows.size() ) if ( rowIndexA >= Rows.size() )
...@@ -393,12 +403,12 @@ void CGUITable::swapRows(u32 rowIndexA, u32 rowIndexB) ...@@ -393,12 +403,12 @@ void CGUITable::swapRows(u32 rowIndexA, u32 rowIndexB)
} }
bool CGUITable::selectColumnHeader(s32 xpos, s32 ypos) bool CGUITable::selectColumnHeader(s32 xpos, s32 ypos)
{ {
if ( ypos > ( AbsoluteRect.UpperLeftCorner.Y + ItemHeight ) ) if ( ypos > ( AbsoluteRect.UpperLeftCorner.Y + ItemHeight ) )
return false; return false;
core::rect<s32> frameRect(AbsoluteRect); core::rect<s32> frameRect(AbsoluteRect);
s32 pos = frameRect.UpperLeftCorner.X;; s32 pos = frameRect.UpperLeftCorner.X;;
...@@ -412,15 +422,15 @@ bool CGUITable::selectColumnHeader(s32 xpos, s32 ypos) ...@@ -412,15 +422,15 @@ bool CGUITable::selectColumnHeader(s32 xpos, s32 ypos)
{ {
if ( ActiveTab == s32(i) ) if ( ActiveTab == s32(i) )
{ {
if ( m_CurrentOrdering == EGOM_ASCENDING ) if ( CurrentOrdering == EGOM_ASCENDING )
m_CurrentOrdering = EGOM_DESCENDING; CurrentOrdering = EGOM_DESCENDING;
else else
m_CurrentOrdering = EGOM_ASCENDING; CurrentOrdering = EGOM_ASCENDING;
} }
else else
{ {
ActiveTab = i; ActiveTab = i;
m_CurrentOrdering = EGOM_ASCENDING; CurrentOrdering = EGOM_ASCENDING;
} }
if ( !Columns[i].useCustomOrdering ) if ( !Columns[i].useCustomOrdering )
...@@ -451,7 +461,7 @@ void CGUITable::orderRows() ...@@ -451,7 +461,7 @@ void CGUITable::orderRows()
Row swap; Row swap;
s32 columnIndex = getActiveColumn(); s32 columnIndex = getActiveColumn();
if ( m_CurrentOrdering == EGOM_ASCENDING ) if ( CurrentOrdering == EGOM_ASCENDING )
{ {
for ( s32 i = 0 ; i < s32(Rows.size()) - 1 ; ++i ) for ( s32 i = 0 ; i < s32(Rows.size()) - 1 ; ++i )
{ {
...@@ -525,6 +535,7 @@ void CGUITable::selectNew(s32 ypos, bool onlyHover) ...@@ -525,6 +535,7 @@ void CGUITable::selectNew(s32 ypos, bool onlyHover)
} }
} }
//! draws the element and its children //! draws the element and its children
void CGUITable::draw() void CGUITable::draw()
{ {
...@@ -586,7 +597,7 @@ void CGUITable::draw() ...@@ -586,7 +597,7 @@ void CGUITable::draw()
textRect.UpperLeftCorner.X = pos + CellWidthPadding; textRect.UpperLeftCorner.X = pos + CellWidthPadding;
textRect.LowerRightCorner.X = pos + Columns[j].width - 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) if ((s32)i == Selected)
{ {
...@@ -638,7 +649,7 @@ void CGUITable::draw() ...@@ -638,7 +649,7 @@ void CGUITable::draw()
if ( (s32)i == ActiveTab ) 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.X = columnrect.LowerRightCorner.X - CellWidthPadding - ARROW_PAD / 2 + 2;
columnrect.UpperLeftCorner.Y += 7; columnrect.UpperLeftCorner.Y += 7;
...@@ -711,8 +722,6 @@ void CGUITable::breakText(core::stringw &text, u32 cellWidth ) ...@@ -711,8 +722,6 @@ void CGUITable::breakText(core::stringw &text, u32 cellWidth )
} }
//! Writes attributes of the object. //! 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. //! scripting languages, editors, debuggers or xml serialization purposes.
......
...@@ -34,7 +34,7 @@ namespace gui ...@@ -34,7 +34,7 @@ namespace gui
virtual void addColumn(const wchar_t* caption, s32 id=-1); virtual void addColumn(const wchar_t* caption, s32 id=-1);
//! Returns the number of columns in the table control //! 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. //! Makes a column active. This will trigger an ordering process.
/** \param idx: The id of the column to make active. /** \param idx: The id of the column to make active.
...@@ -50,44 +50,45 @@ namespace gui ...@@ -50,44 +50,45 @@ namespace gui
//! set a column width //! set a column width
virtual void setColumnWidth(u32 columnIndex, u32 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 //! This tells the table control whether is should send an
//! a column header is clicked. If set to false, the table control will use a default alphabetical ordering scheme. //! 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 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); virtual void setColumnCustomOrdering(u32 columnIndex, bool state);
//! Returns which row is currently selected //! Returns which row is currently selected
virtual s32 getSelected() const; virtual s32 getSelected() const;
//! Returns amount of rows in the tabcontrol //! Returns amount of rows in the tabcontrol
virtual s32 getRowcount() const; virtual s32 getRowCount() const;
//! adds a row to the table //! adds a row to the table
/** \param rowIndex: zero based index of rows. The row will be inserted at this /** \param rowIndex: zero based index of rows. The row will be
position, if a row already exist there, it will be placed after it. If the row inserted at this position. If a row already exists
is larger than the actual number of row by more than one, it won't be created. there, it will be placed after it. If the row is larger
Note that if you create a row that's not at the end, there might be performance issues*/ 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); virtual void addRow(u32 rowIndex);
//! Remove a row from the table //! Remove a row from the table
virtual void removeRow(u32 rowIndex); 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(); virtual void clearRows();
//! Swap two row positions. This is useful for a custom ordering algo. //! Swap two row positions. This is useful for a custom ordering algo.
virtual void swapRows(u32 rowIndexA, u32 rowIndexB); virtual void swapRows(u32 rowIndexA, u32 rowIndexB);
//! This tells the table to start ordering all the rows. You need to explicitly //! This tells the table to start ordering all the rows. You
//! tell the table to re order the rows when a new row is added or the cells data is //! need to explicitly tell the table to reorder the rows when
//! changed. This makes the system more flexible and doesn't make you pay the cost of //! a new row is added or the cells data is changed. This makes
//! ordering when adding a lot of rows. //! the system more flexible and doesn't make you pay the cost
//! of ordering when adding a lot of rows.
virtual void orderRows(); virtual void orderRows();
//! Set the text of a cell //! Set the text of a cell
virtual void setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text); virtual void setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text);
...@@ -106,18 +107,15 @@ namespace gui ...@@ -106,18 +107,15 @@ namespace gui
//! Get the data of a cell //! Get the data of a cell
virtual void* getCellData(u32 rowIndex, u32 columnIndex ) const; virtual void* getCellData(u32 rowIndex, u32 columnIndex ) const;
//! clears the table, deletes all items in the table //! clears the table, deletes all items in the table
virtual void clear(); virtual void clear();
//! called if an event happened. //! called if an event happened.
virtual bool OnEvent(const SEvent& event); virtual bool OnEvent(const SEvent& event);
//! draws the element and its children //! draws the element and its children
virtual void draw(); virtual void draw();
//! Writes attributes of the object. //! 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. //! scripting languages, editors, debuggers or xml serialization purposes.
...@@ -159,24 +157,24 @@ namespace gui ...@@ -159,24 +157,24 @@ namespace gui
core::array< Column > Columns; core::array< Column > Columns;
core::array< Row > Rows; core::array< Row > Rows;
s32 ItemHeight;
s32 TotalItemHeight;
gui::IGUIFont* Font; gui::IGUIFont* Font;
gui::IGUIScrollBar* ScrollBar; gui::IGUIScrollBar* ScrollBar;
bool Clip; bool Clip;
bool DrawBack; bool DrawBack;
bool MoveOverSelect; bool MoveOverSelect;
bool Selecting;
s32 ItemHeight;
s32 TotalItemHeight;
s32 Selected; s32 Selected;
s32 CellWidthPadding;
s32 CellHeightPadding; s32 CellHeightPadding;
s32 CellWidthPadding;
s32 ActiveTab; s32 ActiveTab;
bool Selecting; EGUI_ORDERING_MODE CurrentOrdering;
EGUI_ORDERING_MODE m_CurrentOrdering;
}; };
} // end namespace gui } // end namespace gui
} // end namespace irr } // end namespace irr
#endif #endif
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