home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / bubpd103.zip / Source / bubblepd.cpp next >
C/C++ Source or Header  |  1998-11-15  |  72KB  |  1,732 lines

  1. /***********************************************************************/
  2. /* BubblePad - Replacement class for the launchpad of Warp 3/4         */
  3. /* (C) Chris Wohlgemuth                                                */
  4. /*                                                                     */
  5. /* E-Mail: chris.wohlgemuth@cityweb.de                                 */
  6. /*     or  christopher.wohlgemuth@bch.siemens.de                       */
  7. /*                                                                     */
  8. /* Released under the GNU Public Licence                               */
  9. /* See file COPYING for further information                            */
  10. /*                                                                     */
  11. /* 20.06.98 V1.00:  First public version                               */
  12. /* 16.08.98 V1.00a: Corrected bug: fly over help window on some        */
  13. /*                  systems remains visible. Workaround: When help     */
  14. /*                  stucks on the desktop move pointer over another    */
  15. /*                  button                                             */
  16. /*                                                                     */
  17. /* 18.08.98 V1.00b: Corrected positioning of drawers. Drawers below    */
  18. /*                  or on the left of the launchpad were placed        */
  19. /*                  with some distance to the launchpad                */
  20. /*                  Timer routines rewritten.                          */
  21. /*                                                                     */
  22. /* 18.08.98 V1.01: Stucking window problem for drawers with autoclose  */
  23. /*                  feature corrected                                  */
  24. /*                                                                     */
  25. /* 19.09.98 V1.02: Positioning of help windows for launchpad at the    */
  26. /*                 top of the desktop corrected.                       */
  27. /*                 Drawer button hide feature added.                   */
  28. /*                 Individual settings for BubblePads added.           */
  29. /*                 Bug with broken references causing drawers to       */
  30. /*                 disapear fixed                                      */
  31. /*                 Added saving of drawer state. Drawers are reopened  */
  32. /*                 on next reboot. Doesn't work with normal open/close */
  33. /*                 Moved button reordering from wpRefreshDrawer()      */
  34. /*                 to wpSetDrawerHWND(). This eliminates the flickering*/
  35. /*                 when opening drawers.                               */
  36. /*                                                                     */
  37. /* 13.11.98 V1.03: Option to disable/enable the reopening of drawers   */
  38. /*                 on reboot.                                          */
  39. /*                 Setup strings for the bubblepad features added.     */
  40. /*                 Option to remove each action button                 */
  41. /*                                                                     */
  42. /***********************************************************************/
  43. /*
  44.  * This program is free software; you can redistribute it and/or modify
  45.  * it under the terms of the GNU General Public License as published by
  46.  * the Free Software Foundation; either version 2, or (at your option)
  47.  * any later version.
  48.  *
  49.  * This program is distributed in the hope that it will be useful,
  50.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  51.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  52.  * GNU General Public License for more details.
  53.  *
  54.  * You should have received a copy of the GNU General Public License
  55.  * along with this program; see the file COPYING.  If not, write to
  56.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  57.  */
  58. #define INCL_WINWORKPLACE
  59. #define INCL_WPCLASS
  60. #define INCL_GPILCIDS
  61. #define INCL_GPIPRIMITIVES
  62. #define INCL_GPIBITMAPS
  63.  
  64. #include "BUBBLEPD.hh"
  65. #include <somcls.hh>
  66. #include <wpobject.hh>
  67. #include <pmwp.h>
  68. #include <os2.h>
  69.  
  70.  
  71. // for sprintf
  72. #include <stdio.h>
  73. #include <string.h>  //for strchr()
  74. #include <stdlib.h>  //for atoi
  75.  
  76. #define xVal  12      //x-distance of Bubble
  77. #define yVal  12      //y-distance of Bubble
  78. #define delta 0       //use this if you want to reduce the button size
  79.  
  80. //#define debug      //uncomment for debuging
  81.  
  82. static PFNWP  oldButtonProc2;  //place for original button-procedure
  83. static HWND hwndBubbleWindow=NULLHANDLE;// The handle of the help window
  84.  
  85. M_WPObject  M_ob;  //We need a class object to get an object pointer from HOBJECT
  86.  
  87. #ifdef debug
  88. /* Display a PM-Messagebox with an Errortext if debug is defined */
  89. void showMessage(HWND hwnd,PSZ msgText)
  90. {
  91.     WinMessageBox(HWND_DESKTOP,hwnd ,msgText ,"Debug Launchpad",0,MB_OK);
  92. }
  93. #endif
  94.  
  95. /* This function returns the module handle of our class-dll */
  96. HMODULE QueryModuleHandle(void)
  97. {
  98.     static HMODULE hmod=0;
  99.     
  100.     if(!hmod) {
  101.         PSZ pathname=SOMClassMgrObject  //Query Pathname of class file
  102.             ->somLocateClassFile(somIdFromString("WPLnchCW"),1,2);
  103.         DosQueryModuleHandle(pathname,&hmod);  //Query module handle
  104.     }
  105.     return hmod;
  106. }
  107.  
  108. /*************************************************************/
  109. /* This dialog procedure handles the Bubblehelp enable page  */
  110. /*************************************************************/
  111. MRESULT EXPENTRY BubblehelpDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {    
  112.         ULONG spinValue;
  113.  
  114.      switch(msg) {
  115.      case WM_INITDLG :    
  116.         //thisPtr
  117.         WinSetWindowULong(hwnd,QWL_USER,LONGFROMMP(mp2));
  118.         /* We have to initialize the dialog controls with the approbiate values */
  119.  
  120.         // Set the focus on the enable checkbox
  121.         WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, CWDLG_ENABLEBUBBLE));
  122.         // Set the linits for the delay spin button
  123.         WinSendMsg(WinWindowFromID(hwnd, CWDLG_DELAYSPIN),
  124.                              SPBM_SETLIMITS,(MPARAM)MAXDELAY,(MPARAM)0);
  125.         // Set the current value for delay
  126.         WinSendMsg(WinWindowFromID(hwnd, CWDLG_DELAYSPIN),
  127.                              SPBM_SETCURRENTVALUE,
  128.                              (MPARAM)((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->delayValue,
  129.                              (MPARAM)NULL);
  130.         // Enable or disable the spin button according to the value of bubbleEnabled
  131.         WinEnableWindow(WinWindowFromID(hwnd, CWDLG_DELAYSPIN),((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bubbleEnabled);
  132.         // Set the state of the enable checkbox
  133.         WinSendMsg(WinWindowFromID(hwnd, CWDLG_ENABLEBUBBLE),
  134.                              BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bubbleEnabled),(MPARAM)NULL);
  135.         return (MRESULT) TRUE;  //Initialisation done
  136.  
  137.      case WM_DESTROY:
  138.         /* The notebook closes and gets destroyed */
  139.         // Query the value of the delay spin button
  140.         WinSendMsg(WinWindowFromID(hwnd, CWDLG_DELAYSPIN),
  141.                              SPBM_QUERYVALUE,(MPARAM)&spinValue,
  142.                              MPFROM2SHORT(0,SPBQ_ALWAYSUPDATE));                
  143.         ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->delayValue=spinValue;
  144.             // Write the new  values to the instance permanent data
  145.         ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpSaveDeferred();
  146.         break;
  147.     case WM_CONTROL:
  148.         /* The window controls send WM_CONTROL messages */
  149.         switch(SHORT1FROMMP(mp1)) {
  150.         case CWDLG_ENABLEBUBBLE:
  151.             // We only have one checkbox, so we do not really need this switch statement
  152.             // but with it you can expand the dialog easily 
  153.             if(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bubbleEnabled)// switch the bubbleEnabled state
  154.                 ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bubbleEnabled=0;                        
  155.             else 
  156.                 ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bubbleEnabled=1;                
  157.             // Enable or disable the spin button according to the value of bubbleEnabled
  158.             WinEnableWindow(WinWindowFromID(hwnd, CWDLG_DELAYSPIN),((WPLnchCW*)WinQueryWindowULong(hwnd,QWL_USER))->bubbleEnabled);            
  159.             // Set the state of the enable checkbox    
  160.             WinSendMsg(WinWindowFromID(hwnd, CWDLG_ENABLEBUBBLE),
  161.                                  BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bubbleEnabled),(MPARAM)NULL);
  162.  
  163.             WinPostMsg(WinWindowFromID(((WPLnchCW*)WinQueryWindowULong(hwnd,QWL_USER))->wpQueryDrawerHWND(0),300),
  164.                                  BM_CLICK,FALSE,0);
  165.             break;
  166.         case CWDLG_DELAYSPIN:
  167.             switch (SHORT2FROMMP(mp1)) {
  168.             case SPBN_UPARROW:
  169.             case SPBN_DOWNARROW:
  170.             case SPBN_ENDSPIN:
  171.                 // Query the value of the delay spin button
  172.                 WinSendMsg(WinWindowFromID(hwnd, CWDLG_DELAYSPIN),
  173.                                      SPBM_QUERYVALUE,(MPARAM)&spinValue,
  174.                                      MPFROM2SHORT(0,SPBQ_ALWAYSUPDATE));                
  175.                 ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->delayValue=spinValue;            
  176.                 break;
  177.             default:
  178.                 break;
  179.             }
  180.         } // end switch(SHORT1FROMMP(mp1))
  181.         break;            
  182.         //} // end switch(SHORT2FROMMP(mp1))
  183.         return (MRESULT) TRUE;
  184.     }
  185.     // The WinDefDlgProc() handles the rest of the messages
  186.     return WinDefDlgProc(hwnd, msg, mp1, mp2);
  187. }
  188.  
  189. /*************************************************************/
  190. /* This dialog procedure handles the colour and font page    */
  191. /*************************************************************/            
  192. MRESULT EXPENTRY ColorchangeDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  193.     HINI hini;
  194.     HOBJECT  hObject;
  195.     ULONG  attrFound;
  196.     ULONG  len;
  197.     static RGB b;
  198.     static RGB f;
  199.     static     font[FONTNAMELENGTH];
  200.     char msgText[250];
  201.     
  202.      switch(msg) {
  203.      case WM_INITDLG :    
  204.         WinSetWindowULong(hwnd,QWL_USER,LONGFROMMP(mp2));
  205.     
  206.         /* We have to initialize the dialog controls with the approbiate values */
  207.  
  208.         // Set the focus on the demo area
  209.         WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, CWDLG_TEXTDEMOFIELD));
  210.         // Set the background colour of the demo area
  211.         WinSetPresParam(WinWindowFromID(hwnd, CWDLG_TEXTDEMOFIELD),
  212.                                         PP_BACKGROUNDCOLOR,(ULONG)sizeof(RGB) ,&((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->background );
  213.         // Set the foreground colour of the demo area
  214.         WinSetPresParam(WinWindowFromID(hwnd, CWDLG_TEXTDEMOFIELD),
  215.                                         PP_FOREGROUNDCOLOR,(ULONG)sizeof(RGB) ,&((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->foreground );
  216.         // Set the font of the demo area
  217.         WinSetPresParam(WinWindowFromID(hwnd, CWDLG_TEXTDEMOFIELD),
  218.                                         PP_FONTNAMESIZE,(ULONG)sizeof(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->fontName),
  219.                                         &((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->fontName );
  220.         b=((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->background;  // Save value for undo 
  221.         f=((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->foreground;  //Save value for undo
  222.         memcpy(&font,&((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->fontName,
  223.                      sizeof(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->fontName));
  224.         return (MRESULT) TRUE;
  225.     case WM_DESTROY:
  226.         /* The notebook closes and gets destroyed */
  227.         // Query the current background colour
  228.         len=WinQueryPresParam(WinWindowFromID(hwnd, CWDLG_TEXTDEMOFIELD),
  229.                                                     PP_BACKGROUNDCOLOR,0,&attrFound,sizeof(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->background),
  230.                                                     &((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->background,QPF_NOINHERIT);
  231.         // Query the current font
  232.         len=WinQueryPresParam(WinWindowFromID(hwnd, CWDLG_TEXTDEMOFIELD),
  233.                                                     PP_FONTNAMESIZE,0,&attrFound,sizeof(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->fontName),
  234.                                                     &((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->fontName,QPF_NOINHERIT);
  235.         // Query the current foreground colour
  236.         len=WinQueryPresParam(WinWindowFromID(hwnd, CWDLG_TEXTDEMOFIELD),
  237.                                                     PP_FOREGROUNDCOLOR,0,&attrFound,sizeof(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->foreground),
  238.                                                     &((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->foreground,QPF_NOINHERIT);
  239.         // Save font to instance permanent data
  240.         ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpSaveDeferred();
  241.         break;
  242.     case WM_COMMAND :
  243.         switch (SHORT1FROMMP(mp1)) {
  244.             // Process commands here //
  245.         case CWDLG_COLORUNDO:
  246.             /* The undo button was clicked */
  247.             ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->background=b;  // Restore the previous background colour
  248.             ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->foreground=f;  // Restore the previous background colour
  249.             // Set the background colour of the demo area
  250.             WinSetPresParam(WinWindowFromID(hwnd, CWDLG_TEXTDEMOFIELD),
  251.                                             PP_BACKGROUNDCOLOR,(ULONG)sizeof(RGB) ,&((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->background );
  252.             // Set the foreground colour of the demo area
  253.             WinSetPresParam(WinWindowFromID(hwnd, CWDLG_TEXTDEMOFIELD),
  254.                                             PP_FOREGROUNDCOLOR,(ULONG)sizeof(RGB) ,&((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->foreground );            
  255.             // Set the font of the demo area
  256.             WinSetPresParam(WinWindowFromID(hwnd, CWDLG_TEXTDEMOFIELD),
  257.                                             PP_FONTNAMESIZE,(ULONG)sizeof(font) ,&font);
  258.             break;
  259.         case CWDLG_COLORSTANDARD:
  260.             /* The default button was clicked */
  261.             ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->background.bBlue=180;  // Set the default colours
  262.             ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->background.bGreen=255; 
  263.             ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->background.bRed=255;
  264.             ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->foreground.bBlue=0;
  265.             ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->foreground.bGreen=0;            
  266.             ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->foreground.bRed=0;
  267.             // Set the default font
  268.             memcpy(&((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->fontName,"8.Helv",sizeof("8.Helv"));
  269.             // Set the background colour of the demo area
  270.             WinSetPresParam(WinWindowFromID(hwnd, CWDLG_TEXTDEMOFIELD),
  271.                                             PP_BACKGROUNDCOLOR,(ULONG)sizeof(RGB) ,&((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->background );
  272.             // Set the foreground colour of the demo area
  273.             WinSetPresParam(WinWindowFromID(hwnd, CWDLG_TEXTDEMOFIELD),
  274.                                             PP_FOREGROUNDCOLOR,(ULONG)sizeof(RGB) ,&((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->foreground );
  275.             // Set the font of the demo area
  276.             WinSetPresParam(WinWindowFromID(hwnd, CWDLG_TEXTDEMOFIELD),
  277.                                             PP_FONTNAMESIZE,(ULONG)sizeof(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->fontName),
  278.                                             &((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->fontName );
  279.             break;
  280.         case CWDLG_COLORPALETTE:
  281.             /* Colour... button was clicked */
  282.             // Open the colorpalette 
  283.             if((hObject=WinQueryObject("<WP_HIRESCLRPAL>"))!=NULL) {
  284.                 WinOpenObject(hObject,OPEN_DEFAULT,TRUE);
  285.             }
  286.             else {//Error, can't open the palette
  287.                 /*  Show an error msg.                           */
  288.                 WinLoadString(WinQueryAnchorBlock(hwnd),QueryModuleHandle(),ID_NOCOLORPALETTESTRING,
  289.                                             sizeof(msgText), msgText);
  290.                 WinMessageBox(HWND_DESKTOP,
  291.                                             hwnd,         
  292.                                             msgText,          
  293.                                             (PSZ) NULL,                      
  294.                                             ID_COLORPALETTEMSGBOX,            /* Window ID */
  295.                                             MB_OK |
  296.                                             MB_MOVEABLE |
  297.                                             MB_ICONEXCLAMATION |
  298.                                             MB_DEFBUTTON1);                  /* Style     */
  299.                 
  300.             }
  301.             break;
  302.         case CWDLG_FONTPALETTE:
  303.             /* Font... button was clicked */
  304.             // Open the fontpalette 
  305.             if((hObject=WinQueryObject("<WP_FNTPAL>"))!=NULL) {
  306.                 WinOpenObject(hObject,OPEN_DEFAULT,TRUE);
  307.             }
  308.             else {//Error, can't open the palette
  309.                 /*  Show an error msg.                           */
  310.                 WinLoadString(WinQueryAnchorBlock(hwnd),QueryModuleHandle(),ID_NOFONTPALETTESTRING,
  311.                                             sizeof(msgText), msgText);
  312.                 WinMessageBox(HWND_DESKTOP,
  313.                                             hwnd,         
  314.                                             msgText,          
  315.                                             (PSZ) NULL,                      
  316.                                             ID_COLORPALETTEMSGBOX,                   /* Window ID */
  317.                                             MB_OK |
  318.                                             MB_MOVEABLE |
  319.                                             MB_ICONEXCLAMATION |
  320.                                             MB_DEFBUTTON1);                  /* Style     */
  321.             }
  322.             break;
  323.         }
  324.         /* Don't call WinDefDlgProc here, or the dialog gets closed */
  325.         return (MRESULT) TRUE;
  326.     }
  327.     // The WinDefDlgProc() handles the rest of the messages
  328.     return WinDefDlgProc(hwnd, msg, mp1, mp2);
  329. }
  330.  
  331.  
  332. /*************************************************************/
  333. /* This dialog procedure handles the third option page       */
  334. /*************************************************************/
  335. MRESULT EXPENTRY OptionDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  336.     
  337.      switch(msg) {
  338.      case WM_INITDLG :    
  339.         /* We have to initialize the dialog controls with the approbiate values */
  340.         WinSetWindowULong(hwnd,QWL_USER,LONGFROMMP(mp2));
  341.         // Set the focus on the smallsize checkbox
  342.         WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, CWDLG_SMALLSIZE));
  343.         // Set limits of the distance spinbutton
  344.         WinSendMsg(WinWindowFromID(hwnd, CWDLG_DISTANCESPIN),
  345.                              SPBM_SETLIMITS,(MPARAM)MAXBUTTONDISTANCE,(MPARAM)MINBUTTONDISTANCE);
  346.         // Set distance spinbutton to the current value of icondistance
  347.         WinSendMsg(WinWindowFromID(hwnd, CWDLG_DISTANCESPIN),
  348.                              SPBM_SETCURRENTVALUE,
  349.                              (MPARAM)((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->icondistance,
  350.                              (MPARAM)NULL);
  351.         // Enable or disable the spin button according to the value of smallSizeEnabled
  352.         WinEnableWindow(WinWindowFromID(hwnd, CWDLG_DISTANCESPIN),((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->smallSizeEnabled);
  353.         // Set the state of the smallSizeEnabled checkbox
  354.         WinSendMsg(WinWindowFromID(hwnd, CWDLG_SMALLSIZE),
  355.                              BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->smallSizeEnabled),(MPARAM)NULL);
  356.         // Enable or disable the noDrawers checkbox according to the value of smallSizeEnabled
  357.         WinEnableWindow(WinWindowFromID(hwnd, CWDLG_NODRAWERS),((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->smallSizeEnabled);
  358.         // Set the state of the noDrawers checkbox
  359.         WinSendMsg(WinWindowFromID(hwnd, CWDLG_NODRAWERS),
  360.                              BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->noDrawers),(MPARAM)NULL);
  361.         // Set the state of the ReOpenDrawers checkbox
  362.         WinSendMsg(WinWindowFromID(hwnd, CWDLG_REOPEN),
  363.                              BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->ulReOpen),(MPARAM)NULL);
  364.         return (MRESULT) TRUE;
  365.     case WM_DESTROY:
  366.         /* The notebook closes and gets destroyed */
  367.         // Save the value to the instance data
  368.         ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpSaveDeferred();
  369.         break;                
  370.     case WM_CONTROL:
  371.         switch (SHORT2FROMMP(mp1)) {
  372.         case SPBN_ENDSPIN:
  373.             /* The value of the spinbutton has changed */
  374.             ULONG spinValue;
  375.             // Query the new spinbutton value
  376.             WinSendMsg(WinWindowFromID(hwnd, CWDLG_DISTANCESPIN),
  377.                                  SPBM_QUERYVALUE,(MPARAM)&spinValue,
  378.                                  MPFROM2SHORT(0,SPBQ_ALWAYSUPDATE));                                     
  379.             ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->icondistance=spinValue;
  380.             // Refresh the size of the launchpad
  381.             ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpRefreshDrawer(0);//0: LaunchPad
  382.             break;
  383.         case BN_CLICKED:
  384.             switch(SHORT1FROMMP(mp1)) {
  385.             case CWDLG_SMALLSIZE:
  386.                 /* checkbox was clicked */
  387.                 if(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->smallSizeEnabled)  // Change the value of smallSizeEnabled
  388.                     ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->smallSizeEnabled=0;
  389.                 else 
  390.                     ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->smallSizeEnabled=1;                
  391.                 // Set the checkbox state
  392.                 WinSendMsg(WinWindowFromID(hwnd, CWDLG_SMALLSIZE),
  393.                                      BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->smallSizeEnabled),(MPARAM)NULL);
  394.                 // Enable/disable the spinbutton
  395.                 WinEnableWindow(WinWindowFromID(hwnd, CWDLG_DISTANCESPIN),((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->smallSizeEnabled);
  396.                 // Enable/disable the noDrawers checkbox
  397.                 WinEnableWindow(WinWindowFromID(hwnd, CWDLG_NODRAWERS),((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->smallSizeEnabled);
  398.                 // Refresh the size of the launchpad
  399.                 ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpRefreshDrawer(0);//0: LaunchPad
  400.                 break;
  401.             case CWDLG_NODRAWERS:
  402.                 if(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpQueryHideDrawers())  // Change the value of smallSizeEnabled
  403.                     ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpSetHideDrawers(0);
  404.                 else 
  405.                     ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpSetHideDrawers(1);
  406.                 // Set the checkbox state
  407.                  WinSendMsg(WinWindowFromID(hwnd, CWDLG_NODRAWERS),
  408.                                      BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpQueryHideDrawers()),(MPARAM)NULL);
  409.                 // Refresh the size of the launchpad
  410.                 ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpRefreshDrawer(0);//0: LaunchPad
  411.                 break;
  412.             case CWDLG_REOPEN:
  413.                 /* checkbox was clicked */
  414.                 if(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->ulReOpen)  // Change the value of smallSizeEnabled
  415.                     ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->ulReOpen=0;
  416.                 else 
  417.                     ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->ulReOpen=1;                
  418.                 // Set the checkbox state
  419.                 WinSendMsg(WinWindowFromID(hwnd, CWDLG_REOPEN),
  420.                                      BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->ulReOpen),(MPARAM)NULL);
  421.                 break;
  422.             } // end switch(SHORT1FROMMP(mp1))
  423.             break;
  424.         }// end switch SHORT2FROMMP(mp1)
  425.         return (MRESULT) TRUE;
  426.     }
  427.     // The WinDefDlgProc() handles the rest of the messages
  428.     return WinDefDlgProc(hwnd, msg, mp1, mp2);
  429. }
  430.  
  431. /*************************************************************/
  432. /* This dialog procedure handles the action button page      */
  433. /*************************************************************/
  434. MRESULT EXPENTRY ActionButtonDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  435.     
  436.      switch(msg) {
  437.      case WM_INITDLG :    
  438.         /* We have to initialize the dialog controls with the approbiate values */
  439.         WinSetWindowULong(hwnd,QWL_USER,LONGFROMMP(mp2));
  440.         // Set the focus on the smallsize checkbox
  441.         WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, CBID_SHUTDOWN));
  442.  
  443.         // Set the state of the shutdown checkbox
  444.         WinSendMsg(WinWindowFromID(hwnd, CBID_SHUTDOWN),
  445.                              BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bShutdown),(MPARAM)NULL);
  446.         // Set the state of the lock checkbox
  447.         WinSendMsg(WinWindowFromID(hwnd, CBID_LOCK),
  448.                              BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bLock),(MPARAM)NULL);
  449.         // Set the state of the windowlist checkbox
  450.         WinSendMsg(WinWindowFromID(hwnd, CBID_WINDOWLIST),
  451.                              BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bWindowList),(MPARAM)NULL);
  452.         // Set the state of the search checkbox
  453.         WinSendMsg(WinWindowFromID(hwnd, CBID_SEARCH),
  454.                              BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bSearch),(MPARAM)NULL);
  455.         return (MRESULT) TRUE;
  456.     case WM_DESTROY:
  457.         /* The notebook closes and gets destroyed */
  458.         // Save the value to the instance data
  459.         ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpSaveDeferred();
  460.         break;                
  461.     case WM_CONTROL:
  462.         switch (SHORT2FROMMP(mp1)) {
  463.         case BN_CLICKED:
  464.             switch(SHORT1FROMMP(mp1)) {
  465.             case CBID_SHUTDOWN:
  466.                 /* checkbox was clicked */
  467.                 if(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bShutdown)  // Change the value of smallSizeEnabled
  468.                     ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bShutdown=FALSE;
  469.                 else 
  470.                     ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bShutdown=TRUE;                
  471.                 // Set the checkbox state
  472.                 WinSendMsg(WinWindowFromID(hwnd, CBID_SHUTDOWN),
  473.                                      BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bShutdown),(MPARAM)NULL);
  474.                 // Refresh the size of the launchpad
  475.                 ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpRefreshDrawer(0);//0: LaunchPad
  476.                 break;
  477.             case CBID_LOCK:
  478.                 /* checkbox was clicked */
  479.                 if(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bLock)  // Change the value of smallSizeEnabled
  480.                     ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bLock=FALSE;
  481.                 else 
  482.                     ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bLock=TRUE;                
  483.                 // Set the checkbox state
  484.                 WinSendMsg(WinWindowFromID(hwnd, CBID_LOCK),
  485.                                      BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bLock),(MPARAM)NULL);
  486.                 // Refresh the size of the launchpad
  487.                 ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpRefreshDrawer(0);//0: LaunchPad
  488.                 break;
  489.             case CBID_WINDOWLIST:
  490.                 /* checkbox was clicked */
  491.                 if(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bWindowList)  // Change the value of smallSizeEnabled
  492.                     ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bWindowList=FALSE;
  493.                 else 
  494.                     ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bWindowList=TRUE;                
  495.                 // Set the checkbox state
  496.                 WinSendMsg(WinWindowFromID(hwnd, CBID_WINDOWLIST),
  497.                                      BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bWindowList),(MPARAM)NULL);
  498.                 // Refresh the size of the launchpad
  499.                 ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpRefreshDrawer(0);//0: LaunchPad
  500.                 break;
  501.             case CBID_SEARCH:
  502.                 /* checkbox was clicked */
  503.                 if(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bSearch)  // Change the value of smallSizeEnabled
  504.                     ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bSearch=FALSE;
  505.                 else 
  506.                     ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bSearch=TRUE;                
  507.                 // Set the checkbox state
  508.                 WinSendMsg(WinWindowFromID(hwnd, CBID_SEARCH),
  509.                                      BM_SETCHECK,MPFROMSHORT(((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->bSearch),(MPARAM)NULL);
  510.                 // Refresh the size of the launchpad
  511.                 ((WPLnchCW*) WinQueryWindowULong(hwnd,QWL_USER))->wpRefreshDrawer(0);//0: LaunchPad
  512.                 break;
  513.             } // end switch(SHORT1FROMMP(mp1))
  514.             break;
  515.         }// end switch SHORT2FROMMP(mp1)
  516.         return (MRESULT) TRUE;
  517.     }
  518.     // The WinDefDlgProc() handles the rest of the messages
  519.     return WinDefDlgProc(hwnd, msg, mp1, mp2);
  520. }
  521.  
  522. /*****************************************************************************/
  523. /*  New launchpad button procedure with fly over help                                                */
  524. /*****************************************************************************/
  525. static MRESULT EXPENTRY newButtonProc(HWND hwnd, ULONG msg,MPARAM mp1,MPARAM mp2 )
  526. {
  527.     static BOOL bBubbleOn=TRUE;
  528.     POINTL ptl;
  529.     HPS  hps;
  530.     FONTMETRICS   fm;
  531.     LONG  ulWinTextLen;
  532.     POINTL aptlPoints[TXTBOX_COUNT];
  533.     RECTL   rcl;
  534.     LONG   deltaX,deltaY;
  535.     RGB    rgb= {200,200,0};
  536.     static USHORT id=0;//Initialisation new in V1.00a 
  537.     RECTL  rclWork;
  538.     ULONG bubbleEnabled;
  539.     HWND hwndStore;
  540.     
  541.     switch (msg)
  542.         {
  543.         case WM_DESTROY:
  544.             WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,1);//Stop timer if running
  545.             if(hwndBubbleWindow) WinDestroyWindow(hwndBubbleWindow);/*  close the bubblewindow  */
  546.             hwndBubbleWindow=0;
  547.             /* Stop delay timer if running */
  548.             WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,WinQueryWindowUShort(hwnd,QWS_ID));            
  549.             break;
  550.         case WM_NEWBUBBLE:
  551.             ULONG bubbleEnabled;
  552.             HWND hwndStore;
  553.             bubbleEnabled=1;
  554.             hwndStore=WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),ID_STOREWINDOW);
  555.             if(hwndStore)bubbleEnabled=((WPLnchCW*) WinQueryWindowULong(hwndStore,QWL_USER) )->bubbleEnabled;
  556.             /*  we have to build a new information window                                                                   */
  557.             if(hwndBubbleWindow){// if(){...} new in V1.00a 
  558.                 WinDestroyWindow(hwndBubbleWindow);/*  close the bubblewindow  */
  559.                 hwndBubbleWindow=0;
  560.             }
  561.             // Query the pointer position
  562.             WinQueryPointerPos(HWND_DESKTOP,&ptl);
  563.             WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1);
  564.             WinQueryWindowRect(hwnd,&rclWork);                
  565.             if(!hwndBubbleWindow 
  566.                  && WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl)
  567.                  && bubbleEnabled) {
  568.                 static HWND hwndBubbleClient;
  569.                 ULONG style=FCF_BORDER;
  570.                 char winText[255];
  571.  
  572.                 /* Get window text (It's the object title) for size calculating */
  573.                 WinQueryWindowText(hwnd,sizeof(winText),winText);
  574.                 ulWinTextLen=(LONG)strlen(winText); // Query text length
  575.  
  576.                 /* Delete 'Returns' in object title */
  577.                 char *pBuchst;
  578.                 pBuchst=strchr(winText,10);
  579.                 if(pBuchst)    winText[pBuchst-winText]=' ';
  580.                 pBuchst=strchr(winText,13);
  581.                 if(pBuchst)    winText[pBuchst-winText]=' ';
  582.                 
  583.                 /* Create help window */
  584.                 hwndBubbleWindow=WinCreateStdWindow(HWND_DESKTOP,
  585.                                                                                         0,
  586.                                                                                         &style,
  587.                                                                                         WC_STATIC,
  588.                                                                                         "",
  589.                                                                                         SS_TEXT|DT_CENTER|DT_VCENTER,
  590.                                                                                         NULLHANDLE,
  591.                                                                                         400,
  592.                                                                                         &hwndBubbleClient);
  593.                          
  594.                 // Set the font for the help
  595.                 WinSetPresParam(hwndBubbleClient,PP_FONTNAMESIZE,sizeof(((WPLnchCW*) WinQueryWindowULong(hwndStore,QWL_USER) )->fontName),
  596.                                                 &((WPLnchCW*) WinQueryWindowULong(hwndStore,QWL_USER) )->fontName);
  597.                 /* Calculate text size in pixel */
  598.                 hps=WinBeginPaint(hwndBubbleClient,(HPS)NULL,(PRECTL)NULL);
  599.                 GpiQueryTextBox(hps,ulWinTextLen,winText,TXTBOX_COUNT,aptlPoints);
  600.                 WinEndPaint(hps);
  601.                 
  602.                 /* Set colors */
  603.                 WinSetPresParam(hwndBubbleClient,
  604.                                                 PP_BACKGROUNDCOLOR,sizeof(RGB) ,&((WPLnchCW*) WinQueryWindowULong(hwndStore,QWL_USER) )->background );
  605.                 WinSetPresParam(hwndBubbleClient,
  606.                                                 PP_FOREGROUNDCOLOR,sizeof(RGB) ,&((WPLnchCW*) WinQueryWindowULong(hwndStore,QWL_USER) )->foreground );                
  607.  
  608.                 /* Calculate bubble positon and show bubble */
  609.                 WinQueryPointerPos(HWND_DESKTOP,&ptl);//Query pointer position in the desktop window
  610.                 WinQueryWindowRect(HWND_DESKTOP,&rcl);//Query desktop size
  611.                 aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+7+xVal+ptl.x 
  612.                     > rcl.xRight 
  613.                     ? deltaX=-aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x-xVal-xVal-7 
  614.                     : deltaX=0 ;
  615.                 /*
  616.                 aptlPoints[TXTBOX_TOPLEFT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+2+yVal+ptl.x 
  617.                     > rcl.yTop 
  618.                     ? deltaY=-aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x-yVal
  619.                     : deltaY=0 ;    */            
  620.                 aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y+2+yVal+ptl.y 
  621.                     > rcl.yTop 
  622.                     ? deltaY=-aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y-2*yVal-7
  623.                     : deltaY=0 ;                
  624.                 WinSetWindowPos(hwndBubbleWindow,
  625.                                                 HWND_DESKTOP,
  626.                                                 ptl.x+xVal+deltaX,ptl.y+yVal+deltaY,  //deltaY value not used yet
  627.                                                 aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+8,
  628.                                                 aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y+2,
  629.                                                 SWP_SIZE|SWP_MOVE|SWP_SHOW);
  630.                 /* Set bubble text */
  631.                 WinSetWindowText(hwndBubbleClient,winText);
  632.                 WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,1,35); 
  633.             } // end if(!hwndBubbleWindow)
  634.             break;
  635.         case WM_MOUSEMOVE:
  636.             USHORT  tempID;
  637.             ULONG delayValue;
  638.             delayValue=250;
  639.             hwndStore=WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),ID_STOREWINDOW);
  640.             if(hwndStore)delayValue=((WPLnchCW*) WinQueryWindowULong(hwndStore,QWL_USER) )->delayValue;
  641.             tempID=WinQueryWindowUShort(hwnd,QWS_ID);/*  get the id of the window under the pointer  */              
  642.             if(id!=tempID) {    // New Button?    
  643.                 WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,tempID,(ULONG)delayValue); // New timer for delay
  644.                 id=tempID;  // Save ID 
  645.             }
  646.             else {
  647.                 if(!hwndBubbleWindow)WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,tempID,(ULONG)delayValue); // New timer for delay    
  648.             }            
  649.             break;
  650.         case WM_TIMER:            
  651.             switch (SHORT1FROMMP(mp1))
  652.                 {
  653.                 case 1: //Intervall timer
  654.                     /* Test pointer position */
  655.                     WinQueryPointerPos(HWND_DESKTOP,&ptl);
  656.                     WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1);
  657.                     WinQueryWindowRect(hwnd,&rclWork);
  658.                     if(!WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl))
  659.                         {    // Button has changed                 
  660.                             WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,1);  // stop the running timer
  661.                             if(hwndBubbleWindow) WinDestroyWindow(hwndBubbleWindow);/*  close the bubblewindow  */
  662.                             hwndBubbleWindow=0;
  663.                             id=0;
  664.                         }                         
  665.                     break;
  666.                 default:// delay over
  667.                     //                    if (SHORT1FROMMP(mp1)==id) {
  668.                     if (SHORT1FROMMP(mp1)==WinQueryWindowUShort(hwnd,QWS_ID)) {//our own timer. It has got the window id
  669.                         WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,SHORT1FROMMP(mp1));//Stop the delay timer
  670.                         /* Check the pointer position */
  671.                         WinQueryPointerPos(HWND_DESKTOP,&ptl);
  672.                         WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1);
  673.                         WinQueryWindowRect(hwnd,&rclWork);
  674.                         if(WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl))
  675.                             WinPostMsg(hwnd,WM_NEWBUBBLE,NULL,NULL);//Request a help window
  676.                     }
  677.                     break;
  678.                 }
  679.             break;            
  680.         }
  681.     // call the original button procedure to handle the rest of the messages
  682.     return (*oldButtonProc2)(hwnd,msg,mp1,mp2);    
  683. };
  684.  
  685. /* This class function returns the name of our class */
  686. PSZ M_WPLnchCW::wpclsQueryTitle()
  687. {
  688.     return "Ext-LaunchPad";
  689. }
  690.  
  691. /************************************************************/
  692. /* We have to override wpRefreshDrawer() cause we must know */
  693. /* if there're new objects on the launchpad. Every object   */
  694. /* has got a button and we have to change the window        */
  695. /* procedure of the button                                  */
  696. /************************************************************/ 
  697. void WPLnchCW::wpRefreshDrawer(ULONG ulDrawer)
  698. {
  699.     
  700.     // Call parent so it can update its private structures and build the
  701.     // buttons
  702.     // We will change the button procedures later on to provide the 
  703.     // bubble help 
  704.     ((somTD_WPLaunchPad_wpRefreshDrawer)
  705.      somParentNumResolve(__ClassObject->somGetPClsMtabs(),
  706.                                              1,
  707.                                              __ClassObject->
  708.                                              somGetMethodToken(somIdFromString
  709.                                                                                  ("wpRefreshDrawer")))
  710.      )(this,ulDrawer);        
  711.     // This piece of code looks strange, because we're doing no additional processing. Only if we're doing that
  712.     // wpSetDrawerHWND(ULONG ulDrawer,HWND hwnd) is called with the new hwnd. Might be a bug.
  713.     // Docs say wpSetDrawer() is called every time a drawer is build. I realized it is only called when the drawer
  714.     // closes. 
  715.     return;
  716. }
  717.  
  718. void WPLnchCW::wpSetDrawerHWND(ULONG ulDrawer,HWND hwndDrawer)
  719. {
  720.     SWP  swp;
  721.     SWP  lpSWP;
  722.     SWP  desktopSWP;
  723.     
  724.     HWND hwnd;
  725.     HWND hwndNext;
  726.     HWND hwndStore;
  727.     
  728.     HENUM henum;
  729.     BOOL  succ;
  730.     USHORT  id;
  731.     PFNWP  tempProc;
  732.     ULONG  num;
  733.     int maxcy,maxcy1,maxcy3,maxcy2,maxcx,maxcx1,maxcx2,maxcx3;
  734.     ULONG numActionButtons;
  735.     int deltaActionButtons;
  736.     ULONG xpos,ypos;
  737.     ULONG res;
  738.     ULONG tempBit;    
  739.     int titlebarSize;
  740.     int actionButtonsText;
  741.  
  742.     int textDelta2;
  743.     int textDelta;
  744.     PSZ  objectTitle;
  745.     HOBJECT *hobject;
  746.     BOOL  isVertical;
  747.     WPObject *wpObject;
  748.     int hasActionButtons;
  749.  
  750. #ifdef debug
  751.     char buf2[260];
  752.     sprintf(buf2,"wpSetDrawerHWND() beginning    ulDrawer: %x hwndDrawer: %x ",ulDrawer,hwndDrawer);
  753.     showMessage(HWND_DESKTOP,buf2);
  754. #endif                                
  755.                         
  756.     actionButtonsText=0;    
  757.     hasActionButtons=1;
  758.     
  759.     if(!hwndDrawer){//Drawer closes, no reordering of buttons necessary
  760.         if(ulDrawer)
  761.             {//We have a drawer. Mark it as closed
  762.                 ULONG tempBit;
  763.                 tempBit=1;
  764.                 tempBit=tempBit<<(ulDrawer-1);
  765.                 ulOpenDrawers&=~tempBit;
  766.             }
  767.         ((somTD_WPLaunchPad_wpSetDrawerHWND)
  768.          somParentNumResolve(__ClassObject->somGetPClsMtabs(),
  769.                                                  1,
  770.                                                  __ClassObject->
  771.                                                  somGetMethodToken(somIdFromString
  772.                                                                                      ("wpSetDrawerHWND")))
  773.          )(this,ulDrawer,hwndDrawer);                
  774.         return;
  775.     }    
  776.     
  777.     if(!WinWindowFromID(hwndDrawer,200)){//That's the first Button. If we have it, the launchpad is built.
  778.         // No the pad isn't ready. Call parent and wait for next call
  779.         ((somTD_WPLaunchPad_wpSetDrawerHWND)
  780.          somParentNumResolve(__ClassObject->somGetPClsMtabs(),
  781.                                                  1,
  782.                                                  __ClassObject->
  783.                                                  somGetMethodToken(somIdFromString
  784.                                                                                      ("wpSetDrawerHWND")))
  785.          )(this,ulDrawer,hwndDrawer);            
  786.         return;
  787.     }
  788.     
  789.     
  790.     // The original Launchpad has built the buttons. We can now reorder them. The Launchpad isn't visible yet.
  791.     // When calling wpSetDrawerHWND() of the parent the launchpad will be displayed
  792.     
  793.     if(ulDrawer)
  794.         {//We have a drawer. Mark it as opened, so we can save the open state on shutdown and reopen it on IPL
  795.             ULONG tempBit;
  796.             tempBit=1;
  797.             tempBit=tempBit << (ulDrawer-1);
  798.             ulOpenDrawers|=tempBit;        
  799. #ifdef debug
  800.             char buf2[260];
  801.             sprintf(buf2,"ulDrawer: %x ulOpenDrawers:  %x  tempBit: %x",ulDrawer,ulOpenDrawers,tempBit);                                
  802.             //    showMessage(HWND_DESKTOP,buf2);
  803. #endif
  804.             wpSaveDeferred();//Save open state
  805.         }
  806.     
  807.     //Query state of ActionButtons?
  808.     res=wpQueryActionButtonStyle();    
  809.     if(res==ACTION_BUTTONS_OFF)hasActionButtons=0;
  810.     if(res==ACTION_BUTTONS_TEXT)actionButtonsText=1;
  811.     wpQueryActionButtons(&numActionButtons);
  812.     deltaActionButtons=2;
  813.     if(numActionButtons<=3)deltaActionButtons=1;
  814.     if(numActionButtons==1)deltaActionButtons=0;
  815.  
  816.     //The Warpcenter is a Child of WPLaunchPad, so it inherits all the features.
  817.     // We substitute WPLaunchPad with WPLnchCW, so the Warpcenter inherits the 
  818.     // bubblehelp but it doesn't need it cause it has its own. So if it's the WarpCenter
  819.     // do nothing.
  820.     if(strcmp(somGetClassName(),"SmartCenter")) {// 0 if equal
  821.         // It's not the Warpcenter
  822.         
  823.         // Query the window handle of the drawer
  824.         //It may be the launchpad itself or a drawer
  825.         //hwnd=wpQueryDrawerHWND(ulDrawer);
  826.         hwnd=hwndDrawer;
  827.         
  828.         if(!WinWindowFromID(hwnd,ID_STOREWINDOW))//We use this window to store our object ptr
  829.             WinCreateWindow(hwnd,WC_BUTTON,"StoreWindow",0,0,0,0,0,NULL,HWND_TOP,ID_STOREWINDOW,NULL,NULL);
  830.         hwndStore=WinWindowFromID(hwnd,ID_STOREWINDOW);
  831.         if(hwndStore)WinSetWindowULong(hwndStore,QWL_USER,(ULONG)this);
  832.         isVertical=wpQueryDisplayVertical();//true if vertical 
  833.         if(hwnd) {  // Just to catch errors
  834. #ifdef debug
  835.             //    showMessage(hwnd,"Main window");
  836. #endif
  837.             // Query the list of objects living on this drawer
  838.             hobject=wpQueryObjectList(ulDrawer,&num);
  839.             xpos=0;
  840.             maxcx=0;
  841.             maxcy=0;                        
  842.             maxcx1=-1;
  843.             maxcy1=-1;
  844.  
  845.             henum=WinBeginEnumWindows(hwnd);// We will query all child windows
  846.             while((hwndNext=WinGetNextWindow(henum))!=NULLHANDLE) {
  847.                 // Get windowsize and position
  848.                 WinQueryWindowPos(hwndNext,(PSWP)&swp);
  849.                 
  850.                 // Query window ID
  851.                 // The small drawer buttons have got ID 3XX
  852.                 // The object buttons have got ID 2XX
  853.                 // The action buttons (e.g. shutdown) have got ID 1XX
  854.                 id=WinQueryWindowUShort(hwndNext,QWS_ID);    
  855.                 if(id<400) {
  856.                     if(id>=300) //ID 3XX Drawer-Buttons
  857.                         {
  858.                             maxcy3=swp.cy;//Vert. size of Drawer-Buttons. We need it later
  859.                             maxcx3=swp.cx;//Horz. size of Drawer-Buttons
  860.                             if(noDrawers){
  861.                                 maxcx3=-(int)(icondistance/2);
  862.                                 maxcy3=-(int)(icondistance/2);
  863. #ifdef debug
  864.                                 char buf[260];
  865.                                 sprintf(buf,"maxcx3: %d,     maxcy3:   %d,    icondistance: %d",maxcx3,maxcy3,icondistance);
  866.                                 //                    showMessage(HWND_DESKTOP,buf);
  867. #endif                                    
  868.                             }
  869.                         }
  870.                     else{
  871.                         if(id>=200){   //ID 2XX object Buttons on the launchpad
  872.                             maxcy2=swp.cy;//Vert. sizeize of Prog-Buttons
  873.                             maxcx2=swp.cx;//Horz. size of Prog-Buttons
  874.                             maxcx+=swp.cx+icondistance;  // We need this for sizechanging of the launchpad
  875.                             maxcy+=swp.cy+icondistance;
  876.  
  877.                             //        maxcx+=swp.cx+icondistance/2;  // We need this for sizechanging of the launchpad
  878.                             //        maxcy+=swp.cy+icondistance/2;// When using delta
  879.                         }
  880.                         else{
  881.                             if(id==100){ //ID 1XX System-Buttons auf der Klickstart
  882.                                 xpos=swp.x;//x-pos of leftmost button
  883.                                 ypos=swp.y;
  884.                                 maxcx1=swp.cx;
  885.                                 maxcy1=swp.cy;
  886.                                 maxcx+=((swp.cx+1)*numActionButtons);// There're 4 system buttons (normaly)
  887.                                 maxcy+=((swp.cy+1)*numActionButtons);                            
  888.                             }
  889.                         }
  890.                     }                
  891.                 }//end id<400
  892.                 else {//id>400. One of these windows must be the Titlebar
  893.                     char classname[4];
  894.                     //Check if it's the titlebar
  895.                     if(WinQueryClassName(hwndNext,sizeof(classname),classname)==2) {
  896.                         if(*(classname+1)==0x39) {//WC_TITLEBAR
  897.                             // We can't use the system defined value for the titlebar size
  898.                             // because the user may use a custom font for the titlebar so
  899.                             // the size is unknown.
  900.                             WinQueryWindowPos(hwndNext,(PSWP)&swp);//Titlebardimensions
  901.                             // We have to take care of the titlebar size if we resize the launchpad
  902.                             // so save the value
  903.                             titlebarSize=swp.cy;//y-size=0 if titlebar isn't visible
  904.                         }
  905.                     }                    
  906.                 }
  907.             }
  908.             succ=WinEndEnumWindows(henum);
  909.             /****************************************
  910.              *                     
  911.              * Size Launchpad 
  912.              *
  913.              ****************************************/
  914. #ifdef debug
  915.             //    showMessage(hwnd,"Size Launchpad");
  916. #endif
  917.             WinQueryWindowPos(HWND_DESKTOP,(PSWP)&desktopSWP);//Get desktop size
  918.             WinQueryWindowPos(hwnd,(PSWP)&swp);//Get launchpadsize or drawersize
  919.             // Only resize launchpad if user enabled this feature
  920.             if(smallSizeEnabled) {
  921.                 // Hide the launchpad (or drawer) so the user can't see the resizing
  922.                 //    WinShowWindow(hwnd,FALSE);                
  923.                 HWND lpHWND=wpQueryDrawerHWND(0);//Query HWND of launchpad
  924.                 
  925.                 //*************** Launchpad is horizontal                
  926.                 if(!isVertical) {
  927.                     if(!ulDrawer){//Launchpad
  928.                         WinSetWindowPos(hwnd,NULL,0,0,
  929.                                                         maxcx+(1+hasActionButtons)*icondistance-actionButtonsText*maxcx1*deltaActionButtons,
  930.                                                         maxcy3+maxcy2+icondistance/2+2*icondistance+titlebarSize,
  931.                                                         SWP_SIZE|SWP_HIDE);
  932.                         /*WinSetWindowPos(hwnd,NULL,0,0,
  933.                             maxcx+(1+hasActionButtons)*icondistance-actionButtonsText*maxcx1*2+icondistance/2,
  934.                             maxcy3+maxcy2+icondistance/2+2*icondistance+titlebarSize-delta,
  935.                             SWP_SIZE|SWP_HIDE);
  936.                             */
  937.                     }
  938.                     else {  //Drawer
  939.                         if(WinQueryWindowPos(lpHWND,(PSWP)&lpSWP)&&swp.y<lpSWP.y){//got launchpad size and drawer is below launchpad
  940.                             //Check if small drawer fits above launchpad
  941.                             if((icondistance+maxcy+titlebarSize)<(desktopSWP.cy-(lpSWP.y+lpSWP.cy+titlebarSize)))
  942.                                 {// yes, place it above
  943.                                     WinSetWindowPos(hwnd,NULL,swp.x+(swp.cx-maxcx2-icondistance)/2,
  944.                                                                     lpSWP.y+lpSWP.cy+titlebarSize,
  945.                                                                     maxcx2+icondistance,
  946.                                                                     icondistance+maxcy+titlebarSize,
  947.                                                                     SWP_SIZE|SWP_MOVE);
  948.                                 }
  949.                             else
  950.                                 {//No, no place for drawer
  951.                                     WinSetWindowPos(hwnd,NULL,swp.x+(swp.cx-maxcx2-icondistance)/2,
  952.                                                                     lpSWP.y-(icondistance+maxcy+titlebarSize),
  953.                                                                     maxcx2+icondistance,
  954.                                                                     icondistance+maxcy+titlebarSize,
  955.                                                                     SWP_SIZE|SWP_MOVE);                        
  956.                                 }
  957.                         }
  958.                         else {//couldn't get launchpad size, using default positions
  959.                             WinSetWindowPos(hwnd,NULL,swp.x+(swp.cx-maxcx2-icondistance)/2,
  960.                                                             swp.y,
  961.                                                             maxcx2+icondistance,
  962.                                                             icondistance+maxcy+titlebarSize,
  963.                                                             SWP_SIZE|SWP_MOVE);
  964.                         }
  965.                     }
  966.                 }
  967.                 // ************** Launchpad is vertical **************
  968.                 else {
  969.                     if(!ulDrawer){//Launchpad
  970.                         WinSetWindowPos(hwnd,NULL,0,0,maxcx3+maxcx2+icondistance/2+2*icondistance,
  971.                                                         maxcy+titlebarSize+(1+hasActionButtons)*icondistance,SWP_SIZE);
  972.                         //WinSetWindowPos(hwnd,NULL,0,0,maxcx3+maxcx2+icondistance/2+2*icondistance-delta,
  973.                         //                                maxcy+titlebarSize+(1+hasActionButtons)*icondistance+icondistance/2,SWP_SIZE);
  974.                     }
  975.                     else {  //Drawer needs some position tweaking
  976.                         if(WinQueryWindowPos(lpHWND,(PSWP)&lpSWP)&&swp.x<lpSWP.x){//got launchpad size and drawer is left of launchpad
  977.                             //Check if small drawer fits to the right of launchpad
  978.                             if((icondistance+maxcx)<(desktopSWP.cx-(lpSWP.x+lpSWP.cx)))
  979.                                 {// yes, place it on the right side
  980.                                     WinSetWindowPos(hwnd,NULL,lpSWP.x+lpSWP.cx,
  981.                                                                     swp.y+(swp.cy-maxcy2-icondistance)/2,
  982.                                                                     maxcx+icondistance,
  983.                                                                     icondistance+maxcy2+titlebarSize,
  984.                                                                     SWP_SIZE|SWP_MOVE);
  985.                                 }
  986.                             else
  987.                                 {//No, no place for drawer
  988.                                     WinSetWindowPos(hwnd,NULL,lpSWP.x-(maxcx+icondistance),
  989.                                                                     swp.y+(swp.cy-maxcy2-icondistance)/2,
  990.                                                                     maxcx+icondistance,
  991.                                                                     icondistance+maxcy2+titlebarSize,
  992.                                                                     SWP_SIZE|SWP_MOVE);                        
  993.                                 }
  994.                         }
  995.                         else {//couldn't get launchpad size, using default positions
  996.                             WinSetWindowPos(hwnd,NULL,
  997.                                                             swp.x,
  998.                                                             swp.y+(swp.cy-maxcy2-icondistance)/2,
  999.                                                             icondistance+maxcx,
  1000.                                                             maxcy2+icondistance+titlebarSize,SWP_SIZE|SWP_MOVE);
  1001.                         }
  1002.                     }    
  1003.                 }
  1004.             }            
  1005.             /****************************************
  1006.              *                     
  1007.              * Size the buttons and change the window procedure
  1008.              *
  1009.              ****************************************/
  1010. #ifdef debug
  1011.             //    showMessage(hwnd,"Size buttons and change window procedures");
  1012. #endif
  1013.             henum=WinBeginEnumWindows(hwnd);// We will query all child windows
  1014.             while((hwndNext=WinGetNextWindow(henum))!=NULLHANDLE) {
  1015.                 // Query the current position of the buttons
  1016.                 WinQueryWindowPos(hwndNext,(PSWP)&swp);
  1017.                 // Query the window ID
  1018.                 id=WinQueryWindowUShort(hwndNext,QWS_ID);
  1019.                 if(id>=300)//ID 3XX Drawer-Icons
  1020.                     {
  1021.                         if(smallSizeEnabled) {
  1022.                             if(id<400) {
  1023.                                 if(!noDrawers) {
  1024.                                     //**************** Launchpad is horizontal *************    
  1025.                                     if(!isVertical) {
  1026.                                         // Set new position and size of the icons
  1027.                                         /*    WinSetWindowPos(hwndNext,NULL,
  1028.                                                 4*(maxcx1+1)+(id-300)*(maxcx2+icondistance)
  1029.                                                 -actionButtonsText*maxcx1*2
  1030.                                                 +(1+hasActionButtons)*icondistance,
  1031.                                                 maxcy2+icondistance/2+icondistance,
  1032.                                                 swp.cx-delta,swp.cy-delta,SWP_MOVE|SWP_SIZE);*/
  1033.                                         WinSetWindowPos(hwndNext,NULL,
  1034.                                                                         numActionButtons*(maxcx1+1)+(id-300)*(maxcx2+icondistance)
  1035.                                                                         -actionButtonsText*maxcx1*deltaActionButtons
  1036.                                                                         +(1+hasActionButtons)*icondistance,
  1037.                                                                         maxcy2+icondistance/2+icondistance,
  1038.                                                                         swp.cx-delta,swp.cy-delta,SWP_MOVE|SWP_SIZE);
  1039.                                         /*        WinSetWindowPos(hwndNext,NULL,
  1040.                                                     4*(maxcx1+1)+(id-300)*(maxcx2+icondistance/2)
  1041.                                                     -actionButtonsText*maxcx1*2
  1042.                                                     +(1+hasActionButtons)*icondistance,
  1043.                                                     maxcy2+icondistance/2+icondistance,
  1044.                                                     swp.cx-delta,swp.cy-delta,SWP_MOVE|SWP_SIZE);*/
  1045.                                     }
  1046.                                 //*************** Launchpad is vertical *****************
  1047.                                 else{
  1048.                                     //  Set new position and size of the icons
  1049.                                     /*     WinSetWindowPos(hwndNext,NULL,maxcx2+icondistance/2+icondistance,
  1050.                                              4*(maxcy1+1)+(id-300)*(icondistance+maxcy2)
  1051.                                              +(1+hasActionButtons)*icondistance,
  1052.                                              swp.cx,swp.cy-delta,SWP_MOVE|SWP_SIZE);*/
  1053.  
  1054.                                     WinSetWindowPos(hwndNext,NULL,maxcx2+icondistance/2+icondistance,
  1055.                                                                     numActionButtons*(maxcy1+1)+(id-300)*(icondistance+maxcy2)
  1056.                                                                     +(1+hasActionButtons)*icondistance,
  1057.                                                                     swp.cx,swp.cy-delta,SWP_MOVE|SWP_SIZE);
  1058.                                     /*                                    WinSetWindowPos(hwndNext,NULL,maxcx2+icondistance/2+icondistance,
  1059.                                                                             4*(maxcy1+1)+(id-300)*(icondistance/2+maxcy2)
  1060.                                                                             +(1+hasActionButtons)*icondistance,
  1061.                                                                             swp.cx,swp.cy-delta,SWP_MOVE|SWP_SIZE);*/
  1062.                                 }    // else
  1063.                                 } //if(!NODRAWERS)
  1064.                             else {
  1065.                                 WinSetWindowPos(hwndNext,NULL,0,0,0,0,SWP_HIDE);
  1066.                                 
  1067.                             } // else if(!NODRAWERS)
  1068.                             }// endif(id<400)
  1069.                         }// endif(smallSizeEnabled)
  1070.                     }
  1071.             else //id>=300
  1072.                 {
  1073.                     if(id>=200)//ID 2XX Progicons auf der Klickstartleiste
  1074.                         {
  1075.                             // We subclass the window so we can track mouse movements
  1076.                             // over the buttons and can build a bubble help if the mouse
  1077.                             // resides over a button.
  1078.                             // WinSubclassWindow() returns the old procedure and sets our procedure
  1079.                             // as the default.
  1080.                             // If the returned procedure is the same as our own we have already subclassed
  1081.                             // the window otherwise we save the original procedure pointer.
  1082.                             tempProc=WinSubclassWindow(hwndNext,newButtonProc);                        
  1083.                             if(tempProc!=(*newButtonProc)){
  1084.                                 oldButtonProc2=tempProc; 
  1085.                             }
  1086.                             // Now we need the class object to get a WPObject* from the HOBJECT
  1087.                             
  1088. #ifdef debug
  1089.                             //        showMessage(hwnd,"Inside enumeration loop...ProgIcons");
  1090. #endif
  1091.                             wpObject=M_ob.wpclsQueryObject(hobject[id-200]);
  1092.                             if(wpObject)
  1093.                                 objectTitle=wpObject->wpQueryTitle();
  1094.                             else
  1095.                                 objectTitle="";
  1096. #ifdef debug
  1097.                             //        showMessage(hwnd,"Inside enumeration loop...ProgIcons after wpQueryTitle()");
  1098. #endif
  1099.                             
  1100.                             // Set the object title as the window title. In our button proc we
  1101.                             // take this window title and display it in the help window.
  1102.                             // The original launchpad only sets the window title in this way if
  1103.                             // you've switched on text on the launchpad.
  1104.                             WinSetWindowText(hwndNext,objectTitle);
  1105.                             
  1106. #ifdef debug
  1107.                             //        showMessage(hwnd,"ID >=200, Program-Icons");
  1108. #endif
  1109.                             if(smallSizeEnabled)
  1110.                                 WinSetWindowBits(hwndNext,QWL_STYLE,BS_NOPOINTERFOCUS,BS_NOPOINTERFOCUS);
  1111.                             if(!ulDrawer)//Launchpad
  1112.                                 {
  1113.                                     if(smallSizeEnabled) {
  1114.                                         //************ Horizontal
  1115.                                         if(!isVertical) 
  1116.                                             // Set new position and size of the icons
  1117.                                             /*    WinSetWindowPos(hwndNext,NULL,
  1118.                                                     4*(maxcx1+1)+(id-200)*(maxcx2+icondistance)
  1119.                                                     +(1+hasActionButtons)*icondistance
  1120.                                                     -actionButtonsText*maxcx1*2,
  1121.                                                     icondistance,swp.cx-delta,swp.cy-delta,
  1122.                                                     SWP_MOVE|SWP_SIZE);*/
  1123.  
  1124.                                             WinSetWindowPos(hwndNext,NULL,
  1125.                                                                             numActionButtons*(maxcx1+1)+(id-200)*(maxcx2+icondistance)
  1126.                                                                             +(1+hasActionButtons)*icondistance
  1127.                                                                             -actionButtonsText*maxcx1*deltaActionButtons,
  1128.                                                                             icondistance,swp.cx-delta,swp.cy-delta,
  1129.                                                                             SWP_MOVE|SWP_SIZE);
  1130.                                         
  1131.                                         /* WinSetWindowPos(hwndNext,NULL,
  1132.                                              4*(maxcx1+1)+(id-200)*(maxcx2+icondistance/2)
  1133.                                              +(1+hasActionButtons)*icondistance
  1134.                                              -actionButtonsText*maxcx1*2,
  1135.                                              icondistance,swp.cx-delta,swp.cy-delta,
  1136.                                              SWP_MOVE|SWP_SIZE);*/
  1137.                                                 
  1138.                                                 
  1139.                                                 //************ Vertikal
  1140.                                                 else  
  1141.                                                     // Set new position and size of the icons
  1142.                                                     /*        WinSetWindowPos(hwndNext,NULL,icondistance,
  1143.                                                                 4*(maxcy1+1)+(id-200)*(icondistance+maxcy2)
  1144.                                                                 +(1+hasActionButtons)*icondistance,                                
  1145.                                                                 swp.cx-delta,swp.cy-delta,SWP_MOVE|SWP_SIZE);*/
  1146.                                                 WinSetWindowPos(hwndNext,NULL,icondistance,
  1147.                                                                                 numActionButtons*(maxcy1+1)+(id-200)*(icondistance+maxcy2)
  1148.                                                                                 +(1+hasActionButtons)*icondistance,                                
  1149.                                                                                 swp.cx-delta,swp.cy-delta,SWP_MOVE|SWP_SIZE);
  1150.                                                 /*                WinSetWindowPos(hwndNext,NULL,icondistance,
  1151.                                                                     4*(maxcy1+1)+(id-200)*(icondistance/2+maxcy2)
  1152.                                                                     +(1+hasActionButtons)*icondistance,                                
  1153.                                                                     swp.cx-delta,swp.cy-delta,SWP_MOVE|SWP_SIZE);*/
  1154.                                     }//endif(smallSizeEnabled)
  1155.                                 }// endif(!ulDrawer)
  1156.                             else//Launchpad-drawer
  1157.                                 {
  1158.                                     if(smallSizeEnabled) {
  1159.                                         //************ Horizontal
  1160.                                         if(!isVertical)WinSetWindowPos(hwndNext,NULL,icondistance/2,
  1161.                                                                                                      icondistance+(id-200)*(maxcy2+icondistance),
  1162.                                                                                                      swp.cx-delta,swp.cy-delta,SWP_MOVE|SWP_SIZE);
  1163.                                         //************ Vertikal
  1164.                                         else    WinSetWindowPos(hwndNext,NULL,//swp.x,
  1165.                                                                                     icondistance+(id-200)*(maxcx2+icondistance),
  1166.                                                                                     icondistance/2,swp.cx-delta,
  1167.                                                                                     swp.cy-delta,SWP_MOVE|SWP_SIZE);    
  1168.                                     }
  1169.                                 }//#endelse    Launchpad-drawer                        
  1170.                         }
  1171.                     else  //ID 1XX; shutdown, window list etc.
  1172.                         {    
  1173.                             tempProc=WinSubclassWindow(hwndNext,newButtonProc);                        
  1174.                             if(tempProc!=(*newButtonProc)){
  1175.                                 oldButtonProc2=tempProc;
  1176.                             }
  1177.                             if(smallSizeEnabled) {
  1178.                                 WinSetWindowBits(hwndNext,QWL_STYLE,BS_NOPOINTERFOCUS,BS_NOPOINTERFOCUS);
  1179.                                 //********** Launchpad is horizontal    
  1180.                                 if(!isVertical)
  1181.                                     if(actionButtonsText) {//ActionButtons with Text
  1182.                                         textDelta=id-100;
  1183.                                         textDelta2=textDelta;
  1184.                                         textDelta2/=2;
  1185.                                         textDelta&=1;
  1186.                                         WinSetWindowPos(hwndNext,NULL,
  1187.                                                                         icondistance+textDelta2*(1+maxcx1),
  1188.                                                                         //    icondistance+((icondistance/2)+maxcy1)*textDelta,
  1189.                                                                         icondistance+((icondistance/2)+maxcy1-icondistance*noDrawers*2)*textDelta,
  1190.                                                                         swp.cx,(maxcy2+maxcy3)/2,SWP_MOVE|SWP_SIZE);
  1191.                                     }
  1192.                                     else {
  1193.                                         WinSetWindowPos(hwndNext,NULL,
  1194.                                                                         icondistance+(id-100)*(1+maxcx1),
  1195.                                                                         icondistance,
  1196.                                                                         swp.cx-delta,maxcy2+maxcy3+icondistance/2-delta,SWP_MOVE|SWP_SIZE);
  1197.                                     }
  1198.                                 //******** Verikal
  1199.                                 else WinSetWindowPos(hwndNext,NULL,icondistance,
  1200.                                                                          icondistance+(id-100)*(1+swp.cy),
  1201.                                                                          maxcx2+maxcx3+icondistance/2-delta,swp.cy-delta,SWP_MOVE|SWP_SIZE);
  1202.                             }// endif(smallSizeEnabled)
  1203.                         };
  1204.                 };
  1205.             };
  1206.     succ=WinEndEnumWindows(henum);
  1207.     WinSetWindowPos(hwnd,NULL,0,0,0,0,SWP_SHOW);  // Show the launchpad
  1208.         };        
  1209.     }; // endif strcmp()
  1210. //Make Launchpad visible
  1211.     ((somTD_WPLaunchPad_wpSetDrawerHWND)
  1212.      somParentNumResolve(__ClassObject->somGetPClsMtabs(),
  1213.                                              1,
  1214.                                              __ClassObject->
  1215.                                              somGetMethodToken(somIdFromString
  1216.                                                                                  ("wpSetDrawerHWND")))
  1217.      )(this,ulDrawer,hwndDrawer);            
  1218.     return;
  1219. }
  1220.  
  1221. /********************************************************/
  1222. /* New class function which inserts the bubblehelp page */
  1223. /* into the settings notebook                           */
  1224. /********************************************************/
  1225. ULONG WPLnchCW::AddBubblehelpPage(HWND hwndNotebook)
  1226. {
  1227.     PAGEINFO pageinfo;
  1228.     char pageName[50];
  1229.     
  1230.     //Clear the pageinfo structure
  1231.     memset((PCH)&pageinfo, 0, sizeof(PAGEINFO));
  1232.     //Fill the pageinfo structure
  1233.     pageinfo.cb = sizeof(PAGEINFO);
  1234.     pageinfo.hwndPage = NULLHANDLE;
  1235.     //The page has got a major tab and status text
  1236.     pageinfo.usPageStyleFlags = BKA_MAJOR|BKA_STATUSTEXTON;
  1237.     pageinfo.usPageInsertFlags = BKA_FIRST;
  1238.     //We want page numbers
  1239.     pageinfo.usSettingsFlags = SETTINGS_PAGE_NUMBERS;
  1240.     //The dialog procedure for this page
  1241.     pageinfo.pfnwp = BubblehelpDlgProc;
  1242.     //The resource is in the class file
  1243.     pageinfo.resid = QueryModuleHandle();
  1244.     pageinfo.dlgid = ID_BUBBLEENABLE;
  1245.     pageinfo.pszName = pageName;        
  1246.     //We need a pointer to our WPS-object in the dialog procedure
  1247.     //to call class functions
  1248.     pageinfo.pCreateParams = this;
  1249.     //The ID of the help panel for this page
  1250.     pageinfo.idDefaultHelpPanel = 001;
  1251.     //Tell the WPS the help library name
  1252.     pageinfo.pszHelpLibraryName = "bubblepd.hlp";
  1253.     //Load the name for the notebookpage
  1254.     WinLoadString(WinQueryAnchorBlock(hwndNotebook),QueryModuleHandle(),
  1255.                                 ID_BUBBLESTRING,sizeof(pageName),pageName);
  1256.     
  1257.     //Insert the page into the settings notebook
  1258.     return wpInsertSettingsPage(hwndNotebook,&pageinfo);
  1259. }
  1260.  
  1261. /********************************************************/
  1262. /* New class function which inserts the colour and font */
  1263. /* page into the settings notebook                      */
  1264. /********************************************************/
  1265. ULONG WPLnchCW::AddColorchangePage(HWND hwndNotebook)
  1266. {
  1267.     PAGEINFO pageinfo;
  1268.     
  1269.     //Clear the pageinfo structure
  1270.     memset((PCH)&pageinfo, 0, sizeof(PAGEINFO));
  1271.     //Fill the pageinfo structure
  1272.     pageinfo.cb = sizeof(PAGEINFO);
  1273.     pageinfo.hwndPage = NULLHANDLE;
  1274.     pageinfo.usPageStyleFlags = BKA_STATUSTEXTON;
  1275.     pageinfo.usPageInsertFlags = BKA_FIRST;
  1276.     //We want page numbers
  1277.     pageinfo.usSettingsFlags = SETTINGS_PAGE_NUMBERS;    
  1278.     //The dialog procedure for this page
  1279.     pageinfo.pfnwp = ColorchangeDlgProc;
  1280.     //The resource is in the class file
  1281.     pageinfo.resid = QueryModuleHandle();
  1282.     pageinfo.dlgid = ID_COLORCHANGE;
  1283.     //We need a pointer to our WPS-object in the dialog procedure
  1284.     //to call class functions
  1285.     pageinfo.pCreateParams = this;
  1286.     //The ID of the help panel for this page
  1287.     pageinfo.idDefaultHelpPanel = 202;
  1288.     //Tell the WPS the help library name
  1289.     pageinfo.pszHelpLibraryName = "bubblepd.hlp";
  1290.     //We have no major tab so we need no name
  1291.     
  1292.     //Insert the page into the settings notebook
  1293.     return wpInsertSettingsPage(hwndNotebook,&pageinfo);
  1294. }
  1295.  
  1296. /********************************************************/
  1297. /* New class function which inserts the size option     */
  1298. /* page into the settings notebook                      */
  1299. /********************************************************/
  1300. ULONG WPLnchCW::AddOptionPage(HWND hwndNotebook)
  1301. {
  1302.     PAGEINFO pageinfo;
  1303.     
  1304.     //Clear the pageinfo structure
  1305.     memset((PCH)&pageinfo, 0, sizeof(PAGEINFO));
  1306.     //Fill the pageinfo structure
  1307.     pageinfo.cb = sizeof(PAGEINFO);
  1308.     pageinfo.hwndPage = NULLHANDLE;
  1309.     pageinfo.usPageStyleFlags = BKA_STATUSTEXTON;
  1310.     pageinfo.usPageInsertFlags = BKA_FIRST;
  1311.     //We want page numbers
  1312.     pageinfo.usSettingsFlags = SETTINGS_PAGE_NUMBERS;
  1313.     //The dialog procedure for this page
  1314.     pageinfo.pfnwp = OptionDlgProc;
  1315.     //The resource is in the class file
  1316.     pageinfo.resid = QueryModuleHandle();
  1317.     pageinfo.dlgid = ID_OPTIONPAGE;
  1318.     //We need a pointer to our WPS-object in the dialog procedure
  1319.     //to call class functions
  1320.     pageinfo.pCreateParams = this;
  1321.     //The ID of the help panel for this page
  1322.     pageinfo.idDefaultHelpPanel = 200;
  1323.     //Tell the WPS the help library name
  1324.     pageinfo.pszHelpLibraryName = "bubblepd.hlp";
  1325.     //We have no major tab so we need no name
  1326.  
  1327.     //Insert the page into the settings notebook
  1328.     return wpInsertSettingsPage(hwndNotebook,&pageinfo);
  1329. }
  1330.  
  1331. /********************************************************/
  1332. /* New class function which inserts the action button   */
  1333. /* option page into the settings notebook               */
  1334. /********************************************************/
  1335. ULONG WPLnchCW::AddActionButtonPage(HWND hwndNotebook)
  1336. {
  1337.     PAGEINFO pageinfo;
  1338.     
  1339.     //Clear the pageinfo structure
  1340.     memset((PCH)&pageinfo, 0, sizeof(PAGEINFO));
  1341.     //Fill the pageinfo structure
  1342.     pageinfo.cb = sizeof(PAGEINFO);
  1343.     pageinfo.hwndPage = NULLHANDLE;
  1344.     pageinfo.usPageStyleFlags = BKA_STATUSTEXTON;
  1345.     pageinfo.usPageInsertFlags = BKA_FIRST;
  1346.     //We want page numbers
  1347.     pageinfo.usSettingsFlags = SETTINGS_PAGE_NUMBERS;
  1348.     //The dialog procedure for this page
  1349.     pageinfo.pfnwp = ActionButtonDlgProc;
  1350.     //The resource is in the class file
  1351.     pageinfo.resid = QueryModuleHandle();
  1352.     pageinfo.dlgid = ID_ACTIONBPAGE;
  1353.     //We need a pointer to our WPS-object in the dialog procedure
  1354.     //to call class functions
  1355.     pageinfo.pCreateParams = this;
  1356.     //The ID of the help panel for this page
  1357.     pageinfo.idDefaultHelpPanel = 400;
  1358.     //Tell the WPS the help library name
  1359.     pageinfo.pszHelpLibraryName = "bubblepd.hlp";
  1360.     //We have no major tab so we need no name
  1361.  
  1362.     //Insert the page into the settings notebook
  1363.     return wpInsertSettingsPage(hwndNotebook,&pageinfo);
  1364. }
  1365.  
  1366. BOOL WPLnchCW::wpAddLaunchPadPage2(HWND hwndNotebook)
  1367. {
  1368.     return(AddOptionPage(hwndNotebook)&& 
  1369.                  AddActionButtonPage(hwndNotebook)&&
  1370.                  ((somTD_WPLaunchPad_wpAddLaunchPadPage2)
  1371.                     somParentNumResolve(__ClassObject->somGetPClsMtabs(),
  1372.                                                             1,
  1373.                                                             __ClassObject->
  1374.                                                             somGetMethodToken(somIdFromString
  1375.                                                                                                 ("wpAddLaunchPadPage2")))
  1376.                     )(this,hwndNotebook));        
  1377. }
  1378.  
  1379.  
  1380. BOOL WPLnchCW::wpAddSettingsPages(HWND hwndNotebook)
  1381. {
  1382.     ULONG   ulPageIdColor;
  1383.     ULONG   ulPageIdBubble;
  1384.     ULONG   ulPageIdUninstall;
  1385.  
  1386.     //The Warpcenter is a Child of WPLaunchPad, so it inherits all the features.
  1387.     // We substitute WPLaunchPad with WPLnchCW, so the Warpcenter inherits the 
  1388.     // Bubblehelp pages but it doesn't need them cause it has its own bubblehelp.
  1389.     
  1390.     // Check if it's the Warpcenter (classname is 'SmartCenter')
  1391.     // somGetClassName() returns our class name
  1392.     if(strcmp(somGetClassName(),"SmartCenter")) {// 0 if equal
  1393.         //Insert our settings pages
  1394.         ulPageIdColor=AddColorchangePage(hwndNotebook);
  1395.         ulPageIdBubble=AddBubblehelpPage(hwndNotebook);
  1396.         return(ulPageIdColor 
  1397.                      && ulPageIdBubble
  1398.                      //call parent
  1399.                      &&((somTD_WPObject_wpAddSettingsPages)
  1400.                             somParentNumResolve(__ClassObject->somGetPClsMtabs(),
  1401.                                                                     1,
  1402.                                                                     __ClassObject->
  1403.                                                                     somGetMethodToken(somIdFromString
  1404.                                                                                                         ("wpAddSettingsPages")))
  1405.                             )(this,hwndNotebook));
  1406.         
  1407.     }
  1408.     else // If SmartCenter only call parent
  1409.     return    ((somTD_WPObject_wpAddSettingsPages)
  1410.                      somParentNumResolve(__ClassObject->somGetPClsMtabs(),
  1411.                                                              1,
  1412.                                                              __ClassObject->
  1413.                                                              somGetMethodToken(somIdFromString
  1414.                                                                                                  ("wpAddSettingsPages")))
  1415.                      )(this,hwndNotebook);
  1416.                      
  1417.     // Durch obige Konstruktion wird die Elternmethode des direkten Vorgängers aufgerufen,
  1418.     // und nicht die ursprüngliche von WPLaunchPad, falls WPLaunchPad replaced wurde.
  1419.     // Durch diesen Aufruf gehen eventuelle Erweiterungen durch Vererbung verloren:
  1420.     //            < return WPLaunchPad::wpMenuItemSelected(hwndFrame, ulMenuId); >
  1421.     // Dieser Aufruf macht Ergänzungen in wpobject.hh erforderlich!!! Wird durch ein VAC-Fixpack vielleicht später
  1422.     //erledigt
  1423. }
  1424. BOOL WPLnchCW::wpSaveState()
  1425. {
  1426.     ULONG ulActionButtons;
  1427.     
  1428. #ifdef debug
  1429.                                 char buf[260];
  1430.                                 sprintf(buf,"wpSaveState()  ulOpenDrawers: %x",ulOpenDrawers);
  1431.                                 showMessage(HWND_DESKTOP,buf);
  1432. #endif
  1433.     wpSaveLong("WPLnchCW",ID_NODRAWERS,noDrawers);
  1434.     wpSaveLong("WPLnchCW",ID_SMALLSIZEENABLED,smallSizeEnabled);
  1435.     wpSaveLong("WPLnchCW",ID_DELAYVALUE,delayValue);
  1436.     wpSaveLong("WPLnchCW",ID_ICONDISTANCE,icondistance);
  1437.     wpSaveLong("WPLnchCW",ID_BUBBLEENABLED,bubbleEnabled);
  1438.     wpSaveLong("WPLnchCW",ID_OPENDRAWERBITS,ulOpenDrawers);
  1439.     wpSaveLong("WPLnchCW",ID_REOPEN,ulReOpen);
  1440.     wpSaveData("WPLnchCW",ID_BACKGROUND,(PBYTE)&background,sizeof(RGB));
  1441.     wpSaveData("WPLnchCW",ID_FOREGROUND,(PBYTE)&foreground,sizeof(RGB));
  1442.     wpSaveString("WPLnchCW",ID_FONT,(PBYTE)&fontName);
  1443.     ulActionButtons=0;
  1444.     if(bShutdown)ulActionButtons+=1;
  1445.     if(bLock)ulActionButtons+=2;
  1446.     if(bWindowList)ulActionButtons+=4;
  1447.     if(bSearch)ulActionButtons+=8;
  1448.     wpSaveLong("WPLnchCW",ID_ACTIONBUTTONS,ulActionButtons);
  1449.  
  1450.     return((somTD_WPObject_wpSaveState)
  1451.                  somParentNumResolve(__ClassObject->somGetPClsMtabs(),
  1452.                                                          1,
  1453.                                                          __ClassObject->
  1454.                                                          somGetMethodToken(somIdFromString
  1455.                                                                                              ("wpSaveState")))                     
  1456.                  )(this);
  1457. }
  1458.  
  1459.  
  1460. BOOL WPLnchCW::wpRestoreState(ULONG ulReserved)
  1461. {
  1462.     BOOL  rc;
  1463.     ULONG dataSize=sizeof(USHORT);
  1464.     ULONG ulActionButtons;
  1465.     
  1466.     /* Read values from instance data                                         */
  1467.     /* If we start the BubblePad for the first time there're no values in the */
  1468.     /* instance data. In this case use defaults.                              */
  1469.  
  1470.     if(!wpRestoreLong("WPLnchCW",ID_NODRAWERS,&noDrawers))
  1471.         noDrawers=0;
  1472.     if(!wpRestoreLong("WPLnchCW",ID_SMALLSIZEENABLED,&smallSizeEnabled))
  1473.         smallSizeEnabled=1;
  1474.     if(!wpRestoreLong("WPLnchCW",ID_DELAYVALUE,&delayValue))
  1475.         delayValue=250;
  1476.     if(!wpRestoreLong("WPLnchCW",ID_ICONDISTANCE,&icondistance))
  1477.         icondistance=4;
  1478.     if(!wpRestoreLong("WPLnchCW",ID_BUBBLEENABLED,&bubbleEnabled))
  1479.         bubbleEnabled=1;
  1480.     if(!wpRestoreLong("WPLnchCW",ID_OPENDRAWERBITS,&ulOpenDrawers))
  1481.         ulOpenDrawers=(ULONG)0;
  1482.     if(!wpRestoreLong("WPLnchCW",ID_REOPEN,&ulReOpen))
  1483.         ulReOpen=(ULONG)0;
  1484.         bShutdown=TRUE;
  1485.         bLock=TRUE;
  1486.         bWindowList=TRUE;
  1487.         bSearch=TRUE;
  1488.     if(wpRestoreLong("WPLnchCW",ID_ACTIONBUTTONS,&ulActionButtons)) {
  1489.         if(~ulActionButtons & 1)bShutdown=FALSE;
  1490.         if(~ulActionButtons & 2)bLock=FALSE;
  1491.         if(~ulActionButtons & 4)bWindowList=FALSE;
  1492.         if(~ulActionButtons & 8)bSearch=FALSE;
  1493.     }
  1494.     dataSize=sizeof(RGB);
  1495.     if(!wpRestoreData("WPLnchCW",ID_BACKGROUND,(PBYTE)&background,&dataSize)) {
  1496.         background.bBlue=180;
  1497.         background.bGreen=255;
  1498.         background.bRed=255;
  1499.     }
  1500.     dataSize=sizeof(RGB);
  1501.     if(!wpRestoreData("WPLnchCW",ID_FOREGROUND,(PBYTE)&foreground,&dataSize)) {
  1502.         foreground.bRed=0;
  1503.         foreground.bGreen=0;
  1504.         foreground.bBlue=0;
  1505.     }
  1506.     memset(fontName,0,sizeof(fontName));    
  1507.     dataSize=sizeof(fontName);
  1508.     if(!wpRestoreString("WPLnchCW",ID_FONT,(PBYTE)&fontName,&dataSize))
  1509.         memcpy(&fontName,"8.Helv",sizeof("8.Helv"));
  1510.     
  1511.     return((somTD_WPObject_wpRestoreState)
  1512.                  somParentNumResolve(__ClassObject->somGetPClsMtabs(),
  1513.                                                          1,
  1514.                                                          __ClassObject->
  1515.                                                          somGetMethodToken(somIdFromString
  1516.                                                                                              ("wpRestoreState")))                     
  1517.                  )(this,ulReserved);
  1518.     
  1519.     // Durch obige Konstruktion wird die direkte Elternmethode aufgerufen,
  1520.     // und nicht die ursprüngliche von WPLaunchPad, falls WPLaunchPad replaced wurde.
  1521.     // Durch diesen Aufruf gehen eventuelle Erweiterungen durch Vererbung verloren:
  1522.     //    
  1523. }
  1524.  
  1525. BOOL WPLnchCW::wpSetup(PSZ pSetupString)
  1526. {
  1527.     /**************************************************
  1528.      *                                                *
  1529.      * Supported setupstrings:                        *
  1530.      *                                                *
  1531.      * LPNODRAWERS=1/0                                *
  1532.      * LPBUBBLE=1/0                                   *
  1533.      * LPSMALL=1/0                                    *
  1534.      * LPREOPENDRAWERS=1/0                            *
  1535.      * LPDELAY=1-9999                                 *
  1536.      * LPDISTANCE=4-18                                *
  1537.      * LPBGCOLOR= RGB                                 *
  1538.      * LPFGCOLOR= RGB                                 *
  1539.      * LPACTIONBUTTONS=1+2+4+8                        *
  1540.      *                                                *
  1541.      **************************************************/
  1542.     BOOL rcParent;
  1543.     char buffer[CCHMAXPATH];
  1544.     ULONG ulBufferSize;
  1545.     ULONG ulBackground;
  1546.     ULONG ulForeground;
  1547.     ULONG ulActionButtons;
  1548.     
  1549.     rcParent=((somTD_WPObject_wpSetup)
  1550.                  somParentNumResolve(__ClassObject->somGetPClsMtabs(),
  1551.                                                          1,
  1552.                                                          __ClassObject->
  1553.                                                          somGetMethodToken(somIdFromString
  1554.                                                                                              ("wpSetup")))                     
  1555.                  )(this,pSetupString);
  1556.     /* Doing our own setup here */
  1557.     ulBufferSize=sizeof(buffer);
  1558.     noDrawers=0;
  1559.     if(wpScanSetupString(pSetupString,"LPNODRAWERS",buffer,&ulBufferSize))
  1560.         if(buffer[0]=='1') noDrawers=1;
  1561.     bubbleEnabled=1;    
  1562.     ulBufferSize=sizeof(buffer);
  1563.     if(wpScanSetupString(pSetupString,"LPBUBBLE",buffer,&ulBufferSize))
  1564.         if(buffer[0]=='0') bubbleEnabled=0;
  1565.     smallSizeEnabled=1;
  1566.     ulBufferSize=sizeof(buffer);
  1567.     if(wpScanSetupString(pSetupString,"LPSMALL",buffer,&ulBufferSize))
  1568.         if(buffer[0]=='0') smallSizeEnabled=0;
  1569.     ulReOpen=0;
  1570.     ulBufferSize=sizeof(buffer);
  1571.     if(wpScanSetupString(pSetupString,"LPREOPENDRAWERS",buffer,&ulBufferSize))
  1572.         if(buffer[0]=='1') ulReOpen=1;        
  1573.     delayValue=250;
  1574.     ulBufferSize=sizeof(buffer);
  1575.     if(wpScanSetupString(pSetupString,"LPDELAY",buffer,&ulBufferSize)) {
  1576.         delayValue=atol(buffer);/* convert to long */
  1577.         if(delayValue>MAXDELAY)delayValue=MAXDELAY;
  1578.     }
  1579.     icondistance=4;
  1580.     ulBufferSize=sizeof(buffer);
  1581.     if(wpScanSetupString(pSetupString,"LPDISTANCE",buffer,&ulBufferSize)) {
  1582.         icondistance=atol(buffer);
  1583.         if(icondistance<4)icondistance=4;
  1584.         if(icondistance>18)icondistance=18;
  1585.     }
  1586.     background.bBlue=180;
  1587.     background.bGreen=255;
  1588.     background.bRed=255;
  1589.     ulBufferSize=sizeof(buffer);
  1590.     if(wpScanSetupString(pSetupString,"LPBGCOLOR",buffer,&ulBufferSize)) {
  1591.         ulBackground=atol(buffer);
  1592.         background.bBlue=(BYTE)(ulBackground & 0xFF);
  1593.         ulBackground=ulBackground>>8;
  1594.         background.bGreen=(BYTE)(ulBackground & 0xFF);
  1595.         ulBackground=ulBackground>>8;
  1596.         background.bRed=(BYTE)(ulBackground & 0xFF);
  1597.     }
  1598.     foreground.bRed=0;
  1599.     foreground.bGreen=0;
  1600.     foreground.bBlue=0;
  1601.     ulBufferSize=sizeof(buffer);
  1602.     if(wpScanSetupString(pSetupString,"LPFGCOLOR",buffer,&ulBufferSize)) {
  1603.         ulForeground=atol(buffer);
  1604.         foreground.bBlue=(BYTE)(ulForeground & 0xFF);
  1605.         ulForeground=ulForeground>>8;
  1606.         foreground.bGreen=(BYTE)(ulForeground & 0xFF);
  1607.         ulForeground=ulForeground>>8;
  1608.         foreground.bRed=(BYTE)(ulForeground & 0xFF);
  1609.     }
  1610.     bShutdown=TRUE;
  1611.     bLock=TRUE;
  1612.     bWindowList=TRUE;
  1613.     bSearch=TRUE;
  1614.     ulBufferSize=sizeof(buffer);
  1615.     if(wpScanSetupString(pSetupString,"LPACTIONBUTTONS",buffer,&ulBufferSize)) {
  1616.         ulActionButtons=atol(buffer);
  1617.         if(~ulActionButtons & 1)bShutdown=FALSE;
  1618.         if(~ulActionButtons & 2)bLock=FALSE;
  1619.         if(~ulActionButtons & 4)bWindowList=FALSE;
  1620.         if(~ulActionButtons & 8)bSearch=FALSE;
  1621.     }
  1622.  
  1623.     /* Fill in defaults */
  1624.     ulOpenDrawers=(ULONG)0;
  1625.     memcpy(&fontName,"8.Helv",sizeof("8.Helv"));
  1626.     return rcParent;
  1627. }
  1628.  
  1629. HWND  WPLnchCW::wpOpen(HWND hwndCnr,ULONG ulView,ULONG ulParam)
  1630. {
  1631.     HWND rcHWND;
  1632.     HWND hwndDrawerButton;
  1633.     ULONG ulTemp;
  1634.     int a;
  1635.     
  1636.     rcHWND=((somTD_WPObject_wpOpen)
  1637.                  somParentNumResolve(__ClassObject->somGetPClsMtabs(),
  1638.                                                          1,
  1639.                                                          __ClassObject->
  1640.                                                          somGetMethodToken(somIdFromString
  1641.                                                                                              ("wpOpen")))                     
  1642.                  )(this,hwndCnr, ulView, ulParam);        
  1643.  
  1644.     if(ulView==OPEN_SETTINGS)    return rcHWND;
  1645.  
  1646.     // The parent function opened the launchpad. We look which drawers were open on last shutdown and
  1647.     // reopen them now if user selected it.
  1648.     ulTemp=ulOpenDrawers;
  1649. #ifdef debug
  1650.     char buf[260];
  1651.     sprintf(buf,"ulOpenDrawers:  %x",ulTemp);                                
  1652.     showMessage(HWND_DESKTOP,buf);
  1653. #endif
  1654.     if(ulReOpen) {            
  1655.         for(a=0;a<32;a++) {
  1656.             if(ulTemp&1) {
  1657.                 hwndDrawerButton=WinWindowFromID(rcHWND,300+a);
  1658.                 if(hwndDrawerButton)
  1659.                     WinPostMsg(hwndDrawerButton,BM_CLICK,MPFROMSHORT(FALSE),MPFROMSHORT(0));
  1660.             }
  1661.             ulTemp=ulTemp>>1;
  1662.         }
  1663.     }/* end of if(ulReOpen) */
  1664.     return rcHWND;
  1665.  
  1666.  
  1667. PACTIONS WPLnchCW::wpQueryActionButtons(PULONG pulNumActions)
  1668. {
  1669.     ULONG num;
  1670.     PACTIONS pActions;
  1671.     char* source;
  1672.     char* dest;
  1673.     ULONG size;
  1674.     static char backupActions[100];
  1675.     static BOOL bBackup=FALSE;
  1676.     
  1677.     pActions=((somTD_WPLaunchPad_wpQueryActionButtons)
  1678.                     somParentNumResolve(__ClassObject->somGetPClsMtabs(),
  1679.                                                             1,
  1680.                                                             __ClassObject->
  1681.                                                             somGetMethodToken(somIdFromString
  1682.                                                                                                 ("wpQueryActionButtons")))                     
  1683.                     )(this,pulNumActions);    
  1684.     if(*pulNumActions<4)    return pActions;// We cannot handle unusual buttonnumbers
  1685.  
  1686.     size=sizeof(PSZ);
  1687.     size+=sizeof(ULONG);
  1688.     size+=sizeof(HPOINTER);
  1689.     if(!bBackup) {
  1690.         memmove(backupActions,pActions,size*4);
  1691.         bBackup=TRUE;
  1692.     }
  1693.     memmove(pActions,backupActions,size*4);    
  1694.     source=(char*)backupActions;
  1695.     dest=(char*)pActions;
  1696.     num=0;
  1697.     if(bShutdown){
  1698.         num++;
  1699.         memmove(dest,source,size);
  1700.         dest+=size;
  1701.     }
  1702.  
  1703.     if(bLock){
  1704.         num++;
  1705.         memmove(dest,source+size,size);
  1706.         dest+=size;
  1707.     }
  1708.  
  1709.     if(bWindowList){
  1710.         num++;
  1711.         memmove(dest,source+size*2,size);
  1712.         dest+=size;
  1713.     }
  1714.     if(bSearch){
  1715.         num++;
  1716.         memmove(dest,source+size*3,size);
  1717.     }    
  1718.     *pulNumActions=num;
  1719.     return pActions;    
  1720. }
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.