home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / uidemo / hello2 / appwin.cxx next >
C/C++ Source or Header  |  1995-02-24  |  1KB  |  36 lines

  1.  
  2. #include "appwin.h"
  3. #include "ui/stddlg.h"
  4. #include "ui/applic.h"
  5.  
  6. AppWindow::AppWindow()
  7. : UI_CompositeVObject (NULL, NULL, FALSE, UI_Rectangle (40, 40, 400, 300))
  8. {
  9.     _count = 5;
  10.     _btn   = new UI_PushButton (this, UI_Rectangle (75, 80, 225, 50),
  11.                                 ID_BUTTON);
  12.     _msg   = new UI_Label (this, UI_Rectangle (55, 50, 245, 20), ID_LABEL);
  13.     _msg->Title() = "Hello!";
  14.     _btn->Title() = "Click here " + CL_String(_count) + " times.";
  15.     _title = "YACL Demo";
  16. }
  17.  
  18. bool AppWindow::HandleChildEvent (const UI_Event& e)
  19. {
  20.     if (e.Origin()->ViewID() == ID_BUTTON && e.Type() == Event_Select) {
  21.         _count--;
  22.         if (_count == 0)
  23.             _Application->Destroy (this);
  24.         else
  25.             _btn->Title () (11,1) =  CL_String(_count);
  26.         return TRUE;
  27.     }
  28.     return FALSE;
  29. }
  30.  
  31. bool AppWindow::WantToQuit()
  32. {
  33.     return (UI_SimpleDialog ("Do you really want to quit?", "Confirm", NULL,
  34.                              UIS_YesNo, UIS_Question) == UI_IDYES);
  35. }
  36.