You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
4.8 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: winstl/shims/attribute/get_HWND.hpp
  3. *
  4. * Purpose: Contains access shims for windows.
  5. *
  6. * Created: 7th October 2002
  7. * Updated: 10th August 2009
  8. *
  9. * Home: http://stlsoft.org/
  10. *
  11. * Copyright (c) 2002-2009, Matthew Wilson and Synesis Software
  12. * All rights reserved.
  13. *
  14. * Redistribution and use in source and binary forms, with or without
  15. * modification, are permitted provided that the following conditions are met:
  16. *
  17. * - Redistributions of source code must retain the above copyright notice, this
  18. * list of conditions and the following disclaimer.
  19. * - Redistributions in binary form must reproduce the above copyright notice,
  20. * this list of conditions and the following disclaimer in the documentation
  21. * and/or other materials provided with the distribution.
  22. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
  23. * any contributors may be used to endorse or promote products derived from
  24. * this software without specific prior written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  27. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  30. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  31. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  32. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  33. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  34. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  35. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  36. * POSSIBILITY OF SUCH DAMAGE.
  37. *
  38. * ////////////////////////////////////////////////////////////////////// */
  39. /** \file winstl/shims/attribute/get_HWND.hpp
  40. *
  41. * \brief [C++ only] Definition of stlsoft::get_HWND attribute shim
  42. * functions for Win32 types
  43. * (\ref group__library__shims__window_attribute "Window Attribute Shims").
  44. */
  45. #ifndef WINSTL_INCL_SHIMS_ATTRIBUTE_HPP_GET_HWND
  46. #define WINSTL_INCL_SHIMS_ATTRIBUTE_HPP_GET_HWND
  47. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  48. # define WINSTL_VER_SHIMS_ATTRIBUTE_HPP_GET_HWND_MAJOR 4
  49. # define WINSTL_VER_SHIMS_ATTRIBUTE_HPP_GET_HWND_MINOR 1
  50. # define WINSTL_VER_SHIMS_ATTRIBUTE_HPP_GET_HWND_REVISION 1
  51. # define WINSTL_VER_SHIMS_ATTRIBUTE_HPP_GET_HWND_EDIT 46
  52. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  53. /* /////////////////////////////////////////////////////////////////////////
  54. * Includes
  55. */
  56. #ifndef WINSTL_INCL_WINSTL_H_WINSTL
  57. # include <winstl/winstl.h>
  58. #endif /* !WINSTL_INCL_WINSTL_H_WINSTL */
  59. /* /////////////////////////////////////////////////////////////////////////
  60. * Namespace
  61. */
  62. #ifndef _WINSTL_NO_NAMESPACE
  63. # if defined(_STLSOFT_NO_NAMESPACE) || \
  64. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  65. /* There is no stlsoft namespace, so must define ::winstl */
  66. namespace winstl
  67. {
  68. # else
  69. /* Define stlsoft::winstl_project */
  70. namespace stlsoft
  71. {
  72. namespace winstl_project
  73. {
  74. # endif /* _STLSOFT_NO_NAMESPACE */
  75. #endif /* !_WINSTL_NO_NAMESPACE */
  76. /* /////////////////////////////////////////////////////////////////////////
  77. * get_HWND
  78. *
  79. * This can be applied to an expression, and the return value is the
  80. * corresponding HWND.
  81. */
  82. /* HWND */
  83. /** \brief Access the HWND of the given HWND
  84. *
  85. * \ingroup group__library__shims__window_attribute
  86. *
  87. * This access <a href = "http://stlsoft.org/white_papers.html#shims">shim</a>
  88. * retrieves the HWND window handle for the given HWND handle.
  89. *
  90. * \param h A HWND whose corresponding HWND will be retrieved
  91. * \return The HWND corresponding to the given HWND \c h
  92. */
  93. inline HWND get_HWND(HWND h)
  94. {
  95. return h;
  96. }
  97. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  98. inline HWND get_hwnd(HWND h)
  99. {
  100. return get_HWND(h);
  101. }
  102. template <typename W>
  103. inline HWND get_hwnd(W const& h)
  104. {
  105. return get_HWND(h);
  106. }
  107. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  108. ////////////////////////////////////////////////////////////////////////////
  109. // Unit-testing
  110. #ifdef STLSOFT_UNITTEST
  111. # include "./unittest/get_HWND_unittest_.h"
  112. #endif /* STLSOFT_UNITTEST */
  113. /* ////////////////////////////////////////////////////////////////////// */
  114. #ifndef _WINSTL_NO_NAMESPACE
  115. # if defined(_STLSOFT_NO_NAMESPACE) || \
  116. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  117. } // namespace winstl
  118. # else
  119. } // namespace winstl_project
  120. } // namespace stlsoft
  121. # endif /* _STLSOFT_NO_NAMESPACE */
  122. #endif /* !_WINSTL_NO_NAMESPACE */
  123. /* ////////////////////////////////////////////////////////////////////// */
  124. #endif /* WINSTL_INCL_SHIMS_ATTRIBUTE_HPP_GET_HWND */
  125. /* ///////////////////////////// end of file //////////////////////////// */