summaryrefslogtreecommitdiff
path: root/src/ui/labelwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-19 13:15:08 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-19 13:15:08 +0200
commit7a0980fd58308f7333254a1276e6dd5072326d98 (patch)
tree8431dfd498762a90944bb5e595f61ea2af914a81 /src/ui/labelwidget.c
parent63dc07ddbecfdf0be7c0bd98c53e492628dda98b (diff)
iOS: Adjusting the UI for a tablet screen
Diffstat (limited to 'src/ui/labelwidget.c')
-rw-r--r--src/ui/labelwidget.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c
index d7e6c020..a0664433 100644
--- a/src/ui/labelwidget.c
+++ b/src/ui/labelwidget.c
@@ -28,8 +28,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28#include "util.h" 28#include "util.h"
29#include "keys.h" 29#include "keys.h"
30 30
31iLocalDef iInt2 padding_(int flags) { 31iLocalDef iInt2 padding_(int64_t flags) {
32#if defined (iPlatformAppleMobile)
33 return init_I2(flags & tight_WidgetFlag ? 4 * gap_UI / 2 : (4 * gap_UI), 3 * gap_UI / 2);
34#else
32 return init_I2(flags & tight_WidgetFlag ? 3 * gap_UI / 2 : (3 * gap_UI), gap_UI); 35 return init_I2(flags & tight_WidgetFlag ? 3 * gap_UI / 2 : (3 * gap_UI), gap_UI);
36#endif
33} 37}
34 38
35struct Impl_LabelWidget { 39struct Impl_LabelWidget {
@@ -83,6 +87,19 @@ static iBool processEvent_LabelWidget_(iLabelWidget *d, const SDL_Event *ev) {
83 return iFalse; 87 return iFalse;
84 } 88 }
85 if (!isEmpty_String(&d->command)) { 89 if (!isEmpty_String(&d->command)) {
90#if 0 && defined (iPlatformAppleMobile)
91 /* Touch allows activating any button on release. */
92 switch (ev->type) {
93 case SDL_MOUSEBUTTONUP: {
94 const iInt2 mouse = init_I2(ev->button.x, ev->button.y);
95 if (contains_Widget(w, mouse)) {
96 trigger_LabelWidget_(d);
97 refresh_Widget(w);
98 }
99 break;
100 }
101 }
102#endif
86 switch (processEvent_Click(&d->click, ev)) { 103 switch (processEvent_Click(&d->click, ev)) {
87 case started_ClickResult: 104 case started_ClickResult:
88 setFlags_Widget(w, pressed_WidgetFlag, iTrue); 105 setFlags_Widget(w, pressed_WidgetFlag, iTrue);
@@ -260,7 +277,7 @@ static void sizeChanged_LabelWidget_(iLabelWidget *d) {
260 277
261void updateSize_LabelWidget(iLabelWidget *d) { 278void updateSize_LabelWidget(iLabelWidget *d) {
262 iWidget *w = as_Widget(d); 279 iWidget *w = as_Widget(d);
263 const int flags = flags_Widget(w); 280 const int64_t flags = flags_Widget(w);
264 iInt2 size = add_I2(measure_Text(d->font, cstr_String(&d->label)), muli_I2(padding_(flags), 2)); 281 iInt2 size = add_I2(measure_Text(d->font, cstr_String(&d->label)), muli_I2(padding_(flags), 2));
265 if ((flags & drawKey_WidgetFlag) && d->key) { 282 if ((flags & drawKey_WidgetFlag) && d->key) {
266 iString str; 283 iString str;