home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: SysTools / SysTools.zip / taman002.zip / TASKMANA.ZIP / src / kProcessPage.cpp < prev    next >
C/C++ Source or Header  |  2000-04-29  |  4KB  |  158 lines

  1. /* $Id: kProcessPage.cpp,v 1.1 2000/04/29 19:06:35 stknut Exp $
  2.  *
  3.  * kProcessPage - Process overview dialog. (to be notebook page)
  4.  *
  5.  * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
  6.  *
  7.  */
  8.  
  9.  
  10. /*******************************************************************************
  11. *   Defined Constants And Macros                                               *
  12. *******************************************************************************/
  13. #define INCL_WIN
  14. #define INCL_GPI
  15. #define INCL_BASE
  16.  
  17.  
  18. /*******************************************************************************
  19. *   Header Files                                                               *
  20. *******************************************************************************/
  21. #include <os2.h>
  22. #ifdef USE_KLIB
  23.     #include <kAssert.h>
  24.     #include <kLog.h>
  25.     #include <kHeap.h>
  26. #else
  27.     #include <malloc.h>
  28. #endif
  29. #include <memory.h>
  30. #include <string.h>
  31. #include <stddef.h>
  32. #include <stdio.h>
  33.  
  34. #include "kBase.h"
  35. #include "kError.h"
  36. #include "kDlgBase.h"
  37. #include "kMenuBase.h"
  38. #include "kContainer.h"
  39. #include "kNotebookBase.h"
  40. #include "kNotebookPageBase.h"
  41.  
  42. #include "kQuerySysState.h"
  43. #include "kDetailBase.h"
  44. #include "kProcessRecord.h"
  45. #include "kProcessContainer.h"
  46. #include "kProcessPage.h"
  47. #include "kProcessDetails.h"
  48. #include "kTaskMgr_defs.h"
  49. #include "kTaskMgr.h"
  50.  
  51.  
  52. /**
  53.  * Forwards this event to the container.
  54.  */
  55. VOID kProcessPage::cnrContextMenu(USHORT usId, PRECORDCORE pRecord)
  56. {
  57.     pContainer->cnrContextMenu(usId, pRecord);
  58. }
  59.  
  60.  
  61. /**
  62.  * Forwards this event to the container.
  63.  */
  64. VOID kProcessPage::cnrEnter(USHORT usId, HWND hwndCnr, PRECORDCORE pRecord, ULONG fKey)
  65. {
  66.     pContainer->cnrEnter(usId, hwndCnr, pRecord, fKey);
  67. }
  68.  
  69.  
  70.  
  71. /**
  72.  * timer event. Update content.
  73.  * @param     idTimer  Timer id.
  74.  */
  75. VOID kProcessPage::timer(ULONG idTimer)
  76. {
  77.     if (idTimer == idTimerRefresh)
  78.         pContainer->update();
  79. }
  80.  
  81.  
  82.  
  83.  
  84. /**
  85.  * Constructor. Calls base class constructor.
  86.  * @param     hwndParent   Windowhandle of the parent window. Defaults to HWND_DESKTOP.
  87.  * @param     hwndOwner    Windowhandle of the owner window.
  88.  * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
  89.  * @remark    Throws kError on error.
  90.  *            Use the show()/showModal() methods to show the dialog
  91.  */
  92. kProcessPage::kProcessPage(kNotebookBase *pNtbk) throw (kError)
  93.     : kNotebookPageBase(DL_KPROCESSPAGE, NULLHANDLE, pNtbk),
  94.     pContainer(NULL)
  95. {
  96.     /*
  97.      * Container border size
  98.      */
  99.     ptlBorder.x = 5;
  100.     ptlBorder.y = 4;
  101.     WinMapDlgPoints(hwnd, &ptlBorder, 1, TRUE);
  102.  
  103.     /*
  104.      * Create detail container and fill it.
  105.      */
  106.     pContainer = new kProcessContainer(hwnd, KPROCPG_CNR);
  107.     pContainer->update();
  108.  
  109.     /*
  110.      * Start timer
  111.      */
  112.     idTimerRefresh = timerStart(1UL, REFRESHRATE*1000);
  113.     ASSERT(idTimerRefresh);
  114. }
  115.  
  116.  
  117.  
  118. /**
  119.  * Desctructor stub.
  120.  * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
  121.  * @remark
  122.  */
  123. kProcessPage::~kProcessPage()
  124. {
  125.     if (pContainer != NULL)
  126.         delete pContainer;
  127.     timerStop(idTimerRefresh);
  128.     pContainer = NULL;
  129. }
  130.  
  131.  
  132. /**
  133.  * Move and size the container and dialog.
  134.  * @param     prctlPage  New size of dialog.
  135.  */
  136. VOID  kProcessPage::ntfySized(LONG cx, LONG cy)
  137. {
  138.     /*
  139.      * Resize the dialog
  140.      */
  141.     resizeAndMove(
  142.         0,
  143.         0,
  144.         cx,
  145.         cy);
  146.  
  147.     /*
  148.      * Resize the container.
  149.      */
  150.     pContainer->resizeAndMove(
  151.         ptlBorder.x,
  152.         ptlBorder.y,
  153.         cx - ptlBorder.x*2,
  154.         cy - ptlBorder.y*2
  155.         );
  156. }
  157.  
  158.