GithubHelp home page GithubHelp logo

Comments (7)

fruxo avatar fruxo commented on May 26, 2024

This should work today i think:
Give the TBTabContainer some special skin name, f.ex skin: "duck", "badger" for every new style.
Then in "TBTabContainer.rootlayout", "TBTabContainer.tablayout_x/y", "TBTabContainer.container" and "TBTabContainer.tab" you can use override (or strong-override) with a condition for ancestors with skin name "duck" or "badger" to specify the different versions. It would probably quickly get quite messy (and less efficient) if you have a lot of different visuals though.

Other possible solutions:
You can use the skin attribute under the "tabs" section (or any other attribute) and it will apply to the tabs layout. Adding the same possibility for "container" and "root" would be super simple and allow the skin attribute on those too.

A bug: I noticed TBTabLayout::OnChildAdded always override the skin for TBButton, so any attempt to set the skin attibute directly on a specific tab will currently fail.

from turbobadger.

swap15 avatar swap15 commented on May 26, 2024

Could you write a little example of skin for additional skin, please. For example I want to change background of layout and backgrounds of tab buttons.
Thank you!

from turbobadger.

fruxo avatar fruxo commented on May 26, 2024

In your ui resource:

TBTabContainer: skin: "duck"

In your skin override (assuming you override the default skin):

TBTabContainer.tab_top
    strong-overrides
        element TBTabContainer.ducky_tab
            condition: target: ancestors, property: skin, value: duck
TBTabContainer.ducky_tab
    padding 10
    overrides
        element TBTabContainer.ducky_tab.pressed
            state pressed
TBTabContainer.ducky_tab.pressed
    padding 10
    background-color #fd0

This will add the strong-override section to the default "TBTabContainer.tab_top" skin so the TBTabContainer.ducky_tab skin will be used instead if any ancestor has skin "duck", which the TBTabContainer has.

There's some limitations for what you can change in an override skin, since they can only add to the override/strong-override/child/overlay lists (and not replace in them). So some things requires changing the base skin.

from turbobadger.

fruxo avatar fruxo commented on May 26, 2024

The example won't look pretty, but at least it shows how conditions can be used :)

from turbobadger.

swap15 avatar swap15 commented on May 26, 2024

It working! Thank you!

from turbobadger.

fruxo avatar fruxo commented on May 26, 2024

Great!
And now it's also possible to use the skin attribute on "content" and "root".

from turbobadger.

swap15 avatar swap15 commented on May 26, 2024

Cool! Thanks! :)

from turbobadger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.