Skip to content

Commit d69fbb0

Browse files
committed
refactor(gui): add widget_background.h
BREAKING CHANGE: The widget background operation interface has been changed to private
1 parent 843232e commit d69fbb0

10 files changed

+56
-17
lines changed

build/windows/LCUI/LCUI.vcxproj

+1
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@
351351
<ClInclude Include="..\..\..\include\LCUI_Build.h" />
352352
<ClInclude Include="..\..\..\src\gui\layout\block.h" />
353353
<ClInclude Include="..\..\..\src\gui\layout\flexbox.h" />
354+
<ClInclude Include="..\..\..\src\gui\widget_background.h" />
354355
<ClInclude Include="..\..\..\src\gui\widget_border.h" />
355356
<ClInclude Include="..\..\..\src\gui\widget_diff.h" />
356357
<ClInclude Include="..\..\..\src\gui\widget_util.h" />

build/windows/LCUI/LCUI.vcxproj.filters

+3
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@
330330
<ClInclude Include="..\..\..\src\gui\widget_border.h">
331331
<Filter>源文件\gui</Filter>
332332
</ClInclude>
333+
<ClInclude Include="..\..\..\src\gui\widget_background.h">
334+
<Filter>源文件\gui</Filter>
335+
</ClInclude>
333336
</ItemGroup>
334337
<ItemGroup>
335338
<ClCompile Include="..\..\..\src\draw\border.c">

include/LCUI/gui/widget_base.h

-15
Original file line numberDiff line numberDiff line change
@@ -399,21 +399,6 @@ LCUI_API void Widget_Destroy(LCUI_Widget w);
399399
LCUI_API void Widget_GetOffset(LCUI_Widget w, LCUI_Widget parent,
400400
float *offset_x, float *offset_y);
401401

402-
LCUI_API void LCUIWidget_InitImageLoader(void);
403-
404-
LCUI_API void LCUIWidget_FreeImageLoader(void);
405-
406-
LCUI_API void Widget_InitBackground(LCUI_Widget w);
407-
408-
LCUI_API void Widget_DestroyBackground(LCUI_Widget w);
409-
410-
LCUI_API void Widget_ComputeBackgroundStyle(LCUI_Widget widget);
411-
412-
LCUI_API void Widget_PaintBakcground(LCUI_Widget w, LCUI_PaintContext paint,
413-
LCUI_WidgetActualStyle style);
414-
415-
LCUI_API void Widget_ComputeBackground(LCUI_Widget w, LCUI_Background *out);
416-
417402
LCUI_API float Widget_GetCanvasWidth(LCUI_Widget widget);
418403

419404
LCUI_API float Widget_GetCanvasHeight(LCUI_Widget widget);

src/gui/Makefile.am

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ widget/anchor.c \
3838
widget/button.c \
3939
widget/canvas.c
4040

41-
4241
noinst_HEADERS =\
4342
widget_border.h \
43+
widget_background.h \
44+
widget_shadow.h \
4445
widget_diff.h \
4546
widget_util.h \
4647
layout/flexbox.h \

src/gui/widget.c

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <LCUI/gui/widget/button.h>
4141
#include <LCUI/gui/widget/sidebar.h>
4242
#include <LCUI/gui/widget/scrollbar.h>
43+
#include "widget_background.h"
4344

4445
void LCUI_InitWidget(void)
4546
{

src/gui/widget_background.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* widget_background.c -- The widget background style processing module.
33
*
4-
* Copyright (c) 2018-2019, Liu chao <lc-soft@live.cn> All rights reserved.
4+
* Copyright (c) 2018-2020, Liu chao <lc-soft@live.cn> All rights reserved.
55
*
66
* Redistribution and use in source and binary forms, with or without
77
* modification, are permitted provided that the following conditions are met:
@@ -36,6 +36,7 @@
3636
#include <LCUI/image.h>
3737
#include <LCUI/gui/metrics.h>
3838
#include <LCUI/gui/widget.h>
39+
#include "widget_background.h"
3940

4041
#define ComputeActual LCUIMetrics_ComputeActual
4142

src/gui/widget_background.h

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* widget_background.c -- The widget background style processing module.
3+
*
4+
* Copyright (c) 2020, Liu chao <lc-soft@live.cn> All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* * Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* * Redistributions in binary form must reproduce the above copyright
12+
* notice, this list of conditions and the following disclaimer in the
13+
* documentation and/or other materials provided with the distribution.
14+
* * Neither the name of LCUI nor the names of its contributors may be used
15+
* to endorse or promote products derived from this software without
16+
* specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28+
* POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
void LCUIWidget_InitImageLoader(void);
32+
33+
void LCUIWidget_FreeImageLoader(void);
34+
35+
void Widget_InitBackground(LCUI_Widget w);
36+
37+
void Widget_DestroyBackground(LCUI_Widget w);
38+
39+
void Widget_ComputeBackgroundStyle(LCUI_Widget widget);
40+
41+
void Widget_PaintBakcground(LCUI_Widget w, LCUI_PaintContext paint,
42+
LCUI_WidgetActualStyle style);
43+
44+
void Widget_ComputeBackground(LCUI_Widget w, LCUI_Background *out);

src/gui/widget_base.c

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <LCUI/gui/widget.h>
3939
#include <LCUI/gui/metrics.h>
4040
#include "widget_util.h"
41+
#include "widget_background.h"
4142

4243
static struct LCUI_WidgetModule {
4344
LCUI_Widget root; /**< 根级部件 */

src/gui/widget_paint.c

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <LCUI/gui/widget.h>
3737
#include <LCUI/display.h>
3838
#include "widget_border.h"
39+
#include "widget_background.h"
3940

4041
//#define DEBUG_FRAME_RENDER
4142
#define ComputeActualPX(VAL) LCUIMetrics_ComputeActual(VAL, LCUI_STYPE_PX)

src/gui/widget_task.c

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <LCUI/gui/metrics.h>
3939
#include "widget_diff.h"
4040
#include "widget_border.h"
41+
#include "widget_background.h"
4142

4243
typedef struct LCUI_WidgetTaskContextRec_ *LCUI_WidgetTaskContext;
4344

0 commit comments

Comments
 (0)