diff options
Diffstat (limited to 'src/ui/scrollwidget.c')
-rw-r--r-- | src/ui/scrollwidget.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ui/scrollwidget.c b/src/ui/scrollwidget.c index 3d8f5eaa..f5340897 100644 --- a/src/ui/scrollwidget.c +++ b/src/ui/scrollwidget.c | |||
@@ -1,3 +1,25 @@ | |||
1 | /* Copyright 2020 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
2 | |||
3 | Redistribution and use in source and binary forms, with or without | ||
4 | modification, are permitted provided that the following conditions are met: | ||
5 | |||
6 | 1. Redistributions of source code must retain the above copyright notice, this | ||
7 | list of conditions and the following disclaimer. | ||
8 | 2. Redistributions in binary form must reproduce the above copyright notice, | ||
9 | this list of conditions and the following disclaimer in the documentation | ||
10 | and/or other materials provided with the distribution. | ||
11 | |||
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
13 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
14 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
15 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
16 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
17 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
18 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
20 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | ||
22 | |||
1 | #include "scrollwidget.h" | 23 | #include "scrollwidget.h" |
2 | #include "paint.h" | 24 | #include "paint.h" |
3 | #include "util.h" | 25 | #include "util.h" |
@@ -39,6 +61,7 @@ static iRect thumbRect_ScrollWidget_(const iScrollWidget *d) { | |||
39 | const int total = size_Range(&d->range); | 61 | const int total = size_Range(&d->range); |
40 | if (total > 0) { | 62 | if (total > 0) { |
41 | const int tsize = thumbSize_ScrollWidget_(d); | 63 | const int tsize = thumbSize_ScrollWidget_(d); |
64 | // iAssert(tsize <= height_Rect(bounds)); | ||
42 | const int tpos = | 65 | const int tpos = |
43 | iClamp((float) d->thumb / (float) total, 0, 1) * (height_Rect(bounds) - tsize); | 66 | iClamp((float) d->thumb / (float) total, 0, 1) * (height_Rect(bounds) - tsize); |
44 | rect.pos.y = bounds.pos.y + tpos; | 67 | rect.pos.y = bounds.pos.y + tpos; |