Implemented getPropertiesImplemented in all widgets.

This commit is contained in:
Martín Lucas Golini
2022-10-20 12:41:52 -03:00
parent faf18c4285
commit 7e605d8fac
74 changed files with 482 additions and 27 deletions

View File

@@ -87,6 +87,8 @@ class EE_API UIAbstractTableView : public UIAbstractView {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
bool getRowSearchByName() const;
void setRowSearchByName( bool rowSearchByName );

View File

@@ -36,8 +36,10 @@ class EE_API UICheckBox : public UITextView {
virtual bool applyProperty( const StyleSheetProperty& attribute );
std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
protected:
UIWidget* mActiveButton;

View File

@@ -343,6 +343,8 @@ class EE_API UICodeEditor : public UIWidget, public TextDocument::Client {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
const bool& getHighlightMatchingBracket() const;
void setHighlightMatchingBracket( const bool& highlightMatchingBracket );

View File

@@ -32,6 +32,8 @@ class EE_API UIComboBox : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
void loadFromXmlNode( const pugi::xml_node& node );
protected:

View File

@@ -167,6 +167,8 @@ class EE_API UIConsole : public UIWidget,
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
void updateCacheSize();
virtual Uint32 onPressEnter();

View File

@@ -49,6 +49,8 @@ class EE_API UIDropDownList : public UITextInput {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
virtual void loadFromXmlNode( const pugi::xml_node& node );
protected:

View File

@@ -48,6 +48,8 @@ class EE_API UIGridLayout : public UILayout {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
virtual bool applyProperty( const StyleSheetProperty& attribute );
virtual void updateLayout();

View File

@@ -35,10 +35,12 @@ class EE_API UIImage : public UIWidget {
const Vector2f& getAlignOffset() const;
virtual bool applyProperty( const StyleSheetProperty& attribute );
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual bool applyProperty( const StyleSheetProperty& attribute );
virtual std::vector<PropertyId> getPropertiesImplemented() const;
const UIScaleType& getScaleType() const;

View File

@@ -34,6 +34,8 @@ class EE_API UILinearLayout : public UILayout {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
void updateLayout();
bool isPacking() const;

View File

@@ -102,6 +102,8 @@ class EE_API UIListBox : public UITouchDraggableWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
protected:
friend class UIListBoxItem;
friend class UIItemContainer<UIListBox>;

View File

@@ -56,6 +56,8 @@ class EE_API UILoader : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
Float getArcStartAngle() const;
UILoader* setArcStartAngle( const Float& arcStartAngle );

View File

@@ -74,6 +74,8 @@ class EE_API UIMenu : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
UINode* getOwnerNode() const;
/** The owner node is the node who triggers the visibility of the menu */

View File

@@ -30,6 +30,8 @@ class EE_API UIMenuCheckBox : public UIMenuItem {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
protected:
bool mActive;
UISkin* mSkinActive;

View File

@@ -30,6 +30,8 @@ class EE_API UIMenuRadioButton : public UIMenuItem {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
protected:
bool mActive;
UISkin* mSkinActive;

View File

@@ -59,6 +59,8 @@ class EE_API UIProgressBar : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
const StyleConfig& getStyleConfig() const;
protected:

View File

@@ -46,6 +46,8 @@ class EE_API UIPushButton : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
void setTextAlign( const Uint32& align );
virtual Sizef getContentSize() const;

View File

@@ -37,6 +37,8 @@ class EE_API UIRadioButton : public UITextView {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
protected:
UIWidget* mActiveButton;
UIWidget* mInactiveButton;

View File

@@ -14,6 +14,8 @@ class EE_API UIRoot : public UIWidget {
bool applyProperty( const StyleSheetProperty& attribute );
virtual std::vector<PropertyId> getPropertiesImplemented() const;
protected:
UIRoot();

View File

@@ -36,6 +36,8 @@ class EE_API UIScrollableWidget : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
virtual Sizef getContentSize() const = 0;
void scrollToTop();

View File

@@ -78,6 +78,8 @@ class EE_API UIScrollBar : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
bool isDragging() const;
protected:

View File

@@ -42,6 +42,8 @@ class EE_API UIScrollView : public UITouchDraggableWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
protected:
ScrollViewType mViewType;
ScrollBarMode mVScrollMode;

View File

@@ -34,6 +34,8 @@ class EE_API UISelectButton : public UIPushButton {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
virtual void setSelected( bool set );
void setSelectOnClick( bool set );

View File

@@ -77,6 +77,8 @@ class EE_API UISlider : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
Sizef getMinimumSize();
bool isDragging() const;

View File

@@ -59,6 +59,8 @@ class EE_API UISpinBox : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
protected:
UITextInput* mInput;
UIWidget* mPushUp;

View File

@@ -42,6 +42,8 @@ class EE_API UISplitter : public UILayout {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
virtual void updateLayout();
protected:

View File

@@ -51,6 +51,8 @@ class EE_API UISprite : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
protected:
Graphics::Sprite* mSprite;
RenderMode mRender;

View File

@@ -34,6 +34,8 @@ class EE_API UITab : public UISelectButton {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
UITabWidget* getTabWidget() const;
virtual UIWidget* getExtraInnerWidget() const;

View File

@@ -122,6 +122,8 @@ class EE_API UITabWidget : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
virtual bool isDrawInvalidator() const;
void invalidate( Node* invalidator );

View File

@@ -54,6 +54,8 @@ class EE_API UITextInput : public UITextView, public TextDocument::Client {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
virtual UIWidget* setPadding( const Rectf& padding );
const String& getHint() const;

View File

@@ -48,6 +48,8 @@ class EE_API UITextureRegion : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
protected:
UIScaleType mScaleType;
Graphics::TextureRegion* mTextureRegion;

View File

@@ -88,6 +88,8 @@ class EE_API UITextView : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
void setTextAlign( const Uint32& align );
UITextView* setFontFillColor( const Color& color, Uint32 from, Uint32 to );

View File

@@ -91,6 +91,8 @@ class EE_API UITooltip : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
const String& getStringBuffer() const;
void setStringBuffer( const String& stringBuffer );

View File

@@ -34,6 +34,8 @@ class EE_API UITouchDraggableWidget : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
protected:
Vector2f mTouchDragPoint;
Vector2f mTouchDragAcceleration;

View File

@@ -51,10 +51,12 @@ class EE_API UIViewPager : public UIWidget {
void setTimingFunction( const Ease::Interpolation& timingFunction );
virtual bool applyProperty( const StyleSheetProperty& attribute );
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex ) const;
virtual bool applyProperty( const StyleSheetProperty& attribute );
virtual std::vector<PropertyId> getPropertiesImplemented() const;
const Int32& getTotalPages() const;

View File

@@ -80,6 +80,8 @@ class EE_API UIWidgetTable : public UITouchDraggableWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
protected:
friend class UIItemContainer<UIWidgetTable>;
friend class UIWidgetTableRow;

View File

@@ -157,6 +157,8 @@ class EE_API UIWindow : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
std::string getWindowFlagsString() const;
Sizef getMinWindowSizeWithDecoration();

View File

@@ -656,6 +656,12 @@ std::string UIAbstractTableView::getPropertyString( const PropertyDefinition* pr
}
}
std::vector<PropertyId> UIAbstractTableView::getPropertiesImplemented() const {
auto props = UIAbstractView::getPropertiesImplemented();
props.push_back( PropertyId::RowHeight );
return props;
}
bool UIAbstractTableView::getRowSearchByName() const {
return mRowSearchByName;
}

View File

@@ -235,6 +235,12 @@ std::string UICheckBox::getPropertyString( const PropertyDefinition* propertyDef
}
}
std::vector<PropertyId> UICheckBox::getPropertiesImplemented() const {
auto props = UITextView::getPropertiesImplemented();
props.push_back( PropertyId::Checked );
return props;
}
bool UICheckBox::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -1945,6 +1945,24 @@ std::string UICodeEditor::getPropertyString( const PropertyDefinition* propertyD
}
}
std::vector<PropertyId> UICodeEditor::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::Locked,
PropertyId::Color,
PropertyId::ShadowColor,
PropertyId::SelectionColor,
PropertyId::SelectionBackColor,
PropertyId::FontFamily,
PropertyId::FontSize,
PropertyId::FontStyle,
PropertyId::TextStrokeWidth,
PropertyId::TextStrokeColor,
PropertyId::TextSelection,
PropertyId::LineSpacing };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
const bool& UICodeEditor::getHighlightMatchingBracket() const {
return mHighlightMatchingBracket;
}

View File

@@ -225,4 +225,45 @@ std::string UIComboBox::getPropertyString( const PropertyDefinition* propertyDef
}
}
std::vector<PropertyId> UIComboBox::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = {
PropertyId::Color,
PropertyId::ShadowColor,
PropertyId::SelectionColor,
PropertyId::SelectionBackColor,
PropertyId::FontFamily,
PropertyId::FontSize,
PropertyId::FontStyle,
PropertyId::Wordwrap,
PropertyId::TextStrokeWidth,
PropertyId::TextStrokeColor,
PropertyId::TextSelection,
PropertyId::TextAlign,
PropertyId::Text,
PropertyId::AllowEditing,
PropertyId::MaxLength,
PropertyId::Numeric,
PropertyId::AllowFloat,
PropertyId::Hint,
PropertyId::HintColor,
PropertyId::HintShadowColor,
PropertyId::HintFontSize,
PropertyId::HintFontFamily,
PropertyId::HintFontStyle,
PropertyId::HintStrokeWidth,
PropertyId::HintStrokeColor,
PropertyId::PopUpToRoot,
PropertyId::MaxVisibleItems,
PropertyId::SelectedIndex,
PropertyId::SelectedText,
PropertyId::ScrollBarStyle,
PropertyId::RowHeight,
PropertyId::VScrollMode,
PropertyId::HScrollMode,
};
props.insert( props.end(), local.begin(), local.end() );
return props;
}
}} // namespace EE::UI

View File

@@ -208,12 +208,22 @@ std::string UIConsole::getPropertyString( const PropertyDefinition* propertyDef,
}
}
std::vector<PropertyId> UIConsole::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::Color, PropertyId::ShadowColor,
PropertyId::SelectionColor, PropertyId::SelectionBackColor,
PropertyId::FontFamily, PropertyId::FontSize,
PropertyId::FontStyle, PropertyId::TextStrokeWidth,
PropertyId::TextStrokeColor };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
UIConsole* UIConsole::setFontSize( const Float& dpSize ) {
if ( mFontStyleConfig.CharacterSize != dpSize ) {
mFontStyleConfig.CharacterSize =
eeabs( dpSize - (int)dpSize ) == 0.5f || (int)dpSize == dpSize ? dpSize
: eefloor( dpSize );
mFontStyleConfig.CharacterSize = mFontStyleConfig.CharacterSize;
invalidateDraw();
onFontChanged();
}

View File

@@ -45,9 +45,7 @@ UIDropDownList::UIDropDownList( const std::string& tag ) :
cb::Make1( this, &UIDropDownList::onItemKeyDown ) );
mListBox->addEventListener( Event::KeyDown, cb::Make1( this, &UIDropDownList::onItemKeyDown ) );
mListBox->addEventListener( Event::OnClear, cb::Make1( this, &UIDropDownList::onWidgetClear ) );
mListBox->addEventListener( Event::OnClose, [&]( const Event* ) {
mListBox = nullptr;
} );
mListBox->addEventListener( Event::OnClose, [&]( const Event* ) { mListBox = nullptr; } );
}
UIDropDownList::~UIDropDownList() {
@@ -143,12 +141,12 @@ void UIDropDownList::showList() {
if ( mStyleConfig.MaxNumVisibleItems < mListBox->getCount() ) {
mListBox->setSize(
NULL != mFriendNode ? mFriendNode->getSize().getWidth() : getSize().getWidth(),
( Int32 )( mStyleConfig.MaxNumVisibleItems * mListBox->getRowHeight() ) +
(Int32)( mStyleConfig.MaxNumVisibleItems * mListBox->getRowHeight() ) +
tPadding.Top + tPadding.Bottom );
} else {
mListBox->setSize( NULL != mFriendNode ? mFriendNode->getSize().getWidth()
: getSize().getWidth(),
( Int32 )( mListBox->getCount() * mListBox->getRowHeight() ) +
(Int32)( mListBox->getCount() * mListBox->getRowHeight() ) +
tPadding.Top + tPadding.Bottom );
}
@@ -377,6 +375,15 @@ std::string UIDropDownList::getPropertyString( const PropertyDefinition* propert
return "";
}
std::vector<PropertyId> UIDropDownList::getPropertiesImplemented() const {
auto props = UITextInput::getPropertiesImplemented();
auto local = { PropertyId::PopUpToRoot, PropertyId::MaxVisibleItems, PropertyId::SelectedIndex,
PropertyId::SelectedText, PropertyId::ScrollBarStyle, PropertyId::RowHeight,
PropertyId::VScrollMode, PropertyId::HScrollMode };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
void UIDropDownList::loadFromXmlNode( const pugi::xml_node& node ) {
beginAttributesTransaction();

View File

@@ -258,6 +258,15 @@ std::string UIGridLayout::getPropertyString( const PropertyDefinition* propertyD
}
}
std::vector<PropertyId> UIGridLayout::getPropertiesImplemented() const {
auto props = UILayout::getPropertiesImplemented();
auto local = { PropertyId::ColumnMargin, PropertyId::RowMargin, PropertyId::ColumnMode,
PropertyId::RowMode, PropertyId::ColumnWeight, PropertyId::RowWeight,
PropertyId::ColumnWidth, PropertyId::RowHeight, PropertyId::ReverseDraw };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UIGridLayout::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -234,6 +234,13 @@ std::string UIImage::getPropertyString( const PropertyDefinition* propertyDef,
}
}
std::vector<PropertyId> UIImage::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::ScaleType, PropertyId::Tint };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UIImage::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -499,6 +499,13 @@ std::string UILinearLayout::getPropertyString( const PropertyDefinition* propert
}
}
std::vector<PropertyId> UILinearLayout::getPropertiesImplemented() const {
auto props = UILayout::getPropertiesImplemented();
auto local = { PropertyId::Orientation, PropertyId::GravityOwner };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UILinearLayout::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -1054,6 +1054,15 @@ std::string UIListBox::getPropertyString( const PropertyDefinition* propertyDef,
}
}
std::vector<PropertyId> UIListBox::getPropertiesImplemented() const {
auto props = UITouchDraggableWidget::getPropertiesImplemented();
auto local = { PropertyId::RowHeight, PropertyId::VScrollMode,
PropertyId::HScrollMode, PropertyId::SelectedIndex,
PropertyId::SelectedText, PropertyId::ScrollBarStyle };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UIListBox::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -249,6 +249,16 @@ std::string UILoader::getPropertyString( const PropertyDefinition* propertyDef,
}
}
std::vector<PropertyId> UILoader::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::Indeterminate, PropertyId::MaxProgress,
PropertyId::Progress, PropertyId::FillColor,
PropertyId::Radius, PropertyId::OutlineThickness,
PropertyId::AnimationSpeed, PropertyId::ArcStartAngle };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UILoader::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -600,6 +600,13 @@ std::string UIMenu::getPropertyString( const PropertyDefinition* propertyDef,
}
}
std::vector<PropertyId> UIMenu::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::MinIconSize };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UIMenu::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -158,4 +158,11 @@ std::string UIMenuCheckBox::getPropertyString( const PropertyDefinition* propert
}
}
std::vector<PropertyId> UIMenuCheckBox::getPropertiesImplemented() const {
auto props = UIPushButton::getPropertiesImplemented();
auto local = { PropertyId::Checked };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
}} // namespace EE::UI

