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

  1. /* $Id: kModuleDetails.cpp,v 1.1 2000/04/29 19:06:35 stknut Exp $
  2.  *
  3.  * Module Detail Dialog.
  4.  *
  5.  * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
  6.  *
  7.  */
  8. /*******************************************************************************
  9. *   Defined Constants And Macros                                               *
  10. *******************************************************************************/
  11. #define INCL_DOS
  12. #define INCL_DOSERRORS
  13. #define INCL_WIN
  14.  
  15.  
  16. /*******************************************************************************
  17. *   Header Files                                                               *
  18. *******************************************************************************/
  19. #include <os2.h>
  20. #ifdef USE_KLIB
  21.     #include <kAssert.h>
  22.     #include <kLog.h>
  23.     #include <kHeap.h>
  24. #endif
  25. #include <stdio.h>
  26.  
  27. #include "kBase.h"
  28. #include "kError.h"
  29. #include "kDlgBase.h"
  30. #include "kMenuBase.h"
  31. #include "kContainer.h"
  32. #include "kNotebookBase.h"
  33. #include "kNotebookPageBase.h"
  34.  
  35. #include "kQuerySysState.h"
  36. #include "kDetailBase.h"
  37.  
  38. #include "kObjectRecord.h"
  39. #include "kObjectContainer.h"
  40. #include "kModuleRecord.h"
  41. #include "kModuleContainer.h"
  42. #include "kModuleDetails.h"
  43. #include "kTaskMgr_Defs.h"
  44. #include "kTaskMgr.h"
  45.  
  46.  
  47.  
  48. /**
  49.  * Forwards this event to the correct container.
  50.  * @param     usId     Container id.
  51.  * @param     pRecord  Pointer to the record which is selected by either the key
  52.  */
  53. VOID kModuleDetails::cnrContextMenu(USHORT usId, PRECORDCORE pRecord)
  54. {
  55.     if (usId == KMODDTL_CNR_IMPMODULES)
  56.         pCnrImpModules->cnrContextMenu(usId, pRecord);
  57.     else
  58.         pCnrObjects->cnrContextMenu(usId, pRecord);
  59. }
  60.  
  61.  
  62. /**
  63.  * Forwards this event to the correct container.
  64.  */
  65. VOID kModuleDetails::cnrEnter(USHORT usId, HWND hwndCnr, PRECORDCORE pRecord, ULONG fKey)
  66. {
  67.     if (usId == KMODDTL_CNR_IMPMODULES)
  68.         pCnrImpModules->cnrEnter(usId, hwndCnr, pRecord, fKey);
  69.     else
  70.         pCnrObjects->cnrEnter(usId, hwndCnr, pRecord, fKey);
  71. }
  72.  
  73.  
  74. /**
  75.  * WM_DESTROY.
  76.  * We'll simply delete this object.
  77.  */
  78. VOID  kModuleDetails::destroy()
  79. {
  80.     delete this;
  81. }
  82.  
  83.  
  84. /**
  85.  * Resizes the dialog.
  86.  * This will resize the individual components.
  87.  * @param     pswpOld  Old window size.
  88.  * @param     pswpNew  New window size.
  89.  */
  90. VOID kModuleDetails::resize(PSWP pswpOld, PSWP pswpNew)
  91. {
  92.     /* FIXME - not implemented */
  93.     pswpNew = pswpNew;
  94.     pswpOld = pswpOld;
  95. }
  96.  
  97.  
  98.  
  99. /**
  100.  * Module detail dialog.
  101.  * @param     hMTE         Handle of the module which we are to view details for.
  102.  * @param     hwndOwner    Handle of the owner.
  103.  */
  104. kModuleDetails::kModuleDetails(USHORT hMTE, HWND hwndOwner) throw(kError)
  105.   : kDlgBase(DL_KMODULEDETAILS, NULLHANDLE, NULLHANDLE, HWND_DESKTOP),
  106.     kDetailBase(hwnd),
  107.     hwndOwner(hwndOwner), pCnrObjects(NULL), pCnrImpModules(NULL),
  108.     hMTE(hMTE)
  109. {
  110.     CHAR        szBuffer[256];
  111.     qsLrec_t *  pMteRec;
  112.  
  113.     /* find hMte record */
  114.     pMteRec = QSGetMteData(hMTE);
  115.     if (pMteRec == NULL)
  116.         throw(kError(ERROR_INVALID_PARAMETER, kError::dos));
  117.  
  118.     /*
  119.      * Set title.
  120.      */
  121.     sprintf(&szBuffer[0], "hMTE %04x - %.240s",
  122.             hMTE, pMteRec->pName);
  123.     setTitle(&szBuffer[0]);
  124.  
  125.  
  126.     /*
  127.      * Create the two containers
  128.      */
  129.     pCnrObjects     = new kObjectContainer(hwnd, KMODDTL_CNR_OBJECTS, hMTE);
  130.     pCnrImpModules  = new kModuleContainer(hwnd, KMODDTL_CNR_IMPMODULES, hMTE);
  131.  
  132.     /*
  133.      * Set dialog data.
  134.      */
  135.     update();
  136. }
  137.  
  138.  
  139. /**
  140.  * Destructor stub.
  141.  */
  142. kModuleDetails::~kModuleDetails()
  143. {
  144.     if (pCnrImpModules)
  145.         delete pCnrImpModules;
  146.     if (pCnrObjects)
  147.         delete pCnrObjects;
  148. }
  149.  
  150.  
  151.  
  152. /**
  153.  * Update function - update dialog contents.
  154.  * @returns   Success indicator.
  155.  * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
  156.  */
  157. BOOL kModuleDetails::update()
  158. {
  159.     qsLrec_t *  pMteRec;
  160.  
  161.     /* find hMte record */
  162.     pMteRec = QSGetMteData(hMTE);
  163.     if (pMteRec == NULL)
  164.         throw(kError(ERROR_INVALID_PARAMETER, kError::dos));
  165.  
  166.     /*
  167.      * Set field contents
  168.      */
  169.     setDlgItemText(KMODDTL_TXT_HMTE,        "0x%04x",   hMTE);
  170.     setDlgItemText(KMODDTL_TXT_MODEL,       pMteRec->fFlat ? "32-bit (LX)" : "16-bit (NE)");
  171.     setDlgItemText(KMODDTL_TXT_COBJECTS,    "%d (0x%x)", pMteRec->ctObj, pMteRec->ctObj);
  172.     setDlgItemText(KMODDTL_TXT_CIMPMODULES, "%d (0x%x)", pMteRec->ctImpMod, pMteRec->ctImpMod);
  173.     setDlgItemText(KMODDTL_TXT_NAME,        "%s",        pMteRec->pName != NULL ? (char*)pMteRec->pName : "<unknown>");
  174.  
  175.     /*
  176.      * Fill the containers.
  177.      */
  178.     pCnrObjects->update();
  179.     pCnrImpModules->update();
  180.  
  181.     return TRUE;
  182. }
  183.  
  184.