Cocostudio:button Three state transitions

Source: Internet
Author: User

When we use the Cocostudio tool, there are three states for Button control buttons, and we can set different pictures for three states individually. The method is then displayed in the program as a different state.    1. Initial state: normal state bool Widget::init () {if (Ccnode::init ()) {setbright (true); } return false;} 2,/*button Switch to disable state (forbidden State), _bright default is True, you can call Setbright (false) To switch button to disable state.    */void widget::setbright (bool bright) {_bright = bright;        if (_bright) {_brightstyle = Bright_none;    Setbrightstyle (Bright_normal);    } else {onpressstatechangedtodisabled ();    }}3 、--Switch to the pressed state, i.e. press the status void widget::setfocused (bool fucos) {if (Fucos = = _focus) {return;    } _focus = Fucos; if (_bright)//default is True {if (_focus) {///If True, Setbrightstyle function is called, Final call//onpressstatechangedtop            The ressed method switches to the pressed state.        Setbrightstyle (Bright_highlight);        } else {Setbrightstyle (bright_normal);    }} else {///if _bright is false, switch directly to the disabled state onpressstatechangedtodisabled (); }}void Widget::seTbrightstyle (Brightstyle style) {if (_brightstyle = = style) {return;    } _brightstyle = style;            Switch (_brightstyle) {case bright_normal:onpressstatechangedtonormal ();        Break            Case bright_highlight:onpressstatechangedtopressed ();        Break    Default:break; }}

Cocostudio:button Three state transitions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.