View File

@@ -150,6 +150,13 @@ std::string UIMenuRadioButton::getPropertyString( const PropertyDefinition* prop
}
}
std::vector<PropertyId> UIMenuRadioButton::getPropertiesImplemented() const {
auto props = UIMenuItem::getPropertiesImplemented();
auto local = { PropertyId::Selected };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UIMenuRadioButton::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -240,6 +240,14 @@ std::string UIProgressBar::getPropertyString( const PropertyDefinition* property
}
}
std::vector<PropertyId> UIProgressBar::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::TotalSteps, PropertyId::Progress, PropertyId::VerticalExpand,
PropertyId::DisplayPercent, PropertyId::MovementSpeed };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UIProgressBar::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -16,8 +16,9 @@ UIPushButton* UIPushButton::NewWithTag( const std::string& tag ) {
return eeNew( UIPushButton, ( tag ) );
}
UIPushButton* UIPushButton::NewWithOpt( const std::string& tag,
const std::function<UITextView*( UIPushButton* )>& newTextViewCb ) {
UIPushButton*
UIPushButton::NewWithOpt( const std::string& tag,
const std::function<UITextView*( UIPushButton* )>& newTextViewCb ) {
return eeNew( UIPushButton, ( tag, newTextViewCb ) );
}
@@ -470,6 +471,30 @@ std::string UIPushButton::getPropertyString( const PropertyDefinition* propertyD
}
}
std::vector<PropertyId> UIPushButton::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::Text,
PropertyId::Icon,
PropertyId::MinIconSize,
PropertyId::TextAlign,
PropertyId::TextAsFallback,
PropertyId::Tint,
PropertyId::Color,
PropertyId::ShadowColor,
PropertyId::SelectionColor,
PropertyId::SelectionBackColor,
PropertyId::FontFamily,
PropertyId::FontSize,
PropertyId::FontStyle,
PropertyId::Wordwrap,
PropertyId::TextStrokeWidth,
PropertyId::TextStrokeColor,
PropertyId::TextSelection,
PropertyId::TextTransform };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UIPushButton::applyProperty( const StyleSheetProperty& attribute ) {
bool attributeSet = true;

View File

@@ -236,13 +236,13 @@ void UIRadioButton::alignFix() {
switch ( Font::getHorizontalAlign( getFlags() ) ) {
case UI_HALIGN_CENTER:
mRealAlignOffset.x =
( Float )( ( Int32 )( ( mSize.x - mPaddingPx.Left - mPaddingPx.Right -
mTextCache->getTextWidth() -
mActiveButton->getPixelsSize().getWidth() +
PixelDensity::dpToPx( mTextSeparation ) ) /
2.f ) ) +
mActiveButton->getPixelsSize().getWidth() + PixelDensity::dpToPx( mTextSeparation );
mRealAlignOffset.x = (Float)( (Int32)( ( mSize.x - mPaddingPx.Left - mPaddingPx.Right -
mTextCache->getTextWidth() -
mActiveButton->getPixelsSize().getWidth() +
PixelDensity::dpToPx( mTextSeparation ) ) /
2.f ) ) +
mActiveButton->getPixelsSize().getWidth() +
PixelDensity::dpToPx( mTextSeparation );
break;
case UI_HALIGN_RIGHT:
mRealAlignOffset.x = ( (Float)mSize.x - mPaddingPx.Left - mPaddingPx.Right -
@@ -288,6 +288,13 @@ std::string UIRadioButton::getPropertyString( const PropertyDefinition* property
}
}
std::vector<PropertyId> UIRadioButton::getPropertiesImplemented() const {
auto props = UITextView::getPropertiesImplemented();
auto local = { PropertyId::Selected };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UIRadioButton::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -36,4 +36,10 @@ bool UIRoot::applyProperty( const StyleSheetProperty& attribute ) {
return true;
}
std::vector<PropertyId> UIRoot::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
props.push_back( PropertyId::DroppableHoveringColor );
return props;
}
}} // namespace EE::UI

View File

@@ -240,6 +240,14 @@ std::string UIScrollableWidget::getPropertyString( const PropertyDefinition* pro
}
}
std::vector<PropertyId> UIScrollableWidget::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::VScrollMode, PropertyId::HScrollMode, PropertyId::ScrollBarStyle,
PropertyId::ScrollBarMode };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
void UIScrollableWidget::scrollToTop() {
mVScroll->setValue( 0 );
}

