Corrected a FIXME by moving a constant where it belongs

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5525 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-06-19 01:10:41 +00:00
parent 11e3877945
commit b297ef72de
8 changed files with 22 additions and 18 deletions

View File

@ -807,7 +807,7 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const
if (!always_show_selection && !show_focus) return;
// don't mark filler items as focused
if (widget->m_properties[PROP_ID] == DynamicRibbonWidget::NO_ITEM_ID) return;
if (widget->m_properties[PROP_ID] == RibbonWidget::NO_ITEM_ID) return;
//const int texture_w = m_tex_squarefocus->getSize().Width;
//const int texture_h = m_tex_squarefocus->getSize().Height;

View File

@ -30,8 +30,6 @@ using namespace irr::gui;
# define round(x) (floor(x+0.5f))
#endif
const char* DynamicRibbonWidget::NO_ITEM_ID = "?";
DynamicRibbonWidget::DynamicRibbonWidget(const bool combo, const bool multi_row) : Widget(WTYPE_DYNAMIC_RIBBON)
{
m_scroll_offset = 0;
@ -696,9 +694,9 @@ void DynamicRibbonWidget::updateLabel(RibbonWidget* from_this_ribbon)
return;
}
}
if (selection_id == NO_ITEM_ID) m_label->setText( L"" );
else m_label->setText( L"Unknown Item" );
if (selection_id == RibbonWidget::NO_ITEM_ID) m_label->setText( L"" );
else m_label->setText( L"Unknown Item" );
}
// -----------------------------------------------------------------------------
@ -823,7 +821,7 @@ void DynamicRibbonWidget::updateItemDisplay()
else
{
icon->setImage( "textures/transparence.png", IconButtonWidget::ICON_PATH_TYPE_RELATIVE );
icon->m_properties[PROP_ID] = NO_ITEM_ID;
icon->m_properties[PROP_ID] = RibbonWidget::NO_ITEM_ID;
//std::cout << " item " << i << " is a FILLER\n";
}
} // next column

View File

@ -162,11 +162,7 @@ namespace GUIEngine
public:
/** Internal identifier of filler items that aer added in a grid ribbon widget to fill
* lines when the number of items cannot be divided by the number of rows in the grid
*/
static const char* NO_ITEM_ID;
/**
* \param combo Whether this is a "combo" ribbon, i.e. whether there is always one selected item.

View File

@ -19,7 +19,6 @@
#include "graphics/irr_driver.hpp"
#include "guiengine/widgets/button_widget.hpp"
#include "guiengine/widgets/dynamic_ribbon_widget.hpp" //FIXME: needs to be removed
#include "guiengine/engine.hpp"
#include "input/input_manager.hpp"
#include "io/file_manager.hpp"
@ -28,6 +27,7 @@
#include <cmath>
using namespace GUIEngine;
using namespace irr::core;
using namespace irr::gui;
@ -36,6 +36,9 @@ using namespace irr::gui;
# define round(x) (floor(x+0.5f))
#endif
const char* RibbonWidget::NO_ITEM_ID = "?";
// -----------------------------------------------------------------------------
RibbonWidget::RibbonWidget(const RibbonType type) : Widget(WTYPE_RIBBON)
@ -331,7 +334,7 @@ EventPropagation RibbonWidget::rightPressed(const int playerID)
// if we reached a filler item, move again (but don't warp)
// FIXME: why is a constant from DynamicRibbon used here??
if (getSelectionIDString(playerID) == DynamicRibbonWidget::NO_ITEM_ID)
if (getSelectionIDString(playerID) == RibbonWidget::NO_ITEM_ID)
{
if (m_selection[playerID] + 1 < m_children.size())
{
@ -375,7 +378,7 @@ EventPropagation RibbonWidget::leftPressed(const int playerID)
}
// if we reached a filler item, move again (but don't warp)
if (getSelectionIDString(playerID) == DynamicRibbonWidget::NO_ITEM_ID)
if (getSelectionIDString(playerID) == RibbonWidget::NO_ITEM_ID)
{
if (m_selection[playerID] > 0) leftPressed(playerID);
}

View File

@ -81,6 +81,13 @@ namespace GUIEngine
public:
/**
* Internal identifier of filler items that are added in a ribbon widget to fill
* lines when the number of items cannot be divided by the number of rows in the grid
* (mostly used by dynamic ribbon widgets, but the base ribbon needs to know about filler items)
*/
static const char* NO_ITEM_ID;
/** Contains which element within the ribbon is currently focused by player 0 (used by the skin to
show mouse hovers over items that are not selected). Only used for COMBO ribbons. */
Widget* m_mouse_focus;

View File

@ -142,7 +142,7 @@ void ArenasScreen::eventCallback(Widget* widget, const std::string& name, const
{
unlock_manager->playLockSound();
}
else if (selection == DynamicRibbonWidget::NO_ITEM_ID)
else if (selection == RibbonWidget::NO_ITEM_ID)
{
}
else

View File

@ -1441,7 +1441,7 @@ void KartSelectionScreen::setKartsFromCurrentGroup()
{
unlock_manager->playLockSound();
}
else if (selected_kart_group != DynamicRibbonWidget::NO_ITEM_ID)
else if (selected_kart_group != RibbonWidget::NO_ITEM_ID)
{
std::vector<int> group = kart_properties_manager->getKartsInGroup(selected_kart_group);
const int kart_amount = group.size();

View File

@ -125,7 +125,7 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name, const
{
unlock_manager->playLockSound();
}
else if (selection == DynamicRibbonWidget::NO_ITEM_ID)
else if (selection == RibbonWidget::NO_ITEM_ID)
{
}
else