home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / df3os2.zip / APPLICAT.CPP next >
C/C++ Source or Header  |  1993-09-14  |  2KB  |  94 lines

  1. // ------------ applicat.cpp
  2.  
  3. #include "dflatpp.h"
  4.  
  5. static Color col = {
  6.     LIGHTGRAY, BLUE,
  7.     LIGHTGRAY, BLUE,
  8.     LIGHTGRAY, BLUE,
  9.     LIGHTGRAY, BLUE
  10. };
  11.  
  12. void Application::OpenWindow()
  13. {
  14.     colors = col;
  15.     desktop.SetApplication(this);
  16.     windowtype = ApplicationWindow;
  17.     clearch = ClearChar;
  18.     SetAttribute(BORDER | SAVESELF | CONTROLBOX | STATUSBAR);
  19.     statusbar = new StatusBar(this);
  20.     takingfocus = False;
  21. }
  22.  
  23. void Application::CloseWindow()
  24. {
  25.     delete statusbar;
  26.     desktop.SetApplication(0);
  27.     DFWindow::CloseWindow();
  28. }
  29.  
  30. void Application::AdjustBorders()
  31. {
  32.     DFWindow::AdjustBorders();
  33.     if (attrib & MENUBAR)
  34.         TopBorderAdj++;
  35.     if (attrib & TOOLBAR)
  36.         TopBorderAdj += 3;
  37.     if (attrib & STATUSBAR)
  38.         BottomBorderAdj = 1;
  39. }
  40.  
  41. Bool Application::SetFocus()
  42. {
  43.     takingfocus = True;
  44.     DFWindow::SetFocus();
  45.     takingfocus = False;
  46.     return True;
  47. }
  48.  
  49. void Application::Show()
  50. {
  51.     if (!takingfocus || !isVisible())
  52.         DFWindow::Show();
  53.     else
  54.         Border();
  55.     desktop.mouse().Show();
  56. }
  57.  
  58. void Application::Keyboard(int key)
  59. {
  60.     if (key == ' ')    // to catch Alt+Spacebar
  61.         DFWindow::Keyboard(key);
  62.     else    {
  63.         // ---- forward unprocessed keys to the menubar
  64.         DFWindow *Wnd = First();
  65.         while (Wnd != 0)    {
  66.             if (Wnd->WindowType() == MenubarWindow)    {
  67.                 Wnd->Keyboard(key);
  68.                 break;
  69.             }
  70.             Wnd = Wnd->Next();
  71.         }
  72.     }
  73. }
  74.  
  75. void Application::ClockTick()
  76. {
  77.     if (statusbar != 0)
  78.         statusbar->ClockTick();
  79. }
  80.  
  81. void Application::StatusMessage(String& Msg)
  82. {
  83.     if (statusbar != 0)
  84.         statusbar->StatusMessage(Msg);
  85. }
  86.  
  87. void Application::Execute(void)
  88. {
  89.     while (desktop.DispatchEvents())
  90.         ;
  91. }
  92.  
  93.  
  94.