This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
407 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Switch | ||
|
||
Represent the switching between two states or on-off state. | ||
|
||
## Basic | ||
|
||
``` switch-basic-demo-xml | ||
<switch checked="checked" /> | ||
``` | ||
|
||
## Text & icon | ||
|
||
With text and icon. | ||
|
||
``` switch-text-icon-demo-xml | ||
<p> | ||
<switch checked-text="开" unchecked-text="关" checked="checked" /> | ||
</p> | ||
<p> | ||
<switch checked-text="1" unchecked-text="0" /> | ||
</p> | ||
<p> | ||
<switch checked-icon="check" unchecked-icon="close" checked="checked" /> | ||
</p> | ||
``` | ||
|
||
## Disabled | ||
|
||
``` switch-text-icon-demo-xml | ||
<p> | ||
<switch disabled="disabled" /> | ||
</p> | ||
<p> | ||
<switch disabled="disabled" checked="checked" /> | ||
</p> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* | ||
/* | ||
* spinner.h -- Spinner, used to indicate the loading state of a component | ||
* or page. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* switch.h -- Switch, used to represent the switching between two states or | ||
* on-off state. | ||
* | ||
* Copyright (c) 2019, Liu chao <[email protected]> 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. | ||
*/ | ||
|
||
#ifndef LCDESIGN_SWITCH_H_ | ||
#define LCDESIGN_SWITCH_H_ | ||
|
||
LCUI_API void LCDesign_InitSwitch(void); | ||
|
||
LCUI_API LCUI_BOOL Switch_IsChecked(LCUI_Widget w); | ||
|
||
LCUI_API void Switch_SetChecked(LCUI_Widget w, LCUI_BOOL checked); | ||
|
||
LCUI_API void Switch_SetCheckedText(LCUI_Widget w, const char *text); | ||
|
||
LCUI_API void Switch_SetUncheckedText(LCUI_Widget w, const char *text); | ||
|
||
LCUI_API void Switch_SetCheckedIcon(LCUI_Widget w, const char *icon_name); | ||
|
||
LCUI_API void Switch_SetUncheckedIcon(LCUI_Widget w, const char *icon_name); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
.switch-bar { | ||
left: -$switch-icon-width; | ||
height: 100%; | ||
width: $switch-bar-width; | ||
position: relative; | ||
} | ||
|
||
.switch-slider { | ||
background-color: #fff; | ||
width: $switch-slider-width; | ||
height: 100%; | ||
} | ||
|
||
.switch-on-block, | ||
.switch-off-block { | ||
width: $switch-icon-width; | ||
color: #fff; | ||
font-size: $switch-icon-height - 2px; | ||
text-align: center; | ||
line-height: $switch-icon-height; | ||
} | ||
|
||
.switch-on-block, | ||
.switch-off-block, | ||
.switch-slider { | ||
display: inline-block; | ||
} | ||
|
||
.switch { | ||
width: $switch-width; | ||
height: $switch-height; | ||
display: inline-block; | ||
border: $switch-border-width solid $switch-color; | ||
background-color: $switch-color; | ||
|
||
&.checked { | ||
border-color: $switch-checked-color; | ||
background-color: $switch-checked-color; | ||
|
||
.switch-bar { | ||
left: 0; | ||
} | ||
} | ||
&:disabled { | ||
opacity: 0.4; | ||
} | ||
} | ||
|
||
.switch-text { | ||
margin-left: $switch-margin-left; | ||
line-height: $switch-height; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* | ||
/* | ||
* spinner.c -- Spinner, used to indicate the loading state of a component | ||
* or page. | ||
* | ||
|
Oops, something went wrong.