gdipluslinecaps.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * gdipluslinecaps.h
  3. *
  4. * GDI+ AdjustableArrowCap class
  5. *
  6. * This file is part of the w32api package.
  7. *
  8. * Contributors:
  9. * Created by Markus Koenig <markus@stber-koenig.de>
  10. *
  11. * THIS SOFTWARE IS NOT COPYRIGHTED
  12. *
  13. * This source code is offered for use in the public domain. You may
  14. * use, modify or distribute it freely.
  15. *
  16. * This code is distributed in the hope that it will be useful but
  17. * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
  18. * DISCLAIMED. This includes but is not limited to warranties of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  20. *
  21. */
  22. #ifndef __GDIPLUS_LINECAPS_H
  23. #define __GDIPLUS_LINECAPS_H
  24. #if __GNUC__ >=3
  25. #pragma GCC system_header
  26. #endif
  27. #ifndef __cplusplus
  28. #error "A C++ compiler is required to include gdipluslinecaps.h."
  29. #endif
  30. class AdjustableArrowCap: public CustomLineCap
  31. {
  32. public:
  33. AdjustableArrowCap(REAL height, REAL width, BOOL isFilled):
  34. CustomLineCap(NULL, Ok)
  35. {
  36. GpAdjustableArrowCap *nativeAdjustableArrowCap = NULL;
  37. lastStatus = DllExports::GdipCreateAdjustableArrowCap(
  38. height, width, isFilled,
  39. &nativeAdjustableArrowCap);
  40. nativeCustomLineCap = nativeAdjustableArrowCap;
  41. }
  42. virtual ~AdjustableArrowCap()
  43. {
  44. }
  45. virtual AdjustableArrowCap* Clone() const
  46. {
  47. GpCustomLineCap *cloneCustomLineCap = NULL;
  48. Status status = updateStatus(DllExports::GdipCloneCustomLineCap(
  49. nativeCustomLineCap, &cloneCustomLineCap));
  50. if (status == Ok) {
  51. AdjustableArrowCap *result = new AdjustableArrowCap(
  52. cloneCustomLineCap, lastStatus);
  53. if (!result) {
  54. DllExports::GdipDeleteCustomLineCap(
  55. cloneCustomLineCap);
  56. lastStatus = OutOfMemory;
  57. }
  58. return result;
  59. } else {
  60. return NULL;
  61. }
  62. }
  63. REAL GetHeight() const
  64. {
  65. REAL result = 0.0f;
  66. updateStatus(DllExports::GdipGetAdjustableArrowCapHeight(
  67. (GpAdjustableArrowCap*) nativeCustomLineCap,
  68. &result));
  69. return result;
  70. }
  71. REAL GetMiddleInset() const
  72. {
  73. REAL result = 0.0f;
  74. updateStatus(DllExports::GdipGetAdjustableArrowCapMiddleInset(
  75. (GpAdjustableArrowCap*) nativeCustomLineCap,
  76. &result));
  77. return result;
  78. }
  79. REAL GetWidth() const
  80. {
  81. REAL result = 0.0f;
  82. updateStatus(DllExports::GdipGetAdjustableArrowCapWidth(
  83. (GpAdjustableArrowCap*) nativeCustomLineCap,
  84. &result));
  85. return result;
  86. }
  87. BOOL IsFilled() const
  88. {
  89. BOOL result = FALSE;
  90. updateStatus(DllExports::GdipGetAdjustableArrowCapFillState(
  91. (GpAdjustableArrowCap*) nativeCustomLineCap,
  92. &result));
  93. return result;
  94. }
  95. Status SetFillState(BOOL isFilled)
  96. {
  97. return updateStatus(DllExports::GdipSetAdjustableArrowCapFillState(
  98. (GpAdjustableArrowCap*) nativeCustomLineCap,
  99. isFilled));
  100. }
  101. Status SetHeight(REAL height)
  102. {
  103. return updateStatus(DllExports::GdipSetAdjustableArrowCapHeight(
  104. (GpAdjustableArrowCap*) nativeCustomLineCap,
  105. height));
  106. }
  107. Status SetMiddleInset(REAL middleInset)
  108. {
  109. return updateStatus(DllExports::GdipSetAdjustableArrowCapMiddleInset(
  110. (GpAdjustableArrowCap*) nativeCustomLineCap,
  111. middleInset));
  112. }
  113. Status SetWidth(REAL width)
  114. {
  115. return updateStatus(DllExports::GdipSetAdjustableArrowCapWidth(
  116. (GpAdjustableArrowCap*) nativeCustomLineCap,
  117. width));
  118. }
  119. private:
  120. AdjustableArrowCap(GpCustomLineCap *customLineCap, Status status):
  121. CustomLineCap(customLineCap, status) {}
  122. AdjustableArrowCap(const AdjustableArrowCap&);
  123. AdjustableArrowCap& operator=(const AdjustableArrowCap&);
  124. };
  125. #endif /* __GDIPLUS_LINECAPS_H */