Remove gui/auxiliary/filter.hpp and unused includes of pane.hpp

Remove filter.hpp, which wasn't included by any file, and relied on
pane.hpp indirectly via one of the lines removed in this commit. The sorting
functionality seems to have moved into pane.cpp when matrix.hpp was added.
Note: there are two other unrelated `filter.hpp` files.

Header pane.hpp is only used by matrix.hpp, pane.cpp, and window_builder.cpp;
the class is also used via a forward-declaration in window.hpp, which friends
it, allowing a call to window::layout_linked_widgets. The class is also made
accessible via REGISTER_WIDGET.

Part of #6540.
This commit is contained in:
Steve Cotton 2022-03-09 13:54:05 +01:00
parent 1f41893f18
commit 3279973960
7 changed files with 0 additions and 80 deletions

View file

@ -431,7 +431,6 @@
<Unit filename="../../src/global.hpp" />
<Unit filename="../../src/gui/auxiliary/field-fwd.hpp" />
<Unit filename="../../src/gui/auxiliary/field.hpp" />
<Unit filename="../../src/gui/auxiliary/filter.hpp" />
<Unit filename="../../src/gui/auxiliary/find_widget.hpp" />
<Unit filename="../../src/gui/auxiliary/iterator/exception.hpp" />
<Unit filename="../../src/gui/auxiliary/iterator/iterator.cpp" />

View file

@ -493,7 +493,6 @@
<Unit filename="../../src/global.hpp" />
<Unit filename="../../src/gui/auxiliary/field-fwd.hpp" />
<Unit filename="../../src/gui/auxiliary/field.hpp" />
<Unit filename="../../src/gui/auxiliary/filter.hpp" />
<Unit filename="../../src/gui/auxiliary/find_widget.hpp" />
<Unit filename="../../src/gui/auxiliary/iterator/exception.hpp" />
<Unit filename="../../src/gui/auxiliary/iterator/iterator.cpp" />

View file

@ -491,7 +491,6 @@
<Unit filename="../../src/global.hpp" />
<Unit filename="../../src/gui/auxiliary/field-fwd.hpp" />
<Unit filename="../../src/gui/auxiliary/field.hpp" />
<Unit filename="../../src/gui/auxiliary/filter.hpp" />
<Unit filename="../../src/gui/auxiliary/find_widget.hpp" />
<Unit filename="../../src/gui/auxiliary/iterator/exception.hpp" />
<Unit filename="../../src/gui/auxiliary/iterator/iterator.cpp" />

View file

@ -1,72 +0,0 @@
/*
Copyright (C) 2012 - 2022
by Mark de Wever <koraq@xs4all.nl>
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
/**
* @file
* Define the common filters for the @ref gui2::pane class.
*/
#pragma once
#include "gui/widgets/text_box.hpp"
#include "lexical_cast.hpp"
#include "serialization/unicode.hpp"
namespace gui2
{
template <class T>
inline bool sort(const pane::item& lhs,
const pane::item& rhs,
const std::string& tag,
const bool ascending)
{
if(ascending) {
return lexical_cast<T>(lhs.tags.at(tag))
< lexical_cast<T>(rhs.tags.at(tag));
} else {
return lexical_cast<T>(lhs.tags.at(tag))
> lexical_cast<T>(rhs.tags.at(tag));
}
}
/**
* A filter testing whether a search string is used in a text.
*
* The comparison is a lower-case comparison.
*
* The function is expected to be used as a functor for
* @ref gui2::pane::filter().
*
* @param item The pane item to search in.
* @param tag The tag of the field containing the text to
* search in. @note This text field should
* already contain lower-cased text only.
* @param text_box A text box object whose text is the search
* string. The text in the text box will be
* converted to lower-cased text before the
* comparison is done.
*
* @returns Whether or not the comparison found a match.
*/
inline bool contains(const pane::item& item,
const std::string& tag,
const text_box& text_box)
{
return item.tags.at(tag).find(utf8::lowercase(text_box.text()))
!= std::string::npos;
}
} // namespace gui2

View file

@ -26,7 +26,6 @@
#include "help/help.hpp"
#include "gettext.hpp"
#include "gui/auxiliary/filter.hpp"
#include "gui/auxiliary/find_widget.hpp"
#include "gui/dialogs/addon/license_prompt.hpp"
#include "gui/dialogs/addon/addon_auth.hpp"
@ -40,7 +39,6 @@
#include "gui/widgets/drawing.hpp"
#include "gui/widgets/image.hpp"
#include "gui/widgets/listbox.hpp"
#include "gui/widgets/pane.hpp"
#include "gui/widgets/settings.hpp"
#include "gui/widgets/toggle_button.hpp"
#include "gui/widgets/text_box.hpp"

View file

@ -21,7 +21,6 @@
#include "gui/dialogs/modal_dialog.hpp"
#include "gui/widgets/addon_list.hpp"
#include "gui/widgets/pane.hpp"
#include <boost/dynamic_bitset.hpp>
@ -29,7 +28,6 @@ namespace gui2
{
class text_box_base;
class text_box;
class pane;
class selectable_item;
class button;
class stacked_widget;

View file

@ -25,7 +25,6 @@
#include "gui/core/widget_definition.hpp"
#include "gui/core/window_builder.hpp"
#include "gui/core/window_builder/helper.hpp"
#include "gui/widgets/pane.hpp"
#include "gui/widgets/selectable_item.hpp"
#include "gui/widgets/settings.hpp"
#include "gui/widgets/toggle_button.hpp"