View File

@@ -380,6 +380,15 @@ std::string UIScrollBar::getPropertyString( const PropertyDefinition* propertyDe
}
}
std::vector<PropertyId> UIScrollBar::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::Orientation, PropertyId::MinValue, PropertyId::MaxValue,
PropertyId::Value, PropertyId::ClickStep, PropertyId::PageStep,
PropertyId::BackgroundExpand };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UIScrollBar::isDragging() const {
return mSlider->isDragging();
}

View File

@@ -277,6 +277,14 @@ std::string UIScrollView::getPropertyString( const PropertyDefinition* propertyD
}
}
std::vector<PropertyId> UIScrollView::getPropertiesImplemented() const {
auto props = UITouchDraggableWidget::getPropertiesImplemented();
auto local = { PropertyId::VScrollMode, PropertyId::HScrollMode, PropertyId::ScrollBarStyle,
PropertyId::ScrollBarMode };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UIScrollView::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -113,6 +113,13 @@ std::string UISelectButton::getPropertyString( const PropertyDefinition* propert
}
}
std::vector<PropertyId> UISelectButton::getPropertiesImplemented() const {
auto props = UIPushButton::getPropertiesImplemented();
auto local = { PropertyId::SelectOnClick, PropertyId::Selected };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
void UISelectButton::setSelected( bool set ) {
if ( set ) {
select();

View File

@@ -445,8 +445,8 @@ void UISlider::manageClick( const Uint32& Flags ) {
else
setValue( mValue + mClickStep );
}
} else if ( Flags & (EE_BUTTONS_WUWD|EE_BUTTONS_WLWR) ) {
if ( Flags & (EE_BUTTON_WUMASK|EE_BUTTON_WLMASK) )
} else if ( Flags & ( EE_BUTTONS_WUWD | EE_BUTTONS_WLWR ) ) {
if ( Flags & ( EE_BUTTON_WUMASK | EE_BUTTON_WLMASK ) )
setValue( mValue - mClickStep );
else
setValue( mValue + mClickStep );
@@ -583,6 +583,15 @@ std::string UISlider::getPropertyString( const PropertyDefinition* propertyDef,
}
}
std::vector<PropertyId> UISlider::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::Orientation, PropertyId::MinValue, PropertyId::MaxValue,
PropertyId::Value, PropertyId::ClickStep, PropertyId::PageStep,
PropertyId::HalfSlider, PropertyId::BackgroundExpand };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UISlider::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -301,6 +301,14 @@ std::string UISpinBox::getPropertyString( const PropertyDefinition* propertyDef,
}
}
std::vector<PropertyId> UISpinBox::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::MinValue, PropertyId::MaxValue, PropertyId::Value,
PropertyId::ClickStep };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UISpinBox::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -158,6 +158,14 @@ std::string UISplitter::getPropertyString( const PropertyDefinition* propertyDef
}
}
std::vector<PropertyId> UISplitter::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::SplitterPartition, PropertyId::SplitterAlwaysShow,
PropertyId::Orientation };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
void UISplitter::onChildCountChange( Node* child, const bool& removed ) {
if ( child != mSplitter ) {
if ( !removed ) {

View File

@@ -54,8 +54,8 @@ void UISprite::draw() {
if ( NULL != mSprite && 0.f != mAlpha ) {
checkTextureRegionUpdate();
mSprite->setPosition( Vector2f( ( Float )( mScreenPosi.x + (int)mAlignOffset.x ),
( Float )( mScreenPosi.y + (int)mAlignOffset.y ) ) );
mSprite->setPosition( Vector2f( (Float)( mScreenPosi.x + (int)mAlignOffset.x ),
(Float)( mScreenPosi.y + (int)mAlignOffset.y ) ) );
TextureRegion* textureRegion = mSprite->getCurrentTextureRegion();
@@ -208,6 +208,13 @@ std::string UISprite::getPropertyString( const PropertyDefinition* propertyDef,
}
}
std::vector<PropertyId> UISprite::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::Src };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UISprite::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -280,6 +280,13 @@ std::string UITab::getPropertyString( const PropertyDefinition* propertyDef,
}
}
std::vector<PropertyId> UITab::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::Text, PropertyId::Owns };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UITab::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -177,6 +177,24 @@ std::string UITabWidget::getPropertyString( const PropertyDefinition* propertyDe
}
}
std::vector<PropertyId> UITabWidget::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::MaxTextLength,
PropertyId::MinTabWidth,
PropertyId::MaxTabWidth,
PropertyId::TabClosable,
PropertyId::TabsEdgesDiffSkin,
PropertyId::TabSeparation,
PropertyId::TabHeight,
PropertyId::TabBarHideOnSingleTab,
PropertyId::TabBarAllowRearrange,
PropertyId::TabBarAllowDragAndDrop,
PropertyId::TabAllowSwitchTabsInEmptySpaces,
PropertyId::DroppableHoveringColor };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UITabWidget::isDrawInvalidator() const {
return true;
}

