@@ -107,6 +107,12 @@ LCUI_Style Widget_GetStyle(LCUI_Widget w, int key)
107
107
return & w -> custom_style -> sheet [key ];
108
108
}
109
109
110
+ LCUI_Style Widget_GetInheritedStyle (LCUI_Widget w , int key )
111
+ {
112
+ assert (key >= 0 && key < w -> inherited_style -> length );
113
+ return & w -> inherited_style -> sheet [key ];
114
+ }
115
+
110
116
void Widget_SetVisibility (LCUI_Widget w , const char * value )
111
117
{
112
118
LCUI_Style s = Widget_GetStyle (w , key_visibility );
@@ -118,16 +124,41 @@ void Widget_SetVisibility(LCUI_Widget w, const char *value)
118
124
Widget_UpdateStyle (w , FALSE);
119
125
}
120
126
121
- void Widget_Show (LCUI_Widget w )
127
+ void Widget_SetVisible (LCUI_Widget w )
122
128
{
123
129
Widget_SetVisibility (w , "visible" );
124
130
}
125
131
126
- void Widget_Hide (LCUI_Widget w )
132
+ void Widget_SetHidden (LCUI_Widget w )
127
133
{
128
134
Widget_SetVisibility (w , "hidden" );
129
135
}
130
136
137
+ void Widget_Show (LCUI_Widget w )
138
+ {
139
+ LCUI_Style s = Widget_GetStyle (w , key_display );
140
+
141
+ if (s -> is_valid && s -> type == LCUI_STYPE_STYLE &&
142
+ s -> val_style == SV_NONE ) {
143
+ Widget_UnsetStyle (w , key_display );
144
+ } else if (!w -> computed_style .visible ) {
145
+ s = Widget_GetInheritedStyle (w , key_display );
146
+ if (s -> is_valid && s -> type == LCUI_STYPE_STYLE &&
147
+ s -> val_style != SV_NONE ) {
148
+ Widget_SetStyle (w , key_display , s -> val_style , style );
149
+ } else {
150
+ Widget_SetStyle (w , key_display , SV_BLOCK , style );
151
+ }
152
+ }
153
+ Widget_UpdateStyle (w , FALSE);
154
+ }
155
+
156
+ void Widget_Hide (LCUI_Widget w )
157
+ {
158
+ Widget_SetStyle (w , key_display , SV_NONE , style );
159
+ Widget_UpdateStyle (w , FALSE);
160
+ }
161
+
131
162
void Widget_SetPosition (LCUI_Widget w , LCUI_StyleValue position )
132
163
{
133
164
Widget_SetStyle (w , key_position , position , style );
0 commit comments