home *** CD-ROM | disk | FTP | other *** search
/ CD/PC Actual 13 / CDA13.ISO / cdactual / demobin / share / program / C / ACTLIB12.ZIP / TVTOOLS.ZIP / TVSRC.ZIP / STATBOX.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-01  |  1.1 KB  |  58 lines

  1. /*  Copyright (C) 1993   Marc Stern  (internet: stern@mble.philips.be)  */
  2.  
  3. #define Uses_TProgram
  4. #define Uses_TDeskTop
  5. #define Uses_TDialog
  6. #define Uses_TRect
  7. #define Uses_TStaticText
  8. #include "tvtools.h"
  9.  
  10. #include <stdarg.h>
  11. #include <stdio.h>
  12.  
  13.  
  14. static TDialog *TheStatusBox = 0;
  15.  
  16. Boolean existStatusBox()
  17. {
  18.  return TheStatusBox != 0;
  19. }
  20.  
  21.  
  22.  
  23. void RemoveStatusBox()
  24. {
  25.  if ( TheStatusBox )
  26.     {
  27.      TObject::destroy(TheStatusBox) ;
  28.      TheStatusBox = 0;
  29.     }
  30. }
  31.  
  32.  
  33.  
  34. void StatusBox( const char *msg )
  35. {
  36.  RemoveStatusBox();
  37.  
  38.  TheStatusBox = new TDialog( TRect(0, 0, 40, 9), "Please Wait" );
  39.  TheStatusBox->options |= ofCentered;
  40.  TheStatusBox->flags &= ~wfClose;
  41.  TheStatusBox->insert( new TStaticText(TRect(3 , 2 , TheStatusBox->size.x - 2 ,
  42.                                        TheStatusBox->size.y - 1) ,
  43.                                        msg)
  44.                      );
  45.  
  46.  TProgram::deskTop->insert( TheStatusBox );
  47. }
  48.  
  49.  
  50. void StatusBoxf( const char *fmt, ... )
  51. {
  52.  char buffer[256];
  53.  
  54.  vsprintf( buffer , fmt , ... );
  55.  StatusBox( buffer );
  56. }
  57.  
  58.