From 65ebba7b5152af154f0b8806a5ae4cf2fb68d2f8 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Sat, 23 Nov 2013 17:18:09 +0100 Subject: Generate language popup from language file --- atari/gemtk/objc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'atari/gemtk/objc.c') diff --git a/atari/gemtk/objc.c b/atari/gemtk/objc.c index 3c13f553c..20838478f 100644 --- a/atari/gemtk/objc.c +++ b/atari/gemtk/objc.c @@ -372,7 +372,7 @@ OBJECT *gemtk_obj_tree_copy(OBJECT *tree) OBJECT * gemtk_obj_create_popup_tree(const char **items, int nitems, char * selected, bool horizontal, - int max_width) + int max_width, int max_height) { OBJECT * popup = NULL; int box_width = 0; @@ -394,14 +394,16 @@ OBJECT * gemtk_obj_create_popup_tree(const char **items, int nitems, int len = strlen(items[i]); if (horizontal && (max_width<1)) { - box_width += len * char_width; + box_width += (len * char_width)+4; } else if (!horizontal){ /* Detect max width, used for vertical rendering: */ if(len*char_width > box_width){ box_width = (len+2) * char_width; } - box_height += item_height; + //if (max_height < 1) { + box_height += item_height; + //} } } @@ -412,6 +414,10 @@ OBJECT * gemtk_obj_create_popup_tree(const char **items, int nitems, if (horizontal) { box_height = item_height; } + else if(max_height > 0){ + // TODO: validate max_height, shrink values larger than screen height + //box_height = max_height; + } /* printf("popup height: %d, popup width: %d\n", box_height, box_width); @@ -453,8 +459,7 @@ OBJECT * gemtk_obj_create_popup_tree(const char **items, int nitems, flags |= OF_LASTOB; } - item_width = (horizontal) ? ((int)strlen(items[i])*char_width) : box_width; - + item_width = (horizontal) ? ((int)strlen(items[i])*char_width)+2 : box_width; /* printf("addin popup item \"%s\" (w: %d, h: %d, flags: %x) at %d/%d\n", items[i], item_width, item_height, flags, -- cgit v1.2.3