dl
dl::UI::Panel类 参考

UI面板 更多...

#include <dl_ui_panel.h>

Public 类型

enum  PickupMode { E_SIZE = 1 << 1 , E_ELEMENT = 1 << 2 , E_CHILD = 1 << 4 }
 
enum  OrderMode { AUTO , CUSTOM , FORCE }
 

Public 成员函数

void AddCpt (Components *cpt)
 添加一个Element
 
template<typename T>
void Add (T *p)
 添加一个Element
 
void Add (Text *p)
 脚本导出使用
 
void Add (std::string_view json_path)
 添加多个Element,通过json文件
 
void AddPanel (Panel *child)
 添加子panel
 
void DelCpt (Components *cpt)
 移除子Element,不删除
 
template<typename T>
void Del (T *p)
 添加一个Element
 
PanelClone ()
 克隆
 
void SetPosPixel (const Position &pos_pixel)
 设置 像素位置
 
void DtPosPixel (const Position &dt)
 
void SetPosScale (const Position &pos_scale)
 设置 比例位置
 
void SetDir (Align::Dir4 dir)
 设置朝向,基于Coor旋转,旋转后仍然定位到左上角
 
void SetAlign (const Align::Direction2 &hv)
 设置 在父节点的对齐
 
void SetLocator (const Locator &loc)
 设置Locator
 
void SetLocator (const Locator::SL &sl)
 
void SetLocator (std::string_view name)
 
void SetAutoCoor (bool auto_coor)
 设置是否自动调整位置
 
void SetAutoRun (bool auto_run)
 设置是否自动执行
 
void SetAutoRender (bool auto_render)
 设置是否自动绘制
 
void SetOrderMode (OrderMode mode)
 设置order模式
 
void SetOrder (float order)
 设置order
 
void SetOrderInParent (int order_parent)
 设置order
 
void RefreshOrder ()
 
void SetName (std::string_view name)
 设置名字
 
void SetSelect (size_t index)
 设置被选中的元素
 
void ElementSetSelect (size_t index, bool select)
 设置元素是否选中
 
void SetSelectAll (bool select)
 设置所有子元素的选中状态
 
void Update ()
 执行逻辑 @node 默认情况会自动调用
 
void Render ()
 执行绘制 @node 默认情况会自动调用
 
void UpdateRadio ()
 执行逻辑Radio @node 手动调用,把子panel作为radio处理
 
bool IsUpdate ()
 执行了Update
 
bool IsRender ()
 执行了Render
 
std::string GetName () const
 返回名字
 
CoorGetCoor ()
 返回坐标系
 
CoorGetCoorRef ()
 
Align::Dir4 GetDir ()
 
PanelGetParent ()
 返回父panel
 
std::vector< Panel * > GetChildAll ()
 返回子panel
 
size_t GetChildNum (bool recursion=false)
 返回子panel数量
 
size_t GetChildIndex (Panel *child)
 返回子panel下标
 
PanelGetChild (size_t i)
 返回子panel
 
PanelGetChildSelect ()
 返回被选中的子panel
 
void SetChildSelect (Panel *panel)
 设置被选中的子panel,可以传空
 
PanelGetChildPickup ()
 返回光标悬停的子panel
 
template<typename T>
std::size_t GetIndex ()
 返回第一个满足条件的组件下标
 
template<typename T>
ComponentsGet ()
 返回第一个满足条件的组件
 
size_t GetClickIndex ()
 返回被点击的元素
 
std::string GetClickName ()
 
size_t GetDownIndex ()
 返回被按下的元素
 
size_t GetSelectIndex ()
 返回被选中的元素下标
 
ComponentsGetSelect ()
 返回被选中的元素
 
std::string GetSelectName ()
 
bool IsSelectIndex (size_t index)
 index元素是否选中状态
 
Position GetSize ()
 返回大小
 
Position GetParentSize ()
 返回父节点大小
 
RectF GetRect ()
 返回所有元素和子节点组成的包围盒
 
Position GetPosition ()
 
float GetOrder ()
 
const LocatorGetLocator ()
 
template<typename T>
TGetElement (size_t n=0)
 返回第n个元素
 
template<typename T>
std::vector< T * > GetElementVector ()
 返回所有类型的元素
 
bool IsPickup ()
 是否被鼠标选中(任意子元素、子面板被选中)
 
void SetSize (const Position &size)
 
void SetAutoSize (bool auto_size)
 
void SetPickupMode (PickupMode mode)
 
void SetPickupMode (int mode)
 
void SetSizeFull ()
 
void OnChangeElementData (Components *cpt)
 
bool IsAutoRun ()
 
UI::ButtonExGetButton (size_t n=0, bool show_log=true)
 返回第n个按钮
 
