summaryrefslogtreecommitdiff
path: root/src/ui/widget.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/widget.h')
-rw-r--r--src/ui/widget.h28
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
3Redistribution and use in source and binary forms, with or without
4modification, are permitted provided that the following conditions are met:
5
61. Redistributions of source code must retain the above copyright notice, this
7 list of conditions and the following disclaimer.
82. 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
12THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
13ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
16ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
17(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
18LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19ANY 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
21SOFTWARE, 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
108const iString *id_Widget (const iWidget *); 131const iString *id_Widget (const iWidget *);
109int flags_Widget (const iWidget *); 132int flags_Widget (const iWidget *);
110iRect bounds_Widget (const iWidget *); 133iRect bounds_Widget (const iWidget *); /* outer bounds */
134iRect innerBounds_Widget (const iWidget *);
111iInt2 localCoord_Widget (const iWidget *, iInt2 coord); 135iInt2 localCoord_Widget (const iWidget *, iInt2 coord);
112iBool contains_Widget (const iWidget *, iInt2 coord); 136iBool contains_Widget (const iWidget *, iInt2 coord);
113iAny * findChild_Widget (const iWidget *, const char *id); 137iAny * findChild_Widget (const iWidget *, const char *id);
@@ -131,6 +155,8 @@ void setId_Widget (iWidget *, const char *id);
131void setFlags_Widget (iWidget *, int flags, iBool set); 155void setFlags_Widget (iWidget *, int flags, iBool set);
132void setPos_Widget (iWidget *, iInt2 pos); 156void setPos_Widget (iWidget *, iInt2 pos);
133void setSize_Widget (iWidget *, iInt2 size); 157void setSize_Widget (iWidget *, iInt2 size);
158void setPadding_Widget (iWidget *, int left, int top, int right, int bottom);
159iLocalDef void setPadding1_Widget (iWidget *d, int padding) { setPadding_Widget(d, padding, padding, padding, padding); }
134void setBackgroundColor_Widget (iWidget *, int bgColor); 160void setBackgroundColor_Widget (iWidget *, int bgColor);
135void setFrameColor_Widget (iWidget *, int frameColor); 161void setFrameColor_Widget (iWidget *, int frameColor);
136void setCommandHandler_Widget (iWidget *, iBool (*handler)(iWidget *, const char *)); 162void setCommandHandler_Widget (iWidget *, iBool (*handler)(iWidget *, const char *));