Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

msgwin.c

Go to the documentation of this file.
00001 /*************************************************************************
00002 *   FILE: msgwin.c
00003 * AUTHOR: CAL
00004 * DATE: 26 April 1993
00005 * PURPOSE:
00006 *   Creates a pop-up message window with an OK button and returns
00007 *   a message corresponding to that button being pressed.
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 

Generated on Sun Jul 6 23:07:15 2003 for Scotland Yard by doxygen1.2.15