Improved handling of empty 'squares' in scrolling ribbon grids
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4609 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
68381a83e1
commit
4abd5310f7
@ -29,6 +29,11 @@ using namespace irr::gui;
|
||||
# define round(x) (floor(x+0.5f))
|
||||
#endif
|
||||
|
||||
namespace GUIEngine
|
||||
{
|
||||
const char* NO_ITEM_ID = "?";
|
||||
}
|
||||
|
||||
DynamicRibbonWidget::DynamicRibbonWidget(const bool combo, const int max_rows)
|
||||
{
|
||||
m_scroll_offset = 0;
|
||||
@ -569,7 +574,8 @@ void DynamicRibbonWidget::updateLabel(RibbonWidget* from_this_ribbon)
|
||||
}
|
||||
}
|
||||
|
||||
m_label->setText( L"Unknown Item" );
|
||||
if (selection_id == NO_ITEM_ID) m_label->setText( L"" );
|
||||
else m_label->setText( L"Unknown Item" );
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void DynamicRibbonWidget::updateItemDisplay()
|
||||
@ -622,8 +628,8 @@ void DynamicRibbonWidget::updateItemDisplay()
|
||||
}
|
||||
else
|
||||
{
|
||||
icon->setImage( "/gui/main_help.png" );
|
||||
icon->m_properties[PROP_ID] = "?";
|
||||
icon->setImage( "/textures/transparence.png" );
|
||||
icon->m_properties[PROP_ID] = NO_ITEM_ID;
|
||||
}
|
||||
} // next column
|
||||
} // next row
|
||||
|
@ -28,6 +28,9 @@
|
||||
|
||||
namespace GUIEngine
|
||||
{
|
||||
/** The identifier returned for empty "cells" in the ribbon */
|
||||
extern const char* NO_ITEM_ID;
|
||||
|
||||
/**
|
||||
* Even if you have a ribbon that only acts on click/enter, you may wish to know which
|
||||
* item is currently highlighted. In this case, create a listener and pass it to the ribbon.
|
||||
|
@ -1251,6 +1251,9 @@ void KartSelectionScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
{
|
||||
unlock_manager->playLockSound();
|
||||
}
|
||||
else if (selection == NO_ITEM_ID)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<int> group = kart_properties_manager->getKartsInGroup(selection);
|
||||
|
@ -78,6 +78,9 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name, const
|
||||
{
|
||||
unlock_manager->playLockSound();
|
||||
}
|
||||
else if (selection == NO_ITEM_ID)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
Track* clickedTrack = track_manager->getTrack(selection);
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "audio/sound_manager.hpp"
|
||||
#include "config/stk_config.hpp"
|
||||
@ -60,6 +61,7 @@ void TrackManager::addTrackSearchDir(const std::string &dir)
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Get TrackData by the track identifier.
|
||||
* \param ident Identifier = basename of the directory the track is in.
|
||||
* \return The corresponding track object, or NULL if not found
|
||||
*/
|
||||
Track* TrackManager::getTrack(const std::string& ident) const
|
||||
{
|
||||
@ -71,7 +73,10 @@ Track* TrackManager::getTrack(const std::string& ident) const
|
||||
|
||||
std::ostringstream msg;
|
||||
msg<<"TrackManager: Couldn't find track: '"<<ident<<"'";
|
||||
throw std::runtime_error(msg.str());
|
||||
std::cerr << msg.str() << std::endl;
|
||||
return NULL;
|
||||
|
||||
//throw std::runtime_error(msg.str());
|
||||
} // getTrack
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user