Inherit UIHTMLInput from UIHTMLWidget.

This commit is contained in:
Martín Lucas Golini
2026-05-10 14:26:47 -03:00
parent cafdefbf4a
commit a38ffe2532
4 changed files with 16 additions and 9 deletions

View File

@@ -1,11 +1,12 @@
#ifndef EE_UI_UIHTMLINPUT_HPP
#define EE_UI_UIHTMLINPUT_HPP
#include <eepp/ui/uihtmlwidget.hpp>
#include <eepp/ui/uiwidget.hpp>
namespace EE { namespace UI {
class EE_API UIHTMLInput : public UIWidget {
class EE_API UIHTMLInput : public UIHTMLWidget {
public:
static UIHTMLInput* New();

View File

@@ -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<PropertyId> 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

View File

@@ -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();
}
}

View File

@@ -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();