View File

@@ -465,6 +465,18 @@ std::string UITextInput::getPropertyString( const PropertyDefinition* propertyDe
}
}
std::vector<PropertyId> UITextInput::getPropertiesImplemented() const {
auto props = UITextView::getPropertiesImplemented();
auto local = {
PropertyId::Text, PropertyId::AllowEditing, PropertyId::MaxLength,
PropertyId::Numeric, PropertyId::AllowFloat, PropertyId::Hint,
PropertyId::HintColor, PropertyId::HintShadowColor, PropertyId::HintFontSize,
PropertyId::HintFontFamily, PropertyId::HintFontStyle, PropertyId::HintStrokeWidth,
PropertyId::HintStrokeColor };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UITextInput::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -114,10 +114,10 @@ void UITextureRegion::draw() {
}
} else {
mTextureRegion->setOffset(
Vector2i( ( Int32 )( (Float)oOff.x / mTextureRegion->getPixelDensity() *
PixelDensity::getPixelDensity() ),
( Int32 )( (Float)oOff.y / mTextureRegion->getPixelDensity() *
PixelDensity::getPixelDensity() ) ) );
Vector2i( (Int32)( (Float)oOff.x / mTextureRegion->getPixelDensity() *
PixelDensity::getPixelDensity() ),
(Int32)( (Float)oOff.y / mTextureRegion->getPixelDensity() *
PixelDensity::getPixelDensity() ) ) );
mTextureRegion->setDestSize( Vector2f( (Float)mTextureRegion->getPixelsSize().x,
(Float)mTextureRegion->getPixelsSize().y ) );
@@ -222,6 +222,13 @@ std::string UITextureRegion::getPropertyString( const PropertyDefinition* proper
}
}
std::vector<PropertyId> UITextureRegion::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::Src, PropertyId::ScaleType, PropertyId::Tint };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UITextureRegion::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -766,6 +766,18 @@ std::string UITextView::getPropertyString( const PropertyDefinition* propertyDef
}
}
std::vector<PropertyId> UITextView::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = {
PropertyId::Text, PropertyId::TextTransform, PropertyId::Color,
PropertyId::ShadowColor, PropertyId::SelectionColor, PropertyId::SelectionBackColor,
PropertyId::FontFamily, PropertyId::FontSize, PropertyId::FontStyle,
PropertyId::Wordwrap, PropertyId::TextStrokeWidth, PropertyId::TextStrokeColor,
PropertyId::TextSelection, PropertyId::TextAlign };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
void UITextView::setTextAlign( const Uint32& align ) {
mFlags &= ~( UI_HALIGN_CENTER | UI_HALIGN_RIGHT );
mFlags |= align;

View File

@@ -367,6 +367,16 @@ std::string UITooltip::getPropertyString( const PropertyDefinition* propertyDef,
}
}
std::vector<PropertyId> UITooltip::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = {
PropertyId::TextTransform, PropertyId::Color, PropertyId::ShadowColor,
PropertyId::FontFamily, PropertyId::FontSize, PropertyId::FontStyle,
PropertyId::TextStrokeWidth, PropertyId::TextStrokeColor, PropertyId::TextAlign };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
const String& UITooltip::getStringBuffer() const {
return mStringBuffer;
}

