axmol/cocos/ui/UILayout.h

667 lines
20 KiB
C
Raw Normal View History

2019-11-23 20:27:39 +08:00
/****************************************************************************
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
2021-08-31 15:50:18 +08:00
Copyright (c) Bytedance Inc.
2019-11-23 20:27:39 +08:00
2021-08-31 15:50:18 +08:00
https://adxe.org
2019-11-23 20:27:39 +08:00
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __LAYOUT_H__
#define __LAYOUT_H__
#include "ui/UIWidget.h"
#include "ui/GUIExport.h"
#include "renderer/CCCustomCommand.h"
#include "renderer/CCGroupCommand.h"
#include "renderer/CCCallbackCommand.h"
/**
* @addtogroup ui
* @{
*/
NS_CC_BEGIN
class DrawNode;
class LayerColor;
class LayerGradient;
class StencilStateManager;
struct CC_DLL ResourceData;
2021-12-25 10:04:45 +08:00
namespace ui
{
2019-11-23 20:27:39 +08:00
class LayoutManager;
class Scale9Sprite;
/**
*@brief Layout interface for creating LayoutManger and do actual layout.
* @js NA
*/
class CC_GUI_DLL LayoutProtocol
{
public:
/**
*@brief Default constructor.
*/
2021-12-25 10:04:45 +08:00
LayoutProtocol() {}
2019-11-23 20:27:39 +08:00
/**
*@brief Default destructor.
*/
2021-12-25 10:04:45 +08:00
virtual ~LayoutProtocol() {}
2019-11-23 20:27:39 +08:00
/**
* @brief Create a custom layout manager.
*
* @return A LayoutManager descendants instance.
*/
virtual LayoutManager* createLayoutManager() = 0;
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* @brief Return the content size of layout.
*
2021-10-23 23:27:14 +08:00
* @return A content size in Vec2.
2019-11-23 20:27:39 +08:00
*/
2021-12-25 10:04:45 +08:00
virtual Vec2 getLayoutContentSize() const = 0;
2019-11-23 20:27:39 +08:00
/**
* @brief Get all elements of the layout.
*
* @return A vector of Node pointers.
*/
2021-12-25 10:04:45 +08:00
virtual const Vector<Node*>& getLayoutElements() const = 0;
2019-11-23 20:27:39 +08:00
/**
* @brief The main function to do the layout job.
* Different layout manager should implement its own layout algorithm.
*
*/
virtual void doLayout() = 0;
};
/**
2021-12-25 10:04:45 +08:00
*@brief A container for holding a few child widgets.
2019-11-23 20:27:39 +08:00
*
2021-12-25 10:04:45 +08:00
* The child widgets could be rearranged according to the layout type and it also enables clipping, set background image
*and color.
2019-11-23 20:27:39 +08:00
*
* There are mainly four types of layout:
* - Absolute layout: This the default layout type, child elements are arranged by their absolute position.
* - Horizontal layout: child elements are arranged horizontally.
* - Vertical layout: child elements are arranged vertically.
* - Relative layout: child elements are arranged relative to certain rules.
*
*/
class CC_GUI_DLL Layout : public Widget, public LayoutProtocol
{
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
DECLARE_CLASS_GUI_INFO
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
public:
/**
* Layout type, default is ABSOLUTE.
*/
enum class Type
{
ABSOLUTE,
VERTICAL,
HORIZONTAL,
2021-08-31 15:50:18 +08:00
RELATIVE,
CENTER_VERTICAL,
2019-11-23 20:27:39 +08:00
};
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Clipping Type, default is STENCIL.
*/
enum class ClippingType
{
STENCIL,
SCISSOR
};
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Background color type, default is NONE.
*/
enum class BackGroundColorType
{
NONE,
SOLID,
GRADIENT
};
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Default constructor
* @js ctor
* @lua new
*/
Layout();
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Default destructor
* @js NA
* @lua NA
*/
virtual ~Layout();
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Create a empty layout.
*/
static Layout* create();
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Sets a background image for layout.
*
* @param fileName image file path.
2021-12-25 10:04:45 +08:00
* @param texType @see TextureResType.
2019-11-23 20:27:39 +08:00
*/
2021-12-25 10:04:45 +08:00
void setBackGroundImage(const std::string& fileName, TextureResType texType = TextureResType::LOCAL);
2019-11-23 20:27:39 +08:00
/**
* Sets a background image capinsets for layout, it only affects the scale9 enabled background image
*
* @param capInsets The capInsets in Rect.
*
*/
void setBackGroundImageCapInsets(const Rect& capInsets);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Query background image's capInsets size.
*@return The background image capInsets.
*/
2021-12-25 10:04:45 +08:00
const Rect& getBackGroundImageCapInsets() const;
2019-11-23 20:27:39 +08:00
/**
* Sets Color Type for layout's background
*
* @param type @see `BackGroundColorType`
*/
void setBackGroundColorType(BackGroundColorType type);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Query the layout's background color type.
*@return The layout's background color type.
*/
2021-12-25 10:04:45 +08:00
BackGroundColorType getBackGroundColorType() const;
2019-11-23 20:27:39 +08:00
/**
* Enable background image scale9 rendering.
*
* @param enabled True means enable scale9 rendering for background image, false otherwise.
*/
void setBackGroundImageScale9Enabled(bool enabled);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Query background image scale9 enable status.
*@return Whether background image is scale9 enabled or not.
*/
2021-12-25 10:04:45 +08:00
bool isBackGroundImageScale9Enabled() const;
2019-11-23 20:27:39 +08:00
/**
* Set background color for layout
* The color only applies to layout when it's color type is BackGroundColorType::SOLIDE
*
* @param color Color in Color3B.
*/
2021-12-25 10:04:45 +08:00
void setBackGroundColor(const Color3B& color);
2019-11-23 20:27:39 +08:00
/**
* Query the layout's background color.
*@return Background color in Color3B.
*/
2021-12-25 10:04:45 +08:00
const Color3B& getBackGroundColor() const;
2019-11-23 20:27:39 +08:00
/**
* Set start and end background color for layout.
* This setting only take effect when the layout's color type is BackGroundColorType::GRADIENT
*
* @param startColor Color value in Color3B.
* @param endColor Color value in Color3B.
*/
2021-12-25 10:04:45 +08:00
void setBackGroundColor(const Color3B& startColor, const Color3B& endColor);
2019-11-23 20:27:39 +08:00
/**
* Get the gradient background start color.
*@return Gradient background start color value.
*/
2021-12-25 10:04:45 +08:00
const Color3B& getBackGroundStartColor() const;
2019-11-23 20:27:39 +08:00
/**
* Get the gradient background end color.
* @return Gradient background end color value.
*/
2021-12-25 10:04:45 +08:00
const Color3B& getBackGroundEndColor() const;
2019-11-23 20:27:39 +08:00
/**
* Sets background color opacity of layout.
*
* @param opacity The opacity in `GLubyte`.
*/
void setBackGroundColorOpacity(uint8_t opacity);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Get the layout's background color opacity.
*@return Background color opacity value.
*/
2021-12-25 10:04:45 +08:00
uint8_t getBackGroundColorOpacity() const;
2019-11-23 20:27:39 +08:00
/**
* Sets background color vector for layout.
* This setting only take effect when layout's color type is BackGroundColorType::GRADIENT
*
* @param vector The color vector in `Vec2`.
*/
2021-12-25 10:04:45 +08:00
void setBackGroundColorVector(const Vec2& vector);
2019-11-23 20:27:39 +08:00
/**
* Get the layout's background color vector.
*@return Background color vector.
*/
2021-12-25 10:04:45 +08:00
const Vec2& getBackGroundColorVector() const;
2019-11-23 20:27:39 +08:00
/**
* Set layout's background image color.
*@param color Background color value in `Color3B`.
*/
void setBackGroundImageColor(const Color3B& color);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Set opacity of background image.
*@param opacity Background image opacity in GLubyte.
*/
void setBackGroundImageOpacity(uint8_t opacity);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Get color of layout's background image.
*@return Layout's background image color.
*/
2021-12-25 10:04:45 +08:00
const Color3B& getBackGroundImageColor() const;
2019-11-23 20:27:39 +08:00
/**
* Get the opacity of layout's background image.
* @return The opacity of layout's background image.
*/
2021-12-25 10:04:45 +08:00
uint8_t getBackGroundImageOpacity() const;
2019-11-23 20:27:39 +08:00
/**
* Remove the background image of layout.
*/
void removeBackGroundImage();
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Gets background image texture size.
*
* @return background image texture size.
*/
2021-10-23 23:27:14 +08:00
const Vec2& getBackGroundImageTextureSize() const;
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Toggle layout clipping.
*
* If you do need clipping, you pass true to this function.
*
* @param enabled Pass true to enable clipping, false otherwise.
*/
virtual void setClippingEnabled(bool enabled);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Change the clipping type of layout.
* On default, the clipping type is `ClippingType::STENCIL`.
* @see `ClippingType`
*@param type The clipping type of layout.
*/
void setClippingType(ClippingType type);
/**
*
* @see `setClippingType(ClippingType)`
*/
2021-12-25 10:04:45 +08:00
ClippingType getClippingType() const;
2019-11-23 20:27:39 +08:00
/**
* Gets if layout is clipping enabled.
*
* @return if layout is clipping enabled.
*/
2021-12-25 10:04:45 +08:00
virtual bool isClippingEnabled() const;
2019-11-23 20:27:39 +08:00
/**
* Returns the "class name" of widget.
*/
virtual std::string getDescription() const override;
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Change the layout type.
*@param type Layout type.
*/
virtual void setLayoutType(Type type);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Query layout type.
*@return Get the layout type.
*/
2021-12-25 10:04:45 +08:00
virtual Type getLayoutType() const;
2019-11-23 20:27:39 +08:00
2021-12-25 10:04:45 +08:00
virtual void addChild(Node* child) override;
virtual void addChild(Node* child, int localZOrder) override;
2019-11-23 20:27:39 +08:00
/**
* Adds a child to the container with z order and tag
*
2021-12-25 10:04:45 +08:00
* If the child is added to a 'running' node, then 'onEnter' and 'onEnterTransitionDidFinish' will be called
* immediately.
2019-11-23 20:27:39 +08:00
*
* @param child A child node
* @param localZOrder Z order for drawing priority. Please refer to setLocalZOrder(int)
* @param tag A integer to identify the node easily. Please refer to setTag(int)
*/
virtual void addChild(Node* child, int localZOrder, int tag) override;
2021-12-25 10:04:45 +08:00
virtual void addChild(Node* child, int localZOrder, const std::string& name) override;
virtual void visit(Renderer* renderer, const Mat4& parentTransform, uint32_t parentFlags) override;
2019-11-23 20:27:39 +08:00
virtual void removeChild(Node* child, bool cleanup = true) override;
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* Removes all children from the container with a cleanup.
*
* @see `removeAllChildrenWithCleanup(bool)`
*/
virtual void removeAllChildren() override;
/**
2021-12-25 10:04:45 +08:00
* Removes all children from the container, and do a cleanup to all running actions depending on the cleanup
* parameter.
2019-11-23 20:27:39 +08:00
*
* @param cleanup true if all running actions on all children nodes should be cleanup, false otherwise.
* @js removeAllChildren
* @lua removeAllChildren
*/
virtual void removeAllChildrenWithCleanup(bool cleanup) override;
/**
* force refresh widget layout
*/
virtual void forceDoLayout();
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* request to refresh widget layout
*/
virtual void requestDoLayout();
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* @lua NA
*/
virtual void onEnter() override;
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* @lua NA
*/
virtual void onExit() override;
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
virtual void setGlobalZOrder(float globalZOrder) override;
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* If a layout is loop focused which means that the focus movement will be inside the layout
*@param loop pass true to let the focus movement loop inside the layout
*/
void setLoopFocus(bool loop);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
2021-12-25 10:04:45 +08:00
*@return If focus loop is enabled, then it will return true, otherwise it returns false. The default value is
*false.
2019-11-23 20:27:39 +08:00
*/
2021-12-25 10:04:45 +08:00
bool isLoopFocus() const;
2019-11-23 20:27:39 +08:00
/**
*@param pass To specify whether the layout pass its focus to its child
*/
void setPassFocusToChild(bool pass);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* @return To query whether the layout will pass the focus to its children or not. The default value is true
*/
2021-12-25 10:04:45 +08:00
bool isPassFocusToChild() const;
2019-11-23 20:27:39 +08:00
/**
2021-12-25 10:04:45 +08:00
* When a widget is in a layout, you could call this method to get the next focused widget within a specified
*direction. If the widget is not in a layout, it will return itself
2019-11-23 20:27:39 +08:00
*@param direction the direction to look for the next focused widget in a layout
*@param current the current focused widget
*@return the next focused widget in a layout
*/
virtual Widget* findNextFocusedWidget(FocusDirection direction, Widget* current) override;
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* To specify a user-defined functor to decide which child widget of the layout should get focused
* @param FocusDirection the finding direction
* @param this previous focused widget
* @return return the index of widget in the layout
*/
std::function<int(FocusDirection, Widget*)> onPassFocusToChild;
2021-12-25 10:04:45 +08:00
/**
* Override function. Set camera mask, the node is visible by the camera whose camera flag & node's camera mask is
* true.
2019-11-23 20:27:39 +08:00
* @param mask Mask being set
* @param applyChildren If true call this function recursively from this node to its children.
*/
virtual void setCameraMask(unsigned short mask, bool applyChildren = true) override;
ResourceData getRenderFile();
2021-12-25 10:04:45 +08:00
CC_CONSTRUCTOR_ACCESS :
// override "init" method of widget.
virtual bool
init() override;
2019-11-23 20:27:39 +08:00
protected:
2021-12-25 10:04:45 +08:00
// override "onSizeChanged" method of widget.
2019-11-23 20:27:39 +08:00
virtual void onSizeChanged() override;
2021-12-25 10:04:45 +08:00
// init background image renderer.
2019-11-23 20:27:39 +08:00
void addBackGroundImage();
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
void supplyTheLayoutParameterLackToChild(Widget* child);
virtual Widget* createCloneInstance() override;
virtual void copySpecialProperties(Widget* model) override;
virtual void copyClonedWidgetChildren(Widget* model) override;
2021-12-25 10:04:45 +08:00
void stencilClippingVisit(Renderer* renderer, const Mat4& parentTransform, uint32_t parentFlags);
void scissorClippingVisit(Renderer* renderer, const Mat4& parentTransform, uint32_t parentFlags);
2021-10-23 23:27:14 +08:00
void setStencilClippingSize(const Vec2& size);
2019-11-23 20:27:39 +08:00
const Rect& getClippingRect();
2021-12-25 10:04:45 +08:00
virtual void doLayout() override;
virtual LayoutManager* createLayoutManager() override;
virtual Vec2 getLayoutContentSize() const override;
virtual const Vector<Node*>& getLayoutElements() const override;
// clipping
2019-11-23 20:27:39 +08:00
void onBeforeVisitScissor();
void onAfterVisitScissor();
void updateBackGroundImageColor();
void updateBackGroundImageOpacity();
void updateBackGroundImageRGBA();
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
*get the content size of the layout, it will accumulate all its children's content size
*/
2021-10-23 23:27:14 +08:00
Vec2 getLayoutAccumulatedSize() const;
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
2021-12-25 10:04:45 +08:00
* When the layout get focused, it the layout pass the focus to its child, it will use this method to determine
*which child will get the focus. The current algorithm to determine which child will get focus is
*nearest-distance-priority algorithm
2019-11-23 20:27:39 +08:00
*@param direction The next focused widget direction
*@return The index of child widget in the container
*/
2021-12-25 10:04:45 +08:00
int findNearestChildWidgetIndex(FocusDirection direction, Widget* baseWidget);
2019-11-23 20:27:39 +08:00
/**
2021-12-25 10:04:45 +08:00
* When the layout get focused, it the layout pass the focus to its child, it will use this method to determine
*which child will get the focus. The current algorithm to determine which child will get focus is
*farthest-distance-priority algorithm
2019-11-23 20:27:39 +08:00
*@param direction The next focused widget direction
*@return The index of child widget in the container
*/
int findFarthestChildWidgetIndex(FocusDirection direction, Widget* baseWidget);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* calculate the nearest distance between the baseWidget and the children of the layout
*@param the base widget which will be used to calculate the distance between the layout's children and itself
*@return return the nearest distance between the baseWidget and the layout's children
*/
float calculateNearestDistance(Widget* baseWidget);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* calculate the farthest distance between the baseWidget and the children of the layout
*@param the base widget which will be used to calculate the distance between the layout's children and itself
*@return return the farthest distance between the baseWidget and the layout's children
*/
float calculateFarthestDistance(Widget* baseWidget);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
2021-12-25 10:04:45 +08:00
* when a layout pass the focus to it's child, use this method to determine which algorithm to use, nearest or
* farthest distance algorithm or not
2019-11-23 20:27:39 +08:00
*/
void findProperSearchingFunctor(FocusDirection dir, Widget* baseWidget);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* find the first non-layout widget in this layout
*/
2021-12-25 10:04:45 +08:00
Widget* findFirstNonLayoutWidget();
2019-11-23 20:27:39 +08:00
/**
* find the first focus enabled widget index in the layout, it will recursive searching the child widget
*/
int findFirstFocusEnabledWidgetIndex();
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* find a focus enabled child Widget in the layout by index
*/
Widget* findFocusEnabledChildWidgetByIndex(ssize_t index);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* get the center point of a widget in world space
*/
2021-12-25 10:04:45 +08:00
Vec2 getWorldCenterPoint(Widget* node) const;
2019-11-23 20:27:39 +08:00
/**
2021-12-25 10:04:45 +08:00
* this method is called internally by nextFocusedWidget. When the dir is Right/Down, then this method will be
*called
2019-11-23 20:27:39 +08:00
*@param direction the direction.
*@param current the current focused widget
*@return the next focused widget
*/
2021-12-25 10:04:45 +08:00
Widget* getNextFocusedWidget(FocusDirection direction, Widget* current);
2019-11-23 20:27:39 +08:00
/**
* this method is called internally by nextFocusedWidget. When the dir is Left/Up, then this method will be called
*@param direction the direction.
*@param current the current focused widget
*@return the next focused widget
*/
2021-12-25 10:04:45 +08:00
Widget* getPreviousFocusedWidget(FocusDirection direction, Widget* current);
2019-11-23 20:27:39 +08:00
/**
* find the nth element in the _children array. Only the Widget descendant object will be returned
*@param index The index of a element in the _children array
*/
2021-12-25 10:04:45 +08:00
Widget* getChildWidgetByIndex(ssize_t index) const;
2019-11-23 20:27:39 +08:00
/**
* whether it is the last element according to all their parents
*/
2021-12-25 10:04:45 +08:00
bool isLastWidgetInContainer(Widget* widget, FocusDirection direction) const;
2019-11-23 20:27:39 +08:00
/**Lookup any parent widget with a layout type as the direction,
* if the layout is loop focused, then return true, otherwise
* It returns false
*/
2021-12-25 10:04:45 +08:00
bool isWidgetAncestorSupportLoopFocus(Widget* widget, FocusDirection direction) const;
2019-11-23 20:27:39 +08:00
/**
* pass the focus to the layout's next focus enabled child
*/
Widget* passFocusToChild(FocusDirection direction, Widget* current);
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
/**
* If there are no focus enabled child in the layout, it will return false, otherwise it returns true
*/
2021-12-25 10:04:45 +08:00
bool checkFocusEnabledChild() const;
2019-11-23 20:27:39 +08:00
protected:
2021-12-25 10:04:45 +08:00
// background
2019-11-23 20:27:39 +08:00
bool _backGroundScale9Enabled;
Scale9Sprite* _backGroundImage;
std::string _backGroundImageFileName;
Rect _backGroundImageCapInsets;
BackGroundColorType _colorType;
TextureResType _bgImageTexType;
2021-10-23 23:27:14 +08:00
Vec2 _backGroundImageTextureSize;
2019-11-23 20:27:39 +08:00
Color3B _backGroundImageColor;
uint8_t _backGroundImageOpacity;
LayerColor* _colorRender;
LayerGradient* _gradientRender;
Color3B _cColor;
Color3B _gStartColor;
Color3B _gEndColor;
Vec2 _alongVector;
uint8_t _cOpacity;
2021-12-25 10:04:45 +08:00
// clipping
2019-11-23 20:27:39 +08:00
bool _clippingEnabled;
Type _layoutType;
ClippingType _clippingType;
DrawNode* _clippingStencil;
bool _scissorOldState;
Rect _clippingOldRect;
Rect _clippingRect;
Layout* _clippingParent;
bool _clippingRectDirty;
2021-12-25 10:04:45 +08:00
// clipping
StencilStateManager* _stencilStateManager;
2019-11-23 20:27:39 +08:00
GroupCommand _groupCommand;
CallbackCommand _beforeVisitCmdStencil;
CallbackCommand _afterDrawStencilCmd;
CallbackCommand _afterVisitCmdStencil;
CallbackCommand _beforeVisitCmdScissor;
CallbackCommand _afterVisitCmdScissor;
2021-12-25 10:04:45 +08:00
2019-11-23 20:27:39 +08:00
bool _doLayoutDirty;
bool _isInterceptTouch;
2021-12-25 10:04:45 +08:00
// whether enable loop focus or not
2019-11-23 20:27:39 +08:00
bool _loopFocus;
2021-12-25 10:04:45 +08:00
// on default, it will pass the focus to the next nearest widget
2019-11-23 20:27:39 +08:00
bool _passFocusToChild;
2021-12-25 10:04:45 +08:00
// when finding the next focused widget, use this variable to pass focus between layout & widget
2019-11-23 20:27:39 +08:00
bool _isFocusPassing;
};
2021-12-25 10:04:45 +08:00
} // namespace ui
2019-11-23 20:27:39 +08:00
NS_CC_END
// end of ui group
/// @}
#endif /* defined(__Layout__) */