diff --git a/include/eepp/ui/uihtmlinput.hpp b/include/eepp/ui/uihtmlinput.hpp index 91ce7f616..1f9aed491 100644 --- a/include/eepp/ui/uihtmlinput.hpp +++ b/include/eepp/ui/uihtmlinput.hpp @@ -1,11 +1,12 @@ #ifndef EE_UI_UIHTMLINPUT_HPP #define EE_UI_UIHTMLINPUT_HPP +#include #include namespace EE { namespace UI { -class EE_API UIHTMLInput : public UIWidget { +class EE_API UIHTMLInput : public UIHTMLWidget { public: static UIHTMLInput* New(); diff --git a/src/eepp/ui/uihtmlinput.cpp b/src/eepp/ui/uihtmlinput.cpp index d2c300027..8b3cd021a 100644 --- a/src/eepp/ui/uihtmlinput.cpp +++ b/src/eepp/ui/uihtmlinput.cpp @@ -15,7 +15,7 @@ UIHTMLInput* UIHTMLInput::New() { return eeNew( UIHTMLInput, () ); } -UIHTMLInput::UIHTMLInput() : UIWidget( "input" ) { +UIHTMLInput::UIHTMLInput() : UIHTMLWidget( "input" ) { mFlags |= UI_HTML_ELEMENT; mWidthPolicy = SizePolicy::WrapContent; mHeightPolicy = SizePolicy::WrapContent; @@ -27,7 +27,7 @@ Uint32 UIHTMLInput::getType() const { } bool UIHTMLInput::isType( const Uint32& type ) const { - return UIHTMLInput::getType() == type || UIWidget::isType( type ); + return UIHTMLInput::getType() == type || UIHTMLWidget::isType( type ); } bool UIHTMLInput::applyProperty( const StyleSheetProperty& attribute ) { @@ -48,14 +48,15 @@ bool UIHTMLInput::applyProperty( const StyleSheetProperty& attribute ) { break; } - if ( id != PropertyId::Id && id != PropertyId::Class && id != PropertyId::Type ) { + if ( id != PropertyId::Id && id != PropertyId::Class && id != PropertyId::Type && + id != PropertyId::Display ) { mProperties[id] = attribute; if ( mChildWidget ) { mChildWidget->applyProperty( attribute ); } } - return UIWidget::applyProperty( attribute ); + return UIHTMLWidget::applyProperty( attribute ); } std::string UIHTMLInput::getPropertyString( const PropertyDefinition* propertyDef, @@ -78,11 +79,11 @@ std::string UIHTMLInput::getPropertyString( const PropertyDefinition* propertyDe return val; } - return UIWidget::getPropertyString( propertyDef, propertyIndex ); + return UIHTMLWidget::getPropertyString( propertyDef, propertyIndex ); } std::vector UIHTMLInput::getPropertiesImplemented() const { - auto props = UIWidget::getPropertiesImplemented(); + auto props = UIHTMLWidget::getPropertiesImplemented(); props.push_back( PropertyId::Type ); props.push_back( PropertyId::Value ); return props; @@ -172,7 +173,7 @@ String UIHTMLInput::getFormValue() const { } void UIHTMLInput::onSizeChange() { - UIWidget::onSizeChange(); + UIHTMLWidget::onSizeChange(); } }} // namespace EE::UI diff --git a/src/eepp/ui/uihtmlwidget.cpp b/src/eepp/ui/uihtmlwidget.cpp index 8093dfda4..7f3ac94ca 100644 --- a/src/eepp/ui/uihtmlwidget.cpp +++ b/src/eepp/ui/uihtmlwidget.cpp @@ -50,6 +50,7 @@ void UIHTMLWidget::onDisplayChange() { void UIHTMLWidget::setDisplay( CSSDisplay display ) { if ( mDisplay != display ) { + auto oldDisplay = mDisplay; mDisplay = display; mNodeFlags |= NODE_FLAG_OVER_FIND_ALLOWED; @@ -62,8 +63,12 @@ void UIHTMLWidget::setDisplay( CSSDisplay display ) { setLayoutWidthPolicy( SizePolicy::MatchParent ); } else if ( mDisplay == CSSDisplay::None ) { mNodeFlags &= ~NODE_FLAG_OVER_FIND_ALLOWED; + setVisible( false ); } + if ( oldDisplay == CSSDisplay::None ) + setVisible( true ); + onDisplayChange(); } } diff --git a/src/examples/ui_html/ui_html.cpp b/src/examples/ui_html/ui_html.cpp index 1907ad5a7..e216cfe1c 100644 --- a/src/examples/ui_html/ui_html.cpp +++ b/src/examples/ui_html/ui_html.cpp @@ -48,7 +48,7 @@ EE_MAIN_FUNC int main( int argc, char** argv ) { Log::instance()->setLiveWrite( true ); Http::setDefaultUserAgent( "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like " - "Gecko) eepp-html/0.0.1 Chrome/140.0.0.0 Safari/537.36" ); + "Gecko) Chrome/148.0.0.0 Safari/537.36" ); auto win = app.getWindow(); auto ui = app.getUI();