cocos2d - X 노드 (LayoutParameter. h) API

본문http://blog.csdn.net/runaying ,인용 은 출처 를 밝 혀 야 합 니 다!
cocos2d - X 노드 (LayoutParameter. h) API
따뜻 한 알림: 여러분 이 더 잘 공부 할 수 있 도록 본인 의 블 로 그 를 보 는 것 을 강력 추천 합 니 다. Cocos2d - X 권위 있 는 안내서 노트
일부 레이아웃 매개 변수, 상대 레이아웃 매개 변수, 선형 레이아웃 매개 변수
///cocos2d-x-3.0alpha0/extensions/CocoStudio/GUI/Layouts
//       ,      ,      


#ifndef __LAYOUTPARMETER_H__
#define __LAYOUTPARMETER_H__

#include "UILayoutDefine.h"

NS_CC_EXT_BEGIN

typedef enum
{
    LAYOUT_PARAMETER_NONE,
    LAYOUT_PARAMETER_LINEAR,
    LAYOUT_PARAMETER_RELATIVE
}LayoutParameterType;

class LayoutParameter : public Object
{
public:
    /**
     * Default constructor
     */
    LayoutParameter() : _margin(UIMargin()){_layoutParameterType = LAYOUT_PARAMETER_NONE;};
    
    /**
     * Default destructor
     */
    virtual ~LayoutParameter(){};
    
    /**
     * Allocates and initializes.
     * @return                 LayoutParameter
     */
    static LayoutParameter* create();
    
    /**
     *   LayoutParameter    margin (  )  .
     *
     * @see UIMargin
     *
     * @param margin
     */
    void setMargin(const UIMargin& margin);
    const UIMargin& getMargin() const;
    
    /**
     * Gets LayoutParameterType of LayoutParameter.
     *
     * @see LayoutParameterType
     *
     * @return LayoutParameterType
     */
    LayoutParameterType getLayoutType() const;
protected:
    UIMargin _margin;
    LayoutParameterType _layoutParameterType;
};

class LinearLayoutParameter : public LayoutParameter
{
public:
    /**
     * Default constructor
     */
    LinearLayoutParameter() : m_eLinearGravity(LINEAR_GRAVITY_NONE){_layoutParameterType = LAYOUT_PARAMETER_LINEAR;};
    
    /**
     * Default destructor
     */
    virtual ~LinearLayoutParameter(){};
    
    /**
     *       .
     * @return A initialized LayoutParameter which is marked as "autorelease".
     */
    static LinearLayoutParameter* create();
    
    /**
     * Sets UILinearGravity parameter for LayoutParameter.
     *
     * @see UILinearGravity
     *
     * @param UILinearGravity
     */
    void setGravity(UILinearGravity gravity);
    UILinearGravity getGravity() const;
protected:
    UILinearGravity m_eLinearGravity;
};

class RelativeLayoutParameter : public LayoutParameter
{
public:
    /**
     * Default constructor
     */
    RelativeLayoutParameter() : m_eRelativeAlign(RELATIVE_ALIGN_NONE),m_strRelativeWidgetName(""),m_strRelativeLayoutName(""){_layoutParameterType = LAYOUT_PARAMETER_RELATIVE;};
    
    /**
     * Default destructor
     */
    virtual ~RelativeLayoutParameter(){};
    
    /**
     *       .
     * @return A initialized LayoutParameter which is marked as "autorelease".
     */
    static RelativeLayoutParameter* create();
    
    /**
     * Sets UIRelativeAlign parameter for LayoutParameter.
     *
     * @see UIRelativeAlign
     *
     * @param UIRelativeAlign
     */
    void setAlign(UIRelativeAlign align);
    
    /**
     * Gets UIRelativeAlign parameter for LayoutParameter.
     *
     * @see UIRelativeAlign
     *
     * @return UIRelativeAlign
     */
    UIRelativeAlign getAlign() const;
    
    /**
     *   LayoutParameter     key.      widget named
     *
     * @param name
     */
    void setRelativeToWidgetName(const char* name);
    const char* getRelativeToWidgetName() const;
    
    /**
     * Sets LayoutParameter        。
     *
     * @param name
     */
    void setRelativeName(const char* name);
    
    /**
     *   LayoutParameter        。
     *
     * @return name
     */
    const char* getRelativeName() const;
protected:
    UIRelativeAlign m_eRelativeAlign;
    std::string m_strRelativeWidgetName;
    std::string m_strRelativeLayoutName;
};

NS_CC_EXT_END

#endif /* defined(__LayoutParameter__) */

좋은 웹페이지 즐겨찾기