mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 05:47:42 +00:00
General: Include headers where applicable
Ensures necessary dependencies are always included where applicable, as well as avoiding including dependencies where they aren't necessary.
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
#include "specter/ScrollView.hpp"
|
||||
#include "specter/ViewResources.hpp"
|
||||
#include "specter/RootView.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "specter/Button.hpp"
|
||||
#include "specter/IViewManager.hpp"
|
||||
#include "specter/RootView.hpp"
|
||||
#include "specter/ViewResources.hpp"
|
||||
|
||||
namespace specter {
|
||||
#define MAX_SCROLL_SPEED 100
|
||||
@@ -20,6 +24,27 @@ ScrollView::ScrollView(ViewResources& res, View& parentView, Style style)
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView::SideButtonBinding::SideButtonBinding(ScrollView& sv, IViewManager& vm)
|
||||
: m_sv(sv), m_leftName(vm.translate<locale::scroll_left>()), m_rightName(vm.translate<locale::scroll_right>()) {}
|
||||
|
||||
std::string_view ScrollView::SideButtonBinding::name(const Control* control) const {
|
||||
return (control == reinterpret_cast<Control*>(m_sv.m_sideButtons[0].m_view.get())) ? m_leftName.c_str()
|
||||
: m_rightName.c_str();
|
||||
}
|
||||
|
||||
void ScrollView::SideButtonBinding::down(const Button* button, [[maybe_unused]] const boo::SWindowCoord& coord) {
|
||||
if (button == m_sv.m_sideButtons[0].m_view.get()) {
|
||||
m_sv.m_sideButtonState = SideButtonState::ScrollRight;
|
||||
} else {
|
||||
m_sv.m_sideButtonState = SideButtonState::ScrollLeft;
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollView::SideButtonBinding::up([[maybe_unused]] const Button* button,
|
||||
[[maybe_unused]] const boo::SWindowCoord& coord) {
|
||||
m_sv.m_sideButtonState = SideButtonState::None;
|
||||
}
|
||||
|
||||
bool ScrollView::_scroll(const boo::SScrollDelta& scroll) {
|
||||
if (m_contentView.m_view) {
|
||||
float ratioX = subRect().size[0] / float(m_contentView.m_view->nominalWidth());
|
||||
|
||||
Reference in New Issue
Block a user