2 xkbd - xlib based onscreen keyboard.
4 Copyright (C) 2001 Matthew Allum
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
23 #define WIDGET_BUTTON 1
28 bx = malloc(sizeof(box));
37 button *box_add_button(box *bx, button *but)
41 but->parent = bx; /* set its parent */
43 if (bx->root_kid == NULL) /* new list */
45 bx->root_kid = (list *)malloc(sizeof(list));
46 bx->root_kid->next = NULL;
47 bx->tail_kid = bx->root_kid;
48 bx->root_kid->data = but;
49 bx->root_kid->type = WIDGET_BUTTON;
54 new_ptr = bx->tail_kid;
55 new_ptr->next = malloc(sizeof(list));
56 new_ptr->next->next = NULL;
57 new_ptr->next->data = but;
58 new_ptr->next->type = WIDGET_BUTTON;
59 bx->tail_kid = new_ptr->next;
65 box *box_add_box(box *bx, box *b)
69 b->parent = bx; /* set its parent */
71 if (bx->root_kid == NULL) /* new list */
73 bx->root_kid = (list *)malloc(sizeof(list));
74 bx->root_kid->next = NULL;
75 bx->tail_kid = bx->root_kid;
76 bx->root_kid->data = b;
77 bx->root_kid->type = WIDGET_BOX;
81 new_ptr = bx->tail_kid;
82 new_ptr->next = malloc(sizeof(list));
83 new_ptr->next->next = NULL;
84 new_ptr->next->data = b;
85 new_ptr->next->type = WIDGET_BOX;
86 bx->tail_kid = new_ptr->next;
91 void box_list_contents(box *bx)
93 list *ptr = bx->root_kid;
94 if (ptr == NULL) return;
97 /* if (ptr->type == WIDGET_BUTTON)
98 printf("listing %s\n", ((button *)ptr->data)->txt); */
99 printf("size is %i\n", sizeof(*(ptr->data)));