`s.
5 |
6 | .nav-link {
7 | display: block;
8 | padding: $nav-link-padding-y $nav-link-padding-x;
9 |
10 | // Disabled state lightens text
11 | &.disabled {
12 | color: $nav-link-disabled-color;
13 | }
14 | }
15 |
16 | .subnav {
17 | .nav-item * {
18 | font-size: rem2px(.85);
19 | }
20 | }
21 |
22 | //
23 | // Tabs
24 | //
25 |
26 | .nav-tabs {
27 | border-bottom: $nav-tabs-border-width solid $nav-tabs-border-color;
28 |
29 | .nav-item {
30 | margin-bottom: -$nav-tabs-border-width;
31 | }
32 |
33 | .nav-link {
34 | border: $nav-tabs-border-width solid transparent;
35 |
36 | @include hover-focus {
37 | border-color: $nav-tabs-link-hover-border-color $nav-tabs-link-hover-border-color $nav-tabs-border-color;
38 | }
39 |
40 | &.disabled {
41 | color: $nav-link-disabled-color;
42 | background-color: transparent;
43 | border-color: transparent;
44 | }
45 | }
46 |
47 | .nav-link.active,
48 | .nav-item.show .nav-link {
49 | color: $nav-tabs-link-active-color;
50 | background-color: $nav-tabs-link-active-bg;
51 | border-color: $nav-tabs-link-active-border-color $nav-tabs-link-active-border-color $nav-tabs-link-active-bg;
52 | }
53 |
54 | .dropdown-menu {
55 | // Make dropdown border overlap tab border
56 | margin-top: -$nav-tabs-border-width;
57 | }
58 | }
59 |
60 | // Tabbable tabs
61 | //
62 | // Hide tabbable panes to start, show them when `.active`
63 |
64 | .tab-content {
65 | .tab-pane {
66 | display: none;
67 |
68 | &.active {
69 | display: block;
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/scss/_navbar.scss:
--------------------------------------------------------------------------------
1 | // Contents
2 | //
3 | // Navbar
4 | // Navbar brand
5 | // Navbar nav
6 | // Navbar text
7 | // Navbar divider
8 | // Responsive navbar
9 | // Navbar position
10 | // Navbar themes
11 |
12 |
13 | // Navbar
14 | //
15 | // Provide a static navbar from which we expand to create full-width, fixed, and
16 | // other navbar variations.
17 |
18 | .navbar {
19 | padding: $navbar-padding-y $navbar-padding-x;
20 | }
21 |
22 |
23 | // Navbar brand
24 | //
25 | // Used for brand, project, or site names.
26 |
27 | .navbar-brand {
28 | display: inline-block;
29 | padding-top: $navbar-brand-padding-y;
30 | padding-bottom: $navbar-brand-padding-y;
31 | margin-right: $navbar-padding-x;
32 | font-size: $navbar-brand-font-size;
33 | line-height: inherit;
34 | white-space: nowrap;
35 | }
36 |
37 |
38 | // Navbar nav
39 | //
40 | // Custom navbar navigation (doesn't require `.nav`, but does make use of `.nav-link`).
41 |
42 | .navbar-nav {
43 | display: inline-block;
44 |
45 | .nav-item {
46 | display: inline-block;
47 | }
48 | .nav-link {
49 | padding-right: rem2px(.5);
50 | padding-left: rem2px(.5);
51 | }
52 | }
53 |
54 |
55 | // Navbar text
56 | //
57 | //
58 |
59 | .navbar-text {
60 | display: inline-block;
61 | padding-top: $nav-link-padding-y;
62 | padding-bottom: $nav-link-padding-y;
63 | }
64 |
65 | // Navbar themes
66 | //
67 | // Styles for switching between navbars with light or dark background.
68 |
69 | // Dark links against a light background
70 | .navbar-light {
71 | .navbar-brand {
72 | color: $navbar-light-active-color;
73 |
74 | @include hover-focus {
75 | color: $navbar-light-active-color;
76 | }
77 | }
78 |
79 | .navbar-nav {
80 | .nav-link {
81 | @include text {
82 | color: $navbar-light-color;
83 | }
84 |
85 | @include hover-focus {
86 | @include text {
87 | color: $navbar-light-hover-color;
88 | }
89 | }
90 |
91 | &.disabled {
92 | @include text {
93 | color: $navbar-light-disabled-color;
94 | }
95 | }
96 | }
97 |
98 | .show .nav-link,
99 | .active .nav-link,
100 | .nav-link.show,
101 | .nav-link.active {
102 | @include text {
103 | color: $navbar-light-active-color;
104 | }
105 | }
106 | }
107 |
108 | .navbar-text {
109 | color: $navbar-light-color;
110 | a {
111 | color: $navbar-light-active-color;
112 |
113 | @include hover-focus {
114 | color: $navbar-light-active-color;
115 | }
116 | }
117 | }
118 | }
119 |
120 | // White links against a dark background
121 | .navbar-dark {
122 | .navbar-brand {
123 | color: $navbar-dark-active-color;
124 |
125 | @include hover-focus {
126 | color: $navbar-dark-active-color;
127 | }
128 | }
129 |
130 | .navbar-nav {
131 | .nav-link {
132 | @include text {
133 | color: $navbar-dark-color;
134 | }
135 |
136 | @include hover-focus {
137 | @include text {
138 | color: $navbar-dark-hover-color;
139 | }
140 | }
141 |
142 | &.disabled {
143 | @include text {
144 | color: $navbar-dark-disabled-color;
145 | }
146 | }
147 | }
148 |
149 | .show .nav-link,
150 | .active .nav-link,
151 | .nav-link.show,
152 | .nav-link.active {
153 | @include text {
154 | color: $navbar-dark-active-color;
155 | }
156 | }
157 | }
158 |
159 | .navbar-text {
160 | color: $navbar-dark-color;
161 | a {
162 | color: $navbar-dark-active-color;
163 |
164 | @include hover-focus {
165 | color: $navbar-dark-active-color;
166 | }
167 | }
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/src/scss/_notification.scss:
--------------------------------------------------------------------------------
1 | .notification-container {
2 | width: 100%;
3 | max-width: 384px;
4 | padding: $box-shadow-wrapper-padding;
5 | z-index: $zindex-notification-notice;
6 | position: absolute;
7 | pointer-events: none;
8 | }
9 |
10 | .notification-notice {
11 | padding: $notification-notice-padding-y $notification-notice-padding-x;
12 | background-color: $notification-notice-bg;
13 | border: $notification-notice-border;
14 | pointer-events: auto;
15 | margin-bottom: $notification-margin-bottom;
16 |
17 | @include box-shadow($box-shadow);
18 | @include border-radius($border-radius);
19 | }
20 |
21 | .notification-notice-close {
22 | top: $notification-notice-padding-y;
23 | right: $notification-notice-padding-x;
24 | position: absolute;
25 | opacity: .5;
26 | line-height: 1;
27 | color: $close-color;
28 | font-size: $close-font-size;
29 |
30 | @include hover-focus {
31 | color: $close-color;
32 | opacity: .75;
33 | }
34 | }
35 |
36 | .notification-notice-title {
37 | font-size: $notification-notice-title-size;
38 | margin-bottom: $notification-notice-title-margin-bottom;
39 | }
40 |
41 | .notification-notice-description {
42 | color: $notification-color;
43 | }
44 |
45 | .notification-notice-icon {
46 | width: $notification-notice-icon-size;
47 | height: $notification-notice-icon-size;
48 | font-size: $notification-notice-icon-size;
49 | line-height: $notification-notice-icon-size;
50 | top: $notification-notice-padding-y;
51 | left: $notification-notice-padding-x;
52 | position: absolute;
53 | }
54 |
55 | .notification-notice-has-icon .notification-notice-content {
56 | padding-left: $notification-notice-icon-size + map-get($spacers, 2);
57 | }
58 |
59 | .notification-notice-icon-success {
60 | color: $green;
61 | }
62 |
63 | .notification-notice-icon-info {
64 | color: $blue;
65 | }
66 |
67 | .notification-notice-icon-warning {
68 | color: $orange;
69 | }
70 |
71 | .notification-notice-icon-error {
72 | color: $red;
73 | }
74 |
75 | .notification-container-top-left {
76 | top: 0;
77 | left: 0;
78 | }
79 |
80 | .notification-container-top-right {
81 | top: 0;
82 | right: 0;
83 | }
84 |
85 | .notification-container-bottom-left {
86 | bottom: 0;
87 | left: 0;
88 | }
89 |
90 | .notification-container-bottom-right {
91 | bottom: 0;
92 | right: 0;
93 | }
94 |
95 |
--------------------------------------------------------------------------------
/src/scss/_radio.scss:
--------------------------------------------------------------------------------
1 | .radio-inner {
2 | width: $radio-size;
3 | height: $radio-size;
4 | border: $radio-border-width solid $radio-border-color;
5 | border-radius: $radio-size / 2;
6 | display: inline-block;
7 | vertical-align: middle;
8 | }
9 |
10 | .radio-inner-icon {
11 | background-color: $radio-checked-color;
12 | width: $radio-inner-icon-size;
13 | height: $radio-inner-icon-size;
14 | border-radius: $radio-inner-icon-size / 2;
15 | margin: $radio-inner-icon-margin;
16 | display: none;
17 | }
18 |
19 | .radio-text {
20 | padding: 0 map-get($spacers, 2);
21 | }
22 |
23 | radio {
24 | display: inline-block;
25 | margin-right: map-get($spacers, 2);
26 |
27 | &:hover .radio-inner {
28 | border-color: $radio-checked-color;
29 | }
30 |
31 | &.checked {
32 | .radio-inner {
33 | border-color: $radio-checked-color;
34 | }
35 | .radio-inner-icon {
36 | display: block;
37 | }
38 | }
39 | &:disabled {
40 | .radio-inner {
41 | border-color: $radio-border-color;
42 | background-color: $radio-disabled-bg;
43 | }
44 | .radio-inner-icon {
45 | background-color: $radio-disabled-color;
46 | }
47 | .radio-text {
48 | color: $radio-disabled-color;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/scss/_rate.scss:
--------------------------------------------------------------------------------
1 | rate {
2 | display: inline-block;
3 |
4 | icon,
5 | span {
6 | font-size: $rate-star-size;
7 | display: inline-block;
8 | color: $rate-star-color;
9 | margin-right: map-get($spacers, 2);
10 | }
11 | }
12 |
13 | .rate-star-void {
14 | color: $rate-star-void-color;
15 | }
16 |
--------------------------------------------------------------------------------
/src/scss/_reboot.scss:
--------------------------------------------------------------------------------
1 | * {
2 | box-sizing: border-box;
3 | }
4 |
5 | //
6 | // Typography
7 | //
8 |
9 | // Remove top margins from headings
10 | //
11 | // By default, ``-`` all receive top and bottom margins. We nuke the top
12 | // margin for easier control within type scales as it avoids margin collapsing.
13 | // stylelint-disable selector-list-comma-newline-after
14 | h1, h2, h3, h4, h5, h6 {
15 | margin-top: 0;
16 | margin-bottom: $headings-margin-bottom;
17 | }
18 |
19 | // Reset margins on paragraphs
20 | //
21 | // Similarly, the top margin on `
`s get reset. However, we also reset the
22 | // bottom margin to use `rem` units instead of `em`.
23 | p {
24 | margin-top: 0;
25 | margin-bottom: $paragraph-margin-bottom;
26 | }
27 |
28 | #{$text-elements}, .text {
29 | @include text-default-style;
30 | }
31 |
32 | span, small, strong, b, cite, img, text, textview {
33 | display: inline-block;
34 | }
35 |
--------------------------------------------------------------------------------
/src/scss/_switch.scss:
--------------------------------------------------------------------------------
1 | .switch-inner-bar {
2 | left: -$switch-icon-width;
3 | height: 100%;
4 | width: $switch-bar-width;
5 | position: relative;
6 | }
7 |
8 | .switch-inner-slider {
9 | background-color: #fff;
10 | width: $switch-slider-width;
11 | border-radius: $switch-border-radius;
12 | height: 100%;
13 | }
14 |
15 | .switch-inner-on-block,
16 | .switch-inner-off-block {
17 | width: $switch-icon-width;
18 | color: #fff;
19 | font-size: $switch-icon-height - 2px;
20 | text-align: center;
21 | line-height: $switch-icon-height;
22 | }
23 |
24 | .switch-inner-on-block,
25 | .switch-inner-off-block,
26 | .switch-inner-slider {
27 | display: inline-block;
28 | }
29 |
30 | .switch-inner {
31 | width: $switch-width;
32 | height: $switch-height;
33 | display: inline-block;
34 | border: $switch-border-width solid $switch-color;
35 | border-radius: $switch-border-radius;
36 | background-color: $switch-color;
37 | }
38 |
39 | .switch-text {
40 | margin-left: $switch-margin-left;
41 | line-height: $switch-height;
42 | }
43 |
44 | .switch {
45 | &.checked {
46 | .switch-inner {
47 | border-color: $switch-checked-color;
48 | background-color: $switch-checked-color;
49 | }
50 |
51 | .switch-inner-bar {
52 | left: 0;
53 | }
54 | }
55 | &:disabled {
56 | opacity: 0.4;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/scss/_tooltip.scss:
--------------------------------------------------------------------------------
1 | // Base class
2 | .tooltip {
3 | position: absolute;
4 | z-index: $zindex-tooltip;
5 | display: block;
6 | margin: $tooltip-margin;
7 | font-size: $tooltip-font-size;
8 | opacity: 0;
9 | pointer-events: none;
10 |
11 | &.show { opacity: $tooltip-opacity; }
12 |
13 | .tooltip-arrow {
14 | position: absolute;
15 | display: block;
16 | width: $tooltip-arrow-width;
17 | height: $tooltip-arrow-height;
18 | border-color: transparent;
19 | }
20 | }
21 |
22 | .tooltip-top {
23 | padding: $tooltip-arrow-height 0;
24 |
25 | .tooltip-arrow {
26 | bottom: 0;
27 | left: 50%;
28 | margin-left: -$tooltip-arrow-width / 2;
29 | border-top-width: $tooltip-arrow-height;
30 | border-right-width: $tooltip-arrow-width / 2;
31 | border-left-width: $tooltip-arrow-width / 2;
32 | border-bottom-width: 0;
33 | border-top-color: $tooltip-arrow-color;
34 | }
35 | }
36 |
37 | .tooltip-right {
38 | padding: 0 $tooltip-arrow-height;
39 |
40 | .tooltip-arrow {
41 | left: 0;
42 | top: 50%;
43 | margin-top: -$tooltip-arrow-width / 2;
44 | width: $tooltip-arrow-height;
45 | height: $tooltip-arrow-width;
46 | border-top-width: $tooltip-arrow-width / 2;
47 | border-right-width: $tooltip-arrow-height;
48 | border-bottom-width: $tooltip-arrow-width / 2;
49 | border-left-width: 0;
50 | border-right-color: $tooltip-arrow-color;
51 | }
52 | }
53 |
54 | .tooltip-bottom {
55 | padding: $tooltip-arrow-height 0;
56 |
57 | .tooltip-arrow {
58 | top: 0;
59 | left: 50%;
60 | margin-left: -$tooltip-arrow-width / 2;
61 | border-top-width: 0;
62 | border-right-width: $tooltip-arrow-width / 2;
63 | border-bottom-width: $tooltip-arrow-height;
64 | border-left-width: $tooltip-arrow-width / 2;
65 | border-bottom-color: $tooltip-arrow-color;
66 | }
67 | }
68 |
69 | .tooltip-left {
70 | padding: 0 $tooltip-arrow-height;
71 |
72 | .tooltip-arrow {
73 | top: 50%;
74 | right: 0;
75 | width: $tooltip-arrow-height;
76 | height: $tooltip-arrow-width;
77 | margin-top: -$tooltip-arrow-width / 2;
78 | border-top-width: $tooltip-arrow-width / 2;
79 | border-right-width: 0;
80 | border-bottom-width: $tooltip-arrow-width / 2;
81 | border-left-width: $tooltip-arrow-height;
82 | border-left-color: $tooltip-arrow-color;
83 | }
84 | }
85 |
86 | // Wrapper for the tooltip content
87 | .tooltip-inner {
88 | max-width: $tooltip-max-width;
89 | padding: $tooltip-padding-y $tooltip-padding-x;
90 | color: $tooltip-color;
91 | text-align: center;
92 | background-color: $tooltip-bg;
93 | @include border-radius($tooltip-border-radius);
94 | }
95 |
--------------------------------------------------------------------------------
/src/scss/_type.scss:
--------------------------------------------------------------------------------
1 | //
2 | // Headings
3 | //
4 |
5 | h1, h2, h3, h4, h5, h6,
6 | .h1, .h2, .h3, .h4, .h5, .h6 {
7 | margin-bottom: $headings-margin-bottom;
8 | font-family: $headings-font-family;
9 | font-weight: $headings-font-weight;
10 | line-height: $headings-line-height;
11 | color: $headings-color;
12 | }
13 |
14 | h1, .h1 { font-size: $h1-font-size; }
15 | h2, .h2 { font-size: $h2-font-size; }
16 | h3, .h3 { font-size: $h3-font-size; }
17 | h4, .h4 { font-size: $h4-font-size; }
18 | h5, .h5 { font-size: $h5-font-size; }
19 | h6, .h6 { font-size: $h6-font-size; }
20 |
21 | .lead {
22 | font-size: $lead-font-size;
23 | font-weight: $lead-font-weight;
24 | }
25 |
26 | //
27 | // Horizontal rules
28 | //
29 |
30 | hr {
31 | margin-top: rem2px(1);
32 | margin-bottom: rem2px(1);
33 | border: 0;
34 | border-top: $hr-border-width solid $hr-border-color;
35 | }
36 |
37 |
38 | //
39 | // Emphasis
40 | //
41 |
42 | small,
43 | .small {
44 | font-size: $small-font-size;
45 | font-weight: $font-weight-normal;
46 | }
47 |
48 | //
49 | // Code
50 | //
51 |
52 | code-block, pre {
53 | font-family: $font-family-monospace;
54 | }
55 |
56 |
57 | //
58 | // Misc
59 | //
60 |
61 | blockquote, .blockquote {
62 | margin-bottom: rem2px(1);
63 | padding: rem2px(.4) rem2px(.8);
64 | border-left: $blockquote-border-width solid $blockquote-border-color;
65 | }
66 |
67 | i, cite {
68 | font-style: italic;
69 | }
70 |
71 | strong, b {
72 | font-weight: $font-weight-bold;
73 | }
74 |
--------------------------------------------------------------------------------
/src/scss/_utilities.scss:
--------------------------------------------------------------------------------
1 | @import "utilities/background";
2 | @import "utilities/float";
3 | @import "utilities/spacing";
4 | @import "utilities/layout";
5 | @import "utilities/text";
6 |
--------------------------------------------------------------------------------
/src/scss/font/_ubuntu.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: Noto Sans CJK;
3 | src: url("/usr/share/fonts/opentype/noto/NotoSansCJK.ttc");
4 | }
5 | @font-face {
6 | font-family: WenQuanYi Micro Hei;
7 | src: url("/usr/share/fonts/opentype/noto/NotoSansCJK.ttc");
8 | }
9 | @font-face {
10 | font-family: Ubuntu Mono;
11 | src: url("/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-B.ttf");
12 | }
13 | @font-face {
14 | font-family: Ubuntu Mono;
15 | src: url("/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-BI.ttf");
16 | }
17 | @font-face {
18 | font-family: Ubuntu Mono;
19 | src: url("/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf");
20 | }
21 | @font-face {
22 | font-family: Ubuntu Mono;
23 | src: url("/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-RI.ttf");
24 | }
25 | @font-face {
26 | font-family: Ubuntu;
27 | src: url("/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf");
28 | }
29 | @font-face {
30 | font-family: Ubuntu;
31 | src: url("/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-RI.ttf");
32 | }
33 | @font-face {
34 | font-family: Ubuntu;
35 | src: url("/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf");
36 | }
37 | @font-face {
38 | font-family: Ubuntu;
39 | src: url("/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-BI.ttf");
40 | }
41 | @font-face {
42 | font-family: Ubuntu;
43 | src: url("/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-L.ttf");
44 | }
45 | @font-face {
46 | font-family: Ubuntu;
47 | src: url("/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-LI.ttf");
48 | }
49 | @font-face {
50 | font-family: Ubuntu;
51 | src: url("/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-M.ttf");
52 | }
53 | @font-face {
54 | font-family: Ubuntu;
55 | src: url("/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-MI.ttf");
56 | }
57 | @font-face {
58 | font-family: Liberation Mono;
59 | src: url("/usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf");
60 | }
61 | @font-face {
62 | font-family: Liberation Mono;
63 | src: url("/usr/share/fonts/truetype/liberation/LiberationMono-Italic.ttf");
64 | }
65 | @font-face {
66 | font-family: Liberation Mono;
67 | src: url("/usr/share/fonts/truetype/liberation/LiberationMono-BoldItalic.ttf");
68 | }
69 | @font-face {
70 | font-family: Liberation Mono;
71 | src: url("/usr/share/fonts/truetype/liberation/LiberationMono-Bold.ttf");
72 | }
73 |
--------------------------------------------------------------------------------
/src/scss/font/_windows.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: Segoe UI;
3 | src: url("C:/windows/fonts/segoeui.ttf");
4 | }
5 | @font-face {
6 | font-family: Segoe UI;
7 | src: url("C:/windows/fonts/segoeuib.ttf");
8 | }
9 | @font-face {
10 | font-family: Segoe UI;
11 | src: url("C:/windows/fonts/segoeuii.ttf");
12 | }
13 | @font-face {
14 | font-family: Segoe UI;
15 | src: url("C:/windows/fonts/segoeuil.ttf");
16 | }
17 | @font-face {
18 | font-family: Segoe UI;
19 | src: url("C:/windows/fonts/segoeuisl.ttf");
20 | }
21 | @font-face {
22 | font-family: Segoe UI;
23 | src: url("C:/windows/fonts/segoeuiz.ttf");
24 | }
25 | @font-face {
26 | font-family: Segoe UI;
27 | src: url("C:/windows/fonts/seguibl.ttf");
28 | }
29 | @font-face {
30 | font-family: Segoe UI;
31 | src: url("C:/windows/fonts/seguili.ttf");
32 | }
33 | @font-face {
34 | font-family: Segoe UI;
35 | src: url("C:/windows/fonts/seguisb.ttf");
36 | }
37 | @font-face {
38 | font-family: Segoe UI;
39 | src: url("C:/windows/fonts/seguisbi.ttf");
40 | }
41 |
42 | @font-face {
43 | font-family: Consolas;
44 | src: url("C:/windows/fonts/consola.ttf");
45 | }
46 | @font-face {
47 | font-family: Consolas;
48 | src: url("C:/windows/fonts/consolab.ttf");
49 | }
50 | @font-face {
51 | font-family: Consolas;
52 | src: url("C:/windows/fonts/consolai.ttf");
53 | }
54 | @font-face {
55 | font-family: Consolas;
56 | src: url("C:/windows/fonts/consolaz.ttf");
57 | }
58 |
59 | @font-face {
60 | font-family: Arial;
61 | src: url("C:/windows/fonts/arial.ttf");
62 | }
63 | @font-face {
64 | font-family: Arial;
65 | src: url("C:/windows/fonts/arialbd.ttf");
66 | }
67 | @font-face {
68 | font-family: Arial;
69 | src: url("C:/windows/fonts/ariblk.ttf");
70 | }
71 | @font-face {
72 | font-family: Arial;
73 | src: url("C:/windows/fonts/arialbi.ttf");
74 | }
75 | @font-face {
76 | font-family: Arial;
77 | src: url("C:/windows/fonts/ariali.ttf");
78 | }
79 |
80 | @font-face {
81 | font-family: Malgun Gothic;
82 | src: url("C:/windows/fonts/malgun.ttf");
83 | }
84 | @font-face {
85 | font-family: Malgun Gothic;
86 | src: url("C:/windows/fonts/malgunbd.ttf");
87 | }
88 | @font-face {
89 | font-family: Malgun Gothic;
90 | src: url("C:/windows/fonts/malgunsl.ttf");
91 | }
92 |
93 | @font-face {
94 | font-family: Microsoft Yahei;
95 | src: url("C:/windows/fonts/msyh.ttc");
96 | }
97 | @font-face {
98 | font-family: Microsoft Yahei;
99 | src: url("C:/windows/fonts/msyhbd.ttc");
100 | }
101 | @font-face {
102 | font-family: Microsoft Yahei;
103 | src: url("C:/windows/fonts/msyhl.ttc");
104 | }
105 |
--------------------------------------------------------------------------------
/src/scss/iconfont/_core.scss:
--------------------------------------------------------------------------------
1 | .#{$mdi-css-prefix},
2 | .#{$mdi-css-prefix}-set {
3 | display: inline-block;
4 | font-family: #{$mdi-font-name};
5 | }
6 |
--------------------------------------------------------------------------------
/src/scss/iconfont/_extras.scss:
--------------------------------------------------------------------------------
1 | $sizes: 18 24 36 48;
2 | @each $size in $sizes {
3 | .#{$mdi-css-prefix}-#{$size}px {
4 | &.#{$mdi-css-prefix}-set,
5 | &.#{$mdi-css-prefix} {
6 | font-size: $size * 1px;
7 | }
8 | }
9 | }
10 |
11 | .#{$mdi-css-prefix}-dark {
12 | color: rgba(0, 0, 0, 0.54);
13 |
14 | &.#{$mdi-css-prefix} {
15 | color: rgba(0, 0, 0, 0.26);
16 | }
17 | }
18 | .#{$mdi-css-prefix}-light {
19 | color: rgba(255, 255, 255, 1);
20 |
21 | &.#{$mdi-css-prefix}-inactive {
22 | color: rgba(255, 255, 255, 0.3);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/scss/iconfont/_icons.scss:
--------------------------------------------------------------------------------
1 | @each $key, $value in $mdi-icons {
2 | .#{$mdi-css-prefix}-#{$key} {
3 | content: char($value);
4 | }
5 | }
6 |
7 | .#{$mdi-css-prefix}-blank {
8 | content: "\F68C";
9 | visibility: hidden;
10 | }
11 |
--------------------------------------------------------------------------------
/src/scss/iconfont/_path.scss:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: '#{$mdi-font-name}';
3 | src: url('#{$mdi-font-path}/iconfont.ttf');
4 | font-weight: normal;
5 | font-style: normal;
6 | }
7 |
--------------------------------------------------------------------------------
/src/scss/lc-design.scss:
--------------------------------------------------------------------------------
1 | @import "functions";
2 | @import "variables";
3 | @import "mixins";
4 | @import "reboot";
5 | @import "font";
6 | @import "iconfont";
7 | @import "type";
8 | @import "grid";
9 | @import "alert";
10 | @import "forms";
11 | @import "nav";
12 | @import "navbar";
13 | @import "buttons";
14 | @import "checkbox";
15 | @import "radio";
16 | @import "dropdown";
17 | @import "list-group";
18 | @import "rate";
19 | @import "switch";
20 | @import "close";
21 | @import "modal";
22 | @import "message";
23 | @import "notification";
24 | @import "tooltip";
25 | @import "utilities";
26 |
--------------------------------------------------------------------------------
/src/scss/mixins/_alert.scss:
--------------------------------------------------------------------------------
1 | @mixin alert-variant($background, $border, $color) {
2 | @include text-default-style;
3 | @include gradient-bg($background);
4 | @include text {
5 | color: $color;
6 | }
7 | border-color: $border;
8 |
9 | hr {
10 | border-top-color: darken($border, 5%);
11 | }
12 |
13 | .alert-link {
14 | color: darken($color, 10%);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/scss/mixins/_background-variant.scss:
--------------------------------------------------------------------------------
1 | // Contextual backgrounds
2 |
3 | @mixin bg-variant($parent, $color) {
4 | #{$parent} {
5 | background-color: $color;
6 | }
7 | a#{$parent} {
8 | @include hover-focus {
9 | background-color: darken($color, 10%);
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/scss/mixins/_border-radius.scss:
--------------------------------------------------------------------------------
1 | // Single side border-radius
2 |
3 | @mixin border-radius($radius: $border-radius) {
4 | @if $enable-rounded {
5 | border-radius: $radius;
6 | }
7 | }
8 |
9 | @mixin border-top-radius($radius) {
10 | @if $enable-rounded {
11 | border-top-left-radius: $radius;
12 | border-top-right-radius: $radius;
13 | }
14 | }
15 |
16 | @mixin border-right-radius($radius) {
17 | @if $enable-rounded {
18 | border-top-right-radius: $radius;
19 | border-bottom-right-radius: $radius;
20 | }
21 | }
22 |
23 | @mixin border-bottom-radius($radius) {
24 | @if $enable-rounded {
25 | border-bottom-right-radius: $radius;
26 | border-bottom-left-radius: $radius;
27 | }
28 | }
29 |
30 | @mixin border-left-radius($radius) {
31 | @if $enable-rounded {
32 | border-top-left-radius: $radius;
33 | border-bottom-left-radius: $radius;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/scss/mixins/_box-shadow.scss:
--------------------------------------------------------------------------------
1 | @mixin box-shadow($shadow...) {
2 | @if $enable-shadows {
3 | box-shadow: $shadow;
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/src/scss/mixins/_buttons.scss:
--------------------------------------------------------------------------------
1 | // Button variants
2 | //
3 | // Easily pump out default styles, as well as :hover, :focus, :active,
4 | // and disabled options for all buttons
5 |
6 | @mixin button-variant($background, $border, $hover-background: lighten($background, 10%), $hover-border: lighten($border, 10%), $active-background: darken($background, 10%), $active-border: darken($border, 10%)) {
7 | border-color: $border;
8 | @include text {
9 | color: color-yiq($background);
10 | }
11 | @include gradient-bg($background);
12 | @include box-shadow($btn-box-shadow);
13 |
14 | &:hover, &:hover:focus {
15 | border-color: $hover-border;
16 |
17 | @include gradient-bg($hover-background);
18 | @include text {
19 | color: color-yiq($hover-background);
20 | }
21 | }
22 |
23 | &:active, &.active {
24 | &, &:focus {
25 | background-color: $active-background;
26 | border-color: $active-border;
27 |
28 | @include text {
29 | color: color-yiq($active-background);
30 | }
31 | }
32 | }
33 |
34 | &:focus,
35 | &.focus {
36 | background-color: $background;
37 | box-shadow: 0 0 0 $input-btn-focus-width rgba($border, .2);
38 |
39 | @include text {
40 | color: color-yiq($background);
41 | }
42 | }
43 |
44 | // Disabled comes first so active can properly restyle
45 | &.disabled,
46 | &:disabled {
47 | background-color: $background;
48 | border-color: $border;
49 | }
50 | }
51 |
52 | @mixin button-outline-variant($color, $color-hover: #fff) {
53 | background-color: transparent;
54 | background-image: none;
55 | border-color: $color;
56 |
57 | @include text {
58 | color: $color;
59 | }
60 |
61 | &:hover, &:focus:hover {
62 | background-color: $color;
63 | border-color: $color;
64 |
65 | @include text {
66 | color: $color-hover;
67 | }
68 | }
69 |
70 | &:active,
71 | &.active {
72 | &, &:focus {
73 | background-color: darken($color, 5);
74 | border-color: darken($color, 4);
75 |
76 | @include text {
77 | color: $color-hover;
78 | }
79 | }
80 | }
81 |
82 | &:focus,
83 | &.focus {
84 | border-color: $color;
85 | background-color: transparent;
86 | box-shadow: 0 0 0 $input-btn-focus-width rgba($color, .5);
87 |
88 | @include text {
89 | color: $color;
90 | }
91 | }
92 |
93 | &.disabled,
94 | &:disabled {
95 | background-color: transparent;
96 |
97 | @include text {
98 | color: $color;
99 | }
100 | }
101 | }
102 |
103 | // Button sizes
104 | @mixin button-size($padding-y, $padding-x, $font-size, $line-height, $border-radius) {
105 | padding: $padding-y $padding-x;
106 | @include border-radius($border-radius);
107 | @include text {
108 | font-size: $font-size;
109 | line-height: $line-height;
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/src/scss/mixins/_float.scss:
--------------------------------------------------------------------------------
1 | @mixin float-right {
2 | right: 0;
3 | position: absolute;
4 | }
5 |
6 | @mixin float-left {
7 | left: 0;
8 | position: absolute;
9 | }
10 |
11 | @mixin float-top {
12 | top: 0;
13 | left: 0;
14 | right: auto;
15 | bottom: auto;
16 | position: absolute;
17 | }
18 |
19 | @mixin float-bottom {
20 | left: 0;
21 | bottom: 0;
22 | top: auto;
23 | right: auto;
24 | position: absolute;
25 | }
26 |
27 | @mixin float-none {
28 | top: auto;
29 | left: auto;
30 | right: auto;
31 | bottom: auto;
32 | position: static;
33 | }
34 |
--------------------------------------------------------------------------------
/src/scss/mixins/_forms.scss:
--------------------------------------------------------------------------------
1 | // Form control focus state
2 | //
3 | // Generate a customized focus state and for any input with the specified color,
4 | // which defaults to the `$input-focus-border-color` variable.
5 | //
6 | // We highly encourage you to not customize the default value, but instead use
7 | // this to tweak colors on an as-needed basis. This aesthetic change is based on
8 | // WebKit's default styles, but applicable to a wider range of browsers. Its
9 | // usability and accessibility should be taken into account with any change.
10 | //
11 | // Example usage: change the default blue border and shadow to white for better
12 | // contrast against a dark gray background.
13 | @mixin form-control-focus() {
14 | &:focus {
15 | color: $input-focus-color;
16 | background-color: $input-focus-bg;
17 | border-color: $input-focus-border-color;
18 | // Avoid using mixin so we can pass custom focus shadow properly
19 | @if $enable-shadows {
20 | box-shadow: 0 0 0 $input-focus-width rgba($input-focus-border-color, .2);
21 | } @else {
22 | box-shadow: $input-focus-box-shadow;
23 | }
24 | }
25 | }
26 |
27 |
28 | @mixin form-validation-state($state, $color) {
29 |
30 | .#{$state}-feedback {
31 | display: none;
32 | margin-top: $form-feedback-margin-top;
33 | font-size: $form-feedback-font-size;
34 | color: $color;
35 | }
36 |
37 | .#{$state}-tooltip {
38 | position: absolute;
39 | top: 100%;
40 | z-index: 5;
41 | display: none;
42 | width: 250px;
43 | padding: rem2px(.5);
44 | margin-top: rem2px(.1);
45 | font-size: rem2px(.875);
46 | line-height: 1;
47 | color: #fff;
48 | background-color: rgba($color, .8);
49 | }
50 |
51 | .form-control,
52 | .custom-select {
53 | .was-validated &:#{$state},
54 | &.is-#{$state} {
55 | border-color: $color;
56 |
57 | &:focus {
58 | border-color: $color;
59 | box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/scss/mixins/_gradients.scss:
--------------------------------------------------------------------------------
1 | // Gradients
2 |
3 | @mixin gradient-bg($color) {
4 | @if $enable-gradients {
5 | background: $color linear-gradient(180deg, mix($body-bg, $color, 15%), $color) repeat-x;
6 | } @else {
7 | background-color: $color;
8 | }
9 | }
10 |
11 | // Horizontal gradient, from left to right
12 | //
13 | // Creates two color stops, start and end, by specifying a color and position for each color stop.
14 | @mixin gradient-x($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%) {
15 | background-image: linear-gradient(to right, $start-color $start-percent, $end-color $end-percent);
16 | background-repeat: repeat-x;
17 | }
18 |
19 | // Vertical gradient, from top to bottom
20 | //
21 | // Creates two color stops, start and end, by specifying a color and position for each color stop.
22 | @mixin gradient-y($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%) {
23 | background-image: linear-gradient(to bottom, $start-color $start-percent, $end-color $end-percent);
24 | background-repeat: repeat-x;
25 | }
26 |
27 | @mixin gradient-directional($start-color: #555, $end-color: #333, $deg: 45deg) {
28 | background-image: linear-gradient($deg, $start-color, $end-color);
29 | background-repeat: repeat-x;
30 | }
31 | @mixin gradient-x-three-colors($start-color: #00b3ee, $mid-color: #7a43b6, $color-stop: 50%, $end-color: #c3325f) {
32 | background-image: linear-gradient(to right, $start-color, $mid-color $color-stop, $end-color);
33 | background-repeat: no-repeat;
34 | }
35 | @mixin gradient-y-three-colors($start-color: #00b3ee, $mid-color: #7a43b6, $color-stop: 50%, $end-color: #c3325f) {
36 | background-image: linear-gradient($start-color, $mid-color $color-stop, $end-color);
37 | background-repeat: no-repeat;
38 | }
39 | @mixin gradient-radial($inner-color: #555, $outer-color: #333) {
40 | background-image: radial-gradient(circle, $inner-color, $outer-color);
41 | background-repeat: no-repeat;
42 | }
43 | @mixin gradient-striped($color: rgba(255,255,255,.15), $angle: 45deg) {
44 | background-image: linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
45 | }
46 |
--------------------------------------------------------------------------------
/src/scss/mixins/_grid-framework.scss:
--------------------------------------------------------------------------------
1 | // Framework grid generation
2 | //
3 | // Used only by Bootstrap to generate the correct number of grid classes given
4 | // any value of `$grid-columns`.
5 |
6 | @mixin make-grid-columns($columns: $grid-columns, $gutter: $grid-gutter-width) {
7 | %grid-column {
8 | position: relative;
9 | width: 100%;
10 | min-height: 1px; // Prevent columns from collapsing when empty
11 | padding-right: ($gutter / 2);
12 | padding-left: ($gutter / 2);
13 | }
14 |
15 | $infix: "";
16 |
17 | @for $i from 1 through $columns {
18 | .col#{$infix}-#{$i} {
19 | @extend %grid-column;
20 | }
21 | }
22 | .col#{$infix},
23 | .col#{$infix}-auto {
24 | @extend %grid-column;
25 | }
26 |
27 | .col#{$infix} {
28 | max-width: 100%;
29 | display: inline-block;
30 | }
31 | .col#{$infix}-auto {
32 | width: auto;
33 | max-width: none;
34 | }
35 |
36 | @for $i from 1 through $columns {
37 | .col#{$infix}-#{$i} {
38 | @include make-col($i, $columns);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/scss/mixins/_grid.scss:
--------------------------------------------------------------------------------
1 | /// Grid system
2 | //
3 | // Generate semantic grid columns with these mixins.
4 |
5 | @mixin make-container() {
6 | width: 100%;
7 | margin-right: auto;
8 | margin-left: auto;
9 | padding-right: ($grid-gutter-width / 2);
10 | padding-left: ($grid-gutter-width / 2);
11 | }
12 |
13 | @mixin make-row() {
14 | display: block;
15 | margin-right: ($grid-gutter-width / -2);
16 | margin-left: ($grid-gutter-width / -2);
17 | }
18 |
19 | @mixin make-col($size, $columns: $grid-columns) {
20 | max-width: percentage($size / $columns);
21 | }
22 |
--------------------------------------------------------------------------------
/src/scss/mixins/_hover.scss:
--------------------------------------------------------------------------------
1 | @mixin hover {
2 | &:hover { @content; }
3 | }
4 |
5 | @mixin hover-focus {
6 | &:focus,
7 | &:hover {
8 | @content;
9 | }
10 | }
11 |
12 | @mixin plain-hover-focus {
13 | &,
14 | &:focus,
15 | &:hover {
16 | @content;
17 | }
18 | }
19 |
20 | @mixin hover-focus-active {
21 | &:focus,
22 | &:active,
23 | &:hover {
24 | @content;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/scss/mixins/_list-group.scss:
--------------------------------------------------------------------------------
1 | // List Groups
2 |
3 | @mixin list-group-item-variant($state, $background, $color) {
4 | .list-group-item-#{$state} {
5 | color: $color;
6 | background-color: $background;
7 |
8 | &.list-group-item-action {
9 | @include hover-focus {
10 | color: $color;
11 | background-color: darken($background, 5%);
12 | }
13 |
14 | &.active {
15 | color: #fff;
16 | background-color: $color;
17 | border-color: $color;
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/scss/mixins/_nav-divider.scss:
--------------------------------------------------------------------------------
1 | // Horizontal dividers
2 | //
3 | // Dividers (basically an hr) within dropdowns and nav lists
4 |
5 | @mixin nav-divider($color: #e5e5e5) {
6 | height: 1px;
7 | margin: ($spacer / 2) 0;
8 | background-color: $color;
9 | }
10 |
--------------------------------------------------------------------------------
/src/scss/mixins/_text-emphasis.scss:
--------------------------------------------------------------------------------
1 | // stylelint-disable declaration-no-important
2 |
3 | // Typography
4 |
5 | @mixin text-emphasis-variant($parent, $color) {
6 | #{$parent} {
7 | color: $color;
8 | }
9 | a#{$parent} {
10 | @include hover-focus {
11 | color: darken($color, 10%);
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/scss/mixins/_text.scss:
--------------------------------------------------------------------------------
1 | @mixin text-default-style() {
2 | color: $font-color-base;
3 | font-family: $font-family-base;
4 | font-size: $font-size-base;
5 | line-height: $line-height-base;
6 | }
7 |
8 | @mixin text {
9 | & {
10 | @content;
11 | }
12 |
13 | #{$text-elements}, .text {
14 | @content;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/scss/utilities/_background.scss:
--------------------------------------------------------------------------------
1 | @each $color, $value in $theme-colors {
2 | @include bg-variant(".bg-#{$color}", $value);
3 | }
4 |
5 | .bg-white {
6 | background-color: $white !important;
7 | }
8 |
9 | .bg-transparent {
10 | background-color: transparent !important;
11 | }
12 |
--------------------------------------------------------------------------------
/src/scss/utilities/_float.scss:
--------------------------------------------------------------------------------
1 | .float-left {
2 | @include float-left;
3 | }
4 | .float-right {
5 | @include float-right;
6 | }
7 | .float-none {
8 | @include float-none;
9 | }
10 | .float-top {
11 | @include float-top;
12 | }
13 | .float-bottom {
14 | @include float-bottom;
15 | }
16 |
--------------------------------------------------------------------------------
/src/scss/utilities/_layout.scss:
--------------------------------------------------------------------------------
1 | .d-flex {
2 | display: flex;
3 | }
4 |
5 | .justify-content-center {
6 | justify-content: center;
7 | }
8 |
--------------------------------------------------------------------------------
/src/scss/utilities/_spacing.scss:
--------------------------------------------------------------------------------
1 | // Margin and Padding
2 |
3 | $infix: "";
4 |
5 | @each $prop, $abbrev in (margin: m, padding: p) {
6 | @each $size, $length in $spacers {
7 |
8 | .#{$abbrev}#{$infix}-#{$size} { #{$prop}: $length; }
9 | .#{$abbrev}t#{$infix}-#{$size},
10 | .#{$abbrev}y#{$infix}-#{$size} {
11 | #{$prop}-top: $length;
12 | }
13 | .#{$abbrev}r#{$infix}-#{$size},
14 | .#{$abbrev}x#{$infix}-#{$size} {
15 | #{$prop}-right: $length;
16 | }
17 | .#{$abbrev}b#{$infix}-#{$size},
18 | .#{$abbrev}y#{$infix}-#{$size} {
19 | #{$prop}-bottom: $length;
20 | }
21 | .#{$abbrev}l#{$infix}-#{$size},
22 | .#{$abbrev}x#{$infix}-#{$size} {
23 | #{$prop}-left: $length;
24 | }
25 | }
26 | }
27 |
28 | // Some special margin utils
29 | .m#{$infix}-auto { margin: auto; }
30 | .mt#{$infix}-auto,
31 | .my#{$infix}-auto {
32 | margin-top: auto;
33 | }
34 | .mr#{$infix}-auto,
35 | .mx#{$infix}-auto {
36 | margin-right: auto;
37 | }
38 | .mb#{$infix}-auto,
39 | .my#{$infix}-auto {
40 | margin-bottom: auto;
41 | }
42 | .ml#{$infix}-auto,
43 | .mx#{$infix}-auto {
44 | margin-left: auto;
45 | }
46 |
--------------------------------------------------------------------------------
/src/scss/utilities/_text.scss:
--------------------------------------------------------------------------------
1 | // stylelint-disable declaration-no-important
2 |
3 | //
4 | // Text
5 | //
6 |
7 | // Alignment
8 |
9 | .text-nowrap { white-space: nowrap; }
10 |
11 | .font-weight-light { font-weight: $font-weight-light; }
12 | .font-weight-normal { font-weight: $font-weight-normal; }
13 | .font-weight-bold { font-weight: $font-weight-bold; }
14 | .font-italic { font-style: italic; }
15 |
16 | // Contextual colors
17 |
18 | .text-white { color: #fff; }
19 |
20 | @each $color, $value in $theme-colors {
21 | @include text-emphasis-variant(".text-#{$color}", $value);
22 | }
23 |
24 | .text-muted { color: $text-muted; }
25 |
--------------------------------------------------------------------------------
/src/ui/components/alert.c:
--------------------------------------------------------------------------------
1 | /*
2 | * alert.c -- Provide contextual feedback messages for typical user actions
3 | * with the handful of available and flexible alert messages.
4 | *
5 | * Copyright (c) 2018, Liu chao All rights reserved.
6 | *
7 | * Redistribution and use in source and binary forms, with or without
8 | * modification, are permitted provided that the following conditions are met:
9 | *
10 | * * Redistributions of source code must retain the above copyright notice,
11 | * this list of conditions and the following disclaimer.
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | * * Neither the name of LCUI nor the names of its contributors may be used
16 | * to endorse or promote products derived from this software without
17 | * specific prior written permission.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | * POSSIBILITY OF SUCH DAMAGE.
30 | */
31 |
32 | #include
33 | #include
34 | #include
35 |
36 | void LCDesign_InitAlert(void)
37 | {
38 | LCUIWidget_NewPrototype("alert", "textview");
39 | }
40 |
--------------------------------------------------------------------------------
/src/ui/components/icon.c:
--------------------------------------------------------------------------------
1 | /*
2 | * icon.c -- Icon component.
3 | *
4 | * Copyright (c) 2019, Liu chao 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 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 |
37 | #define CLASS_NAME "icon"
38 | #define CLASS_PREFIX_NAME "icon-"
39 |
40 | typedef struct IconRec_ {
41 | char class_name[256];
42 | } IconRec, *Icon;
43 |
44 | static struct LCDesign_IconModule {
45 | LCUI_WidgetPrototype proto;
46 | } self;
47 |
48 | static void Icon_Init(LCUI_Widget w)
49 | {
50 | Icon that = Widget_AddData(w, self.proto, sizeof(IconRec));
51 |
52 | that->class_name[0] = 0;
53 | self.proto->proto->init(w);
54 | Widget_AddClass(w, CLASS_NAME);
55 | }
56 |
57 | int Icon_SetName(LCUI_Widget w, const char *name)
58 | {
59 | Icon that = Widget_GetData(w, self.proto);
60 |
61 | if (strlen(that->class_name) > 0) {
62 | Widget_RemoveClass(w, that->class_name);
63 | }
64 | strcpy(that->class_name, CLASS_PREFIX_NAME);
65 | strcat(that->class_name, name);
66 | return Widget_AddClass(w, that->class_name);
67 | }
68 |
69 | static void Icon_SetAttr(LCUI_Widget w, const char *name,
70 | const char *value)
71 | {
72 | if (strcmp(name, "name") == 0) {
73 | Icon_SetName(w, value);
74 | }
75 | }
76 |
77 | void LCDesign_InitIcon(void)
78 | {
79 | self.proto = LCUIWidget_NewPrototype("icon", "textview");
80 | self.proto->init = Icon_Init;
81 | self.proto->setattr = Icon_SetAttr;
82 | }
83 |
--------------------------------------------------------------------------------
/src/ui/components/img.c:
--------------------------------------------------------------------------------
1 | /*
2 | * img.c -- Display a image.
3 | *
4 | * Copyright (c) 2019, Liu chao 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 | #include
32 | #include
33 | #include
34 | #include
35 |
36 | void LCDesign_InitImg(void)
37 | {
38 | LCUIWidget_NewPrototype("img", NULL);
39 | }
40 |
--------------------------------------------------------------------------------
/src/ui/components/label.c:
--------------------------------------------------------------------------------
1 | /*
2 | * label.c -- Label component, which is used to represents a caption for an
3 | * item in a user interface.
4 | *
5 | * Copyright (c) 2018, Liu chao All rights reserved.
6 | *
7 | * Redistribution and use in source and binary forms, with or without
8 | * modification, are permitted provided that the following conditions are met:
9 | *
10 | * * Redistributions of source code must retain the above copyright notice,
11 | * this list of conditions and the following disclaimer.
12 | * * Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | * * Neither the name of LCUI nor the names of its contributors may be used
16 | * to endorse or promote products derived from this software without
17 | * specific prior written permission.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | * POSSIBILITY OF SUCH DAMAGE.
30 | */
31 |
32 | #include
33 | #include
34 | #include
35 | #include
36 |
37 | static struct LCDesign_LabelModule {
38 | LCUI_WidgetPrototype proto;
39 | } self;
40 |
41 | static void Label_OnClick(LCUI_Widget w, LCUI_WidgetEvent e, void *arg)
42 | {
43 | LCUI_Widget target = NULL;
44 | const char *target_id = Widget_GetAttribute(w, "for");
45 |
46 | if (target_id) {
47 | target = LCUIWidget_GetById(target_id);
48 | }
49 | if (target) {
50 | LCUIWidget_SetFocus(target);
51 | }
52 | }
53 |
54 | static void Label_Init(LCUI_Widget w)
55 | {
56 | self.proto->proto->init(w);
57 | Widget_BindEvent(w, "click", Label_OnClick, NULL, NULL);
58 | }
59 |
60 | void LCDesign_InitLabel(void)
61 | {
62 | self.proto = LCUIWidget_NewPrototype("label", "textview");
63 | self.proto->init = Label_Init;
64 | }
65 |
--------------------------------------------------------------------------------
/src/ui/components/password.c:
--------------------------------------------------------------------------------
1 | /*
2 | * password.c -- Password input box.
3 | *
4 | * Copyright (c) 2018, Liu chao 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 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 |
37 | static struct LCDesign_PasswordModule {
38 | LCUI_WidgetPrototype proto;
39 | } self;
40 |
41 | static void Password_Init(LCUI_Widget w)
42 | {
43 | self.proto->proto->init(w);
44 | TextEdit_SetPasswordChar(w, L'●');
45 | }
46 |
47 | void LCDesign_InitPassword(void)
48 | {
49 | self.proto = LCUIWidget_NewPrototype("password", "textedit");
50 | self.proto->init = Password_Init;
51 | }
52 |
--------------------------------------------------------------------------------
/src/ui/components/radio-group.c:
--------------------------------------------------------------------------------
1 | /*
2 | * radio-group.c -- Radio group
3 | *
4 | * Copyright (c) 2019, Liu chao 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 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 |
37 | typedef struct RadioGroupRec_ {
38 | LCUI_Widget checked_radio;
39 | } RadioGroupRec, *RadioGroup;
40 |
41 | static struct RadioGroupModule {
42 | LCUI_WidgetPrototype prototype;
43 | } self;
44 |
45 | static void RadioGroup_OnInit(LCUI_Widget w)
46 | {
47 | RadioGroup data =
48 | Widget_AddData(w, self.prototype, sizeof(RadioGroupRec));
49 |
50 | data->checked_radio = NULL;
51 | }
52 |
53 | int RadioGroup_SetCheckedRadio(LCUI_Widget w, LCUI_Widget radio)
54 | {
55 | LCUI_Widget parent;
56 | RadioGroup data = Widget_GetData(w, self.prototype);
57 |
58 | for (parent = radio->parent; parent; parent = parent->parent) {
59 | if (parent == w) {
60 | break;
61 | }
62 | }
63 | if (parent != w) {
64 | return -1;
65 | }
66 | data->checked_radio = radio;
67 | return 0;
68 | }
69 |
70 | int RadioGroup_SetValue(LCUI_Widget w, const char *value)
71 | {
72 | int found = -1;
73 | const char *radio_value;
74 |
75 | LCUI_Widget child;
76 | LinkedListNode *node;
77 | RadioGroup data = Widget_GetData(w, self.prototype);
78 |
79 | data->checked_radio = NULL;
80 | for (LinkedList_Each(node, &w->children)) {
81 | child = node->data;
82 | if (!Widget_CheckType(child, "radio")) {
83 | continue;
84 | }
85 | radio_value = Widget_GetAttribute(child, "value");
86 | if (radio_value && strcmp(value, radio_value) == 0) {
87 | Radio_SetChecked(child, TRUE);
88 | data->checked_radio = child;
89 | found = 0;
90 | } else {
91 | Radio_SetChecked(child, FALSE);
92 | }
93 | }
94 | return found;
95 | }
96 |
97 | const char *RadioGroup_GetValue(LCUI_Widget w)
98 | {
99 | RadioGroup data = Widget_GetData(w, self.prototype);
100 |
101 | if (data->checked_radio) {
102 | return Widget_GetAttribute(data->checked_radio, "value");
103 | }
104 | return NULL;
105 | }
106 |
107 | void LCDesign_InitRadioGroup(void)
108 | {
109 | self.prototype = LCUIWidget_NewPrototype("radio-group", NULL);
110 | self.prototype->init = RadioGroup_OnInit;
111 | }
112 |
--------------------------------------------------------------------------------
/src/ui/components/typography.c:
--------------------------------------------------------------------------------
1 | /*
2 | * typography.c -- Including headings, body text, and more.
3 | *
4 | * Copyright (c) 2018-2019, Liu chao 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 | #include
32 | #include
33 | #include
34 | #include
35 |
36 | void LCDesign_InitTypograhy(void)
37 | {
38 | LCUIWidget_NewPrototype("hr", NULL);
39 | LCUIWidget_NewPrototype("text", "textview");
40 | LCUIWidget_NewPrototype("span", "text");
41 | LCUIWidget_NewPrototype("h1", "text");
42 | LCUIWidget_NewPrototype("h2", "text");
43 | LCUIWidget_NewPrototype("h3", "text");
44 | LCUIWidget_NewPrototype("h4", "text");
45 | LCUIWidget_NewPrototype("h5", "text");
46 | LCUIWidget_NewPrototype("h6", "text");
47 | LCUIWidget_NewPrototype("p", "text");
48 | LCUIWidget_NewPrototype("pre", "text");
49 | LCUIWidget_NewPrototype("code-block", "text");
50 | LCUIWidget_NewPrototype("blockquote", "text");
51 | LCUIWidget_NewPrototype("i", "text");
52 | LCUIWidget_NewPrototype("b", "text");
53 | LCUIWidget_NewPrototype("cite", "text");
54 | LCUIWidget_NewPrototype("strong", "text");
55 | LCUIWidget_NewPrototype("small", "text");
56 | }
57 |
--------------------------------------------------------------------------------
/src/ui/dismiss.c:
--------------------------------------------------------------------------------
1 | /*
2 | * dismiss.c -- The widget dismissal controller.
3 | *
4 | * Copyright (c) 2018, Liu chao 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 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 |
37 | #define HANDLERS_COUNT 3
38 |
39 | typedef struct LCDesign_DismissHandlerRec_ {
40 | const char *name;
41 | void(*dismiss)(LCUI_Widget);
42 | } LCDesign_DismissHandlerRec, *LCDesign_DismissHandler;
43 |
44 | static struct LCDesign_DismissModule {
45 | LCDesign_DismissHandlerRec handlers[HANDLERS_COUNT];
46 | } self = {
47 | {
48 | { "modal", Modal_Hide },
49 | { "alert", Widget_Destroy },
50 | { "toast", Widget_Destroy }
51 | }
52 | };
53 |
54 | static void OnClick(LCUI_Widget w, LCUI_WidgetEvent e, void *arg)
55 | {
56 | int i;
57 | const char *name = NULL;
58 | LCDesign_DismissHandler handler;
59 |
60 | if (e->target) {
61 | name = Widget_GetAttribute(e->target, "data-dismiss");
62 | }
63 | if (!name) {
64 | return;
65 | }
66 | for (i = 0; i < HANDLERS_COUNT; ++i) {
67 | handler = &self.handlers[i];
68 | if (strcmp(handler->name, name) != 0) {
69 | continue;
70 | }
71 | for (w = e->target->parent; w; w = w->parent) {
72 | if (Widget_CheckType(w, handler->name) ||
73 | Widget_HasClass(w, handler->name)) {
74 | handler->dismiss(w);
75 | break;
76 | }
77 | }
78 | break;
79 | }
80 | }
81 |
82 | void LCDesign_InitDismiss(void)
83 | {
84 | LCUI_Widget root = LCUIWidget_GetRoot();
85 | Widget_BindEvent(root, "click", OnClick, NULL, NULL);
86 | }
87 |
--------------------------------------------------------------------------------
/src/ui/toggle.c:
--------------------------------------------------------------------------------
1 | /*
2 | * toggle.c -- The widget status toggle controller.
3 | *
4 | * Copyright (c) 2018, Liu chao 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 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 |
37 | #define HANDLERS_COUNT 2
38 |
39 | typedef struct LCDesign_ToggleHandlerRec_ {
40 | const char *name;
41 | void( *toggle )(LCUI_Widget, LCUI_Widget);
42 | } LCDesign_ToggleHandlerRec, *LCDesign_ToggleHandler;
43 |
44 | static void ToggleModal( LCUI_Widget btn, LCUI_Widget target )
45 | {
46 | if( target ) {
47 | Modal_Show( target );
48 | }
49 | }
50 |
51 | static void ToggleDropdown( LCUI_Widget btn, LCUI_Widget target )
52 | {
53 | if( target ) {
54 | Dropdown_BindTarget( target, btn );
55 | Dropdown_Toggle( target );
56 | }
57 | }
58 |
59 | static struct LCDesign_ToggleModule {
60 | LCDesign_ToggleHandlerRec handlers[HANDLERS_COUNT];
61 | } self = {
62 | {
63 | { "modal", ToggleModal },
64 | { "dropdown", ToggleDropdown }
65 | }
66 | };
67 |
68 | static void OnClick( LCUI_Widget w, LCUI_WidgetEvent e, void *arg )
69 | {
70 | int i;
71 | const char *target_id;
72 | const char *name = NULL;
73 | LCDesign_ToggleHandler handler;
74 | LCUI_Widget btn;
75 |
76 | for( btn = e->target; btn; btn = btn->parent ) {
77 | name = Widget_GetAttribute( btn, "data-toggle" );
78 | if( name ) {
79 | break;
80 | }
81 | }
82 | if( !name ) {
83 | return;
84 | }
85 | for( i = 0; i < HANDLERS_COUNT; ++i ) {
86 | handler = &self.handlers[i];
87 | if( strcmp( handler->name, name ) != 0 ) {
88 | continue;
89 | }
90 | target_id = Widget_GetAttribute( btn, "data-target" );
91 | handler->toggle( btn, LCUIWidget_GetById( target_id ) );
92 | }
93 | }
94 |
95 | void LCDesign_InitToggle( void )
96 | {
97 | LCUI_Widget root = LCUIWidget_GetRoot();
98 | Widget_BindEvent( root, "click", OnClick, NULL, NULL );
99 | }
100 |
--------------------------------------------------------------------------------
/xmake.lua:
--------------------------------------------------------------------------------
1 | add_rules("mode.debug", "mode.release")
2 | set_warnings("all")
3 |
4 | lcpkg_dir = "./lcpkg/installed/$(arch)-$(os)"
5 | lcpkg_incdir = lcpkg_dir.."/include"
6 | lcpkg_pkgdir = lcpkg_dir
7 | if is_mode("debug") then
8 | lcpkg_pkgdir = lcpkg_dir.."/debug"
9 | end
10 | lcpkg_libdir = lcpkg_pkgdir.."/lib"
11 | add_includedirs("include", lcpkg_incdir)
12 | add_linkdirs(lcpkg_libdir, "/usr/local/lib", "/usr/lib")
13 | add_defines("LCDESIGN_EXPORTS")
14 | add_files("src/**.c")
15 | add_headerfiles("include/(**.h)")
16 | add_installfiles("dist/app/assets/(**)", { prefixdir = "share/assets" })
17 |
18 | target("static")
19 | set_kind("static")
20 | set_basename("LCDesign")
21 |
22 | target("shared")
23 | set_kind("shared")
24 | add_links("LCUI")
25 | set_basename("LCDesign")
26 |
27 | includes("demo")
28 |
--------------------------------------------------------------------------------