Add find_widget by id for independent generator.

This commit is contained in:
Mark de Wever 2009-07-11 15:14:33 +00:00
parent b3d31a8a5a
commit c0730b2a4e
2 changed files with 33 additions and 0 deletions

View file

@ -340,6 +340,34 @@ const twidget* tindependant::find_widget(const tpoint& coordinate
return grid.find_widget(coordinate, must_be_active);
}
twidget* tindependant::find_widget(
const std::string& id, const bool must_be_active)
{
for(size_t i = 0; i < get_item_count(); ++i) {
if(is_selected(i)) {
if(twidget* widget = get_item(i).find_widget(id, must_be_active)) {
return widget;
}
}
}
return NULL;
}
const twidget* tindependant::find_widget(
const std::string& id, const bool must_be_active) const
{
for(size_t i = 0; i < get_item_count(); ++i) {
if(is_selected(i)) {
if(const twidget* widget =
get_item(i).find_widget(id, must_be_active)) {
return widget;
}
}
}
return NULL;
}
void tindependant::set_visible_area(const SDL_Rect& area)
{
/*

View file

@ -416,6 +416,11 @@ struct tindependant
const twidget* find_widget(const tpoint& coordinate
, const bool must_be_active) const;
twidget* find_widget(const std::string& id, const bool must_be_active);
const twidget* find_widget(
const std::string& id, const bool must_be_active) const;
/***** ***** ***** ***** keyboard functions ***** ***** ***** *****/
/** Inherited from tgenerator_. */