Skip to content

Commit

Permalink
refactor(gui): add widget_shadow.h
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The widget shadow operation interface has been changed to private
  • Loading branch information
lc-soft committed Feb 16, 2020
1 parent 1638d20 commit cf1208e
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 20 deletions.
1 change: 1 addition & 0 deletions build/windows/LCUI/LCUI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@
<ClInclude Include="..\..\..\src\gui\widget_background.h" />
<ClInclude Include="..\..\..\src\gui\widget_border.h" />
<ClInclude Include="..\..\..\src\gui\widget_diff.h" />
<ClInclude Include="..\..\..\src\gui\widget_shadow.h" />
<ClInclude Include="..\..\..\src\gui\widget_util.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions build/windows/LCUI/LCUI.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@
<ClInclude Include="..\..\..\src\gui\widget_background.h">
<Filter>源文件\gui</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\gui\widget_shadow.h">
<Filter>源文件\gui</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\src\draw\border.c">
Expand Down
19 changes: 0 additions & 19 deletions include/LCUI/gui/widget_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,25 +403,6 @@ LCUI_API void Widget_Destroy(LCUI_Widget w);
LCUI_API void Widget_GetOffset(LCUI_Widget w, LCUI_Widget parent,
float *offset_x, float *offset_y);

LCUI_API float Widget_GetCanvasWidth(LCUI_Widget widget);

LCUI_API float Widget_GetCanvasHeight(LCUI_Widget widget);

LCUI_API float Widget_GetBoxShadowOffsetX(LCUI_Widget w);

LCUI_API float Widget_GetBoxShadowOffsetY(LCUI_Widget w);

LCUI_API float Widget_GetCanvasWidth(LCUI_Widget w);

LCUI_API float Widget_GetCanvasWidth(LCUI_Widget w);

LCUI_API void Widget_ComputeBoxShadow(LCUI_Widget w, LCUI_BoxShadow *out);

LCUI_API void Widget_ComputeBoxShadowStyle(LCUI_Widget w);

LCUI_API void Widget_PaintBoxShadow(LCUI_Widget w, LCUI_PaintContext paint,
LCUI_WidgetActualStyle style);

LCUI_API int Widget_Top(LCUI_Widget w);

LCUI_API void Widget_SortChildrenShow(LCUI_Widget w);
Expand Down
1 change: 1 addition & 0 deletions src/gui/widget_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <LCUI/gui/metrics.h>
#include "widget_util.h"
#include "widget_background.h"
#include "widget_shadow.h"

static struct LCUI_WidgetModule {
LCUI_Widget root; /**< 根级部件 */
Expand Down
1 change: 1 addition & 0 deletions src/gui/widget_paint.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <LCUI/display.h>
#include "widget_border.h"
#include "widget_background.h"
#include "widget_shadow.h"

//#define DEBUG_FRAME_RENDER
#define ComputeActualPX(VAL) LCUIMetrics_ComputeActual(VAL, LCUI_STYPE_PX)
Expand Down
3 changes: 2 additions & 1 deletion src/gui/widget_shadow.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* widget_shadow.c -- widget shadow style processing module.
*
* Copyright (c) 2018, Liu chao <lc-soft@live.cn> All rights reserved.
* Copyright (c) 2018-2020, Liu chao <lc-soft@live.cn> All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -34,6 +34,7 @@
#include <LCUI/gui/metrics.h>
#include <LCUI/gui/widget.h>
#include <LCUI/draw/boxshadow.h>
#include "widget_shadow.h"

static float ComputeXMetric(LCUI_Widget w, LCUI_Style s)
{
Expand Down
44 changes: 44 additions & 0 deletions src/gui/widget_shadow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* widget_shadow.c -- widget shadow style processing module.
*
* Copyright (c) 2020, Liu chao <lc-soft@live.cn> All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of LCUI nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

float Widget_GetCanvasWidth(LCUI_Widget widget);

float Widget_GetCanvasHeight(LCUI_Widget widget);

float Widget_GetBoxShadowOffsetX(LCUI_Widget w);

float Widget_GetBoxShadowOffsetY(LCUI_Widget w);

void Widget_ComputeBoxShadow(LCUI_Widget w, LCUI_BoxShadow *out);

void Widget_ComputeBoxShadowStyle(LCUI_Widget w);

void Widget_PaintBoxShadow(LCUI_Widget w, LCUI_PaintContext paint,
LCUI_WidgetActualStyle style);
1 change: 1 addition & 0 deletions src/gui/widget_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "widget_diff.h"
#include "widget_border.h"
#include "widget_background.h"
#include "widget_shadow.h"

typedef struct LCUI_WidgetTaskContextRec_ *LCUI_WidgetTaskContext;

Expand Down

0 comments on commit cf1208e

Please sign in to comment.