UI::ButtonSpriteExGetButtonSprite (size_t n=0, bool show_log=true)
 
UI::ButtonSprite9ExGetButtonSprite9 (size_t n=0, bool show_log=true)
 
UI::EditBoxExGetEditBox (size_t n=0, bool show_log=true)
 返回第n个列表框
 
UI::TextExGetText (size_t n=0, bool show_log=true)
 返回第n个text
 
UI::BackgroundExGetBackground (size_t n=0, bool show_log=true)
 返回第n个bg
 
void ExSetString (std::string_view str, size_t n=0)
 设置第n个text内容
 
void SetDebugName (std::string_view name)
 

友元

class Manager
 

详细描述

UI面板

在文件 dl_ui_panel.h64 行定义.

成员枚举类型说明

◆ OrderMode

枚举值
AUTO 

自动设置

CUSTOM 

手动设置

FORCE 

强行设置全局

在文件 dl_ui_panel.h74 行定义.

◆ PickupMode

枚举值
E_SIZE 

自己大小

E_ELEMENT 

子元素

E_CHILD 

子面板

在文件 dl_ui_panel.h68 行定义.

成员函数说明

◆ Add() [1/3]

void dl::UI::Panel::Add ( std::string_view json_path)

添加多个Element,通过json文件

◆ Add() [2/3]

template<typename T>
void dl::UI::Panel::Add ( T * p)
inline

添加一个Element

在文件 dl_ui_panel.h88 行定义.

◆ Add() [3/3]

void dl::UI::Panel::Add ( Text * p)
inline

脚本导出使用

在文件 dl_ui_panel.h93 行定义.

◆ AddCpt()

void dl::UI::Panel::AddCpt ( Components * cpt)

添加一个Element

◆ AddPanel()

void dl::UI::Panel::AddPanel ( Panel * child)

添加子panel

◆ Clone()

Panel * dl::UI::Panel::Clone ( )

克隆

◆ Del()

template<typename T>
void dl::UI::Panel::Del ( T * p)
inline

添加一个Element

在文件 dl_ui_panel.h112 行定义.

◆ DelCpt()

void dl::UI::Panel::DelCpt ( Components * cpt)

移除子Element,不删除

注解
仅移除,不会重新刷其他内容的位置

◆ DtPosPixel()

void dl::UI::Panel::DtPosPixel ( const Position & dt)
inline

在文件 dl_ui_panel.h134 行定义.

◆ ElementSetSelect()

void dl::UI::Panel::ElementSetSelect ( size_t index,
bool select )
inline

设置元素是否选中

在文件 dl_ui_panel.h267 行定义.

◆ ExGetBackground()

UI::Background * dl::UI::Panel::ExGetBackground ( size_t n = 0,
bool show_log = true )

返回第n个bg

◆ ExGetButton()

UI::Button * dl::UI::Panel::ExGetButton ( size_t n = 0,
bool show_log = true )

返回第n个按钮

◆ ExGetButtonSprite()

UI::ButtonSprite * dl::UI::Panel::ExGetButtonSprite ( size_t n = 0,
bool show_log = true )

◆ ExGetButtonSprite9()

UI::ButtonSprite9 * dl::UI::Panel::ExGetButtonSprite9 ( size_t n = 0,
bool show_log = true )

◆ ExGetEditBox()

UI::EditBox * dl::UI::Panel::ExGetEditBox ( size_t n = 0,
bool show_log = true )

返回第n个列表框

◆ ExGetText()

UI::Text * dl::UI::Panel::ExGetText ( size_t n = 0,
bool show_log = true )

返回第n个text

◆ ExSetString()

void dl::UI::Panel::ExSetString ( std::string_view str,
size_t n = 0 )

设置第n个text内容

◆ Get()

template<typename T>
Components * dl::UI::Panel::Get ( )
inline

返回第一个满足条件的组件

在文件 dl_ui_panel.h425 行定义.

◆ GetChild()

Panel * dl::UI::Panel::GetChild ( size_t i)
inline

返回子panel

在文件 dl_ui_panel.h384 行定义.

◆ GetChildAll()

std::vector< Panel * > dl::UI::Panel::GetChildAll ( )
inline

返回子panel

在文件 dl_ui_panel.h346 行定义.

◆ GetChildIndex()

size_t dl::UI::Panel::GetChildIndex ( Panel * child)
inline

返回子panel下标

在文件 dl_ui_panel.h369 行定义.

◆ GetChildNum()

size_t dl::UI::Panel::GetChildNum ( bool recursion = false)
inline

返回子panel数量

在文件 dl_ui_panel.h356 行定义.

◆ GetChildPickup()

Panel * dl::UI::Panel::GetChildPickup ( )

返回光标悬停的子panel

◆ GetChildSelect()

Panel * dl::UI::Panel::GetChildSelect ( )

