mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
no real changes because they didn't work
This commit is contained in:
parent
62b6241e37
commit
a2f74431c1
2 changed files with 61 additions and 3 deletions
|
@ -2,16 +2,23 @@
|
|||
|
||||
#include "Popup.hpp"
|
||||
#include "TextInput.hpp"
|
||||
#include "Popup.hpp"
|
||||
|
||||
#include "../loader/Event.hpp"
|
||||
#include <Geode/binding/TextInputDelegate.hpp>
|
||||
|
||||
namespace geode {
|
||||
class ColorPickPopup;
|
||||
|
||||
class GEODE_DLL ColorPickPopupDelegate {
|
||||
public:
|
||||
virtual void updateColor(cocos2d::ccColor4B const& color) {}
|
||||
};
|
||||
|
||||
// todo in v4: make this pimpl and maybe use events over the delegate?
|
||||
// thing with events is that if you just filter via ColorPickPopup* it
|
||||
// won't work unless you automatically detach the filter when closing the
|
||||
// popup (otherwise opening another popup really quickly will just be
|
||||
// allocated into the same memory and now the old filter is catching the
|
||||
// new popup too)
|
||||
class GEODE_DLL ColorPickPopup :
|
||||
public Popup<cocos2d::ccColor4B const&, bool>,
|
||||
public cocos2d::extension::ColorPickerDelegate,
|
||||
|
|
|
@ -10,6 +10,55 @@
|
|||
|
||||
using namespace geode::prelude;
|
||||
|
||||
// class ColorPickPopupEvent::Impl final {
|
||||
// public:
|
||||
// ColorPickPopup* popup;
|
||||
// ccColor4B color;
|
||||
// bool closed = false;
|
||||
// };
|
||||
|
||||
// ColorPickPopupEvent::ColorPickPopupEvent(ColorPickPopup* popup, ccColor4B const& color)
|
||||
// : m_impl(std::make_shared<Impl>())
|
||||
// {
|
||||
// m_impl->popup = popup;
|
||||
// m_impl->color = color;
|
||||
// }
|
||||
// ColorPickPopupEvent::~ColorPickPopupEvent() = default;
|
||||
|
||||
// ColorPickPopup* ColorPickPopupEvent::getPopup() const {
|
||||
// return m_impl->popup;
|
||||
// }
|
||||
// ccColor4B ColorPickPopupEvent::getColor() const {
|
||||
// return m_impl->color;
|
||||
// }
|
||||
// bool ColorPickPopupEvent::isPopupClosed() const {
|
||||
// return m_impl->closed;
|
||||
// }
|
||||
|
||||
// class ColorPickPopupEventFilter::Impl final {
|
||||
// public:
|
||||
// ColorPickPopup* popup;
|
||||
// };
|
||||
|
||||
// ListenerResult ColorPickPopupEventFilter::handle(utils::MiniFunction<Callback> fn, ColorPickPopupEvent* event) {
|
||||
// if (event->getPopup() == m_impl->popup) {
|
||||
// if (event->isPopupClosed()) {
|
||||
// m_impl->popup = nullptr;
|
||||
// }
|
||||
// else {
|
||||
// fn(event);
|
||||
// }
|
||||
// }
|
||||
// return ListenerResult::Propagate;
|
||||
// }
|
||||
// ColorPickPopupEventFilter::ColorPickPopupEventFilter() : ColorPickPopupEventFilter(nullptr) {}
|
||||
// ColorPickPopupEventFilter::ColorPickPopupEventFilter(ColorPickPopup* popup)
|
||||
// : m_impl(std::make_shared<Impl>())
|
||||
// {
|
||||
// m_impl->popup = popup;
|
||||
// }
|
||||
// ColorPickPopupEventFilter::~ColorPickPopupEventFilter() = default;
|
||||
|
||||
bool ColorPickPopup::setup(ccColor4B const& color, bool isRGBA) {
|
||||
m_noElasticity = true;
|
||||
m_color = color;
|
||||
|
@ -334,7 +383,9 @@ void ColorPickPopup::updateState(CCNode* except) {
|
|||
}
|
||||
m_resetBtn->setVisible(m_originalColor != m_color);
|
||||
m_newColorSpr->setColor(to3B(m_color));
|
||||
if (m_delegate) m_delegate->updateColor(m_color);
|
||||
if (m_delegate) {
|
||||
m_delegate->updateColor(m_color);
|
||||
}
|
||||
}
|
||||
|
||||
void ColorPickPopup::onOpacitySlider(CCObject* sender) {
|
||||
|
|
Loading…
Reference in a new issue