summaryrefslogtreecommitdiff
path: root/lib/glwidgets.cc
blob: f8e0389832a8ca8d0f51eb402417c0007d13a03b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <SDL.h>
#include <Input.h>
#include "glfont.h"
#include "glwidgets.h"

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "gettext.h"

mogltk::widget * mogltk::widget::cur_root = 0;

mogltk::widget::widget(widget * _father, int _x, int _y, int _sx, int _sy) throw (GeneralException) :
    x(_x), y(_y), sx(_sx), sy(_sy), father(_father) {

    if (!father)
	father = cur_root;

    if (father) {
	next = father->child;
	father->child = this;
	root = father->root;
    } else {
	next = 0;
	cur_root = root = this;
    }
    prev = 0;
    child = 0;
}

mogltk::widget::~widget() {
    while(child)
	delete child;
    
    if (prev)
	prev->next = next;
    else if (father)
	father->child = next;

    if (next)
	next->prev = prev;
}