MSGBOX.CPP
上传用户:wtrl82617
上传日期:2007-01-07
资源大小:187k
文件大小:1k
源码类别:

界面编程

开发平台:

DOS

  1. // 1993 (c) ALL RIGHTS RESERVED
  2. // AUTHOR:  XuYongYong
  3. /* --------------------------------------------------------
  4.   MSGBOX.CPP
  5.   -------------------------------------------------------- */
  6. #include "msgbox.h"
  7. msgbox_class::msgbox_class(char *title,char *msg_contents,int atype )
  8. :dialog_class(0xAAAA,title,
  9. (win_living_viewport.right-win_living_viewport.left-360)/2,
  10. (win_living_viewport.bottom-win_living_viewport.top-160)/2,
  11. 360,160)
  12. { int x,y;
  13. x=( bounds.right-bounds.left -textwidth (msg_contents ) ) / 2;
  14. if (x<0) x=0;
  15. // insert_control(msg_tstatic=new Tstatic (11,"",x,20,380-x,20,
  16. // msg_contents,ALIGN_MIDDLE) );
  17. insert_control(msg_tstatic=new Tstatic (11,"",LINE_WIDTH,20,
  18. bounds.right-bounds.left-2*LINE_WIDTH,20,msg_contents,ALIGN_MIDDLE) );
  19. if ( atype & MB_ERROR ) puts ("0707");
  20. else if (atype & MB_WARING ) puts ("07");
  21. if (atype & MB_RETRYCANCEL){
  22. strcpy (ok_button->title,"RETRY");
  23. ok_button->setup_control();
  24. } else if (atype &  MB_OK ) {
  25. OffsetRect (&ok_button->bounds,(bounds.right-bounds.left)/4,0);
  26. ok_button->setup_control();
  27. cancel_button->status |= DISABLE;
  28. cancel_button->status |= INVISIBLE;
  29. // ugly things
  30. // one button -----the other is hidden
  31. }
  32. }