Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
7934df5d
G
Graphic Ui
项目概览
OpenHarmony
/
Graphic Ui
大约 1 年 前同步成功
通知
13
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Graphic Ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7934df5d
编写于
4月 14, 2021
作者:
O
openharmony_ci
提交者:
Gitee
4月 14, 2021
浏览文件
操作
浏览文件
下载
差异文件
!93 修复当视图设置为可拖拽的但未定义拖拽行为时,放到scrollview中无法滚动的问题
Merge pull request !93 from JayLeeHW/master
上级
848b2861
c18a41bb
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
103 addition
and
239 deletion
+103
-239
frameworks/components/ui_picker.cpp
frameworks/components/ui_picker.cpp
+0
-1
frameworks/components/ui_time_picker.cpp
frameworks/components/ui_time_picker.cpp
+0
-1
frameworks/components/ui_view.cpp
frameworks/components/ui_view.cpp
+10
-10
frameworks/dock/pointer_input_device.cpp
frameworks/dock/pointer_input_device.cpp
+9
-9
interfaces/kits/components/ui_view.h
interfaces/kits/components/ui_view.h
+65
-218
test/uitest/test_event_injector/ui_test_event_injector.cpp
test/uitest/test_event_injector/ui_test_event_injector.cpp
+1
-0
test/uitest/test_slider/ui_test_slider.cpp
test/uitest/test_slider/ui_test_slider.cpp
+1
-0
test/uitest/test_ui_list/ui_test_ui_list.cpp
test/uitest/test_ui_list/ui_test_ui_list.cpp
+3
-0
test/uitest/test_ui_scroll_view/ui_test_ui_scroll_view.cpp
test/uitest/test_ui_scroll_view/ui_test_ui_scroll_view.cpp
+8
-0
test/uitest/test_ui_swipe_view/ui_test_ui_swipe_view.cpp
test/uitest/test_ui_swipe_view/ui_test_ui_swipe_view.cpp
+6
-0
未找到文件。
frameworks/components/ui_picker.cpp
浏览文件 @
7934df5d
...
...
@@ -173,7 +173,6 @@ UIPicker::UIPicker()
#endif
list_
.
SetLoopState
(
false
);
list_
.
EnableAutoAlign
(
true
);
list_
.
SetIntercept
(
false
);
PickerListScrollListener
*
listener
=
new
PickerListScrollListener
(
this
,
&
list_
);
list_
.
SetScrollStateListener
(
listener
);
listListener_
=
static_cast
<
void
*>
(
listener
);
...
...
frameworks/components/ui_time_picker.cpp
浏览文件 @
7934df5d
...
...
@@ -141,7 +141,6 @@ void UITimePicker::InitPicker(UIPicker*& picker, int16_t start, int16_t end)
picker
->
SetTextColor
(
backgroundColor_
,
highlightColor_
);
picker
->
SetValues
(
start
,
end
);
picker
->
RegisterSelectedListener
(
&
pickerListener_
);
picker
->
SetIntercept
(
false
);
Add
(
picker
);
#if ENABLE_ROTATE_INPUT
...
...
frameworks/components/ui_view.cpp
浏览文件 @
7934df5d
...
...
@@ -32,7 +32,7 @@ UIView::UIView()
isViewGroup_
(
false
),
needRedraw_
(
false
),
styleAllocFlag_
(
false
),
isIntercept_
(
tru
e
),
isIntercept_
(
fals
e
),
#if ENABLE_FOCUS_MANAGER
focusable_
(
false
),
#endif
...
...
@@ -288,7 +288,7 @@ bool UIView::OnLongPressEvent(const LongPressEvent& event)
bool
isConsumed
=
onLongPressListener_
->
OnLongPress
(
*
this
,
event
);
return
isConsumed
;
}
return
false
;
return
isIntercept_
;
}
bool
UIView
::
OnDragStartEvent
(
const
DragEvent
&
event
)
...
...
@@ -298,7 +298,7 @@ bool UIView::OnDragStartEvent(const DragEvent& event)
bool
isConsumed
=
onDragListener_
->
OnDragStart
(
*
this
,
event
);
return
isConsumed
;
}
return
false
;
return
isIntercept_
;
}
bool
UIView
::
OnDragEvent
(
const
DragEvent
&
event
)
...
...
@@ -308,7 +308,7 @@ bool UIView::OnDragEvent(const DragEvent& event)
bool
isConsumed
=
onDragListener_
->
OnDrag
(
*
this
,
event
);
return
isConsumed
;
}
return
false
;
return
isIntercept_
;
}
bool
UIView
::
OnDragEndEvent
(
const
DragEvent
&
event
)
...
...
@@ -318,7 +318,7 @@ bool UIView::OnDragEndEvent(const DragEvent& event)
bool
isConsumed
=
onDragListener_
->
OnDragEnd
(
*
this
,
event
);
return
isConsumed
;
}
return
false
;
return
isIntercept_
;
}
bool
UIView
::
OnClickEvent
(
const
ClickEvent
&
event
)
...
...
@@ -328,7 +328,7 @@ bool UIView::OnClickEvent(const ClickEvent& event)
bool
isConsumed
=
onClickListener_
->
OnClick
(
*
this
,
event
);
return
isConsumed
;
}
return
false
;
return
isIntercept_
;
}
bool
UIView
::
OnPressEvent
(
const
PressEvent
&
event
)
...
...
@@ -338,7 +338,7 @@ bool UIView::OnPressEvent(const PressEvent& event)
bool
isConsumed
=
onTouchListener_
->
OnPress
(
*
this
,
event
);
return
isConsumed
;
}
return
false
;
return
isIntercept_
;
}
bool
UIView
::
OnReleaseEvent
(
const
ReleaseEvent
&
event
)
...
...
@@ -348,7 +348,7 @@ bool UIView::OnReleaseEvent(const ReleaseEvent& event)
bool
isConsumed
=
onTouchListener_
->
OnRelease
(
*
this
,
event
);
return
isConsumed
;
}
return
false
;
return
isIntercept_
;
}
bool
UIView
::
OnCancelEvent
(
const
CancelEvent
&
event
)
...
...
@@ -358,7 +358,7 @@ bool UIView::OnCancelEvent(const CancelEvent& event)
bool
isConsumed
=
onTouchListener_
->
OnCancel
(
*
this
,
event
);
return
isConsumed
;
}
return
false
;
return
isIntercept_
;
}
#if ENABLE_ROTATE_INPUT
...
...
@@ -367,7 +367,7 @@ bool UIView::OnRotateEvent(const RotateEvent& event)
if
(
onRotateListener_
!=
nullptr
)
{
return
onRotateListener_
->
OnRotate
(
*
this
,
event
);
}
return
false
;
return
isIntercept_
;
}
#endif
...
...
frameworks/dock/pointer_input_device.cpp
浏览文件 @
7934df5d
...
...
@@ -101,7 +101,7 @@ void PointerInputDevice::DispatchPressEvent(UIViewGroup* rootView)
if
(
!
touchableView_
->
OnPressEvent
(
evt
))
{
while
(
parent
!=
nullptr
)
{
PressEvent
evtParent
(
curPos_
);
if
(
parent
->
UIView
::
OnPressEvent
(
evtParent
))
{
if
(
parent
->
OnPressEvent
(
evtParent
))
{
break
;
}
parent
=
parent
->
GetParent
();
...
...
@@ -123,7 +123,7 @@ bool PointerInputDevice::ProcessReleaseEvent()
if
(
!
touchableView_
->
OnPressEvent
(
evtPress
))
{
while
(
parent
!=
nullptr
)
{
PressEvent
evtPressParent
(
curPos_
);
if
(
parent
->
UIView
::
OnPressEvent
(
evtPressParent
))
{
if
(
parent
->
OnPressEvent
(
evtPressParent
))
{
break
;
}
parent
=
parent
->
GetParent
();
...
...
@@ -136,7 +136,7 @@ bool PointerInputDevice::ProcessReleaseEvent()
if
(
!
touchableView_
->
OnReleaseEvent
(
evtRelease
))
{
while
(
parent
!=
nullptr
)
{
ReleaseEvent
evtReleaseParent
(
curPos_
);
if
(
parent
->
UIView
::
OnReleaseEvent
(
evtReleaseParent
))
{
if
(
parent
->
OnReleaseEvent
(
evtReleaseParent
))
{
break
;
}
parent
=
parent
->
GetParent
();
...
...
@@ -152,7 +152,7 @@ bool PointerInputDevice::ProcessReleaseEvent()
OnClickEventHappen
(
parent
);
#endif
ClickEvent
evtParent
(
curPos_
);
if
(
parent
->
UIView
::
OnClickEvent
(
evtParent
))
{
if
(
parent
->
OnClickEvent
(
evtParent
))
{
break
;
}
parent
=
parent
->
GetParent
();
...
...
@@ -214,7 +214,7 @@ void PointerInputDevice::DispatchDragStartEvent()
if
(
!
draggableView_
->
OnDragStartEvent
(
evt
))
{
while
(
parent
!=
nullptr
)
{
DragEvent
evtParent
(
curPos_
,
lastPos_
,
dragLen_
);
if
(
parent
->
UIView
::
OnDragStartEvent
(
evtParent
))
{
if
(
parent
->
OnDragStartEvent
(
evtParent
))
{
break
;
}
parent
=
parent
->
GetParent
();
...
...
@@ -237,7 +237,7 @@ void PointerInputDevice::DispatchDragEvent()
if
(
!
draggableView_
->
OnDragEvent
(
evt
))
{
while
(
parent
!=
nullptr
)
{
DragEvent
evtParent
(
curPos_
,
lastPos_
,
dragLen_
);
if
(
parent
->
UIView
::
OnDragEvent
(
evtParent
))
{
if
(
parent
->
OnDragEvent
(
evtParent
))
{
break
;
}
parent
=
parent
->
GetParent
();
...
...
@@ -259,7 +259,7 @@ void PointerInputDevice::DispatchDragEndEvent()
if
(
!
draggableView_
->
OnDragEndEvent
(
evt
))
{
while
(
parent
!=
nullptr
)
{
DragEvent
evtParent
(
curPos_
,
lastPos_
,
dragLen_
);
if
(
parent
->
UIView
::
OnDragEndEvent
(
evtParent
))
{
if
(
parent
->
OnDragEndEvent
(
evtParent
))
{
break
;
}
parent
=
parent
->
GetParent
();
...
...
@@ -290,7 +290,7 @@ void PointerInputDevice::DispatchLongPressEvent(uint32_t elapse)
if
(
!
isConsumed
)
{
while
(
parent
!=
nullptr
)
{
LongPressEvent
evtParent
(
curPos_
,
pressTimeStamp_
);
isConsumed
=
parent
->
UIView
::
OnLongPressEvent
(
evtParent
);
isConsumed
=
parent
->
OnLongPressEvent
(
evtParent
);
if
(
needClick_
&&
(
parent
->
GetOnLongPressListener
()
!=
nullptr
))
{
needClick_
=
false
;
}
...
...
@@ -313,7 +313,7 @@ void PointerInputDevice::DispatchCancelEvent()
if
(
!
touchableView_
->
OnCancelEvent
(
evt
))
{
while
(
parent
!=
nullptr
)
{
CancelEvent
evtParent
(
lastPos_
);
if
(
parent
->
UIView
::
OnCancelEvent
(
evtParent
))
{
if
(
parent
->
OnCancelEvent
(
evtParent
))
{
break
;
}
parent
=
parent
->
GetParent
();
...
...
interfaces/kits/components/ui_view.h
浏览文件 @
7934df5d
...
...
@@ -135,10 +135,7 @@ public:
* @since 1.0
* @version 1.0
*/
virtual
bool
OnClick
(
UIView
&
view
,
const
ClickEvent
&
event
)
{
return
false
;
}
virtual
bool
OnClick
(
UIView
&
view
,
const
ClickEvent
&
event
)
{
return
false
;
}
/**
* @brief A destructor used to delete the <b>OnClickListener</b> instance.
...
...
@@ -167,10 +164,7 @@ public:
* @since 1.0
* @version 1.0
*/
virtual
bool
OnLongPress
(
UIView
&
view
,
const
LongPressEvent
&
event
)
{
return
false
;
}
virtual
bool
OnLongPress
(
UIView
&
view
,
const
LongPressEvent
&
event
)
{
return
false
;
}
/**
* @brief A destructor used to delete the <b>OnLongPressListener</b> instance.
...
...
@@ -198,10 +192,7 @@ public:
* @since 1.0
* @version 1.0
*/
virtual
bool
OnDragStart
(
UIView
&
view
,
const
DragEvent
&
event
)
{
return
false
;
}
virtual
bool
OnDragStart
(
UIView
&
view
,
const
DragEvent
&
event
)
{
return
false
;
}
/**
* @brief Called when a view is being dragged.
...
...
@@ -213,10 +204,7 @@ public:
* @since 1.0
* @version 1.0
*/
virtual
bool
OnDrag
(
UIView
&
view
,
const
DragEvent
&
event
)
{
return
false
;
}
virtual
bool
OnDrag
(
UIView
&
view
,
const
DragEvent
&
event
)
{
return
false
;
}
/**
* @brief Called when a view stops dragging.
...
...
@@ -228,10 +216,7 @@ public:
* @since 1.0
* @version 1.0
*/
virtual
bool
OnDragEnd
(
UIView
&
view
,
const
DragEvent
&
event
)
{
return
false
;
}
virtual
bool
OnDragEnd
(
UIView
&
view
,
const
DragEvent
&
event
)
{
return
false
;
}
/**
* @brief A destructor used to delete the <b>OnDragListener</b> instance.
...
...
@@ -260,10 +245,7 @@ public:
* @since 1.0
* @version 1.0
*/
virtual
bool
OnPress
(
UIView
&
view
,
const
PressEvent
&
event
)
{
return
false
;
}
virtual
bool
OnPress
(
UIView
&
view
,
const
PressEvent
&
event
)
{
return
false
;
}
/**
* @brief Called when a view is released.
...
...
@@ -275,10 +257,7 @@ public:
* @since 1.0
* @version 1.0
*/
virtual
bool
OnRelease
(
UIView
&
view
,
const
ReleaseEvent
&
event
)
{
return
false
;
}
virtual
bool
OnRelease
(
UIView
&
view
,
const
ReleaseEvent
&
event
)
{
return
false
;
}
/**
* @brief Called when a click event on a view is canceled.
...
...
@@ -290,10 +269,7 @@ public:
* @since 1.0
* @version 1.0
*/
virtual
bool
OnCancel
(
UIView
&
view
,
const
CancelEvent
&
event
)
{
return
false
;
}
virtual
bool
OnCancel
(
UIView
&
view
,
const
CancelEvent
&
event
)
{
return
false
;
}
/**
* @brief A destructor used to delete the <b>OnTouchListener</b> instance.
...
...
@@ -320,10 +296,7 @@ public:
* @since 5.0
* @version 3.0
*/
virtual
bool
OnRotate
(
UIView
&
view
,
const
RotateEvent
&
event
)
{
return
true
;
}
virtual
bool
OnRotate
(
UIView
&
view
,
const
RotateEvent
&
event
)
{
return
true
;
}
/**
* @brief A destructor used to delete an <b>OnRotateListener</b> instance.
* @since 5.0
...
...
@@ -346,10 +319,7 @@ public:
* @since 5.0
* @version 3.0
*/
void
SetOnRotateListener
(
OnRotateListener
*
onRotateListener
)
{
onRotateListener_
=
onRotateListener
;
}
void
SetOnRotateListener
(
OnRotateListener
*
onRotateListener
)
{
onRotateListener_
=
onRotateListener
;
}
/**
* @brief Obtains the rotation event listener for the view.
...
...
@@ -357,10 +327,7 @@ public:
* @since 5.0
* @version 3.0
*/
OnRotateListener
*&
GetOnRotateListener
()
{
return
onRotateListener_
;
}
OnRotateListener
*&
GetOnRotateListener
()
{
return
onRotateListener_
;
}
#endif
/**
...
...
@@ -540,10 +507,7 @@ public:
* @since 1.0
* @version 1.0
*/
void
SetOnDragListener
(
OnDragListener
*
onDragListener
)
{
onDragListener_
=
onDragListener
;
}
void
SetOnDragListener
(
OnDragListener
*
onDragListener
)
{
onDragListener_
=
onDragListener
;
}
/**
* @brief Obtains the drag event listener for the view.
...
...
@@ -551,10 +515,7 @@ public:
* @since 1.0
* @version 1.0
*/
OnDragListener
*&
GetOnDragListener
()
{
return
onDragListener_
;
}
OnDragListener
*&
GetOnDragListener
()
{
return
onDragListener_
;
}
/**
* @brief Sets a click event listener for the view.
...
...
@@ -562,10 +523,7 @@ public:
* @since 1.0
* @version 1.0
*/
void
SetOnClickListener
(
OnClickListener
*
onClickListener
)
{
onClickListener_
=
onClickListener
;
}
void
SetOnClickListener
(
OnClickListener
*
onClickListener
)
{
onClickListener_
=
onClickListener
;
}
/**
* @brief Obtains the click event listener for the view.
...
...
@@ -573,10 +531,7 @@ public:
* @since 1.0
* @version 1.0
*/
OnClickListener
*&
GetOnClickListener
()
{
return
onClickListener_
;
}
OnClickListener
*&
GetOnClickListener
()
{
return
onClickListener_
;
}
/**
* @brief Sets a long-press event listener for the view.
...
...
@@ -595,10 +550,7 @@ public:
* @since 1.0
* @version 1.0
*/
OnLongPressListener
*&
GetOnLongPressListener
()
{
return
onLongPressListener_
;
}
OnLongPressListener
*&
GetOnLongPressListener
()
{
return
onLongPressListener_
;
}
/**
* @brief Sets a touch event listener for the view.
...
...
@@ -606,10 +558,7 @@ public:
* @since 1.0
* @version 1.0
*/
void
SetOnTouchListener
(
OnTouchListener
*
onTouchListener
)
{
onTouchListener_
=
onTouchListener
;
}
void
SetOnTouchListener
(
OnTouchListener
*
onTouchListener
)
{
onTouchListener_
=
onTouchListener
;
}
/**
* @brief Obtains the touch event listener for the view.
...
...
@@ -617,10 +566,7 @@ public:
* @since 1.0
* @version 1.0
*/
OnTouchListener
*&
GetTouchListener
()
{
return
onTouchListener_
;
}
OnTouchListener
*&
GetTouchListener
()
{
return
onTouchListener_
;
}
/**
* @brief Obtains the top-level view based on specified coordinates.
...
...
@@ -651,10 +597,7 @@ public:
* @since 1.0
* @version 1.0
*/
void
SetParent
(
UIView
*
parent
)
{
parent_
=
parent
;
}
void
SetParent
(
UIView
*
parent
)
{
parent_
=
parent
;
}
/**
* @brief Obtains the parent view of the view.
...
...
@@ -662,10 +605,7 @@ public:
* @since 1.0
* @version 1.0
*/
UIView
*
GetParent
()
const
{
return
parent_
;
}
UIView
*
GetParent
()
const
{
return
parent_
;
}
/**
* @brief Sets the next sibling view for the view.
...
...
@@ -673,10 +613,7 @@ public:
* @since 1.0
* @version 1.0
*/
void
SetNextSibling
(
UIView
*
sibling
)
{
nextSibling_
=
sibling
;
}
void
SetNextSibling
(
UIView
*
sibling
)
{
nextSibling_
=
sibling
;
}
/**
* @brief Obtains the next sibling view of the view.
...
...
@@ -684,10 +621,7 @@ public:
* @since 1.0
* @version 1.0
*/
UIView
*
GetNextSibling
()
const
{
return
nextSibling_
;
}
UIView
*
GetNextSibling
()
const
{
return
nextSibling_
;
}
/**
* @brief Sets whether the view is visible.
...
...
@@ -711,10 +645,7 @@ public:
* @since 1.0
* @version 1.0
*/
bool
IsVisible
()
const
{
return
visible_
;
}
bool
IsVisible
()
const
{
return
visible_
;
}
/**
* @brief Sets whether the view is touchable.
...
...
@@ -723,10 +654,7 @@ public:
* @since 1.0
* @version 1.0
*/
void
SetTouchable
(
bool
touch
)
{
touchable_
=
touch
;
}
void
SetTouchable
(
bool
touch
)
{
touchable_
=
touch
;
}
/**
* @brief Checks whether the view is touchable.
...
...
@@ -734,10 +662,7 @@ public:
* @since 1.0
* @version 1.0
*/
bool
IsTouchable
()
const
{
return
touchable_
;
}
bool
IsTouchable
()
const
{
return
touchable_
;
}
/**
* @brief Sets whether the view is draggable.
...
...
@@ -758,10 +683,7 @@ public:
* @since 1.0
* @version 1.0
*/
bool
IsDraggable
()
const
{
return
draggable_
;
}
bool
IsDraggable
()
const
{
return
draggable_
;
}
/**
* @brief Sets whether to transfer the drag event to the parent view for processing when the view is being dragged.
...
...
@@ -771,10 +693,7 @@ public:
* @since 1.0
* @version 1.0
*/
void
SetDragParentInstead
(
bool
dragParentInstead
)
{
dragParentInstead_
=
dragParentInstead
;
}
void
SetDragParentInstead
(
bool
dragParentInstead
)
{
dragParentInstead_
=
dragParentInstead
;
}
/**
* @brief Obtains whether the view transfers a drag event to the parent view for processing.
...
...
@@ -783,10 +702,7 @@ public:
* @since 1.0
* @version 1.0
*/
bool
IsDragParentInstead
()
const
{
return
dragParentInstead_
;
}
bool
IsDragParentInstead
()
const
{
return
dragParentInstead_
;
}
/**
* @brief Obtains the absolute rectangle area of the view. When the view has deformation such as rotation,
...
...
@@ -838,10 +754,7 @@ public:
* @since 1.0
* @version 1.0
*/
Rect
GetRelativeRect
()
const
{
return
rect_
;
}
Rect
GetRelativeRect
()
const
{
return
rect_
;
}
/**
* @brief Adjusts the size of the visible area. This operation may affect the final display size.
...
...
@@ -966,10 +879,7 @@ public:
* @since 1.0
* @version 1.0
*/
virtual
void
SetX
(
int16_t
x
)
{
rect_
.
SetX
(
x
);
}
virtual
void
SetX
(
int16_t
x
)
{
rect_
.
SetX
(
x
);
}
/**
* @brief Sets a percentage that represents the proportion of the view's x-coordinate
...
...
@@ -986,10 +896,7 @@ public:
* @since 1.0
* @version 1.0
*/
int16_t
GetX
()
const
{
return
rect_
.
GetX
();
}
int16_t
GetX
()
const
{
return
rect_
.
GetX
();
}
/**
* @brief Sets the y-coordinate for the view.
...
...
@@ -997,10 +904,7 @@ public:
* @since 1.0
* @version 1.0
*/
virtual
void
SetY
(
int16_t
y
)
{
rect_
.
SetY
(
y
);
}
virtual
void
SetY
(
int16_t
y
)
{
rect_
.
SetY
(
y
);
}
/**
* @brief Sets a percentage that represents the proportion of the view's y-coordinate
...
...
@@ -1017,10 +921,7 @@ public:
* @since 1.0
* @version 1.0
*/
int16_t
GetY
()
const
{
return
rect_
.
GetY
();
}
int16_t
GetY
()
const
{
return
rect_
.
GetY
();
}
/**
* @brief Sets the position for the view.
...
...
@@ -1029,10 +930,7 @@ public:
* @since 1.0
* @version 1.0
*/
virtual
void
SetPosition
(
int16_t
x
,
int16_t
y
)
{
rect_
.
SetPosition
(
x
,
y
);
}
virtual
void
SetPosition
(
int16_t
x
,
int16_t
y
)
{
rect_
.
SetPosition
(
x
,
y
);
}
/**
* @brief Sets the position percentages for the view.
...
...
@@ -1082,23 +980,26 @@ public:
* @since 1.0
* @version 1.0
*/
bool
IsViewGroup
()
const
{
return
isViewGroup_
;
}
bool
IsViewGroup
()
const
{
return
isViewGroup_
;
}
/**
* @brief Sets whether to intercept the
drag event. If intercepted, the view does not transfer the drag
event to
* @brief Sets whether to intercept the
input event. If intercepted, the view does not transfer the input
event to
* the parent view after local processing.
* @param isIntercept Specifies whether to intercept the
drag event. Value <b>true</b> means to intercept the drag
* @param isIntercept Specifies whether to intercept the
input event. Value <b>true</b> means to intercept the input
* event, and <b>false</b> means the opposite.
* @since 1.0
* @version 1.0
*/
void
SetIntercept
(
bool
isIntercept
)
{
isIntercept_
=
isIntercept
;
}
void
SetIntercept
(
bool
isIntercept
)
{
isIntercept_
=
isIntercept
;
}
/**
* @brief Gets whether to intercept the input event. If intercepted, the view does not transfer the input event to
* the parent view after local processing.
* @return Returns <b>true</b> if intercept the input event, and <b>false</b> means the opposite.
* @since 1.0
* @version 1.0
*/
bool
IsIntercept
()
{
return
isIntercept_
;
}
/**
* @brief Sets the affine transformation matrix.
...
...
@@ -1128,10 +1029,7 @@ public:
* @since 1.0
* @version 1.0
*/
virtual
UIView
*
GetChildById
(
const
char
*
id
)
const
{
return
nullptr
;
}
virtual
UIView
*
GetChildById
(
const
char
*
id
)
const
{
return
nullptr
;
}
/**
* @brief Sets the view ID.
...
...
@@ -1139,10 +1037,7 @@ public:
* @since 1.0
* @version 1.0
*/
void
SetViewId
(
const
char
*
id
)
{
id_
=
id
;
}
void
SetViewId
(
const
char
*
id
)
{
id_
=
id
;
}
/**
* @brief Obtains the view ID.
...
...
@@ -1150,10 +1045,7 @@ public:
* @since 1.0
* @version 1.0
*/
const
char
*
GetViewId
()
const
{
return
id_
;
}
const
char
*
GetViewId
()
const
{
return
id_
;
}
/**
* @brief Sets the view index.
...
...
@@ -1161,10 +1053,7 @@ public:
* @since 1.0
* @version 1.0
*/
void
SetViewIndex
(
int16_t
index
)
{
index_
=
index
;
}
void
SetViewIndex
(
int16_t
index
)
{
index_
=
index
;
}
/**
* @brief Obtains the view index.
...
...
@@ -1172,10 +1061,7 @@ public:
* @since 1.0
* @version 1.0
*/
int16_t
GetViewIndex
()
const
{
return
index_
;
}
int16_t
GetViewIndex
()
const
{
return
index_
;
}
/**
* @brief Obtains the view type.
...
...
@@ -1183,10 +1069,7 @@ public:
* @since 1.0
* @version 1.0
*/
virtual
UIViewType
GetViewType
()
const
{
return
UI_NUMBER_MAX
;
}
virtual
UIViewType
GetViewType
()
const
{
return
UI_NUMBER_MAX
;
}
/**
* @brief Lays out all child views according to the preset arrangement mode.
...
...
@@ -1371,10 +1254,7 @@ public:
* @since 1.0
* @version 1.0
*/
virtual
int64_t
GetStyle
(
uint8_t
key
)
const
{
return
style_
->
GetStyle
(
key
);
}
virtual
int64_t
GetStyle
(
uint8_t
key
)
const
{
return
style_
->
GetStyle
(
key
);
}
/**
* @brief Obtains the view style. This function applies to scenarios where the style does not need to be modified,
...
...
@@ -1383,10 +1263,7 @@ public:
* @since 1.0
* @version 1.0
*/
const
Style
&
GetStyleConst
()
const
{
return
*
style_
;
}
const
Style
&
GetStyleConst
()
const
{
return
*
style_
;
}
/**
* @brief Sets the opacity for the view.
...
...
@@ -1395,10 +1272,7 @@ public:
* @since 1.0
* @version 1.0
*/
void
SetOpaScale
(
uint8_t
opaScale
)
{
opaScale_
=
opaScale
;
}
void
SetOpaScale
(
uint8_t
opaScale
)
{
opaScale_
=
opaScale
;
}
/**
* @brief Obtains the view opacity.
...
...
@@ -1407,10 +1281,7 @@ public:
* @since 1.0
* @version 1.0
*/
uint8_t
GetOpaScale
()
const
{
return
opaScale_
;
}
uint8_t
GetOpaScale
()
const
{
return
opaScale_
;
}
/**
* @brief Obtains the extra message about a <b>UIView</b> instance. This field is ignored by the graphics
...
...
@@ -1420,10 +1291,7 @@ public:
* @since 5.0
* @version 3.0
*/
ViewExtraMsg
*
GetExtraMsg
()
{
return
viewExtraMsg_
;
}
ViewExtraMsg
*
GetExtraMsg
()
{
return
viewExtraMsg_
;
}
/**
* @brief Sets the extra message about a <b>UIView</b> instance. This field is ignored by the graphics
...
...
@@ -1433,10 +1301,7 @@ public:
* @since 5.0
* @version 3.0
*/
void
SetExtraMsg
(
ViewExtraMsg
*
extraMsg
)
{
viewExtraMsg_
=
extraMsg
;
}
void
SetExtraMsg
(
ViewExtraMsg
*
extraMsg
)
{
viewExtraMsg_
=
extraMsg
;
}
/**
* @brief Rotates the view.
...
...
@@ -1488,10 +1353,7 @@ public:
* @since 5.0
* @version 3.0
*/
void
SetFocusable
(
bool
focusable
)
{
focusable_
=
focusable
;
}
void
SetFocusable
(
bool
focusable
)
{
focusable_
=
focusable
;
}
/**
* @brief 获取视图是否可获焦.
...
...
@@ -1500,10 +1362,7 @@ public:
* @since 5.0
* @version 3.0
*/
bool
IsFocusable
()
const
{
return
focusable_
;
}
bool
IsFocusable
()
const
{
return
focusable_
;
}
/**
* @brief 组件获焦响应
...
...
@@ -1535,10 +1394,7 @@ public:
* @since 5.0
* @version 3.0
*/
virtual
bool
OnFocus
(
UIView
&
view
)
{
return
false
;
}
virtual
bool
OnFocus
(
UIView
&
view
)
{
return
false
;
}
/**
* @brief 回调函数,视图失焦时触发.
...
...
@@ -1546,10 +1402,7 @@ public:
* @since 5.0
* @version 3.0
*/
virtual
bool
OnBlur
(
UIView
&
view
)
{
return
false
;
}
virtual
bool
OnBlur
(
UIView
&
view
)
{
return
false
;
}
/**
* @brief 析构函数.
...
...
@@ -1565,10 +1418,7 @@ public:
* @since 5.0
* @version 3.0
*/
void
SetOnFocusListener
(
OnFocusListener
*
onFocusListener
)
{
onFocusListener_
=
onFocusListener
;
}
void
SetOnFocusListener
(
OnFocusListener
*
onFocusListener
)
{
onFocusListener_
=
onFocusListener
;
}
/**
* @brief 获取当前视图焦点改变事件监听者.
...
...
@@ -1576,10 +1426,7 @@ public:
* @since 5.0
* @version 3.0
*/
OnFocusListener
*
GetOnFocusListener
()
const
{
return
onFocusListener_
;
}
OnFocusListener
*
GetOnFocusListener
()
const
{
return
onFocusListener_
;
}
#endif
bool
GetBitmap
(
ImageInfo
&
bitmap
);
...
...
test/uitest/test_event_injector/ui_test_event_injector.cpp
浏览文件 @
7934df5d
...
...
@@ -333,6 +333,7 @@ void UITestEventInjector::SetUpScrollView()
SetLastPos
(
label
);
scrollTestView_
=
new
UIScrollView
();
scrollTestView_
->
SetIntercept
(
true
);
scrollTestView_
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
scrollTestView_
->
SetPosition
(
VIEW_DISTANCE_TO_LEFT_SIDE
,
positionY_
,
SCROLL_WIDTH
,
SCROLL_HEIGHT
);
scrollTestView_
->
SetXScrollBarVisible
(
true
);
...
...
test/uitest/test_slider/ui_test_slider.cpp
浏览文件 @
7934df5d
...
...
@@ -150,6 +150,7 @@ void UITestSlider::SetUp()
if
(
scroll_
==
nullptr
)
{
scroll_
=
new
UIScrollView
();
scroll_
->
SetIntercept
(
true
);
scroll_
->
SetPosition
(
336
,
11
);
// 336: x-coordinate; 11: y-coordinate
scroll_
->
Resize
(
624
,
Screen
::
GetInstance
().
GetHeight
()
-
70
);
// 624: width; 70: decrease height
container_
->
Add
(
scroll_
);
...
...
test/uitest/test_ui_list/ui_test_ui_list.cpp
浏览文件 @
7934df5d
...
...
@@ -129,6 +129,7 @@ void UITestUIList::UIKit_List_Init_Test_Full_Screen_001()
adapter1_
->
SetData
(
adapterData2_
);
UIList
*
list
=
new
UIList
(
UIList
::
VERTICAL
);
list
->
SetIntercept
(
true
);
list
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
list
->
SetPosition
(
VIEW_DISTANCE_TO_LEFT_SIDE
,
VIEW_DISTANCE_TO_TOP_SIDE
,
g_listW
,
g_listH
-
200
);
// 200: mean list reduce height
...
...
@@ -154,6 +155,7 @@ void UITestUIList::UIKit_List_Init_Test_halh_Screen_001()
adapter2_
->
SetData
(
adapterData1_
);
UIList
*
list
=
new
UIList
(
UIList
::
VERTICAL
);
list
->
SetIntercept
(
true
);
list
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
// 2: half of screen width
list
->
SetPosition
(
Screen
::
GetInstance
().
GetWidth
()
/
2
+
VIEW_DISTANCE_TO_LEFT_SIDE
,
VIEW_DISTANCE_TO_TOP_SIDE
,
...
...
@@ -233,6 +235,7 @@ void UITestUIList::UIKit_List_Scroll_Test_Blank_Set_001()
adapter4_
->
SetData
(
adapterData2_
);
UIList
*
list
=
new
UIList
(
UIList
::
VERTICAL
);
list
->
SetIntercept
(
true
);
list
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
list
->
SetPosition
(
VIEW_DISTANCE_TO_LEFT_SIDE
,
g_listH
-
95
,
g_listW
,
g_listH
);
// 95: decrease y-coordinate
list
->
SetAdapter
(
adapter4_
);
...
...
test/uitest/test_ui_scroll_view/ui_test_ui_scroll_view.cpp
浏览文件 @
7934df5d
...
...
@@ -108,6 +108,7 @@ void UITestUIScrollView::UIKit_UIScrollView_Test_bar_001()
positionY_
+=
DELTA_Y_COORDINATE_2
;
UIScrollView
*
scroll
=
new
UIScrollView
();
scroll
->
SetIntercept
(
true
);
scroll
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
scroll
->
SetPosition
(
positionX_
,
positionY_
,
g_scrollW
,
g_scrollH
);
scroll
->
SetXScrollBarVisible
(
false
);
...
...
@@ -133,6 +134,7 @@ void UITestUIScrollView::UIKit_UIScrollView_Test_bar_002()
positionY_
+=
DELTA_Y_COORDINATE_2
;
UIScrollView
*
scroll
=
new
UIScrollView
();
scroll
->
SetIntercept
(
true
);
scroll
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
scroll
->
SetPosition
(
positionX_
,
positionY_
,
g_scrollW
,
g_scrollH
);
scroll
->
SetXScrollBarVisible
(
true
);
...
...
@@ -157,6 +159,7 @@ void UITestUIScrollView::UIKit_UIScrollView_Test_bar_003()
positionY_
+=
DELTA_Y_COORDINATE_2
;
UIScrollView
*
scroll
=
new
UIScrollView
();
scroll
->
SetIntercept
(
true
);
scroll
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
scroll
->
SetPosition
(
positionX_
,
positionY_
,
g_scrollW
,
g_scrollH
);
scroll
->
SetXScrollBarVisible
(
true
);
...
...
@@ -186,6 +189,7 @@ void UITestUIScrollView::UIKit_UIScrollView_Test_bar_004()
positionY_
+=
DELTA_Y_COORDINATE_2
;
UIScrollView
*
scroll
=
new
UIScrollView
();
scroll
->
SetIntercept
(
true
);
scroll
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
scroll
->
SetPosition
(
positionX_
,
positionY_
,
g_scrollW
,
g_scrollH
);
scroll
->
SetXScrollBarVisible
(
true
);
...
...
@@ -212,6 +216,7 @@ void UITestUIScrollView::UIKit_UIScrollView_Test_Scrollable_Set_001()
positionY_
+=
DELTA_Y_COORDINATE_2
;
UIScrollView
*
scroll
=
new
UIScrollView
();
scroll
->
SetIntercept
(
true
);
scroll
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
scroll
->
SetPosition
(
positionX_
,
positionY_
,
g_scrollW
,
g_scrollH
);
scroll
->
SetScrollBlankSize
(
20
);
// 20: means scroll blank size
...
...
@@ -240,6 +245,7 @@ void UITestUIScrollView::UIKit_UIScrollView_Test_Scrollable_Set_002()
positionY_
+=
DELTA_Y_COORDINATE_2
;
UIScrollView
*
scroll
=
new
UIScrollView
();
scroll
->
SetIntercept
(
true
);
scroll
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
scroll
->
SetPosition
(
positionX_
,
positionY_
,
g_scrollW
,
g_scrollH
);
scroll
->
SetHorizontalScrollState
(
true
);
...
...
@@ -267,6 +273,7 @@ void UITestUIScrollView::UIKit_UIScrollView_Test_Scroll_Blank_Set_001()
positionY_
+=
DELTA_Y_COORDINATE_2
;
UIScrollView
*
scroll
=
new
UIScrollView
();
scroll
->
SetIntercept
(
true
);
scroll
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
scroll
->
SetPosition
(
positionX_
,
positionY_
,
g_scrollW
,
g_scrollH
);
scroll
->
SetScrollBlankSize
(
50
);
// (50): means scroll blank size
...
...
@@ -293,6 +300,7 @@ void UITestUIScrollView::UIKit_UIScrollView_Test_Scroll_listener_001()
positionY_
+=
DELTA_Y_COORDINATE_2
;
UIScrollView
*
scroll
=
new
UIScrollView
();
scroll
->
SetIntercept
(
true
);
scroll
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
scroll
->
SetPosition
(
positionX_
,
positionY_
,
g_scrollW
,
g_scrollH
);
container_
->
Add
(
scroll
);
...
...
test/uitest/test_ui_swipe_view/ui_test_ui_swipe_view.cpp
浏览文件 @
7934df5d
...
...
@@ -84,6 +84,7 @@ void UITestUISwipeView::UIKit_Swipe_View_Test_Horizontal_001()
positionY_
+=
g_deltaCoordinateY2
;
UISwipeView
*
swipe
=
new
UISwipeView
(
UISwipeView
::
HORIZONTAL
);
swipe
->
SetIntercept
(
true
);
swipe
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
swipe
->
SetPosition
(
positionX_
,
positionY_
,
g_swipeW
,
g_swipeH
);
swipe
->
SetBlankSize
(
100
);
// 100: is blank size
...
...
@@ -112,6 +113,7 @@ void UITestUISwipeView::UIKit_Swipe_View_Test_Horizontal_002()
positionY_
+=
g_deltaCoordinateY2
;
UISwipeView
*
swipe
=
new
UISwipeView
(
UISwipeView
::
HORIZONTAL
);
swipe
->
SetIntercept
(
true
);
swipe
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
swipe
->
SetPosition
(
positionX_
,
positionY_
,
g_swipeW
,
g_swipeH
);
swipe
->
SetLoopState
(
true
);
...
...
@@ -147,6 +149,7 @@ void UITestUISwipeView::UIKit_Swipe_View_Test_Ver_001()
positionY_
+=
g_deltaCoordinateY2
;
UISwipeView
*
swipe
=
new
UISwipeView
(
UISwipeView
::
VERTICAL
);
swipe
->
SetIntercept
(
true
);
swipe
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
swipe
->
SetPosition
(
positionX_
,
positionY_
,
g_swipeH
,
g_swipeW
);
container_
->
Add
(
swipe
);
...
...
@@ -174,6 +177,7 @@ void UITestUISwipeView::UIKit_Swipe_View_Test_Ver_002()
positionY_
+=
g_deltaCoordinateY2
;
UISwipeView
*
swipe
=
new
UISwipeView
(
UISwipeView
::
VERTICAL
);
swipe
->
SetIntercept
(
true
);
swipe
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
swipe
->
SetPosition
(
positionX_
,
positionY_
,
g_swipeH
,
g_swipeW
);
swipe
->
SetLoopState
(
true
);
...
...
@@ -207,6 +211,7 @@ void UITestUISwipeView::UIKit_Swipe_View_Test_Remove_001()
positionY_
+=
g_deltaCoordinateY2
;
UISwipeView
*
swipe
=
new
UISwipeView
(
UISwipeView
::
HORIZONTAL
);
swipe
->
SetIntercept
(
true
);
swipe
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
swipe
->
SetPosition
(
positionX_
,
positionY_
,
g_swipeH
,
g_swipeW
);
swipe
->
SetLoopState
(
true
);
...
...
@@ -267,6 +272,7 @@ void UITestUISwipeView::UIKit_Swipe_View_Test_Align_001(UISwipeView::AlignMode a
label
->
SetPosition
(
positionX_
,
lastY_
+
g_blank
);
UISwipeView
*
swipe
=
new
UISwipeView
(
UISwipeView
::
HORIZONTAL
);
swipe
->
SetIntercept
(
true
);
swipe
->
SetStyle
(
STYLE_BACKGROUND_COLOR
,
Color
::
Red
().
full
);
// 100: offset
swipe
->
SetPosition
(
positionX_
,
label
->
GetY
()
+
g_blank
+
g_deltaCoordinateY
,
g_swipeW
-
100
,
g_swipeH
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录