home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / OWLSRC.PAK / COMMCTRL.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  5.0 KB  |  181 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1995, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.11  $
  6. //
  7. // Implementation of TCommCtrlDll, a wrapper for the common control dll
  8. //----------------------------------------------------------------------------
  9. #include <owl/pch.h>
  10. #if !defined(OWL_COMMCTRL_H)
  11. # include <owl/commctrl.h>
  12. #endif
  13.  
  14. //
  15. // Common Controls diagnostic group
  16. //
  17. OWL_DIAGINFO;
  18. DIAG_DEFINE_GROUP_INIT(OWL_INI, OwlCommCtrl, 1, 0);
  19.  
  20. #if defined(BI_PLAT_WIN16)
  21.   static char CommCtrlDllName[] = "COMMCTRL.DLL";
  22. #else
  23.   static char CommCtrlDllName[] = "COMCTL32.DLL";
  24. #endif
  25.  
  26. //
  27. //
  28. //
  29. TCommCtrlDll::TCommCtrlDll()
  30. :
  31.   TModule(CommCtrlDllName, true, true),
  32.  
  33. #if defined(BI_PLAT_WIN32)
  34.   ImageList_AddMasked(*this, "ImageList_AddMasked"),
  35.   ImageList_BeginDrag(*this, "ImageList_BeginDrag"),
  36.   ImageList_DragEnter(*this, "ImageList_DragEnter"),
  37.   ImageList_DragLeave(*this, "ImageList_DragLeave"),
  38.   ImageList_DragMove(*this, "ImageList_DragMove"),
  39.   ImageList_DrawEx(*this, "ImageList_DrawEx"),
  40.   ImageList_GetDragImage(*this, "ImageList_GetDragImage"),
  41.   ImageList_GetIcon(*this, "ImageList_GetIcon"),
  42.   ImageList_GetIconSize(*this, "ImageList_GetIconSize"),
  43.   ImageList_GetImageInfo(*this, "ImageList_GetImageInfo"),
  44.   ImageList_LoadImage(*this, "ImageList_LoadImage"),
  45.   ImageList_Merge(*this, "ImageList_Merge"),
  46.   ImageList_Remove(*this, "ImageList_Remove"),
  47.   ImageList_Replace(*this, "ImageList_Replace"),
  48.   ImageList_SetDragCursorImage(*this, "ImageList_SetDragCursorImage"),
  49.   ImageList_SetIconSize(*this, "ImageList_SetIconSize"),
  50.   ImageList_DragShowNolock(*this, "ImageList_DragShowNolock"),
  51.   ImageList_EndDrag(*this, "ImageList_EndDrag"),
  52. #endif
  53.   CreateMappedBitmap(*this, "CreateMappedBitmap"),
  54.   CreatePropertySheetPage(*this, "CreatePropertySheetPage"),
  55.   CreateStatusWindow(*this, "CreateStatusWindow"),
  56.   CreateToolbarEx(*this, "CreateToolbarEx"),
  57.   CreateUpDownControl(*this, "CreateUpDownControl"),
  58.   DestroyPropertySheetPage(*this, "DestroyPropertySheetPage"),
  59.   DrawInsert(*this, "DrawInsert"),
  60.   DrawStatusText(*this, "DrawStatusText"),
  61.   GetEffectiveClientRect(*this, "GetEffectiveClientRect"),
  62.   ImageList_Add(*this, "ImageList_Add"),
  63.   ImageList_Create(*this, "ImageList_Create"),
  64.   ImageList_Destroy(*this, "ImageList_Destroy"),
  65.   ImageList_Draw(*this, "ImageList_Draw"),
  66.   ImageList_GetBkColor(*this, "ImageList_GetBkColor"),
  67.   ImageList_GetImageCount(*this, "ImageList_GetImageCount"),
  68.   ImageList_ReplaceIcon(*this, "ImageList_ReplaceIcon"),
  69.   ImageList_SetBkColor(*this, "ImageList_SetBkColor"),
  70.   ImageList_SetOverlayImage(*this, "ImageList_SetOverlayImage"),
  71.   InitCommonControls(*this, "InitCommonControls"),
  72.   LBItemFromPt(*this, "LBItemFromPt"),
  73.   MakeDragList(*this, "MakeDragList"),
  74.   MenuHelp(*this, "MenuHelp"),
  75.   PropertySheet(*this, "PropertySheet"),
  76.   ShowHideMenuCtl(*this, "ShowHideMenuCtl")
  77. {
  78.   // Do the initialization now that the Dll is loaded
  79.   //
  80.   InitCommonControls();
  81. }
  82.  
  83.  
  84.  
  85. //
  86. //
  87. //
  88. TCommCtrlDll* 
  89. TCommCtrl::Dll()
  90. {
  91.   static TDllLoader<TCommCtrlDll> ccDll;
  92.   return ccDll.Dll();
  93. }
  94.  
  95. //
  96. //
  97. //
  98. bool          
  99. TCommCtrl::IsAvailable()
  100. {
  101. #if defined(BI_PLAT_WIN16)
  102.  
  103.   // For debugging purposes only
  104.   //
  105. # if defined(__OWL_NO_COMMCTRL)
  106.     return false;
  107. # endif
  108.  
  109.   // Some versions of Win 3.1x (eg. Windows for Workgroups) contain a 
  110.   // COMMCTRL.DLL file. However, that module does not provide the API
  111.   // documented as available from the Win95 and NT 3.51 versions of
  112.   // the Common Control Library.
  113.   //
  114.   if (TSystem::IsWoW() || !TSystem::IsWin95())
  115.     return false;
  116.   return Dll() != 0;
  117. #elif defined(BI_PLAT_WIN32)
  118.   return Dll() != 0;
  119. #endif
  120. }
  121.  
  122. //----------------------------------------------------------------------------
  123.  
  124. //
  125. // Constructor of the Object thrown by the CommonControl wrappers of
  126. // ObjectWindows
  127. //
  128. TXCommCtrl::TXCommCtrl()
  129. :
  130.   TXOwl(IDS_COMMCTRL)
  131. {
  132. }
  133.  
  134. //
  135. // Route to copy an exception object. The 'Clone' method is invoked when
  136. // an exception must be suspended. The cloned copy can latter be used to 
  137. // resume the exception.
  138. //
  139. #if defined(BI_NO_COVAR_RET)
  140. TXBase*
  141. #else
  142. TXCommCtrl*
  143. #endif
  144. TXCommCtrl::Clone()
  145. {
  146.   return new TXCommCtrl(*this);
  147. }
  148.  
  149. //
  150. // Method to localize the actual call to 'throw' an TXCommCtrl object.
  151. // NOTE: Localizing the call to 'throw' is a size optimization: the
  152. //       overhead of a 'throw' statement is generated only once.
  153. //
  154. void
  155. TXCommCtrl::Throw()
  156. {
  157.   THROW( *this );
  158. }
  159.  
  160. //
  161. // Construct a TXCommCtrl exception from scratch, and throw it
  162. //
  163. void
  164. TXCommCtrl::Raise()
  165. {
  166.   TXCommCtrl().Throw();
  167. }
  168.  
  169. //----------------------------------------------------------------------------
  170. // DISPATCH.CPP
  171. //
  172. int32 _OWLFUNC
  173. v_NMHDRCode_Dispatch(GENERIC& generic,
  174.                      void    (GENERIC::*pmf)(uint),
  175.                      uint     /*param1*/,
  176.                      int32    param2)
  177. {
  178.   (generic.*pmf)((LPNMHDR(param2))->code);
  179.   return 0;
  180. }
  181.