home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / BORLAND TURBO / OWLSRC.PAK / UIPART.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  1.3 KB  |  61 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1995, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.8  $
  6. //
  7. //----------------------------------------------------------------------------
  8. #include <owl/pch.h>
  9. #if !defined(OWL_UIHELPER_H)
  10. # include <owl/uihelper.h>
  11. #endif
  12. #if !defined(OWL_GDIOBJEC_H)
  13. # include <owl/gdiobjec.h>
  14. #endif
  15.  
  16. OWL_DIAGINFO;
  17.  
  18. //
  19. // Empty constructor.
  20. //
  21. TUIPart::TUIPart()
  22. {
  23. }
  24.  
  25. //
  26. // Draw the part onto a DC.
  27. // The type and state control how the part should be painted.
  28. //
  29. bool
  30. TUIPart::Paint(TDC& dc, TRect& rect, TType type, TState state)
  31. {
  32.   return DrawFrameControl(dc, rect, type, state);
  33. }
  34.  
  35. #pragma warn -par
  36. //
  37. // Wrapper for the DrawFrameControl API.
  38. //
  39. bool
  40. TUIPart::DrawFrameControl(TDC& dc, TRect& rect, TType type, TState state)
  41. {
  42. #if defined(BI_PLAT_WIN32)
  43.   static bool hasDrawFrameControl = true;
  44.  
  45.   // Try once to see if the API call is available. If not, do ourselves.
  46.   //
  47.   if (hasDrawFrameControl) {
  48.     if (::DrawFrameControl(dc, &rect, type, state))
  49.       return true;
  50.     if (::GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
  51.       hasDrawFrameControl = false;
  52.     else
  53.       return false;
  54.   }
  55. #endif
  56.  
  57.   //
  58.   return false;
  59. }
  60. #pragma warn .par
  61.