返回被选中的子panel

◆ GetClickIndex()

size_t dl::UI::Panel::GetClickIndex ( )
inline

返回被点击的元素

返回值
没有返回-1

在文件 dl_ui_panel.h442 行定义.

◆ GetClickName()

std::string dl::UI::Panel::GetClickName ( )
inline

在文件 dl_ui_panel.h446 行定义.

◆ GetCoor()

Coor * dl::UI::Panel::GetCoor ( )
inline

返回坐标系

注解
通过SetAutoCoor取消自动定位

在文件 dl_ui_panel.h324 行定义.

◆ GetCoorRef()

Coor * dl::UI::Panel::GetCoorRef ( )
inline

在文件 dl_ui_panel.h329 行定义.

◆ GetDir()

Align::Dir4 dl::UI::Panel::GetDir ( )
inline

在文件 dl_ui_panel.h333 行定义.

◆ GetDownIndex()

size_t dl::UI::Panel::GetDownIndex ( )
inline

返回被按下的元素

返回值
没有返回-1

在文件 dl_ui_panel.h461 行定义.

◆ GetElement()

template<typename T>
T * dl::UI::Panel::GetElement ( size_t n = 0)
inline

返回第n个元素

参数
注意按钮均为Button

在文件 dl_ui_panel.h544 行定义.

◆ GetElementVector()

template<typename T>
std::vector< T * > dl::UI::Panel::GetElementVector ( )
inline

返回所有类型的元素

在文件 dl_ui_panel.h554 行定义.

◆ GetIndex()

template<typename T>
std::size_t dl::UI::Panel::GetIndex ( )
inline

返回第一个满足条件的组件下标

在文件 dl_ui_panel.h409 行定义.

◆ GetLocator()

const Locator & dl::UI::Panel::GetLocator ( )
inline

在文件 dl_ui_panel.h535 行定义.

◆ GetName()

std::string dl::UI::Panel::GetName ( ) const
inline

返回名字

在文件 dl_ui_panel.h319 行定义.

◆ GetOrder()

float dl::UI::Panel::GetOrder ( )
inline

在文件 dl_ui_panel.h530 行定义.

◆ GetParent()

Panel * dl::UI::Panel::GetParent ( )
inline

返回父panel

在文件 dl_ui_panel.h337 行定义.

◆ GetParentSize()

Position dl::UI::Panel::GetParentSize ( )

返回父节点大小

注解
父节点不存在或为0时,返回窗口大小

◆ GetPosition()

Position dl::UI::Panel::GetPosition ( )
inline

在文件 dl_ui_panel.h526 行定义.

◆ GetRect()

RectF dl::UI::Panel::GetRect ( )

返回所有元素和子节点组成的包围盒

◆ GetSelect()

Components * dl::UI::Panel::GetSelect ( )
inline

返回被选中的元素

返回值
没有返回空指针

在文件 dl_ui_panel.h479 行定义.

◆ GetSelectIndex()

size_t dl::UI::Panel::GetSelectIndex ( )
inline

返回被选中的元素下标

返回值
没有返回-1

在文件 dl_ui_panel.h470 行定义.

◆ GetSelectName()

std::string dl::UI::Panel::GetSelectName ( )
inline

在文件 dl_ui_panel.h484 行定义.

◆ GetSize()

Position dl::UI::Panel::GetSize ( )

返回大小

注解
自动大小则使用定位器自动大小 若坐标为0,则使用父节点大小,直到窗口大小

◆ IsAutoRun()

bool dl::UI::Panel::IsAutoRun ( )
inline

在文件 dl_ui_panel.h636 行定义.

◆ IsPickup()

bool dl::UI::Panel::IsPickup ( )
inline

是否被鼠标选中(任意子元素、子面板被选中)

在文件 dl_ui_panel.h567 行定义.

◆ IsRender()

bool dl::UI::Panel::IsRender ( )
inline

执行了Render

在文件 dl_ui_panel.h315 行定义.

◆ IsSelectIndex()

bool dl::UI::Panel::IsSelectIndex ( size_t index)
inline

index元素是否选中状态

返回值
失败返回false,并输出日志

在文件 dl_ui_panel.h494 行定义.

◆ IsUpdate()

bool dl::UI::Panel::IsUpdate ( )
inline

执行了Update

在文件 dl_ui_panel.h311 行定义.

◆ OnChangeElementData()

void dl::UI::Panel::OnChangeElementData ( Components * cpt)

◆ RefreshOrder()

void dl::UI::Panel::RefreshOrder ( )
inline

在文件 dl_ui_panel.h237 行定义.

◆ Render()

void dl::UI::Panel::Render ( )

执行绘制 @node 默认情况会自动调用

