source: titan/titan/listbox.h @ 27981

Last change on this file since 27981 was 23286, checked in by nit, 11 years ago

[titan] cleanup

File size: 1.3 KB
Line 
1#ifndef LISTBOX_H
2#define LISTBOX_H
3
4int setlistboxselection(struct skin* listbox, char* childname)
5{
6        struct skin* child = NULL;
7        int count = 0;
8
9        if(listbox == NULL || childname == NULL)
10        {
11                err("NULL detect");
12                return 1;
13        }
14
15        listbox->aktpage = -1;
16        listbox->aktline = 1;
17
18        child = listbox->next;
19        while(child != NULL)
20        {
21                if(child->parentpointer == NULL)
22                {
23                        if(child->parent == NULL)
24                        {
25                                child = child->next;
26                                continue;
27                        }
28                        else if(ostrcmp(child->parent, listbox->name) != 0 || child->hidden == YES || child->deaktivcol > -1)
29                        {
30                                child = child->next;
31                                continue;
32                        }
33                }
34                else if(child->parentpointer != listbox || child->hidden == YES || child->deaktivcol > -1)
35                {
36                        child = child->next;
37                        continue;
38                }
39
40                count++;
41                if(ostrcmp(child->name, childname) == 0)
42                {
43                        listbox->aktpage = -1;
44                        listbox->aktline = count;
45                        break;
46                }
47
48                child = child->next;
49        }
50
51        return 0;
52}
53
54struct skin* addlistbox(struct skin* screen, struct skin* listbox, struct skin* last, int del)
55{
56        struct skin* node = NULL;
57
58        node = addscreennode(screen, NULL, last);
59        if(node != NULL)
60        {
61                node->bordercol = listbox->bordercol;
62                node->width = 100;
63                node->prozwidth = 1;
64                node->height = listbox->fontsize + 2;
65                node->parentpointer = listbox;
66                node->del = del;
67                node->deaktivcol = -1;
68        }
69
70        return node;
71}
72
73#endif
Note: See TracBrowser for help on using the repository browser.