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

  1.  
  2.  
  3. #include "ui/font.h"
  4. #include "ui/dialog.h"
  5. #include "ui/applic.h"
  6.  
  7. #include "appwin.h"
  8.  
  9.  
  10. UI_ViewDescriptor desc[] = {
  11.     {View_PushButton, 2, 0, 0,  60, 30, TRUE,  "Start"},
  12.     {View_PushButton, 3, 0, 60, 60, 30, TRUE,  "Quit"},
  13.     {View_None, -1, 0, 0, 0, 0, 0, 0}
  14. };
  15.  
  16.  
  17. UI_DialogEventDescriptor desc2 [] = {
  18.     105, Event_Select,
  19.     106, Event_Select,
  20.     -1,  Event_None
  21. };
  22.  
  23.  
  24.  
  25.  
  26. AppWindow::AppWindow ()
  27. : UI_CompositeVObject (NULL, desc, FALSE, UI_Rectangle (50, 50, 500, 400))
  28. {
  29.     msg = new UI_Label (this, UI_Rectangle (10, 100, 340, 250));
  30.     msg->Font().PointSize(11);
  31. }
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. bool AppWindow::HandleChildEvent(const UI_Event& e)
  40. {
  41.     if( e.Origin()->ViewID() == 3 && e.Type()== Event_Select) {
  42.         _Application->End();
  43.         return FALSE;
  44.     }
  45.     if (e.Origin()->ViewID() != 2 || e.Type() != Event_Select)
  46.         return FALSE;
  47.  
  48.     UI_Dialog* d =  new UI_Dialog (this,"DIALOG_1", desc2);
  49.     d->Title() = "Inner dialog";
  50.     CL_String& msg_value = (CL_String&) (msg->Model());
  51.     msg_value = "";
  52.     UI_ViewID quitID = d->ExecuteModal ().id; 
  53.  
  54.     CL_IntPtrMapIterator itr ((CL_IntPtrMap&) (d->Model()));
  55.     itr.Reset();
  56.     while (itr.More()) {
  57.         CL_IntPtrAssoc  assoc = itr.Next();
  58.         UI_ViewID id = assoc.key;
  59.         msg_value += "Id " + CL_String (id)
  60.             + " value: " + assoc.value->AsString() + "\r\n";
  61.     }
  62.     msg_value += "Quit button Id: " + CL_String (quitID)
  63.         + "\r\n";
  64.     _Application->Destroy (d);
  65.     return TRUE;
  66. }
  67.  
  68.