ianharrigan / haxeui

IMPORTANT NOTE! This repository is no longer maintained. Please consider the newer version: https://github.com/haxeui/haxeui-core
http://haxeui.org/
392 stars 46 forks source link

height/width of button icon #287

Closed sebthom closed 9 years ago

sebthom commented 9 years ago

Please add an option that allows the specification of the height/width properties for the button icon in XML.

E.g.

<button icon="assets/ok.png" iconHeight="40" iconWidth="40" iconPosition="center" />

Or something like:

<button iconPosition="center">
    <image resource="assets/ok.png" height="40" width="40" />
</button>
ianharrigan commented 9 years ago

Im not at a computer at the moment but i think this can be done with styles, ill get more details when im back on monday.

That said i think you are right though, an explicit xml property seems nicer also. Ill take a look on monday.

Cheers

ianharrigan commented 9 years ago

ok, so there are some new properties in v1.7.20 on haxelib:

These can be used in either xml or css, heres a working example: http://haxeui.org/try.jsp?layoutId=LoXk5Ep

<?xml version="1.0" encoding="utf-8"?>
<vbox id="main" style="padding:5;">
    <scrollview width="400" height="400">
        <hbox>
            <vbox>
                <button text="Test" icon="img/slinky_tiny.jpg" iconWidth="100"/>
                <button text="Test" icon="img/slinky_tiny.jpg" iconHeight="100" />
                <button text="Test" icon="img/slinky_tiny.jpg" iconWidth="50" iconPosition="right" />
                <button text="Test" icon="img/slinky_tiny.jpg" iconHeight="50" iconPosition="top" />
                <button text="Test" icon="img/slinky_tiny.jpg" iconWidth="100" iconHeight="100" />
                <button text="Test" icon="img/slinky_tiny.jpg" iconWidth="50" iconHeight="50" iconPosition="bottom" />
            </vbox>
            <vbox>
                <button text="Test" style="icon:img/slinky_tiny.jpg; iconWidth:100;" />
                <button text="Test" style="icon:img/slinky_tiny.jpg; iconHeight:100;" />
                <button text="Test" style="icon:img/slinky_tiny.jpg; iconWidth:50; iconPosition:right" />
                <button text="Test" style="icon:img/slinky_tiny.jpg; iconHeight:50; iconPosition:top" />
                <button text="Test" style="icon:img/slinky_tiny.jpg; iconWidth:100; iconHeight:100;" />
                <button text="Test" style="icon:img/slinky_tiny.jpg; iconWidth:50; iconHeight:50; iconPosition:bottom" />
            </vbox> 
        </hbox>
    </scrollview>   
</vbox>
sebthom commented 9 years ago

Awesome. Thanks!