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

  1.  
  2. #include "ui/applic.h"
  3.  
  4. #include "appwin.h"
  5.  
  6. const UI_ViewID ID_BUTTON = 101;
  7.  
  8. OurComposite::OurComposite ()
  9. : UI_CompositeVObject (NULL, (UI_ViewDescriptor*) NULL, FALSE,
  10.                        UI_Rectangle (50, 50, 500, 400), 0)
  11. {
  12.     status = new UI_Label      (this, UI_Rectangle (50, 50, 400, 30));
  13.     btn    = new UI_PushButton (this, UI_Rectangle (200, 300, 100, 50),
  14.                                 ID_BUTTON);
  15.     btn->Title () = "OK";
  16. }
  17.  
  18. bool OurComposite::MouseMove (const UI_Point& cursorPos)
  19. {
  20.     CL_String s = "Mouse at " + CL_String ((long) cursorPos.XCoord())
  21.         + ", " + CL_String ((long) cursorPos.YCoord());
  22.     status->Title() = s;
  23.     return TRUE;
  24. }
  25.  
  26.  
  27. bool OurComposite::HandleChildEvent (const UI_Event& e)
  28. {
  29.     switch (e.Type()) {
  30.     case Event_ViewEnter:
  31.         if (e.Origin() == btn)
  32.             status->Title() = "Click here to terminate.";
  33.         break;
  34.         
  35.     case Event_ViewLeave:
  36.         status->Title()= "";
  37.         break;
  38.  
  39.     case Event_Select:
  40.         if (e.Origin() == btn)
  41.             _Application->Destroy(this);
  42.         break;
  43.     }
  44.     return TRUE;
  45. }
  46.  
  47.  
  48.