home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / df3os2.zip / CONTROL.CPP < prev    next >
C/C++ Source or Header  |  1993-09-27  |  999b  |  63 lines

  1. // ------------ control.cpp
  2.  
  3. #include "control.h"
  4. #include "desktop.h"
  5.  
  6. unsigned Control::LatestShortcut;
  7.  
  8. void Control::OpenControl()
  9. {
  10.     Enable();
  11.     shortcut = LatestShortcut;
  12.     LatestShortcut = 0;
  13.     if (Parent())
  14.         // --- x/y is relative to parent
  15.         ChangePosition(Left() + Parent()->Left(),
  16.                         Top() + Parent()->Top());
  17. }
  18.  
  19. void Control::Keyboard(int key)
  20. {
  21.     switch (key)    {
  22.         case ESC:
  23.             if (Parent())
  24.                 if (Parent()->WindowType() != DialogWindow)
  25.                     return;
  26.             break;
  27.         case '\t':
  28.             key = ALT_F6;
  29.             break;
  30.         default:
  31.             break;
  32.     }
  33.     DFWindow::Keyboard(key);
  34. }
  35.  
  36. Bool Control::SetFocus()
  37. {
  38.     if (isEnabled())    {
  39.         DFWindow::SetFocus();
  40.         return True;
  41.     }
  42.     return False;
  43. }
  44.  
  45. void Control::ShortcutSelect()
  46. {
  47.     SetFocus();
  48. }
  49.  
  50. void Control::Select()
  51. {
  52.     if (Parent())
  53.         Parent()->ControlSelected((DFWindow *)this);
  54. }
  55.  
  56. void Control::Choose()
  57. {
  58.     if (Parent())
  59.         Parent()->ControlChosen((DFWindow *)this);
  60. }
  61.  
  62.  
  63.