View File

@@ -157,6 +157,13 @@ std::string UITouchDraggableWidget::getPropertyString( const PropertyDefinition*
}
}
std::vector<PropertyId> UITouchDraggableWidget::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::TouchDrag, PropertyId::TouchDragDeceleration };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UITouchDraggableWidget::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -309,6 +309,19 @@ std::string UIViewPager::getPropertyString( const PropertyDefinition* propertyDe
}
}
std::vector<PropertyId> UIViewPager::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::Orientation,
PropertyId::DragResistance,
PropertyId::ChangePagePercent,
PropertyId::MaxEdgeResistance,
PropertyId::PageTransitionDuration,
PropertyId::TimingFunction,
PropertyId::PageLocked };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UIViewPager::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -678,6 +678,14 @@ std::string UIWidgetTable::getPropertyString( const PropertyDefinition* property
}
}
std::vector<PropertyId> UIWidgetTable::getPropertiesImplemented() const {
auto props = UITouchDraggableWidget::getPropertiesImplemented();
auto local = { PropertyId::RowHeight, PropertyId::VScrollMode, PropertyId::HScrollMode,
PropertyId::ScrollBarStyle };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UIWidgetTable::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -1601,6 +1601,25 @@ std::string UIWindow::getPropertyString( const PropertyDefinition* propertyDef,
}
}
std::vector<PropertyId> UIWindow::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::Width,
PropertyId::Height,
PropertyId::WindowTitle,
PropertyId::WindowOpacity,
PropertyId::WindowButtonsOffset,
PropertyId::WindowFlags,
PropertyId::WindowTitlebarSize,
PropertyId::WindowBorderSize,
PropertyId::WindowMinSize,
PropertyId::WindowButtonsSeparation,
PropertyId::WindowCornerDistance,
PropertyId::WindowTitlebarAutoSize,
PropertyId::WindowBorderAutoSize };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
bool UIWindow::applyProperty( const StyleSheetProperty& attribute ) {
if ( !checkPropertyDefinition( attribute ) )
return false;

View File

@@ -100,6 +100,8 @@ class UITerminal : public UIWidget {
virtual std::string getPropertyString( const PropertyDefinition* propertyDef,
const Uint32& propertyIndex = 0 ) const;
virtual std::vector<PropertyId> getPropertiesImplemented() const;
void executeFile( const std::string& cmd );
const TerminalColorScheme& getColorScheme() const;

View File

@@ -227,6 +227,13 @@ std::string UITerminal::getPropertyString( const PropertyDefinition* propertyDef
}
}
std::vector<PropertyId> UITerminal::getPropertiesImplemented() const {
auto props = UIWidget::getPropertiesImplemented();
auto local = { PropertyId::VScrollMode, PropertyId::ScrollBarStyle, PropertyId::ScrollBarMode };
props.insert( props.end(), local.begin(), local.end() );
return props;
}
void UITerminal::executeFile( const std::string& cmd ) {
if ( mTerm )
mTerm->executeFile( cmd );