diff --git a/bin/assets/layouts/test.css b/bin/assets/layouts/test.css index fdf6ce6f6..fc8758929 100644 --- a/bin/assets/layouts/test.css +++ b/bin/assets/layouts/test.css @@ -14,7 +14,7 @@ * { color: #E6E6E6FF; shadow-color: #32323296; - selected-color: #000; + selection-color: #000; selection-back-color: #969696FF; } diff --git a/bin/assets/ui/uitheme.css b/bin/assets/ui/uitheme.css index 04ce43634..490bf1294 100644 --- a/bin/assets/ui/uitheme.css +++ b/bin/assets/ui/uitheme.css @@ -2,7 +2,7 @@ * { color: #E6E6E6FF; shadow-color: #32323296; - selected-color: #000; + selection-color: #000; selection-back-color: #969696FF; } diff --git a/docs/articles/cssspecification.md b/docs/articles/cssspecification.md index d0c67dfa1..873c36773 100644 --- a/docs/articles/cssspecification.md +++ b/docs/articles/cssspecification.md @@ -1,8 +1,6 @@ # CSS Specification -## WIP - -This document is a work in progress. You'll find that many features are currently not documented. +This document is a work in progress. You may not find some vital information. ## Introduction @@ -98,7 +96,7 @@ grouping method, it selects all the matching nodes. Syntax: `A, B` -Example: `widget, image` will match both `` and `` elements. +Example: `widget, image` will match both `` and `` elements. --- @@ -317,7 +315,7 @@ Read [background-size](https://developer.mozilla.org/en-US/docs/Web/CSS/backgrou Sets the blend mode to the widget. -* Applicable to: Any element. +* Applicable to: Any element * Value Type: string-list * Value List: * `add` @@ -402,7 +400,7 @@ Read [border-top-width](https://developer.mozilla.org/en-US/docs/Web/CSS/border- Defines where the border box is drawn. -* Applicable to: Any element. +* Applicable to: Any element * Value Type: string-list * Value List: * `inside`: The border will be drawn inside the content box. @@ -439,7 +437,7 @@ element. Enables/disables clipping to the element box. -* Applicable to: Any element. +* Applicable to: Any element * Value Type: boolean * Default Value: Varies for each widget/element. @@ -459,8 +457,8 @@ The column mode defines how the size of the column of a grid layout is measured. * Applicable to: EE::UI::UIGridLayout (GridLayout) * Value Type: string-list * Value List: - * `size`: The column width of each grid child will be defined with a fixed width based on the value of the `column-width` length. - * `weight`: The column width of each grid child will be calculated as a normalized percentage of the total grid width using the `column-weight` value. + * `size`: The column width of each grid child will be defined with a fixed width based on the value of the [column-width](#column-width) length. + * `weight`: The column width of each grid child will be calculated as a normalized percentage of the total grid width using the [column-weight](#column-weight) value. * Default value: `weight` --- @@ -478,7 +476,7 @@ Sets the horizontal separation between each element in the grid layout. ### column-weight Sets the percentage width of the child elements of a grid layout. -`column-mode` must be `weight` in order to work. +[column-mode](#column-mode) must be `weight` in order to work. * Applicable to: EE::UI::UIGridLayout (GridLayout) * Value Type: float (normalized between `0` and `1`) @@ -528,7 +526,7 @@ Sets the amount of drag that is needed to start dragging an element. Sets if the element is enabled -* Applicable to: Any element. +* Applicable to: Any element * Value Type: boolean * Default value: `true` @@ -567,7 +565,7 @@ Sets the fill color of a element. Allows to set some very specific flags to the element. Multiple flags can be set, flags are separated by `|`. -* Applicable to: Any element. +* Applicable to: Any element * Value Type: string-list * Value List: * `autosize`: This flag allows the widget/element to resize itself to a minimum size that allows the widget to be fully visible. @@ -668,8 +666,8 @@ With `half-slider` enabled the button will start and end from its center (and no ### hint Sets the hint text of an input. This is the equivalen of `placeholder` in HTML. -Usually this property will be set not in the CSS file but in the XML or by code, but it's -available as an option. +Usually this property will not be set in the CSS file but in the XML as an attribute or from the +code implementation, but it's available as an option. * Applicable to: EE::UI::UITextInput (TextInput) * Value Type: string @@ -779,26 +777,6 @@ Sets an icon to an element that support icons. --- -### icon-auto-margin - -When enabled automatically calculates the optimal horizontal position of an icon in a push button. - -* Applicable to: EE::UI::UIPushButton (PushButton) -* Value Type: boolean -* Default value: `true` - ---- - -### icon-horizontal-margin - -Manually sets the horizontal position of an icon in a push button. - -* Applicable to: EE::UI::UIPushButton (PushButton) -* Value Type: length -* Default value: `4dp` - ---- - ### indeterminate Enables/disables indeterminate mode for a loader. Indeterminate mode is used when the progress of @@ -846,6 +824,7 @@ or one of the special constants. * `match_parent`: The element must be as big as its parent. * `wrap_content`: The element should be only big enough to enclose its content (plus padding). * Default value: `wrap_content` +* Aliases: `layout_height` --- @@ -857,6 +836,7 @@ Accommodates top margin of this element and bottom margin of anchor view. * Applicatable to: Any child of a EE::UI::UIRelativeLayout (RelativeLayout) * Value Type: string (anchor element ID) * Default value: _No value_ +* Aliases: `layout_to_bottom_of` --- @@ -868,6 +848,7 @@ Accommodates right margin of this element and left margin of anchor element. * Applicatable to: Any child of a EE::UI::UIRelativeLayout (RelativeLayout) * Value Type: string (anchor element ID) * Default value: _No value_ +* Aliases: `layout_to_left_of` --- @@ -879,6 +860,7 @@ left margin of this element and right margin of anchor element. * Applicatable to: Any child of a EE::UI::UIRelativeLayout (RelativeLayout) * Value Type: string (anchor element ID) * Default value: _No value_ +* Aliases: `layout_to_right_of` --- @@ -890,6 +872,7 @@ Accommodates bottom margin of this element and top margin of anchor view. * Applicatable to: Any child of a EE::UI::UIRelativeLayout (RelativeLayout) * Value Type: string (anchor element ID) * Default value: _No value_ +* Aliases: `layout_to_top_of` --- @@ -913,6 +896,7 @@ layout weight. * Applicable to: Any element child of a EE::UI::UILinearLayout (LinearLayout) * Value Type: float (normalized from `0` to `1`) * Default value: `0` +* Aliases: `layout_weight` --- @@ -930,6 +914,7 @@ or one of the special constants. * `match_parent`: The element must be as big as its parent. * `wrap_content`: The element should be only big enough to enclose its content (plus padding). * Default value: `wrap_content` +* Aliases: `layout_width` --- @@ -937,24 +922,32 @@ or one of the special constants. Read [margin-bottom](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-bottom) documentation. +* Aliases: `layout_marginBottom` + --- ### margin-left Read [margin-left](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-left) documentation. +* Aliases: `layout_marginLeft` + --- ### margin-right Read [margin-right](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-right) documentation. +* Aliases: `layout_marginRight` + --- ### margin-top Read [margin-top](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-top) documentation. +* Aliases: `layout_marginTop` + --- ### max-height @@ -1177,134 +1170,429 @@ Read [padding-top](https://developer.mozilla.org/en-US/docs/Web/CSS/padding-top) ### page-locked +Locks/unlocks the current page in a view pager (locking means that the page cannot be changed and it's +not scrollable). + +* Applicable to: EE::UI::UIViewPager (ViewPager) +* Value Type: boolean +* Default value: `false` + --- ### page-step +Sets the length value that needs the element to scroll a page. Currently the page step it's not used +by any element but it's a value that can be fetched to implement a page up and down in a scrollable +component. + +* Applicable to: EE::UI::UISlider (Slider), EE::UI::UIProgressBar (ProgressBar) +* Value Type: float +* Default value: `0` + --- -### popup-to-main-control +### popup-to-root + +Sets if the drop down listbox should popup in the root widget node, otherwise will popup in the +parent window. + +* Applicable to: EE::UI::UIDropDownList (DropDownList) +* Value Type: boolean +* Default value: `false` --- ### progress +Sets the current progress of any type of progress bar or loader. + +* Applicable to: EE::UI::UIProgresBar (ProgressBar), EE::UI::UILoader (Loader) +* Value Type: float +* Default value: `0` + --- ### radius +Sets the radius of a loader. This will not change the size of the loader, +only the loader internal size. + +* Applicable to: EE::UI::UILoader (Loader) +* Value Type: length +* Default value: `0` (but it will change with the loader layout size) + --- ### reverse-draw +Enables/disables the reverse draw order for the element. When enabled the element will draw from +the last child to the first. + +* Applicable to: Any element +* Value Type: boolean +* Default value: `false` + --- ### rotation +Sets the element rotation in degrees. + +* Applicable to: Any element +* Value Type: float +* Default value: `0` + --- ### rotation-origin-point-x +Sets the x-axis rotation origin point relative to the element expressed as a length or a percentage. + +* Applicable to: Any element +* Value Type: length or percentage +* Default value: `center` + +Syntax: + +```CSS +rotation-origin-point-x: 50dp; +rotation-origin-point-x: center; +rotation-origin-point-x: 100%; +``` + --- ### rotation-origin-point-y +Sets the y-axis rotation origin point relative to the element expressed as a length or a percentage. + +* Applicable to: Any element +* Value Type: length or percentage +* Default value: `center` + +Syntax: + +```CSS +rotation-origin-point-y: 50dp; +rotation-origin-point-y: center; +rotation-origin-point-y: 100%; +``` + --- ### row-height +Sets the row height in any element that contains fixed size rows. + +* Applicable to: EE::UI::UIListBox (ListBox), EE::UI::UIDropDownList (DropDownList), EE::UI::UITable (Table), EE::UI::UIGridLayout (GridLayout) +* Value Type: length +* Default value: Varies on each case. ListBox and DropDownList will guess the value based on the [font-size](#font-size). Table requires this value to be manually set in order to work. GridLayout +will require the value only if [row-mode](#row-mode) is `size`. + --- ### row-mode +Sets the row mode of a grid layout. +The row mode defines how the size of the row of a grid layout is measured. + +* Applicable to: EE::UI::UIGridLayout (GridLayout) +* Value Type: string-list +* Value List: + * `size`: The row width of each grid child will be defined with a fixed width based on the value of the [row-width](#row-width) length. + * `weight`: The row width of each grid child will be calculated as a normalized percentage of the total grid width using the [row-weight](#row-weight) value. +* Default value: `weight` + --- ### row-margin +Sets the vertical separation between each element in the grid layout. + +* Applicable to: EE::UI::UIGridLayout (GridLayout) +* Value Type: length +* Default value: `0dp` + --- ### row-weight +Sets the percentage height of the child elements of a grid layout. +[row-mode](#row-mode) must be `weight` in order to work. + +* Applicable to: EE::UI::UIGridLayout (GridLayout) +* Value Type: float (normalized between `0` and `1`) +* Default value: `0.25` + --- ### scale +Sets the scale of the element. + +* Applicable to: Any element +* Value Type: vector2-float +* Default value: `1 1` + --- ### scale-origin-point-x +Sets the x-axis scale origin point relative to the element expressed as a length or a percentage. + +* Applicable to: Any element +* Value Type: length or percentage +* Default value: `center` + +Syntax: + +```CSS +scale-origin-point-x: 50dp; +scale-origin-point-x: center; +scale-origin-point-x: 100%; +``` + --- ### scale-origin-point-y +Sets the y-axis scale origin point relative to the element expressed as a length or a percentage. + +* Applicable to: Any element +* Value Type: length or percentage +* Default value: `center` + +Syntax: + +```CSS +scale-origin-point-y: 50dp; +scale-origin-point-y: center; +scale-origin-point-y: 100%; +``` + --- ### scale-type +Sets a method to scale the image inside an element. + +* Applicable to: EE::UI::UIImage (Image), EE::UI::UITextureRegion (TextureRegion) +* Value Type: string-list +* Value List: + * `fit-inside`: Fits the image inside the element mantaining its ratio. + * `expand`: Expands the image to cover the whole element without mantaining its ratio. + * `none`: Keeps the image as it is. + --- ### scrollbar-mode +Defines how the scrollbar should fit inside an scrollable element. + +* Applicable to: EE::UI::UIScrollView (ScrollView) +* Value Type: string-list +* Value List: + * `inclusive`: The scrollbar is part of the scrollable element container, this means that it will + be on top of the content (scrollbars on mobile usually behave like this). + * `exclusive`: The scrollbar is outside the scrollable element container, this means that it will not + be on top of the content (scrollbars on desktop usually behave like this). +* Default value: `exclusive` + --- ### scrollbar-type +Sets the scrollbar style (for the moment defines if it contains buttons at its edge or it's simply a bar). + +* Applicable to: EE::UI::UIScrollBar (ScrollBar), EE::UI::UIListBox (ListBox), EE::UI::UIDropDownLis + (DropDownList), EE::UI::UITable (Table), EE::UI::UIScrollView (ScrollView) +* Value Type: string-list +* Value List: + * `no-buttons`: It's just a scroll bar. + * `two-buttons`: Adds to buttons at its edge. +* Default value: `two-buttons` for desktop platforms, `no-button` for mobile. + --- ### selected ---- +Sets the element state as selected when supported by the specific widget. -### selected-color +* Applicable to: EE::UI::UICheckBox (CheckBox), EE::UI::UIRadioButton (RadioButton) +* Value Type: boolean +* Default value: `false` +* Aliases: `active` --- ### selected-index +Selects an item inside an element containing a list of items from the item index in the list +(starting from `0`). + +* Applicable to: EE::UI::UIListBox (ListBox), EE::UI::UIDropDownList (DropDownList) +* Value Type: integer +* Default value: _No value_ + --- ### selectex-text +Selects an item inside an element containing a list of items from its item text. + +* Applicable to: EE::UI::UIListBox (ListBox), EE::UI::UIDropDownList (DropDownList) +* Value Type: string +* Default value: _No value_ + --- ### selection-back-color +Sets the text selection background color on a text element that suports text selection. + +* Applicable to: EE::UI::UITextView (TextView) and any element that holds inside or extends from a + TextView. EE::UI::UICheckBox (CheckBox), EE::UI::UIRadioButton (RadioButton), EE::UI::UITextInput + (TextInput), EE::UI::UIListBoxItem (ListBox::item), EE::UI::UIDropDownList (DropDownList), + EE::UI::UITextInputPassword (TextInputPassword) +* Value Type: color +* Default color: `#323232` + +--- + +### selection-color + +Sets the text selection color on a text element that suports text selection. + +* Applicable to: EE::UI::UITextView (TextView) and any element that holds inside text or extends from a + TextView. EE::UI::UICheckBox (CheckBox), EE::UI::UIRadioButton (RadioButton), EE::UI::UITextInput + (TextInput), EE::UI::UIListBoxItem (ListBox::item), EE::UI::UIDropDownList (DropDownList), + EE::UI::UITextInputPassword (TextInputPassword), EE::UI::UIPushButton (PushButton) +* Value Type: color +* Default color: `white` + --- ### shadow-color +Sets the text shadow color. + +* Applicable to: EE::UI::UITextView (TextView) and any element that holds inside text or extends from a + TextView. EE::UI::UICheckBox (CheckBox), EE::UI::UIRadioButton (RadioButton), EE::UI::UITextInput + (TextInput), EE::UI::UIListBoxItem (ListBox::item), EE::UI::UIDropDownList (DropDownList), + EE::UI::UITextInputPassword (TextInputPassword), EE::UI::UIPushButton (PushButton), EE::UI::UIToolti + (Tooltip) +* Value Type: color +* Default color: `#323232E6` + --- ### skin +Sets the skin (a.k.a. decoration) to an element. Element skins are automatically applied if there's a specific skin for the element +loaded in the current theme, but new skins can be used and loaded with this property. Skins are the default way +to decorate the widgets, they are loaded from a list of textures or from a texture atlas. Skins are stateful, +this means that a skin can contain all the possible states that a widget can have for decoration, these are: `normal`, `focus`, `selected`, `hover`, `pressed`, `selectedhover`, `selectedpressed`, `disabled`, `checked`. +Current UI skin documentation is lacking. + +* Applicable to: Any element +* Value Type: string (skin name or `none` to disable skinning) +* Default value: The skin corresponding to the widget. + --- ### skin-color ---- +Sets the [skin](#skin) tint color. -### span - ---- - -### special-border-tabs +* Applicable to: Any element +* Value Type: color +* Default value: `white` (no tint) --- ### src +Sets the source of a resource in an element that supports source. + +* Applicable to: EE::UI::UIImage (Image), EE::UI::UISprite (Sprite), EE::UI::UITextureRegion (TextureRegion) +* Value Type: string +* Default value: _No value_ + +Syntax: + +For Image (all the examples are valid). + +For a TextureRegion only the examples with: @textureregion, @drawable, drawable_resource_name +from a texture region resource are valid. + +For a Sprite only the examples with: all the examples are valid except for @9p and http/s resources. + +```CSS +src: file://assets/icon/ee.png; /** relative path to the current working diretory */ +src: "file://assets/icon/ee.png"; +src: https://raw.githubusercontent.com/SpartanJ/eepp/develop/bin/assets/icon/ee.png; +src: "https://raw.githubusercontent.com/SpartanJ/eepp/develop/bin/assets/icon/ee.png"; +src: url(file://assets/icon/ee.png); +src: url(https://raw.githubusercontent.com/SpartanJ/eepp/develop/bin/assets/icon/ee.png); +src: url("file://assets/icon/ee.png"); +src: @image/image_name_already_in_texture_factory; +src: @texture/image_name_already_in_texture_factory; +src: @textureregion/region_name_already_in_any_texture_atlas; +src: @sprite/sprite_name_already_in_any_texture_atlas; /* sprite pattern name **/ +src: @drawable/drawable_name_already_in_any_drawable_manager; /* drawable managers are any holder of image resources. This includes: texture atlases, textures, nine patchs. */ +src: @9p/nine_patch_resource_name_already_in_the_nine_path_manager; +src: drawable_resource_name; /** same as doing: @drawable/drawable_resource_name */ +``` + --- ### tab-closable +Enables/disables tabs to be closable with the middle mouse button click (pending implementation of a close +button inside a tab). + +* Applicable to: EE::UI::UITabWidget (TabWidget) +* Value Type: boolean +* Default value: `false` + +--- + +### tabs-edges-diff-skin + +Enable/disable the tabs edges (most left and right) to use a different skin/decoration from the other tabs. +The most left tab will use the skin: `tab_left` and the most right tab will use `tab_right`. instead of using +the normal `tab` skin. This is to be able to achieve more "closed" tab widgets. + +* Applicable to: EE::UI::UITabWidget (TabWidget) +* Value Type: boolean +* Default value: `false` + --- ### tab-separation +Sets the tabs separation/distance between each other. Negative values are accepted. + +* Applicable to: EE::UI::UITabWidget (TabWidget) +* Value Type: length +* Default value: `0dp` + --- ### text +Sets the text to any element that holds or contains text. +Usually this property will not be set in the CSS file but in the XML as an attribute or from the +code implementation, but it's available as an option. + +* Applicable to: EE::UI::UITextView (TextView) and any element that holds inside or extends from a + TextView. EE::UI::UICheckBox (CheckBox), EE::UI::UIRadioButton (RadioButton), EE::UI::UITextInput + (TextInput), EE::UI::UIListBoxItem (ListBox::item), EE::UI::UIDropDownList (DropDownList), + EE::UI::UITextInputPassword (TextInputPassword), EE::UI::UITooltip (Tooltip), EE::UI::UITab (Tab), + EE::UI::UITextEdit (TextEdit) +* Value Type: string +* Default value: _No value_ + --- ### text-align @@ -1315,42 +1603,120 @@ Read [text-align](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align) d ### text-selection +Enables/disables text selection in any element that contains text. + +* Applicable to: EE::UI::UITextView (TextView) and any element that holds inside or extends from a + TextView. EE::UI::UICheckBox (CheckBox), EE::UI::UIRadioButton (RadioButton), EE::UI::UITextInput + (TextInput), EE::UI::UIListBoxItem (ListBox::item), EE::UI::UIDropDownList (DropDownList), + EE::UI::UITextInputPassword (TextInputPassword), EE::UI::UITooltip (Tooltip), EE::UI::UITab (Tab), + EE::UI::UITextEdit (TextEdit) +* Value Type: boolean +* Default value: `true` for TextEdit, TextInput. `false` for any other element. + --- ### text-stroke-color +Sets the text stroke (also known as text outline) color. + +* Applicable to: EE::UI::UITextView (TextView) and any element that holds inside or extends from a + TextView. +* Value Type: color +* Default color: `black` +* Aliases: `fontOutlineColor` + --- ### text-stroke-width +Sets the text stroke (also known as text outline) width/thickness. + +* Applicable to: EE::UI::UITextView (TextView) and any element that holds inside or extends from a + TextView. +* Value Type: length +* Default value: `0dp` +* Aliases: `fontOutlineThickness` + --- ### theme +Sets a theme to the element. Changing the theme will not have any effect unless [skin](#skin) is also set. + +* Applicable to: Any element +* Value Type: string +* Default value: _No value_ + --- ### timing-function +Sets the timing function (easing function) of a view pager. + +* Applicable to: EE::UI::UIViewPager (ViewPager) +* Value Type: string +* Value List: + * Current timing functions supported: linear, quadratic-in, quadratic-out, quadratic-in-out, + sine-in, sine-out, sine-in-out, exponential-in, exponential-out, exponential-in-out, quartic-in, + quartic-out, quartic-in-out, circular-in, circular-out, circular-in-out, cubic-in, cubic-out, + cubic-in-out, back-in, back-out, back-in-out, bounce-in, bounce-out, bounce-in-out, elastic-in, + elastic-out, elastic-in-out, none. +* Default value: `sine-in` + --- ### tint +Sets the tint color of an image. + +* Applicable to: EE::UI::UIImage (Image), EE::UI::UITextureRegion (TextureRegion) +* Value Type: color +* Default value: `white` (no tint) + --- ### tooltip +Sets the tooltip text and enables the tooltip to the element. +Usually this property will not be set in the CSS file but in the XML as an attribute or from the +code implementation, but it's available as an option. + +* Applicable to: Any element +* Value Type: string +* Default value: _No value_ + --- ### total-steps +Sets the total steps required to complete a progress bar (the maximum value a progress bar will hold). + +* Applicable to: EE::UI::UIProgressBar (ProgressBar) +* Value Type: float +* Default value: `100` + --- ### touch-drag +Enables/disables the element as draggable. When enabled the element will be able to be dragged. + +* Applicable to: EE::UI::UITouchDraggable (TouchDraggable), (EE::UI::UIListBox (ListBox), + EE::UI::UIScrollView (ScrollView), EE::UI::UITable (Table) +* Value Type: boolean +* Default value: `false` + --- ### touch-drag-deceleration +Sets a acceleration value that defines how much will accelerate the drag when the mouse or touch is released. + +* Applicable to: EE::UI::UITouchDraggable (TouchDraggable), (EE::UI::UIListBox (ListBox), + EE::UI::UIScrollView (ScrollView), EE::UI::UITable (Table) +* Value Type: vector2-float +* Default value: `5 5` + --- ### transition-delay @@ -1384,18 +1750,49 @@ elastic-out, elastic-in-out, none. ### value +Sets the current value to an element that accepts values. + +* Applicable to: EE::UI::UIScrollBar (ScrollBar), EE::UI::UISlider (Slider), EE::UI::UISpinBox (SpinBox) +* Value Type: float +* Default value: _Not set_ + --- ### vertical-expand +In a progress bar enables/disables if the progress bar filler should be expanded vertically to the element +height. Whend disabled the filler height will be defined by the filler skin height. + +* Applicable to: EE::UI::UIScrollBar (ScrollBar) +* Value Type: boolean +* Default value: `true` + --- ### visible +Enables/disables the element visibility. + +* Applicable to: Any element +* Value Type: boolean +* Default value: `true` + --- ### vscroll-mode +Sets the vertical scroll mode to any scrollable element. +The mode defines the visibility of the vertical scroll. + +* Applicable to: EE::UI::DropDownList (DropDownList), EE::UI::UIListBox (ListBox), + EE::UI::UIScrollView (ScrollView), EE::UI::UITable (Table), EE::UI::UITextEdit (TextEdit). +* Value Type: string-list +* Value List: + * `auto`: The vertical scrollbar will be visible only when needed. + * `on`: The vertical scrollbar will be always visible. + * `off`: The vertical scrollbar will be always hidden. +* Default value: `auto` + --- ### window-border-auto-size diff --git a/include/eepp/graphics/drawablesearcher.hpp b/include/eepp/graphics/drawablesearcher.hpp index 7e3c238f5..57d413e6f 100644 --- a/include/eepp/graphics/drawablesearcher.hpp +++ b/include/eepp/graphics/drawablesearcher.hpp @@ -8,7 +8,7 @@ namespace EE { namespace Graphics { class EE_API DrawableSearcher { public: - static Drawable* searchByName( const std::string& name ); + static Drawable* searchByName( const std::string& name, bool firstSearchSprite = false ); static Drawable* searchById( const Uint32& id ); diff --git a/include/eepp/ui.hpp b/include/eepp/ui.hpp index e89c08589..938bd1253 100644 --- a/include/eepp/ui.hpp +++ b/include/eepp/ui.hpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/eepp/ui/css/propertydefinition.hpp b/include/eepp/ui/css/propertydefinition.hpp index e77ec5e61..f2f7c9147 100644 --- a/include/eepp/ui/css/propertydefinition.hpp +++ b/include/eepp/ui/css/propertydefinition.hpp @@ -63,7 +63,7 @@ enum class PropertyId : Uint32 { Text = String::hash( "text" ), Color = String::hash( "color" ), ShadowColor = String::hash( "shadow-color" ), - SelectedColor = String::hash( "selected-color" ), + SelectionColor = String::hash( "selection-color" ), SelectionBackColor = String::hash( "selection-back-color" ), FontFamily = String::hash( "font-family" ), FontSize = String::hash( "font-size" ), @@ -83,14 +83,14 @@ enum class PropertyId : Uint32 { MinTabWidth = String::hash( "min-tab-width" ), MaxTabWidth = String::hash( "max-tab-width" ), TabClosable = String::hash( "tab-closable" ), - SpecialBorderTabs = String::hash( "special-border-tabs" ), + TabsEdgesDiffSkin = String::hash( "tabs-edges-diff-skin" ), TabSeparation = String::hash( "tax-separation" ), Selected = String::hash( "selected" ), - PopUpToMainControl = String::hash( "popup-to-main-control" ), + PopUpToRoot = String::hash( "popup-to-root" ), MaxVisibleItems = String::hash( "max-visible-items" ), SelectedIndex = String::hash( "selected-index" ), SelectedText = String::hash( "selected-text" ), - ScrollBarType = String::hash( "scrollbar-type" ), + ScrollBarStyle = String::hash( "scrollbar-style" ), RowHeight = String::hash( "row-height" ), VScrollMode = String::hash( "vscroll-mode" ), HScrollMode = String::hash( "hscroll-mode" ), diff --git a/include/eepp/ui/uihelper.hpp b/include/eepp/ui/uihelper.hpp index 294b194df..d61ada991 100644 --- a/include/eepp/ui/uihelper.hpp +++ b/include/eepp/ui/uihelper.hpp @@ -78,7 +78,7 @@ enum UINodeType { UI_TYPE_LOADER, UI_TYPE_LINEAR_LAYOUT, UI_TYPE_RELATIVE_LAYOUT, - UI_TYPE_TOUCH_DRAGABLE_WIDGET, + UI_TYPE_TOUCH_DRAGGABLE_WIDGET, UI_TYPE_GRID_LAYOUT, UI_TYPE_LAYOUT, UI_TYPE_VIEWPAGER, diff --git a/include/eepp/ui/uilistbox.hpp b/include/eepp/ui/uilistbox.hpp index fff652714..b9c2a160b 100644 --- a/include/eepp/ui/uilistbox.hpp +++ b/include/eepp/ui/uilistbox.hpp @@ -5,11 +5,11 @@ #include #include #include -#include +#include namespace EE { namespace UI { -class EE_API UIListBox : public UITouchDragableWidget { +class EE_API UIListBox : public UITouchDraggableWidget { public: static UIListBox* New(); diff --git a/include/eepp/ui/uiscrollview.hpp b/include/eepp/ui/uiscrollview.hpp index a73054dd2..241635f13 100644 --- a/include/eepp/ui/uiscrollview.hpp +++ b/include/eepp/ui/uiscrollview.hpp @@ -1,13 +1,13 @@ #ifndef EE_UISCROLLVIEW_HPP #define EE_UISCROLLVIEW_HPP -#include +#include namespace EE { namespace UI { class UIScrollBar; -class EE_API UIScrollView : public UITouchDragableWidget { +class EE_API UIScrollView : public UITouchDraggableWidget { public: enum ScrollViewType { Inclusive, Exclusive }; diff --git a/include/eepp/ui/uitable.hpp b/include/eepp/ui/uitable.hpp index ba8414c62..a339ac391 100644 --- a/include/eepp/ui/uitable.hpp +++ b/include/eepp/ui/uitable.hpp @@ -5,11 +5,11 @@ #include #include #include -#include +#include namespace EE { namespace UI { -class EE_API UITable : public UITouchDragableWidget { +class EE_API UITable : public UITouchDraggableWidget { public: static UITable* New(); diff --git a/include/eepp/ui/uitabwidget.hpp b/include/eepp/ui/uitabwidget.hpp index f433dbc69..a23d30993 100644 --- a/include/eepp/ui/uitabwidget.hpp +++ b/include/eepp/ui/uitabwidget.hpp @@ -18,8 +18,8 @@ class EE_API UITabWidget : public UIWidget { Uint32 MinTabWidth = 32; Uint32 MaxTabWidth = 300; bool TabsClosable = false; - bool SpecialBorderTabs = false; //! Indicates if the periferical tabs ( the left and right - //! border tab ) are different from the central tabs. + bool TabsEdgesDiffSkins = false; //! Indicates if the edge tabs ( the left and right + //! border tab ) are different from the central tabs. }; static UITabWidget* New(); @@ -88,7 +88,7 @@ class EE_API UITabWidget : public UIWidget { bool getSpecialBorderTabs() const; - void setSpecialBorderTabs( bool specialBorderTabs ); + void setTabsEdgesDiffSkins( bool diffSkins ); const StyleConfig& getStyleConfig() const; @@ -127,7 +127,7 @@ class EE_API UITabWidget : public UIWidget { virtual void onSizeChange(); - virtual void onChildCountChange( Node * child, const bool& removed ); + virtual void onChildCountChange( Node* child, const bool& removed ); virtual void onPaddingChange(); diff --git a/include/eepp/ui/uitouchdragablewidget.hpp b/include/eepp/ui/uitouchdraggablewidget.hpp similarity index 60% rename from include/eepp/ui/uitouchdragablewidget.hpp rename to include/eepp/ui/uitouchdraggablewidget.hpp index 9579f2e14..165e02a27 100644 --- a/include/eepp/ui/uitouchdragablewidget.hpp +++ b/include/eepp/ui/uitouchdraggablewidget.hpp @@ -1,17 +1,17 @@ -#ifndef EE_UITOUCHDRAGABLEWIDGET_HPP -#define EE_UITOUCHDRAGABLEWIDGET_HPP +#ifndef EE_UITOUCHDRAGGABLEWIDGET_HPP +#define EE_UITOUCHDRAGGABLEWIDGET_HPP #include namespace EE { namespace UI { -class EE_API UITouchDragableWidget : public UIWidget { +class EE_API UITouchDraggableWidget : public UIWidget { public: - static UITouchDragableWidget* New(); + static UITouchDraggableWidget* New(); - UITouchDragableWidget(); + UITouchDraggableWidget(); - ~UITouchDragableWidget(); + ~UITouchDraggableWidget(); virtual Uint32 getType() const; @@ -19,15 +19,15 @@ class EE_API UITouchDragableWidget : public UIWidget { bool isTouchDragEnabled() const; - UITouchDragableWidget* setTouchDragEnabled( const bool& enable ); + UITouchDraggableWidget* setTouchDragEnabled( const bool& enable ); bool isTouchDragging() const; - UITouchDragableWidget* setTouchDragging( const bool& dragging ); + UITouchDraggableWidget* setTouchDragging( const bool& dragging ); Vector2f getTouchDragDeceleration() const; - UITouchDragableWidget* setTouchDragDeceleration( const Vector2f& touchDragDeceleration ); + UITouchDraggableWidget* setTouchDragDeceleration( const Vector2f& touchDragDeceleration ); virtual bool applyProperty( const StyleSheetProperty& attribute ); @@ -39,7 +39,7 @@ class EE_API UITouchDragableWidget : public UIWidget { Vector2f mTouchDragAcceleration; Vector2f mTouchDragDeceleration; - UITouchDragableWidget( const std::string& tag ); + UITouchDraggableWidget( const std::string& tag ); virtual void onTouchDragValueChange( Vector2f diff ); diff --git a/projects/linux/ee.files b/projects/linux/ee.files index 5ba794aa4..58dfc900b 100644 --- a/projects/linux/ee.files +++ b/projects/linux/ee.files @@ -367,7 +367,7 @@ ../../include/eepp/ui/uitheme.hpp ../../include/eepp/ui/uithememanager.hpp ../../include/eepp/ui/uitooltip.hpp -../../include/eepp/ui/uitouchdragablewidget.hpp +../../include/eepp/ui/uitouchdraggablewidget.hpp ../../include/eepp/ui/uiviewpager.hpp ../../include/eepp/ui/uiwidgetcreator.hpp ../../include/eepp/ui/uiwidget.hpp @@ -802,7 +802,7 @@ ../../src/eepp/ui/uitheme.cpp ../../src/eepp/ui/uithememanager.cpp ../../src/eepp/ui/uitooltip.cpp -../../src/eepp/ui/uitouchdragablewidget.cpp +../../src/eepp/ui/uitouchdraggablewidget.cpp ../../src/eepp/ui/uiviewpager.cpp ../../src/eepp/ui/uiwidget.cpp ../../src/eepp/ui/uiwidgetcreator.cpp diff --git a/src/eepp/graphics/drawablesearcher.cpp b/src/eepp/graphics/drawablesearcher.cpp index 492e140b0..e560928e9 100644 --- a/src/eepp/graphics/drawablesearcher.cpp +++ b/src/eepp/graphics/drawablesearcher.cpp @@ -45,10 +45,26 @@ static Drawable* searchByNameInternal( const std::string& name ) { return drawable; } -Drawable* DrawableSearcher::searchByName( const std::string& name ) { +Drawable* DrawableSearcher::searchByName( const std::string& name, bool firstSearchSprite ) { Drawable* drawable = NULL; if ( name.size() ) { + bool searchedSprite = false; + + if ( firstSearchSprite ) { + if ( String::startsWith( name, "@sprite/" ) ) { + drawable = getSprite( name.substr( 8 ) ); + } else { + drawable = getSprite( name ); + } + + if ( NULL != drawable ) { + return drawable; + } + + searchedSprite = true; + } + if ( name[0] == '@' ) { if ( String::startsWith( name, "@textureregion/" ) ) { drawable = @@ -57,7 +73,7 @@ Drawable* DrawableSearcher::searchByName( const std::string& name ) { drawable = TextureFactory::instance()->getByName( name.substr( 7 ) ); } else if ( String::startsWith( name, "@texture/" ) ) { drawable = TextureFactory::instance()->getByName( name.substr( 9 ) ); - } else if ( String::startsWith( name, "@sprite/" ) ) { + } else if ( String::startsWith( name, "@sprite/" ) && !searchedSprite ) { drawable = getSprite( name.substr( 8 ) ); } else if ( String::startsWith( name, "@drawable/" ) ) { drawable = searchByNameInternal( name.substr( 10 ) ); diff --git a/src/eepp/ui/css/stylesheetspecification.cpp b/src/eepp/ui/css/stylesheetspecification.cpp index 19cc5ee46..7400b7f0c 100644 --- a/src/eepp/ui/css/stylesheetspecification.cpp +++ b/src/eepp/ui/css/stylesheetspecification.cpp @@ -186,7 +186,7 @@ void StyleSheetSpecification::registerDefaultProperties() { .addAlias( "text-color" ) .addAlias( "textcolor" ); registerProperty( "shadow-color", "" ).setType( PropertyType::Color ); - registerProperty( "selected-color", "" ).setType( PropertyType::Color ); + registerProperty( "selection-color", "" ).setType( PropertyType::Color ); registerProperty( "selection-back-color", "" ).setType( PropertyType::Color ); registerProperty( "font-family", "" ).addAlias( "font-name" ).setType( PropertyType::String ); registerProperty( "font-size", "" ) @@ -204,8 +204,6 @@ void StyleSheetSpecification::registerDefaultProperties() { registerProperty( "text-align", "" ); registerProperty( "icon", "" ); registerProperty( "min-icon-size", "" ).setType( PropertyType::Vector2 ); - registerProperty( "icon-horizontal-margin", "" ).setType( PropertyType::NumberLength ); - registerProperty( "icon-auto-margin", "" ).setType( PropertyType::NumberLength ); registerProperty( "src", "" ).setType( PropertyType::String ); registerProperty( "scale-type", "" ); registerProperty( "tint", "" ).setType( PropertyType::Color ); @@ -213,24 +211,20 @@ void StyleSheetSpecification::registerDefaultProperties() { registerProperty( "min-tab-width", "" ).setType( PropertyType::NumberLength ); registerProperty( "max-tab-width", "" ).setType( PropertyType::NumberLength ); registerProperty( "tab-closable", "" ).setType( PropertyType::Bool ); - registerProperty( "special-border-tabs", "" ).setType( PropertyType::Bool ); - registerProperty( "line-below-tabs", "" ).setType( PropertyType::Bool ); - registerProperty( "line-below-tabs-color", "" ).setType( PropertyType::Color ); - registerProperty( "line-below-tabs-y-offset", "" ).setType( PropertyType::NumberLength ); + registerProperty( "tabs-edges-diff-skin", "" ).setType( PropertyType::Bool ); registerProperty( "tab-separation", "" ).setType( PropertyType::NumberLength ); registerProperty( "selected", "" ).setType( PropertyType::Bool ).addAlias( "active" ); - registerProperty( "popup-to-main-control", "" ).setType( PropertyType::Bool ); + registerProperty( "popup-to-root", "" ).setType( PropertyType::Bool ); registerProperty( "max-visible-items", "" ).setType( PropertyType::NumberInt ); registerProperty( "selected-index", "" ); registerProperty( "selected-text", "" ); - registerProperty( "scrollbar-type", "" ); + registerProperty( "scrollbar-style", "" ); registerProperty( "row-height", "" ).setType( PropertyType::NumberLength ); registerProperty( "vscroll-mode", "" ); registerProperty( "hscroll-mode", "" ); registerProperty( "column-margin", "" ).setType( PropertyType::NumberLength ); registerProperty( "row-margin", "" ).setType( PropertyType::NumberLength ); - registerProperty( "span", "" ).setType( PropertyType::NumberLength ); registerProperty( "column-mode", "" ); registerProperty( "row-mode", "" ); registerProperty( "column-weight", "" ).setType( PropertyType::NumberFloat ); @@ -307,13 +301,11 @@ void StyleSheetSpecification::registerDefaultProperties() { registerProperty( "hint-font-family", "" ).addAlias( "hint-font-name" ); registerProperty( "transition", "" ).setIndexed(); - registerProperty( "transition-duration", "" ).addAlias( "transitionduration" ); + registerProperty( "transition-duration", "" ); registerProperty( "transition-delay", "0s" ) - .setType( PropertyType::Time ) - .addAlias( "transitiondelay" ); - registerProperty( "transition-timing-function", "linear" ) - .addAlias( "transitiontimingfunction" ); - registerProperty( "transition-property", "" ).addAlias( "transitionproperty" ); + .setType( PropertyType::Time ); + registerProperty( "transition-timing-function", "linear" ); + registerProperty( "transition-property", "" ); registerProperty( "animation", "" ).setIndexed(); registerProperty( "animation-delay", "0s" ).setType( PropertyType::Time ).setIndexed(); diff --git a/src/eepp/ui/uidropdownlist.cpp b/src/eepp/ui/uidropdownlist.cpp index f8e23cbe7..f45acb5d9 100644 --- a/src/eepp/ui/uidropdownlist.cpp +++ b/src/eepp/ui/uidropdownlist.cpp @@ -285,7 +285,7 @@ bool UIDropDownList::applyProperty( const StyleSheetProperty& attribute ) { return false; switch ( attribute.getPropertyDefinition()->getPropertyId() ) { - case PropertyId::PopUpToMainControl: + case PropertyId::PopUpToRoot: setPopUpToMainControl( attribute.asBool() ); break; case PropertyId::MaxVisibleItems: @@ -293,7 +293,7 @@ bool UIDropDownList::applyProperty( const StyleSheetProperty& attribute ) { break; case PropertyId::SelectedIndex: case PropertyId::SelectedText: - case PropertyId::ScrollBarType: + case PropertyId::ScrollBarStyle: case PropertyId::RowHeight: case PropertyId::VScrollMode: case PropertyId::HScrollMode: @@ -311,13 +311,13 @@ std::string UIDropDownList::getPropertyString( const PropertyDefinition* propert return ""; switch ( propertyDef->getPropertyId() ) { - case PropertyId::PopUpToMainControl: + case PropertyId::PopUpToRoot: return mStyleConfig.PopUpToMainControl ? "true" : "false"; case PropertyId::MaxVisibleItems: return String::toStr( mStyleConfig.MaxNumVisibleItems ); case PropertyId::SelectedIndex: case PropertyId::SelectedText: - case PropertyId::ScrollBarType: + case PropertyId::ScrollBarStyle: case PropertyId::RowHeight: case PropertyId::VScrollMode: case PropertyId::HScrollMode: diff --git a/src/eepp/ui/uiimage.cpp b/src/eepp/ui/uiimage.cpp index 5469bcd0e..4c288a912 100644 --- a/src/eepp/ui/uiimage.cpp +++ b/src/eepp/ui/uiimage.cpp @@ -243,8 +243,15 @@ bool UIImage::applyProperty( const StyleSheetProperty& attribute ) { switch ( attribute.getPropertyDefinition()->getPropertyId() ) { case PropertyId::Src: { + std::string path( attribute.getValue() ); + + FunctionString func( FunctionString::parse( path ) ); + if ( !func.getParameters().empty() && func.getName() == "url" ) { + path = func.getParameters().at( 0 ); + } + Drawable* res = NULL; - if ( NULL != ( res = DrawableSearcher::searchByName( attribute.asString() ) ) ) { + if ( NULL != ( res = DrawableSearcher::searchByName( path ) ) ) { if ( res->getDrawableType() == Drawable::SPRITE ) mDrawableOwner = true; diff --git a/src/eepp/ui/uilistbox.cpp b/src/eepp/ui/uilistbox.cpp index 54acf12ee..4c29a8a70 100644 --- a/src/eepp/ui/uilistbox.cpp +++ b/src/eepp/ui/uilistbox.cpp @@ -22,7 +22,7 @@ UIListBox* UIListBox::NewWithTag( const std::string& tag ) { } UIListBox::UIListBox( const std::string& tag ) : - UITouchDragableWidget( tag ), + UITouchDraggableWidget( tag ), mRowHeight( 0 ), mVScrollMode( ScrollBarMode::Auto ), mHScrollMode( ScrollBarMode::Auto ), @@ -92,7 +92,7 @@ Uint32 UIListBox::getType() const { } bool UIListBox::isType( const Uint32& type ) const { - return UIListBox::getType() == type ? true : UITouchDragableWidget::isType( type ); + return UIListBox::getType() == type ? true : UITouchDraggableWidget::isType( type ); } void UIListBox::setTheme( UITheme* Theme ) { @@ -1027,11 +1027,11 @@ std::string UIListBox::getPropertyString( const PropertyDefinition* propertyDef, return String::toStr( getItemSelectedIndex() ); case PropertyId::SelectedText: return getItemSelectedText(); - case PropertyId::ScrollBarType: + case PropertyId::ScrollBarStyle: return mVScrollBar->getScrollBarType() == UIScrollBar::NoButtons ? "no-buttons" : "two-buttons"; default: - return UITouchDragableWidget::getPropertyString( propertyDef, propertyIndex ); + return UITouchDraggableWidget::getPropertyString( propertyDef, propertyIndex ); } } @@ -1041,7 +1041,7 @@ bool UIListBox::applyProperty( const StyleSheetProperty& attribute ) { switch ( attribute.getPropertyDefinition()->getPropertyId() ) { case PropertyId::RowHeight: - setRowHeight( attribute.asDpDimensionI() ); + setRowHeight( attribute.asDpDimensionI( this ) ); break; case PropertyId::VScrollMode: { std::string val = attribute.asString(); @@ -1069,7 +1069,7 @@ bool UIListBox::applyProperty( const StyleSheetProperty& attribute ) { case PropertyId::SelectedText: setSelected( attribute.asString() ); break; - case PropertyId::ScrollBarType: { + case PropertyId::ScrollBarStyle: { std::string val( attribute.asString() ); String::toLowerInPlace( val ); @@ -1083,7 +1083,7 @@ bool UIListBox::applyProperty( const StyleSheetProperty& attribute ) { break; } default: - return UITouchDragableWidget::applyProperty( attribute ); + return UITouchDraggableWidget::applyProperty( attribute ); } return true; @@ -1092,7 +1092,7 @@ bool UIListBox::applyProperty( const StyleSheetProperty& attribute ) { void UIListBox::loadFromXmlNode( const pugi::xml_node& node ) { beginAttributesTransaction(); - UITouchDragableWidget::loadFromXmlNode( node ); + UITouchDraggableWidget::loadFromXmlNode( node ); loadItemsFromXmlNode( node ); diff --git a/src/eepp/ui/uiloader.cpp b/src/eepp/ui/uiloader.cpp index 1207723c4..e373ce2c7 100644 --- a/src/eepp/ui/uiloader.cpp +++ b/src/eepp/ui/uiloader.cpp @@ -268,10 +268,10 @@ bool UILoader::applyProperty( const StyleSheetProperty& attribute ) { setFillColor( attribute.asColor() ); break; case PropertyId::Radius: - setRadius( attribute.asDpDimension() ); + setRadius( attribute.asDpDimension( this ) ); break; case PropertyId::OutlineThickness: - setOutlineThickness( attribute.asDpDimension() ); + setOutlineThickness( attribute.asDpDimension( this ) ); break; case PropertyId::AnimationSpeed: setAnimationSpeed( attribute.asFloat() ); diff --git a/src/eepp/ui/uipushbutton.cpp b/src/eepp/ui/uipushbutton.cpp index 3e829fabd..f714bc56e 100644 --- a/src/eepp/ui/uipushbutton.cpp +++ b/src/eepp/ui/uipushbutton.cpp @@ -332,7 +332,7 @@ std::string UIPushButton::getPropertyString( const PropertyDefinition* propertyD String::format( "%ddp", mIconMinSize.getHeight() ); case PropertyId::Color: case PropertyId::ShadowColor: - case PropertyId::SelectedColor: + case PropertyId::SelectionColor: case PropertyId::SelectionBackColor: case PropertyId::FontFamily: case PropertyId::FontSize: @@ -377,7 +377,7 @@ bool UIPushButton::applyProperty( const StyleSheetProperty& attribute ) { break; case PropertyId::Color: case PropertyId::ShadowColor: - case PropertyId::SelectedColor: + case PropertyId::SelectionColor: case PropertyId::SelectionBackColor: case PropertyId::FontFamily: case PropertyId::FontSize: diff --git a/src/eepp/ui/uiscrollbar.cpp b/src/eepp/ui/uiscrollbar.cpp index 915159369..6d7dc9705 100644 --- a/src/eepp/ui/uiscrollbar.cpp +++ b/src/eepp/ui/uiscrollbar.cpp @@ -335,7 +335,7 @@ std::string UIScrollBar::getPropertyString( const PropertyDefinition* propertyDe return String::fromFloat( getClickStep() ); case PropertyId::PageStep: return String::fromFloat( getPageStep() ); - case PropertyId::ScrollBarType: + case PropertyId::ScrollBarStyle: return getScrollBarType() == NoButtons ? "no-buttons" : "two-buttons"; case PropertyId::BackgroundExpand: return getExpandBackground() ? "true" : "false"; @@ -374,7 +374,7 @@ bool UIScrollBar::applyProperty( const StyleSheetProperty& attribute ) { case PropertyId::PageStep: setPageStep( attribute.asFloat() ); break; - case PropertyId::ScrollBarType: { + case PropertyId::ScrollBarStyle: { std::string val = attribute.asString(); String::toLowerInPlace( val ); diff --git a/src/eepp/ui/uiscrollview.cpp b/src/eepp/ui/uiscrollview.cpp index f71df8903..626897350 100644 --- a/src/eepp/ui/uiscrollview.cpp +++ b/src/eepp/ui/uiscrollview.cpp @@ -9,7 +9,7 @@ UIScrollView* UIScrollView::New() { } UIScrollView::UIScrollView() : - UITouchDragableWidget( "scrollview" ), + UITouchDraggableWidget( "scrollview" ), mViewType( Exclusive ), mVScrollMode( ScrollBarMode::Auto ), mHScrollMode( ScrollBarMode::Auto ), @@ -42,7 +42,7 @@ Uint32 UIScrollView::getType() const { } bool UIScrollView::isType( const Uint32& type ) const { - return UIScrollView::getType() == type ? true : UITouchDragableWidget::isType( type ); + return UIScrollView::getType() == type ? true : UITouchDraggableWidget::isType( type ); } void UIScrollView::onSizeChange() { @@ -83,7 +83,7 @@ void UIScrollView::onChildCountChange( Node* child, const bool& removed ) { containerUpdate(); } - UITouchDragableWidget::onChildCountChange( child, removed ); + UITouchDraggableWidget::onChildCountChange( child, removed ); } void UIScrollView::onPaddingChange() { @@ -267,13 +267,13 @@ std::string UIScrollView::getPropertyString( const PropertyDefinition* propertyD return getHorizontalScrollMode() == ScrollBarMode::Auto ? "auto" : ( getHorizontalScrollMode() == ScrollBarMode::AlwaysOn ? "on" : "off" ); - case PropertyId::ScrollBarType: + case PropertyId::ScrollBarStyle: return mVScroll->getScrollBarType() == UIScrollBar::NoButtons ? "no-buttons" : "two-buttons"; case PropertyId::ScrollBarMode: return getViewType() == Inclusive ? "inclusive" : "exclusive"; default: - return UITouchDragableWidget::getPropertyString( propertyDef, propertyIndex ); + return UITouchDraggableWidget::getPropertyString( propertyDef, propertyIndex ); } } @@ -285,9 +285,9 @@ bool UIScrollView::applyProperty( const StyleSheetProperty& attribute ) { case PropertyId::ScrollBarMode: { std::string val( attribute.asString() ); String::toLowerInPlace( val ); - if ( "inclusive" == val ) + if ( "inclusive" == val || "inside" == val ) setViewType( Inclusive ); - else if ( "exclusive" == val ) + else if ( "exclusive" == val || "outside" == val ) setViewType( Exclusive ); break; } @@ -315,7 +315,7 @@ bool UIScrollView::applyProperty( const StyleSheetProperty& attribute ) { setHorizontalScrollMode( ScrollBarMode::Auto ); break; } - case PropertyId::ScrollBarType: { + case PropertyId::ScrollBarStyle: { std::string val( attribute.asString() ); String::toLowerInPlace( val ); @@ -329,7 +329,7 @@ bool UIScrollView::applyProperty( const StyleSheetProperty& attribute ) { break; } default: - return UITouchDragableWidget::applyProperty( attribute ); + return UITouchDraggableWidget::applyProperty( attribute ); } return true; diff --git a/src/eepp/ui/uisprite.cpp b/src/eepp/ui/uisprite.cpp index 825e3c42c..c65e49b6d 100644 --- a/src/eepp/ui/uisprite.cpp +++ b/src/eepp/ui/uisprite.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -212,11 +213,24 @@ bool UISprite::applyProperty( const StyleSheetProperty& attribute ) { switch ( attribute.getPropertyDefinition()->getPropertyId() ) { case PropertyId::Src: { - std::string val = attribute.asString(); + std::string path( attribute.getValue() ); - if ( val.size() ) { + FunctionString func( FunctionString::parse( path ) ); + if ( !func.getParameters().empty() && func.getName() == "url" ) { + path = func.getParameters().at( 0 ); + } + + Drawable* res = NULL; + if ( NULL != ( res = DrawableSearcher::searchByName( path, true ) ) ) { setIsSpriteOwner( true ); - setSprite( Sprite::New( val ) ); + + if ( res->getDrawableType() == Drawable::SPRITE ) { + setSprite( static_cast( res ) ); + } else if ( res->getDrawableType() == Drawable::TEXTUREREGION ) { + setSprite( Sprite::New( static_cast( res ) ) ); + } else if ( res->getDrawableType() == Drawable::TEXTURE ) { + setSprite( Sprite::New( static_cast( res )->getTextureId() ) ); + } } break; } diff --git a/src/eepp/ui/uitable.cpp b/src/eepp/ui/uitable.cpp index 562b8ce17..9d1125f54 100644 --- a/src/eepp/ui/uitable.cpp +++ b/src/eepp/ui/uitable.cpp @@ -9,7 +9,7 @@ UITable* UITable::New() { } UITable::UITable() : - UITouchDragableWidget( "table" ), + UITouchDraggableWidget( "table" ), mContainerPadding(), mContainer( NULL ), mVScrollBar( NULL ), @@ -69,7 +69,7 @@ Uint32 UITable::getType() const { } bool UITable::isType( const Uint32& type ) const { - return UITable::getType() == type ? true : UITouchDragableWidget::isType( type ); + return UITable::getType() == type ? true : UITouchDraggableWidget::isType( type ); } void UITable::setDefaultCollumnsWidth() { @@ -654,11 +654,11 @@ std::string UITable::getPropertyString( const PropertyDefinition* propertyDef, return getHorizontalScrollMode() == ScrollBarMode::Auto ? "auto" : ( getHorizontalScrollMode() == ScrollBarMode::AlwaysOn ? "on" : "off" ); - case PropertyId::ScrollBarType: + case PropertyId::ScrollBarStyle: return mVScrollBar->getScrollBarType() == UIScrollBar::NoButtons ? "no-buttons" : "two-buttons"; default: - return UITouchDragableWidget::getPropertyString( propertyDef, propertyIndex ); + return UITouchDraggableWidget::getPropertyString( propertyDef, propertyIndex ); } } @@ -668,7 +668,7 @@ bool UITable::applyProperty( const StyleSheetProperty& attribute ) { switch ( attribute.getPropertyDefinition()->getPropertyId() ) { case PropertyId::RowHeight: - setRowHeight( attribute.asDpDimensionI() ); + setRowHeight( attribute.asDpDimensionI( this ) ); break; case PropertyId::VScrollMode: { std::string val = attribute.asString(); @@ -690,7 +690,7 @@ bool UITable::applyProperty( const StyleSheetProperty& attribute ) { setHorizontalScrollMode( ScrollBarMode::AlwaysOff ); break; } - case PropertyId::ScrollBarType: { + case PropertyId::ScrollBarStyle: { std::string val( attribute.asString() ); String::toLowerInPlace( val ); @@ -704,7 +704,7 @@ bool UITable::applyProperty( const StyleSheetProperty& attribute ) { break; } default: - return UITouchDragableWidget::applyProperty( attribute ); + return UITouchDraggableWidget::applyProperty( attribute ); } return true; diff --git a/src/eepp/ui/uitabwidget.cpp b/src/eepp/ui/uitabwidget.cpp index dbad77a6e..8d1c203b2 100644 --- a/src/eepp/ui/uitabwidget.cpp +++ b/src/eepp/ui/uitabwidget.cpp @@ -117,7 +117,7 @@ std::string UITabWidget::getPropertyString( const PropertyDefinition* propertyDe return String::format( "%ddp", getMaxTabWidth() ); case PropertyId::TabClosable: return getTabsClosable() ? "true" : "false"; - case PropertyId::SpecialBorderTabs: + case PropertyId::TabsEdgesDiffSkin: return getSpecialBorderTabs() ? "true" : "false"; case PropertyId::TabSeparation: return String::format( "%ddp", getTabSeparation() ); @@ -172,8 +172,8 @@ bool UITabWidget::applyProperty( const StyleSheetProperty& attribute ) { case PropertyId::TabClosable: setTabsClosable( attribute.asBool() ); break; - case PropertyId::SpecialBorderTabs: - setSpecialBorderTabs( attribute.asBool() ); + case PropertyId::TabsEdgesDiffSkin: + setTabsEdgesDiffSkins( attribute.asBool() ); break; case PropertyId::TabSeparation: setTabSeparation( attribute.asDpDimensionI( this ) ); @@ -238,11 +238,11 @@ void UITabWidget::setTabsClosable( bool tabsClosable ) { } bool UITabWidget::getSpecialBorderTabs() const { - return mStyleConfig.SpecialBorderTabs; + return mStyleConfig.TabsEdgesDiffSkins; } -void UITabWidget::setSpecialBorderTabs( bool specialBorderTabs ) { - mStyleConfig.SpecialBorderTabs = specialBorderTabs; +void UITabWidget::setTabsEdgesDiffSkins( bool diffSkins ) { + mStyleConfig.TabsEdgesDiffSkins = diffSkins; applyThemeToTabs(); } @@ -586,7 +586,7 @@ void UITabWidget::onPaddingChange() { } void UITabWidget::applyThemeToTabs() { - if ( mStyleConfig.SpecialBorderTabs ) { + if ( mStyleConfig.TabsEdgesDiffSkins ) { for ( Uint32 i = 0; i < mTabs.size(); i++ ) { mTabs[i]->applyDefaultTheme(); } diff --git a/src/eepp/ui/uitextureregion.cpp b/src/eepp/ui/uitextureregion.cpp index 1f049f41d..47998cfd9 100644 --- a/src/eepp/ui/uitextureregion.cpp +++ b/src/eepp/ui/uitextureregion.cpp @@ -234,9 +234,14 @@ bool UITextureRegion::applyProperty( const StyleSheetProperty& attribute ) { switch ( attribute.getPropertyDefinition()->getPropertyId() ) { case PropertyId::Src: { Drawable* res = NULL; + std::string name( attribute.asString() ); - if ( NULL != ( res = TextureAtlasManager::instance()->getTextureRegionByName( - attribute.asString() ) ) && + if ( String::startsWith( name, "@textureregion/" ) ) { + name = name.substr( 12 ); + } + + if ( NULL != + ( res = TextureAtlasManager::instance()->getTextureRegionByName( name ) ) && res->getDrawableType() == Drawable::TEXTUREREGION ) { setTextureRegion( static_cast( res ) ); } diff --git a/src/eepp/ui/uitextview.cpp b/src/eepp/ui/uitextview.cpp index 8fe9ff686..fc4e10fd9 100644 --- a/src/eepp/ui/uitextview.cpp +++ b/src/eepp/ui/uitextview.cpp @@ -607,7 +607,7 @@ bool UITextView::applyProperty( const StyleSheetProperty& attribute ) { case PropertyId::ShadowColor: setFontShadowColor( attribute.asColor() ); break; - case PropertyId::SelectedColor: + case PropertyId::SelectionColor: mFontStyleConfig.FontSelectedColor = attribute.asColor(); break; case PropertyId::SelectionBackColor: @@ -644,7 +644,7 @@ bool UITextView::applyProperty( const StyleSheetProperty& attribute ) { autoShrink(); break; case PropertyId::TextStrokeWidth: - setOutlineThickness( PixelDensity::dpToPx( attribute.asDpDimension() ) ); + setOutlineThickness( lengthFromValue( attribute ) ); break; case PropertyId::TextStrokeColor: setOutlineColor( attribute.asColor() ); @@ -681,7 +681,7 @@ std::string UITextView::getPropertyString( const PropertyDefinition* propertyDef return getFontColor().toHexString(); case PropertyId::ShadowColor: return getFontShadowColor().toHexString(); - case PropertyId::SelectedColor: + case PropertyId::SelectionColor: return mFontStyleConfig.FontSelectedColor.toHexString(); case PropertyId::SelectionBackColor: return getSelectionBackColor().toHexString(); diff --git a/src/eepp/ui/uitouchdragablewidget.cpp b/src/eepp/ui/uitouchdraggablewidget.cpp similarity index 72% rename from src/eepp/ui/uitouchdragablewidget.cpp rename to src/eepp/ui/uitouchdraggablewidget.cpp index 2326961de..d43b86695 100644 --- a/src/eepp/ui/uitouchdragablewidget.cpp +++ b/src/eepp/ui/uitouchdraggablewidget.cpp @@ -1,68 +1,68 @@ #include #include -#include +#include namespace EE { namespace UI { -UITouchDragableWidget* UITouchDragableWidget::New() { - return eeNew( UITouchDragableWidget, () ); +UITouchDraggableWidget* UITouchDraggableWidget::New() { + return eeNew( UITouchDraggableWidget, () ); } -UITouchDragableWidget::UITouchDragableWidget( const std::string& tag ) : +UITouchDraggableWidget::UITouchDraggableWidget( const std::string& tag ) : UIWidget( tag ), mTouchDragDeceleration( 5.f, 5.f ) { subscribeScheduledUpdate(); } -UITouchDragableWidget::UITouchDragableWidget() : UITouchDragableWidget( "touchdragable" ) {} +UITouchDraggableWidget::UITouchDraggableWidget() : UITouchDraggableWidget( "touchdraggable" ) {} -UITouchDragableWidget::~UITouchDragableWidget() { +UITouchDraggableWidget::~UITouchDraggableWidget() { if ( NULL != getEventDispatcher() && isTouchDragging() ) getEventDispatcher()->setNodeDragging( NULL ); } -Uint32 UITouchDragableWidget::getType() const { - return UI_TYPE_TOUCH_DRAGABLE_WIDGET; +Uint32 UITouchDraggableWidget::getType() const { + return UI_TYPE_TOUCH_DRAGGABLE_WIDGET; } -bool UITouchDragableWidget::isType( const Uint32& type ) const { - return UITouchDragableWidget::getType() == type ? true : UIWidget::isType( type ); +bool UITouchDraggableWidget::isType( const Uint32& type ) const { + return UITouchDraggableWidget::getType() == type ? true : UIWidget::isType( type ); } -bool UITouchDragableWidget::isTouchDragEnabled() const { +bool UITouchDraggableWidget::isTouchDragEnabled() const { return 0 != ( mFlags & UI_TOUCH_DRAG_ENABLED ); } -UITouchDragableWidget* UITouchDragableWidget::setTouchDragEnabled( const bool& enable ) { +UITouchDraggableWidget* UITouchDraggableWidget::setTouchDragEnabled( const bool& enable ) { writeFlag( UI_TOUCH_DRAG_ENABLED, true == enable ); return this; } -bool UITouchDragableWidget::isTouchDragging() const { +bool UITouchDraggableWidget::isTouchDragging() const { return 0 != ( mNodeFlags & NODE_FLAG_TOUCH_DRAGGING ); } -UITouchDragableWidget* UITouchDragableWidget::setTouchDragging( const bool& dragging ) { +UITouchDraggableWidget* UITouchDraggableWidget::setTouchDragging( const bool& dragging ) { writeNodeFlag( NODE_FLAG_TOUCH_DRAGGING, true == dragging ); return this; } -Vector2f UITouchDragableWidget::getTouchDragDeceleration() const { +Vector2f UITouchDraggableWidget::getTouchDragDeceleration() const { return mTouchDragDeceleration; } -UITouchDragableWidget* -UITouchDragableWidget::setTouchDragDeceleration( const Vector2f& touchDragDeceleration ) { +UITouchDraggableWidget* +UITouchDraggableWidget::setTouchDragDeceleration( const Vector2f& touchDragDeceleration ) { mTouchDragDeceleration = touchDragDeceleration; return this; } -void UITouchDragableWidget::onTouchDragValueChange( Vector2f ) {} +void UITouchDraggableWidget::onTouchDragValueChange( Vector2f ) {} -bool UITouchDragableWidget::isTouchOverAllowedChilds() { +bool UITouchDraggableWidget::isTouchOverAllowedChilds() { return isMouseOverMeOrChilds(); } -void UITouchDragableWidget::scheduledUpdate( const Time& time ) { +void UITouchDraggableWidget::scheduledUpdate( const Time& time ) { if ( mEnabled && mVisible && NULL != getEventDispatcher() ) { if ( isTouchDragEnabled() ) { EventDispatcher* eventDispatcher = getEventDispatcher(); @@ -145,8 +145,8 @@ void UITouchDragableWidget::scheduledUpdate( const Time& time ) { } } -std::string UITouchDragableWidget::getPropertyString( const PropertyDefinition* propertyDef, - const Uint32& propertyIndex ) { +std::string UITouchDraggableWidget::getPropertyString( const PropertyDefinition* propertyDef, + const Uint32& propertyIndex ) { if ( NULL == propertyDef ) return ""; @@ -161,7 +161,7 @@ std::string UITouchDragableWidget::getPropertyString( const PropertyDefinition* } } -bool UITouchDragableWidget::applyProperty( const StyleSheetProperty& attribute ) { +bool UITouchDraggableWidget::applyProperty( const StyleSheetProperty& attribute ) { if ( !checkPropertyDefinition( attribute ) ) return false; diff --git a/src/eepp/ui/uiwidgetcreator.cpp b/src/eepp/ui/uiwidgetcreator.cpp index f20b9ee55..279ea7ae8 100644 --- a/src/eepp/ui/uiwidgetcreator.cpp +++ b/src/eepp/ui/uiwidgetcreator.cpp @@ -25,11 +25,11 @@ #include #include #include -#include +#include +#include #include #include #include -#include namespace EE { namespace UI { @@ -72,7 +72,7 @@ void UIWidgetCreator::createBaseWidgetList() { registeredWidget["window"] = UIWindow::New; registeredWidget["scrollview"] = UIScrollView::New; registeredWidget["textureregion"] = UITextureRegion::New; - registeredWidget["touchdragable"] = UITouchDragableWidget::New; + registeredWidget["touchdraggable"] = UITouchDraggableWidget::New; registeredWidget["gridlayout"] = UIGridLayout::New; registeredWidget["layout"] = UILayout::New; registeredWidget["viewpager"] = UIViewPager::New;