注解
如果关闭了自动执行,但手动调用了Update,则也自动调用Render, 可通过SetAutoRender关闭

◆ SetAlign()

void dl::UI::Panel::SetAlign ( const Align::Direction2 & hv)
inline

设置 在父节点的对齐

注解
注意,Panel大小默认为0,需要设置AutoSize

在文件 dl_ui_panel.h166 行定义.

◆ SetAutoCoor()

void dl::UI::Panel::SetAutoCoor ( bool auto_coor)
inline

设置是否自动调整位置

注解
关闭后获得Coor控制权

在文件 dl_ui_panel.h191 行定义.

◆ SetAutoRender()

void dl::UI::Panel::SetAutoRender ( bool auto_render)
inline

设置是否自动绘制

注解
默认开启,表示调用Update则自动调用Render

在文件 dl_ui_panel.h201 行定义.

◆ SetAutoRun()

void dl::UI::Panel::SetAutoRun ( bool auto_run)
inline

设置是否自动执行

注解
自动执行的前提是 父节点开启自动执行

在文件 dl_ui_panel.h196 行定义.

◆ SetAutoSize()

void dl::UI::Panel::SetAutoSize ( bool auto_size)
inline

在文件 dl_ui_panel.h612 行定义.

◆ SetChildSelect()

void dl::UI::Panel::SetChildSelect ( Panel * panel)

设置被选中的子panel,可以传空

◆ SetDebugName()

void dl::UI::Panel::SetDebugName ( std::string_view name)
inline

在文件 dl_ui_panel.h651 行定义.

◆ SetDir()

void dl::UI::Panel::SetDir ( Align::Dir4 dir)

设置朝向,基于Coor旋转,旋转后仍然定位到左上角

◆ SetLocator() [1/3]

void dl::UI::Panel::SetLocator ( const Locator & loc)
inline

设置Locator

注解
Locator只影响元素,不影响子panel

在文件 dl_ui_panel.h176 行定义.

◆ SetLocator() [2/3]

void dl::UI::Panel::SetLocator ( const Locator::SL & sl)
inline

在文件 dl_ui_panel.h182 行定义.

◆ SetLocator() [3/3]

void dl::UI::Panel::SetLocator ( std::string_view name)

◆ SetName()

void dl::UI::Panel::SetName ( std::string_view name)
inline

设置名字

在文件 dl_ui_panel.h244 行定义.

◆ SetOrder()

void dl::UI::Panel::SetOrder ( float order)
inline

设置order

注解
OrderMode::FORCE 才能设置(子元素默认为-1)

在文件 dl_ui_panel.h215 行定义.

◆ SetOrderInParent()

void dl::UI::Panel::SetOrderInParent ( int order_parent)
inline

设置order

注解
OrderMode::CUSTOM 才能设置

在文件 dl_ui_panel.h228 行定义.

◆ SetOrderMode()

void dl::UI::Panel::SetOrderMode ( OrderMode mode)
inline

设置order模式

注解

在文件 dl_ui_panel.h206 行定义.

◆ SetPickupMode() [1/2]

void dl::UI::Panel::SetPickupMode ( int mode)
inline

在文件 dl_ui_panel.h623 行定义.

◆ SetPickupMode() [2/2]

void dl::UI::Panel::SetPickupMode ( PickupMode mode)
inline

在文件 dl_ui_panel.h619 行定义.

◆ SetPosPixel()

void dl::UI::Panel::SetPosPixel ( const Position & pos_pixel)
inline

设置 像素位置

在文件 dl_ui_panel.h124 行定义.

◆ SetPosScale()

void dl::UI::Panel::SetPosScale ( const Position & pos_scale)
inline

设置 比例位置

在文件 dl_ui_panel.h147 行定义.

◆ SetSelect()

void dl::UI::Panel::SetSelect ( size_t index)
inline

设置被选中的元素

在文件 dl_ui_panel.h252 行定义.

◆ SetSelectAll()

void dl::UI::Panel::SetSelectAll ( bool select)
inline

设置所有子元素的选中状态

在文件 dl_ui_panel.h281 行定义.

◆ SetSize()

void dl::UI::Panel::SetSize ( const Position & size)
inline

在文件 dl_ui_panel.h605 行定义.

◆ SetSizeFull()

void dl::UI::Panel::SetSizeFull ( )
inline

在文件 dl_ui_panel.h628 行定义.

◆ Update()

void dl::UI::Panel::Update ( )

执行逻辑 @node 默认情况会自动调用

◆ UpdateRadio()

void dl::UI::Panel::UpdateRadio ( )

执行逻辑Radio @node 手动调用,把子panel作为radio处理

友元及相关符号说明

◆ Manager

friend class Manager
friend

在文件 dl_ui_panel.h66 行定义.


该类的文档由以下文件生成: