4 static class MsgLine : struct
11 public class NotificationBox : Window
13 background = activeBorder;
14 borderStyle = contour;
18 AutoDestroyThread autoDestroy { box = this };
21 property char * contents
28 int len = strlen(value);
31 for(c = 0; c <= len; c++)
33 if(c == len || value[c] == '\n')
40 line.string = new char[line.len+1];
41 CopyBytes(line.string, value + start, line.len);
42 line.string[line.len] = '\0';
56 int totalWidth, totalHeight, lineHeight;
65 bool ButtonActivate(Window control, bool active, Window previous)
67 control.isDefault = true;
76 autoDestroy.delay = 1;
78 autoDestroy.delay = delay;
79 autoDestroy.app = app;
85 /*bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
88 reactivate.Activate();
93 bool OnResizing(int *w, int *h)
95 *w = Max(*w, Max(totalWidth, 144) + 24);
97 *h = Max(*h, Max(totalHeight, 33));// + 40);
101 void OnRedraw(Surface surface)
104 //int y = (clientSize.h - 33 - totalHeight) / 2;
105 int y = (clientSize.h - totalHeight) / 2;
106 for(line = lines.first; line; line = line.next)
108 surface.WriteText((clientSize.w - totalWidth) / 2, y, line.string, line.len);
113 bool OnLoadGraphics()
118 for(line = lines.first; line; line = line.next)
122 display.FontExtent(fontObject, " ", 1, (int *)&size.w, (int *)&size.h);
124 display.FontExtent(fontObject, line.string, strlen(line.string), (int *)&size.w, (int *)&size.h);
127 totalWidth = Max(totalWidth, size.w);
128 totalHeight += size.h;
136 for(line = lines.first; line; line = line.next)
142 class AutoDestroyThread : Thread
158 for(c = 0; c < r; c--)
161 int vh = h / r / 2 - c * h / (r * 2);
163 //box.position.x += vw / 2;
164 box.position.y += vh / 2;