summaryrefslogtreecommitdiff
path: root/atari/gemtk/objc.c
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2013-11-23 17:18:09 +0100
committerOle Loots <ole@monochrom.net>2013-11-23 17:18:09 +0100
commit65ebba7b5152af154f0b8806a5ae4cf2fb68d2f8 (patch)
tree0c1b0501abaac5929c6e29ec3e7c9b9d14ffbba3 /atari/gemtk/objc.c
parent1ebe82139e376464c15a8f52b1b841339245e638 (diff)
downloadnetsurf-65ebba7b5152af154f0b8806a5ae4cf2fb68d2f8.tar.gz
netsurf-65ebba7b5152af154f0b8806a5ae4cf2fb68d2f8.tar.bz2
Generate language popup from language file
Diffstat (limited to 'atari/gemtk/objc.c')
-rw-r--r--atari/gemtk/objc.c15
1 files changed, 10 insertions, 5 deletions
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,