00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "msgwin.h"
00011 #include "textwin.h"
00012 #include "button.h"
00013
00014 const int Margin = 5;
00015
00016 Message MessageWin (int bc, int bkc, char* t, int tc, char **txt, int txtc)
00017 {
00018 TextWin *w;
00019 PushButton *b;
00020
00021 b = new PushButton (" Ok ", BLACK, 0x01);
00022
00023 w = new TextWin (b->GetXDim() + (Margin*2), b->GetYDim() + (Margin*2),
00024 bc, bkc, t, tc, txt, txtc);
00025 int wx = (theDisplay.GetMaxX() - w->GetXDim()) / 2;
00026 int wy = (theDisplay.GetMaxY() - w->GetYDim()) / 2;
00027 w->Init (&theDisplay, wx, wy);
00028
00029 int bx = (w->Client().GetMaxX() - b->GetXDim()) / 2;
00030 int by = (w->Client().GetMaxY() - b->GetYDim()) - Margin;
00031 w->Client().Add (b, bx, by);
00032
00033 w->Draw ();
00034
00035 Mouse.Flush ();
00036 Message m;
00037 do {
00038 m = w->Client().Dispatch (Mouse.Event ());
00039 } while (m.code != ButtonPress);
00040
00041 delete w;
00042 return m;
00043 }
00044