home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ibmodf.zip / CNTNRPRT.ZIP / CNNOTEBK.CPP next >
Text File  |  1995-04-13  |  8KB  |  230 lines

  1. /*
  2.  *  This file was generated by the SOM Compiler and Emitter Framework.
  3.  *  Generated using:
  4.  *      SOM Emitter emitxtm: 2.41
  5.  */
  6.  
  7. #ifndef SOM_Module_cnnotebk_Source
  8. #define SOM_Module_cnnotebk_Source
  9. #endif
  10. #define CNNotebook_Class_Source
  11. #define VARIABLE_MACROS
  12.  
  13. #ifndef _CNNOTEBKH_
  14.    #include "cnnotebk.h"
  15. #endif
  16.  
  17.  
  18. #ifndef _ORDCOLL_
  19. #include "OrdColl.h"
  20. #endif
  21.  
  22. #include "cnnotebk.xih"
  23.  
  24.  
  25.  
  26. extern "C" {
  27.    MPARAM EXPENTRY ColorPageDlgProc(
  28.       HWND hwnd,
  29.       USHORT msg,
  30.       MPARAM mp1,
  31.       MPARAM mp2);
  32. }
  33.  
  34.  
  35. /**********************************************************************\
  36.  * FUNCTION:  ColorPageDlgProc
  37.  *
  38.  * DESCRIPTION: Dialog procedure for the Color Page
  39.  *
  40.  *
  41. \**********************************************************************/
  42.  
  43.    MPARAM EXPENTRY ColorPageDlgProc(
  44.       HWND hwnd,
  45.       USHORT msg,
  46.       MPARAM mp1,
  47.       MPARAM mp2)
  48. {
  49.  
  50.  
  51.    MRESULT mresReply;
  52.    PBOOKINFO         pbookinfo;
  53.    static ContainerPart     *      myPart;
  54.    static ODNotebook        *      myNotebook;
  55.    Environment*    fSOMEnvironment;
  56.    fSOMEnvironment = somGetGlobalEnvironment();
  57.    ODFrame*  displayFrame;
  58.    ODUShort  whichColor;
  59.  
  60.    /* Get the data for this notebook
  61.     */
  62.    switch(msg)
  63.    {
  64.  
  65.       case WM_INITDLG:
  66.           // deselect radio button selected
  67.           WinCheckButton( hwnd, IDMA_COLOR_GRAY, FALSE) ;
  68.           if ( !(pbookinfo = (PBOOKINFO)WinQueryWindowULong(WinQueryWindow(
  69.              hwnd, QW_PARENT), QWL_USER)) )
  70.              return  (MRESULT)FALSE;
  71.  
  72.           // a pointer to the part is set inside the bookinfo structure which is stored
  73.           // in the window words. Get is in order to access part methods.
  74.           myPart     = (ContainerPart *)pbookinfo->thisPart;
  75.           myNotebook = (ODNotebook *)pbookinfo->thisNotebook;
  76.          return (MPARAM)0;
  77.  
  78.       case WM_COMMAND:
  79.             switch (SHORT1FROMMP(mp1))
  80.             {
  81.                case DID_OK:
  82.             // Query the state of all buttons to find out which was pressed
  83.             ContainerPartData *somThis =
  84.                ContainerPartGetData(myNotebook->GetBase(fSOMEnvironment));
  85.             displayFrame = (ODFrame *)(somThis->fDisplayFrames->First());
  86.  
  87.             mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_GRAY),
  88.                            BM_QUERYCHECK, 0, 0 );
  89.                   if(mresReply)
  90.                      whichColor = IDMA_COLOR_GRAY;
  91.             mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_RED),
  92.                            BM_QUERYCHECK, 0, 0 );
  93.                   if(mresReply)
  94.                      whichColor = IDMA_COLOR_RED;
  95.             mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_GREEN),
  96.                            BM_QUERYCHECK, 0, 0 );
  97.                   if(mresReply )
  98.                      whichColor = IDMA_COLOR_GREEN;
  99.             mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_YELLOW),
  100.                            BM_QUERYCHECK, 0, 0 );
  101.                   if(mresReply)
  102.                      whichColor = IDMA_COLOR_YELLOW;
  103.             mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_BLUE),
  104.                            BM_QUERYCHECK, 0, 0 );
  105.                   if(mresReply)
  106.                      whichColor = IDMA_COLOR_BLUE;
  107.             mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_MAGENTA),
  108.                            BM_QUERYCHECK, 0, 0 );
  109.                   if(mresReply)
  110.                      whichColor = IDMA_COLOR_MAGENTA;
  111.             mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_CYAN),
  112.                            BM_QUERYCHECK, 0, 0 );
  113.                   if(mresReply)
  114.                      whichColor = IDMA_COLOR_CYAN;
  115.             mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_WHITE),
  116.                            BM_QUERYCHECK, 0, 0 );
  117.                   if(mresReply)
  118.                      whichColor = IDMA_COLOR_WHITE;
  119.  
  120.             myPart->SetBGColor1(fSOMEnvironment, displayFrame, whichColor);
  121.             displayFrame->Invalidate(fSOMEnvironment, kODNULL);
  122.                   return (MPARAM)0;
  123.             }
  124.  
  125.       case WM_CONTROL:
  126.          switch (SHORT1FROMMP(mp1))
  127.          {
  128.                   return (MPARAM)0;
  129.          }
  130.       case WM_FOCUSCHANGE:
  131.          /* On a focus change, we will post a message to process all of the
  132.           * changes to stuff.  We don't want to do it here, because if a
  133.           * method displays an error message, we can't switch focus to the
  134.           * message and will hang.
  135.           */
  136.          WinPostMsg(hwnd, WM_FOCUS_PROCESSING, mp1, mp2);
  137.          return WinDefDlgProc( hwnd, msg, mp1, mp2);
  138.  
  139.       case WM_FOCUS_PROCESSING:
  140.                   return (MPARAM)0;
  141.       case WM_DESTROY:
  142.          /* save everything, as the post by the WM_FOCUSCHANGE message
  143.           * will not get processed before this message kills the dialog.
  144.           */
  145.          WinSendMsg(hwnd, WM_FOCUS_PROCESSING, mp1, mp2);
  146.          return WinDefDlgProc(hwnd, msg, mp1, mp2);
  147.  
  148.       default:
  149.          /* Pass all unprocessed messages to the default dialog proc.
  150.           */
  151.          return WinDefDlgProc( hwnd, msg, mp1, mp2);
  152.    }
  153. }
  154.  
  155.  
  156. SOM_Scope ODULong  SOMLINK ODNotebookInsertBackgroundPage(CNNotebook *somSelf,
  157.                                                            Environment *ev,
  158.                                                           HWND hwndNotebook)
  159. {
  160.     CNNotebookData *somThis = CNNotebookGetData(somSelf);
  161.     CNNotebookMethodDebug("CNNotebook","ODNotebookInsertBackgroundPage");
  162.  
  163.     /*
  164.      * Called by AddNotebookPages to insert the Part-Properties General
  165.      *   page. User can view and edit the part title andd icon.
  166.      *   It in turn calls InsertNotebookPage. DlgProc calls GeneralPageTitleChanged
  167.      *   and GeneralPageIconChanged when the notebook is destroyed.
  168.      * Returns: The pageid for the inserted page.
  169.      */
  170.  
  171.     PAGEINFO      pageinfo;
  172.  
  173.     /* Insert the icon settings page - it is applicable to
  174.      * almost all classes of object
  175.      */
  176.     memset( (PCH)&pageinfo, 0, sizeof( PAGEINFO ) );
  177.     pageinfo.cb                = sizeof(PAGEINFO);
  178.     pageinfo.usPageStyleFlags  = BKA_MAJOR;
  179.     pageinfo.usPageInsertFlags = BKA_FIRST;
  180.     pageinfo.pfnwp             = (PFNWP)ColorPageDlgProc;
  181.     pageinfo.resid             = _hmodHandle;
  182.  
  183.  
  184.     pageinfo.dlgid             = DL_COLORS;
  185.     pageinfo.pszName           = "Background";
  186.     pageinfo.usSettingsFlags    = SETTINGS_PAGE_NUMBERS;
  187.     pageinfo.pCreateParams     = (PVOID)somSelf; /* Let dialog know what object */
  188.  
  189.     /* Objects that are never templateable will not have a template
  190.      * checkbox and therefore need a different help panel res id
  191.      */
  192.     return somSelf->InsertNotebookPage(ev, hwndNotebook,  &pageinfo );
  193. }
  194.  
  195. SOM_Scope void  SOMLINK ODNotebookAddNotebookPages(CNNotebook *somSelf,
  196.                                                     Environment *ev,
  197.                                                    HWND hwndNotebook)
  198. {
  199.     CNNotebookData *somThis = CNNotebookGetData(somSelf);
  200.     CNNotebookMethodDebug("CNNotebook","ODNotebookAddNotebookPages");
  201.  
  202.     CHAR LoadError[100];
  203.     APIRET rc = DosLoadModule(LoadError, sizeof(LoadError),
  204.                    "cntnrprt", &_hmodHandle);
  205.  
  206.     somSelf->InsertBackgroundPage(ev, hwndNotebook);
  207.     CNNotebook_parent_ODNotebook_AddNotebookPages(somSelf, ev,
  208.                                                   hwndNotebook);
  209.  
  210. }
  211.  
  212. SOM_Scope void  SOMLINK ODNotebooksomInit(CNNotebook *somSelf)
  213. {
  214.     CNNotebookData *somThis = CNNotebookGetData(somSelf);
  215.     CNNotebookMethodDebug("CNNotebook","ODNotebooksomInit");
  216.  
  217.     CNNotebook_parent_ODNotebook_somInit(somSelf);
  218.  
  219.     _hmodHandle = 0;
  220. }
  221.  
  222. SOM_Scope void  SOMLINK ODNotebooksomUninit(CNNotebook *somSelf)
  223. {
  224.     /* CNNotebookData *somThis = CNNotebookGetData(somSelf); */
  225.     CNNotebookMethodDebug("CNNotebook","ODNotebooksomUninit");
  226.  
  227.     CNNotebook_parent_ODNotebook_somUninit(somSelf);
  228. }
  229.  
  230.