8#ifndef META_OCEAN_PLATFORM_WIN_UTILITIES_H
9#define META_OCEAN_PLATFORM_WIN_UTILITIES_H
18#ifdef OCEAN_COMPILER_MSC
19 #pragma managed(push, off)
24#ifdef OCEAN_COMPILER_MSC
71 static void textOutput(HDC dc,
const int x,
const int y,
const std::string& text);
92 static void textOutput(HDC deviceContext,
const std::wstring& text,
const std::wstring& font,
const unsigned int fontSize,
const bool bold,
const AnchorPosition anchorPosition,
const unsigned int windowWidth,
const unsigned int windowHeight,
const int32_t foregroundColor,
const int32_t backgroundColor = -1,
const int32_t shadowColor = -1,
const unsigned int shadowOffsetX = 2u,
const unsigned int shadowOffsetY = 2u,
const unsigned int marginX = 20u,
const unsigned int marginY = 20u);
120 static void frameOutput(HDC dc,
const int x,
const int y,
const unsigned int width,
const unsigned int height,
const Frame& frame);
145 static inline void desktopFrameOutput(
const int x,
const int y,
const unsigned int scale,
const Frame& frame);
159 static void desktopFrameOutput(
const int x,
const int y,
const unsigned int width,
const unsigned int height,
const Frame& frame);
177 static inline void desktopBitmapOutput(
const int x,
const int y,
const unsigned int scale,
const Bitmap& bitmap);
188 static void bitmapOutput(HDC dc,
const int x,
const int y,
const unsigned int width,
const unsigned int height,
const Bitmap& bitmap);
254 explicit inline ScopedDC(
const HWND window);
265 inline bool isValid()
const;
278 inline void release();
303 HWND window_ =
nullptr;
355 inline bool isValid()
const;
396 HFONT font_ =
nullptr;
399 HFONT previousFont_ =
nullptr;
443 inline bool increase(
const HWND windowHandle);
449 inline bool decrease(
const HWND windowHandle);
455 inline bool isZero(
const HWND windowHandle);
510#if defined(OCEAN_COMPILER_MSC) && defined(_MANAGED)
512inline System::String^
toString(
const std::string& value)
514 return gcnew System::String(value.c_str());
519 return gcnew System::String(value);
522inline System::String^
toString(
const std::wstring& value)
524 return gcnew System::String(value.c_str());
527inline System::String^
toString(
const wchar_t* value)
529 return gcnew System::String(value);
534 char* str = (
char*)(
void*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(value);
535 std::string result(str);
537 System::Runtime::InteropServices::Marshal::FreeHGlobal(System::IntPtr(str));
544 char* str = (
char*)(
void*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(value);
545 std::string result(str);
547 System::Runtime::InteropServices::Marshal::FreeHGlobal(System::IntPtr(str));
566 *
this = std::move(scopedDC);
583 return dc_ !=
nullptr;
606 if (
this != &scopedDC)
610 window_ = scopedDC.window_;
613 scopedDC.window_ =
nullptr;
614 scopedDC.dc_ =
nullptr;
622 *
this = std::move(scopedFont);
632 return font_ !=
nullptr;
644 if (
this != &scopedFont)
648 dc_ = scopedFont.dc_;
649 font_ = scopedFont.font_;
650 previousFont_ = scopedFont.previousFont_;
652 scopedFont.dc_ =
nullptr;
653 scopedFont.font_ =
nullptr;
654 scopedFont.previousFont_ =
nullptr;
669 for (CounterMap::value_type& counterPair : counterMap_)
671 ocean_assert(counterPair.second == 0u);
679 counterMap_[windowHandle]++;
681 return counterMap_[windowHandle] == 1u;
686 ocean_assert(counterMap_.find(windowHandle) != counterMap_.end());
687 ocean_assert(counterMap_[windowHandle] >= 1u);
689 counterMap_[windowHandle]--;
691 return counterMap_[windowHandle] == 0u;
696 return counterMap_[windowHandle] == 0u;
This class implements Ocean's image class.
Definition Frame.h:1969
unsigned int width() const
Returns the width of the frame format in pixel.
Definition Frame.h:3334
unsigned int height() const
Returns the height of the frame in pixel.
Definition Frame.h:3339
This class implements a recursive lock object.
Definition Lock.h:31
This template class is the base class for all singleton objects.
Definition Singleton.h:71
static std::wstring toWString(const char value)
Converts a value to a wstring.
The namespace covering the entire Ocean framework.
Definition Accessor.h:15
AutomaticDifferentiationT< T1, TNumeric1 > operator*(const T2 &left, const AutomaticDifferentiationT< T1, TNumeric1 > &right)
Definition AutomaticDifferentiation.h:528