diff options
Diffstat (limited to 'src/ui/widget.h')
-rw-r--r-- | src/ui/widget.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/ui/widget.h b/src/ui/widget.h index e88a10dc..3f03fc07 100644 --- a/src/ui/widget.h +++ b/src/ui/widget.h | |||
@@ -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 | #pragma once | 23 | #pragma once |
2 | 24 | ||
3 | /* Base class for UI widgets. */ | 25 | /* Base class for UI widgets. */ |
@@ -73,6 +95,7 @@ struct Impl_Widget { | |||
73 | iString id; | 95 | iString id; |
74 | int flags; | 96 | int flags; |
75 | iRect rect; | 97 | iRect rect; |
98 | int padding[4]; /* left, top, right, bottom */ | ||
76 | int bgColor; | 99 | int bgColor; |
77 | int frameColor; | 100 | int frameColor; |
78 | iObjectList *children; | 101 | iObjectList *children; |
@@ -107,7 +130,8 @@ void destroyPending_Widget(void); | |||
107 | 130 | ||
108 | const iString *id_Widget (const iWidget *); | 131 | const iString *id_Widget (const iWidget *); |
109 | int flags_Widget (const iWidget *); | 132 | int flags_Widget (const iWidget *); |
110 | iRect bounds_Widget (const iWidget *); | 133 | iRect bounds_Widget (const iWidget *); /* outer bounds */ |
134 | iRect innerBounds_Widget (const iWidget *); | ||
111 | iInt2 localCoord_Widget (const iWidget *, iInt2 coord); | 135 | iInt2 localCoord_Widget (const iWidget *, iInt2 coord); |
112 | iBool contains_Widget (const iWidget *, iInt2 coord); | 136 | iBool contains_Widget (const iWidget *, iInt2 coord); |
113 | iAny * findChild_Widget (const iWidget *, const char *id); | 137 | iAny * findChild_Widget (const iWidget *, const char *id); |
@@ -131,6 +155,8 @@ void setId_Widget (iWidget *, const char *id); | |||
131 | void setFlags_Widget (iWidget *, int flags, iBool set); | 155 | void setFlags_Widget (iWidget *, int flags, iBool set); |
132 | void setPos_Widget (iWidget *, iInt2 pos); | 156 | void setPos_Widget (iWidget *, iInt2 pos); |
133 | void setSize_Widget (iWidget *, iInt2 size); | 157 | void setSize_Widget (iWidget *, iInt2 size); |
158 | void setPadding_Widget (iWidget *, int left, int top, int right, int bottom); | ||
159 | iLocalDef void setPadding1_Widget (iWidget *d, int padding) { setPadding_Widget(d, padding, padding, padding, padding); } | ||
134 | void setBackgroundColor_Widget (iWidget *, int bgColor); | 160 | void setBackgroundColor_Widget (iWidget *, int bgColor); |
135 | void setFrameColor_Widget (iWidget *, int frameColor); | 161 | void setFrameColor_Widget (iWidget *, int frameColor); |
136 | void setCommandHandler_Widget (iWidget *, iBool (*handler)(iWidget *, const char *)); | 162 | void setCommandHandler_Widget (iWidget *, iBool (*handler)(iWidget *, const char *)); |