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

  1. /* $Id: kAboutPage.cpp,v 1.1 2000/04/29 19:06:34 stknut Exp $
  2.  *
  3.  * kAboutPage - About Notebook page.
  4.  *
  5.  * Copyright (c) 1999-2000 knut st. osmundsen
  6.  *
  7.  */
  8.  
  9. /*******************************************************************************
  10. *   Defined Constants And Macros                                               *
  11. *******************************************************************************/
  12. #define INCL_WINERRORS
  13. #define INCL_WINDIALOG
  14. #define INCL_WININPUT
  15. #define INCL_WINDIALOGS
  16. #define INCL_WINSTDDLGS
  17. #define INCL_WINFRAMEMGR
  18. #define INCL_WINSYS
  19. #define INCL_WINWINDOWMGR
  20.  
  21. /*******************************************************************************
  22. *   Header Files                                                               *
  23. *******************************************************************************/
  24. #include <os2.h>
  25. #ifdef USE_KLIB
  26.     #include <kAssert.h>
  27.     #include <kLog.h>
  28.     #include <kHeap.h>
  29. #endif
  30.  
  31. #include "kError.h"
  32. #include "kDlgBase.h"
  33. #include "kClickDlg.h"
  34. #include "kBeliever.h"
  35. #include "kNotebookBase.h"
  36. #include "kNotebookPageBase.h"
  37.  
  38. #include "kAboutPage.h"
  39. #include "kTaskMgr_defs.h"
  40.  
  41.  
  42.  
  43. /**
  44.  * WM_COMMAND - Popup prayer request dialog.
  45.  * @param     usCmd     Control id which send/posted the message.
  46.  * @param     usSource  Source id.
  47.  * @param     fPointer  Mouse pointer flag.
  48.  * @remark    dismisses the dialog if DID_OK or DID_CANCEL.
  49.  */
  50. VOID  kAboutPage::command(USHORT usCmd, USHORT usSource, BOOL fPointer)
  51. {
  52.     if (usCmd == KABOUTPG_PB_BELIEVERS)
  53.     {
  54.         kBeliever Believer(hwnd);
  55.         Believer.showModal();
  56.     }
  57.  
  58.     usSource = usSource;
  59.     fPointer = fPointer;
  60. }
  61.  
  62.  
  63. /**
  64.  * Creates the about page.
  65.  * @param     pNtbk  Pointer to notebook object.
  66.  */
  67. kAboutPage::kAboutPage(kNotebookBase *pNtbk)
  68. : kNotebookPageBase(DL_KABOUTPAGE, NULLHANDLE, pNtbk)
  69. {
  70. }
  71.  
  72.  
  73. /**
  74.  * destructor stub.
  75.  */
  76. kAboutPage::~kAboutPage()
  77. {
  78. }
  79.  
  80.  
  81.  
  82. /**
  83.  * Center the dialog.
  84.  * @param     cx  New client area size - x.
  85.  * @param     cy  New client area size - y.
  86.  */
  87. VOID kAboutPage::ntfySized(LONG cx, LONG cy)
  88. {
  89.     SWP     swp;
  90.     if (WinQueryWindowPos(hwnd, &swp))
  91.     {
  92.         /*
  93.          * Center dialog.
  94.          * This didn't work while all space around the dialog
  95.          * were white and I haven't figured out how to make it colored.
  96.          * So we'll do it a different manner. Blow up the dialog and center
  97.          * all elements.
  98.          */
  99.         #if 0
  100.         WinSetWindowPos(hwnd,
  101.                         NULLHANDLE,
  102.                         cx / 2 - swp.cx / 2,
  103.                         cy / 2 - swp.cy / 2,
  104.                         0,
  105.                         0,
  106.                         SWP_MOVE);
  107.         #else
  108.         HWND  hwndCtrl;
  109.         HENUM henum;
  110.  
  111.         WinSetWindowPos(hwnd,
  112.                         NULLHANDLE,
  113.                         0,
  114.                         0,
  115.                         cx,
  116.                         cy,
  117.                         SWP_MOVE | SWP_SIZE);
  118.  
  119.         henum = WinBeginEnumWindows(hwnd);
  120.         while ((hwndCtrl = WinGetNextWindow(henum)) != NULLHANDLE)
  121.         {
  122.             SWP swpCtrl;
  123.             if (WinQueryWindowPos(hwndCtrl, &swpCtrl))
  124.                 WinSetWindowPos(hwndCtrl,
  125.                                 NULLHANDLE,
  126.                                 cx / 2 - swpCtrl.cx / 2,
  127.                                 swpCtrl.y + (cy - swp.cy) / 2,
  128.                                 0,
  129.                                 0,
  130.                                 SWP_MOVE);
  131.         }
  132.         WinEndEnumWindows(henum);
  133.         #endif
  134.     }
  135. }
  136.  
  137.  
  138.  
  139. /**
  140.  * When the page is inserted we'll set the background of the
  141.  * notebook page.
  142.  */
  143. VOID  kAboutPage::ntfyInserted()
  144. {
  145.     #if 0 /* Arg! This didn't work - still have with space around the page dialog! */
  146.     LONG lClr;
  147.     HWND hwndParent;
  148.  
  149.     /* Set page background color */
  150.     lClr = SYSCLR_DIALOGBACKGROUND;
  151.     hwndParent = WinQueryWindow(hwnd, QW_PARENT);
  152.     WinSetPresParam(hwndParent,
  153.                     PP_BACKGROUNDCOLORINDEX,
  154.                     sizeof(lClr),
  155.                     &lClr);
  156.  
  157.     WinSetPresParam(hwndParent,
  158.                     PP_HILITEBACKGROUNDCOLORINDEX,
  159.                     sizeof(lClr),
  160.                     &lClr);
  161.     #endif
  162. }
  163.  
  164.