4#ifndef _Stroika_Frameworks_Led_GDI_h_
5#define _Stroika_Frameworks_Led_GDI_h_ 1
7#include "Stroika/Frameworks/StroikaPreComp.h"
29#include "Stroika/Frameworks/Led/Support.h"
31namespace Stroika::Frameworks::Led {
34 using Foundation::Characters::String;
41 using CoordinateType = long;
49 using DistanceType =
unsigned long;
66 constexpr explicit TWIPS (
long v);
67 constexpr operator long ()
const;
73 nonvirtual TWIPS& operator+= (
const TWIPS& rhs);
74 nonvirtual TWIPS& operator-= (
const TWIPS& rhs);
75 nonvirtual TWIPS& operator*= (
double rhs);
78 constexpr bool operator== (
const TWIPS&)
const =
default;
81 static const TWIPS kPoint;
82 static const TWIPS kInch;
83 static const TWIPS kOneInch;
85 TWIPS operator+ (
const TWIPS& lhs,
const TWIPS& rhs);
86 TWIPS operator- (
const TWIPS& lhs,
const TWIPS& rhs);
107 TabStopList () =
default;
110 virtual ~TabStopList () =
default;
119 virtual TWIPS ComputeIthTab (
size_t i)
const = 0;
128 virtual TWIPS ComputeTabStopAfterPosition (TWIPS afterPos)
const = 0;
129 nonvirtual DistanceType ComputeTabStopAfterPosition (Tablet* tablet, DistanceType afterPos)
const;
132#if qStroika_Platform_Windows
137 FontObject () =
default;
139 nonvirtual
operator HFONT ()
const;
140 nonvirtual
int GetObject (
int nCount, LPVOID lpObject)
const;
141 nonvirtual BOOL DeleteObject ();
142 nonvirtual BOOL CreateFontIndirect (
const LOGFONT* lpLogFont);
143 nonvirtual BOOL
Attach (HFONT hObject);
146 HFONT m_hObject{
nullptr};
150#if qStroika_Platform_Windows
155 Brush (COLORREF crColor);
157 nonvirtual
operator HBRUSH ()
const;
158 nonvirtual BOOL
Attach (HBRUSH hObject);
159 nonvirtual BOOL DeleteObject ();
162 HBRUSH m_hObject{
nullptr};
168 template <
typename COORD_TYPE>
171 using CoordinateType = COORD_TYPE;
174 constexpr Point_Base ();
175 constexpr Point_Base (COORD_TYPE newV, COORD_TYPE newH);
176 template <
typename OTHER_POINT_BASE_TYPE>
177 constexpr explicit Point_Base (OTHER_POINT_BASE_TYPE o)
178 : v (COORD_TYPE (o.v))
179 , h (COORD_TYPE (o.h))
190 constexpr strong_ordering operator<=> (
const Point_Base& rhs)
const =
default;
197 template <
typename POINT_TYPE,
typename SIZE_TYPE>
200 using CoordinateType =
typename POINT_TYPE::CoordinateType;
201 using DistanceType =
typename SIZE_TYPE::CoordinateType;
202 using THIS_TYPE = Rect_Base<POINT_TYPE, SIZE_TYPE>;
205 constexpr Rect_Base ();
206 constexpr Rect_Base (CoordinateType newTop, CoordinateType newLeft, DistanceType newHeight, DistanceType newWidth);
207 constexpr Rect_Base (POINT_TYPE origin, SIZE_TYPE size);
210 nonvirtual CoordinateType GetTop ()
const;
211 nonvirtual CoordinateType GetLeft ()
const;
212 nonvirtual CoordinateType GetBottom ()
const;
213 nonvirtual CoordinateType GetRight ()
const;
214 nonvirtual
bool IsEmpty ()
const;
215 nonvirtual DistanceType GetHeight ()
const;
216 nonvirtual DistanceType GetWidth ()
const;
217 nonvirtual POINT_TYPE GetTopLeft ()
const;
218 nonvirtual POINT_TYPE GetTopRight ()
const;
219 nonvirtual POINT_TYPE GetBotRight ()
const;
220 nonvirtual POINT_TYPE GetOrigin ()
const;
221 nonvirtual SIZE_TYPE GetSize ()
const;
222 nonvirtual
bool Contains (POINT_TYPE p)
const;
223 nonvirtual
bool Contains (THIS_TYPE r)
const;
225 nonvirtual
void SetOrigin (POINT_TYPE p);
226 nonvirtual
void SetTop (CoordinateType top);
227 nonvirtual
void SetLeft (CoordinateType left);
228 nonvirtual
void SetBottom (CoordinateType bottom);
229 nonvirtual
void SetRight (CoordinateType right);
234 CoordinateType bottom;
235 CoordinateType right;
238 nonvirtual
const Rect_Base<POINT_TYPE, SIZE_TYPE>& operator+= (
const POINT_TYPE& delta);
239 nonvirtual
const Rect_Base<POINT_TYPE, SIZE_TYPE>& operator-= (
const POINT_TYPE& delta);
240 nonvirtual
const Rect_Base<POINT_TYPE, SIZE_TYPE>& operator*= (
const THIS_TYPE& intersectWith);
245 constexpr strong_ordering operator<=> (
const Rect_Base& rhs)
const =
default;
246 bool operator== (
const Rect_Base& rhs)
const;
252 using Led_Size = Point_Base<DistanceType>;
257 using Led_Point = Point_Base<CoordinateType>;
258 Led_Point operator- (
const Led_Point& lhs,
const Led_Point& rhs);
263 using TWIPS_Point = Point_Base<TWIPS>;
268 using Led_Rect = Rect_Base<Led_Point, Led_Size>;
273 using TWIPS_Rect = Rect_Base<TWIPS_Point, TWIPS_Point>;
275#if qStroika_Frameworks_Led_SupportGDI
282 Region (
const Led_Rect& r);
283 Region (
const Region& from);
285 nonvirtual
const Region& operator= (
const Region& rhs);
288 nonvirtual
bool IsEmpty ()
const;
289 nonvirtual Led_Rect GetBoundingRect ()
const;
292#if qStroika_Platform_Windows
293 operator HRGN ()
const;
294 int CombineRgn (Region* pRgn1, Region* pRgn2,
int nCombineMode);
295 BOOL PtInRegion (
int x,
int y)
const;
296 BOOL PtInRegion (POINT point)
const;
299 BOOL DeleteObject ();
302#if qStroika_Platform_Windows
306 Region operator* (
const Region& lhs,
const Region& rhs);
307 Region operator+ (
const Region& lhs,
const Region& rhs);
318 using ColorValue =
unsigned short;
321 kColorValueMax = USHRT_MAX
326 constexpr Color (ColorValue redValue, ColorValue greenValue, ColorValue blueValue);
327#if qStroika_Platform_Windows
328 explicit Color (COLORREF colorRef);
332 nonvirtual ColorValue GetRed ()
const;
333 nonvirtual ColorValue GetGreen ()
const;
334 nonvirtual ColorValue GetBlue ()
const;
340 static const Color kBlack;
341 static const Color kWhite;
342 static const Color kRed;
343 static const Color kGreen;
344 static const Color kBlue;
345 static const Color kCyan;
346 static const Color kMagenta;
347 static const Color kYellow;
348 static const Color kMaroon;
349 static const Color kOlive;
350 static const Color kNavyBlue;
351 static const Color kPurple;
352 static const Color kTeal;
353 static const Color kGray;
354 static const Color kSilver;
355 static const Color kDarkGreen;
356 static const Color kLimeGreen;
357 static const Color kFuchsia;
358 static const Color kAqua;
361#if qStroika_Platform_Windows
362 nonvirtual COLORREF GetOSRep ()
const;
368 constexpr strong_ordering operator<=> (
const Color& rhs)
const =
default;
369 constexpr bool operator== (
const Color& rhs)
const =
default;
383 unsigned int Distance_Squared (
Color lhs,
Color rhs);
384#if qStroika_Platform_Windows
385 unsigned int Distance_Squared (COLORREF lhs, COLORREF rhs);
394#if qStroika_Platform_Windows
396 Pen (
int nPenStyle,
int nWidth, COLORREF crColor);
398 nonvirtual
operator HPEN ()
const;
399 nonvirtual BOOL Attach (HPEN hObject);
400 nonvirtual BOOL DeleteObject ();
426 eDefaultForScriptJustify
445 eListStyle_None = 9999,
446 eListStyle_Bullet = 23
474 eAtLeastTWIPSSpacing,
478 Rule fRule{eSingleSpace};
482 constexpr LineSpacing () =
default;
483 constexpr LineSpacing (Rule rule);
484 constexpr LineSpacing (Rule rule, TWIPS twips);
485 constexpr LineSpacing (Rule rule,
unsigned lineCount);
488 constexpr bool operator== (
const LineSpacing& rhs)
const;
491 class IncrementalFontSpecification;
505#if qStroika_Platform_Windows
513#if qStroika_Platform_Windows
517 SDKChar fName[LF_FACESIZE];
520 return ::_tcscmp (fName, rhs.fName) == 0;
530 nonvirtual SDKString GetFontName ()
const;
531 nonvirtual
void SetFontName (
const SDKString& fontName);
538 nonvirtual
bool GetStyle_Plain ()
const;
539 nonvirtual
void SetStyle_Plain ();
541 nonvirtual
bool GetStyle_Bold ()
const;
542 nonvirtual
void SetStyle_Bold (
bool isBold);
544 nonvirtual
bool GetStyle_Italic ()
const;
545 nonvirtual
void SetStyle_Italic (
bool isItalic);
547 nonvirtual
bool GetStyle_Underline ()
const;
548 nonvirtual
void SetStyle_Underline (
bool isUnderline);
550 enum SubOrSuperScript {
555 nonvirtual SubOrSuperScript GetStyle_SubOrSuperScript ()
const;
556 nonvirtual
void SetStyle_SubOrSuperScript (SubOrSuperScript subOrSuperScript);
558#if qStroika_Platform_Windows
559 nonvirtual
bool GetStyle_Strikeout ()
const;
560 nonvirtual
void SetStyle_Strikeout (
bool isStrikeout);
563 using FontSize = uint16_t;
564 nonvirtual FontSize GetPointSize ()
const;
565 nonvirtual
void SetPointSize (FontSize pointSize);
567#if qStroika_Platform_Windows
568 nonvirtual
long PeekAtTMHeight ()
const;
569 nonvirtual
void PokeAtTMHeight (
long tmHeight);
572 nonvirtual
Color GetTextColor ()
const;
573 nonvirtual
void SetTextColor (
const Color& textColor);
576#if qStroika_Platform_Windows
577 nonvirtual LOGFONT GetOSRep ()
const;
578 nonvirtual
void GetOSRep (LOGFONT* logFont)
const;
579 nonvirtual
void SetOSRep (LOGFONT logFont);
580 nonvirtual
void LightSetOSRep (LOGFONT logFont);
594 nonvirtual
void MergeIn (
const IncrementalFontSpecification& addInTheseAttributes);
597#if qStroika_Platform_Windows
601 bool fBold : 1 {
false};
602 bool fItalics : 1 {
false};
603 bool fUnderline : 1 {
false};
606 SubOrSuperScript fSubOrSuperScript{SubOrSuperScript::eNoSubOrSuperscript};
607 Color fTextColor{Color::kBlack};
624 IncrementalFontSpecification () =
default;
646 nonvirtual FontNameSpecifier GetFontNameSpecifier ()
const;
647 nonvirtual
bool GetFontNameSpecifier_Valid ()
const;
648 nonvirtual
void InvalidateFontNameSpecifier ();
649 nonvirtual
void SetFontNameSpecifier (FontNameSpecifier fontNameSpecifier);
650 nonvirtual
void SetFontName (
const SDKString& fontName);
653 nonvirtual
bool GetStyle_Plain ()
const;
654 nonvirtual
bool GetStyle_Plain_Valid ()
const;
655 nonvirtual
void InvalidateStyles ();
656 nonvirtual
void SetStyle_Plain ();
658 nonvirtual
bool GetStyle_Bold ()
const;
659 nonvirtual
bool GetStyle_Bold_Valid ()
const;
660 nonvirtual
void InvalidateStyle_Bold ();
661 nonvirtual
void SetStyle_Bold (
bool isBold);
663 nonvirtual
bool GetStyle_Italic ()
const;
664 nonvirtual
bool GetStyle_Italic_Valid ()
const;
665 nonvirtual
void InvalidateStyle_Italic ();
666 nonvirtual
void SetStyle_Italic (
bool isItalic);
668 nonvirtual
bool GetStyle_Underline ()
const;
669 nonvirtual
bool GetStyle_Underline_Valid ()
const;
670 nonvirtual
void InvalidateStyle_Underline ();
671 nonvirtual
void SetStyle_Underline (
bool isUnderline);
673 nonvirtual SubOrSuperScript GetStyle_SubOrSuperScript ()
const;
674 nonvirtual
bool GetStyle_SubOrSuperScript_Valid ()
const;
675 nonvirtual
void InvalidateStyle_SubOrSuperScript ();
676 nonvirtual
void SetStyle_SubOrSuperScript (SubOrSuperScript subOrSuperScript);
678#if qStroika_Platform_Windows
679 nonvirtual
bool GetStyle_Strikeout ()
const;
680 nonvirtual
bool GetStyle_Strikeout_Valid ()
const;
681 nonvirtual
void InvalidateStyle_Strikeout ();
682 nonvirtual
void SetStyle_Strikeout (
bool isStrikeout);
691 nonvirtual
unsigned short GetPointSize ()
const;
692 nonvirtual
bool GetPointSize_Valid ()
const;
693 nonvirtual
void InvalidatePointSize ();
694 nonvirtual
void SetPointSize (FontSize pointSize);
695#if qStroika_Platform_Windows
696 nonvirtual
void PokeAtTMHeight (
long tmHeight);
699 nonvirtual
short GetPointSizeIncrement ()
const;
700 nonvirtual
bool GetPointSizeIncrement_Valid ()
const;
701 nonvirtual
void InvalidatePointSizeIncrement ();
702 nonvirtual
void SetPointSizeIncrement (
short pointSizeIncrement);
704 nonvirtual
Color GetTextColor ()
const;
705 nonvirtual
bool GetTextColor_Valid ()
const;
706 nonvirtual
void InvalidateTextColor ();
707 nonvirtual
void SetTextColor (
const Color& textColor);
710#if qStroika_Platform_Windows
711 nonvirtual LOGFONT GetOSRep ()
const;
712 nonvirtual
void GetOSRep (LOGFONT* logFont)
const;
713 nonvirtual
void SetOSRep (LOGFONT logFont);
714 nonvirtual
void LightSetOSRep (LOGFONT logFont);
715 nonvirtual
bool GetDidSetOSRepCallFlag ()
const;
720 bool operator<=> (
const IncrementalFontSpecification& rhs) =
delete;
721 bool operator== (
const IncrementalFontSpecification& rhs)
const;
724 nonvirtual
void MergeIn (
const IncrementalFontSpecification& addInTheseAttributes);
727 bool fFontSpecifierValid : 1 {
false};
728 bool fStyleValid_Bold : 1 {
false};
729 bool fStyleValid_Italic : 1 {
false};
730 bool fStyleValid_Underline : 1 {
false};
731 bool fStyleValid_SubOrSuperScript : 1 {
false};
732#if qStroika_Platform_Windows
733 bool fStyleValid_Strikeout : 1 {
false};
734 bool fDidSetOSRepCallFlag : 1 {
false};
736 bool fFontSizeValid : 1 {
false};
737 bool fFontSizeIncrementValid : 1 {
false};
738 bool fTextColorValid : 1 {
false};
741 IncrementalFontSpecification
Intersection (
const IncrementalFontSpecification& lhs,
const IncrementalFontSpecification& rhs);
745 class InstalledFonts {
748#if qStroika_Platform_Windows
749 eSkipAtSignFonts = 0x1,
750 eSkipRasterFonts = 0x2,
753#if qStroika_Platform_Windows
754 eDefaultFilterOptions = eSkipAtSignFonts | eSkipRasterFonts
756 eDefaultFilterOptions = 0
759 InstalledFonts (FilterOptions filterOptions = eDefaultFilterOptions);
762 nonvirtual
const vector<SDKString>& GetUsableFontNames ()
const;
765 FilterOptions fFilterOptions;
766 vector<SDKString> fFontNames;
768#if qStroika_Platform_Windows
770 static BOOL FAR PASCAL FontFamilyAdderProc (ENUMLOGFONTEX* pelf, NEWTEXTMETRICEX* ,
int fontType, LPVOID pThis);
775 FontSpecification GetStaticDefaultFont ();
776#if qStroika_Platform_Windows
777 FontSpecification GetStaticDefaultFont (BYTE charSet);
780#if qStroika_Frameworks_Led_SupportGDI
792 static Globals& Get ();
795 static Globals* sThe;
798 nonvirtual
void InvalidateGlobals ();
801 nonvirtual DistanceType GetMainScreenLogPixelsH ()
const;
802 nonvirtual DistanceType GetMainScreenLogPixelsV ()
const;
805 DistanceType fLogPixelsH;
806 DistanceType fLogPixelsV;
809 class _Global_DESTRUCTOR_;
810 friend class _Global_DESTRUCTOR_;
814 Led_Rect operator- (
const Led_Rect& lhs,
const Led_Point& rhs);
815 Led_Rect operator+ (Led_Point p, Led_Rect r);
816 Led_Rect operator+ (Led_Rect r, Led_Point p);
817 bool Intersect (
const Led_Rect& lhs,
const Led_Rect& rhs);
818#if qStroika_Frameworks_Led_SupportGDI
819 bool Intersect (
const Led_Rect& lhs,
const Region& rhs);
820 bool Intersect (
const Region& lhs,
const Led_Rect& rhs);
821 bool Intersect (
const Region& lhs,
const Region& rhs);
824 Led_Rect
Intersection (
const Led_Rect& lhs,
const Led_Rect& rhs);
825 Led_Rect operator* (
const Led_Rect& lhs,
const Led_Rect& rhs);
827 Led_Size operator+ (Led_Size lhs, Led_Size rhs);
828 Led_Size operator* (
int lhs, Led_Size rhs);
830 Led_Rect InsetRect (
const Led_Rect& r,
int vBy,
int hBy);
831 Led_Rect EnsureRectInRect (
const Led_Rect& r, Led_Rect enlosingR);
832#if qStroika_Frameworks_Led_SupportGDI
833 Led_Rect EnsureRectOnScreen (
const Led_Rect& r);
836#if qStroika_Platform_Windows
837 Led_Point AsLedPoint (POINT p);
838 POINT AsPOINT (Led_Point p);
839 Led_Rect AsLedRect (RECT r);
840 RECT AsRECT (Led_Rect p);
841 SIZE AsSIZE (Led_Size s);
842 Led_Size AsLedSize (SIZE s);
845#if qStroika_Frameworks_Led_SupportGDI
846 TWIPS Led_CvtScreenPixelsToTWIPSV (CoordinateType from);
847 TWIPS Led_CvtScreenPixelsToTWIPSH (CoordinateType from);
848 CoordinateType Led_CvtScreenPixelsFromTWIPSV (TWIPS from);
849 CoordinateType Led_CvtScreenPixelsFromTWIPSH (TWIPS from);
852#if qStroika_Frameworks_Led_SupportGDI
861 FontMetrics () =
default;
862#if qStroika_Platform_Windows
863 FontMetrics (
const TEXTMETRIC& from);
865 FontMetrics (
const FontMetrics&) =
default;
866 FontMetrics& operator= (
const FontMetrics& rhs) =
default;
869 nonvirtual DistanceType GetAscent ()
const;
870 nonvirtual DistanceType GetDescent ()
const;
871 nonvirtual DistanceType GetLeading ()
const;
872 nonvirtual DistanceType GetHeight ()
const;
873 nonvirtual DistanceType GetLineHeight ()
const;
876 nonvirtual DistanceType GetMaxCharacterWidth ()
const;
877#if qStroika_Platform_Windows
878 nonvirtual DistanceType GetAveCharacterWidth ()
const;
884#if qStroika_Platform_Windows
885 operator const TEXTMETRIC*()
const;
886 operator TEXTMETRIC*();
890#if qStroika_Platform_Windows
891 TEXTMETRIC fPlatformSpecific{};
896#if qStroika_Frameworks_Led_SupportGDI
897 Color Led_GetTextColor ();
898 Color Led_GetTextBackgroundColor ();
899 Color Led_GetSelectedTextColor ();
900 Color Led_GetSelectedTextBackgroundColor ();
902 class OffscreenTablet;
905#if qStroika_Frameworks_Led_SupportGDI
914#if qStroika_Platform_Windows
920 Tablet (HDC hdc =
nullptr, OwnDCControl ownsDC = eOwnsDC);
927#if qStroika_Platform_Windows
928 nonvirtual
operator HDC ()
const;
932 nonvirtual CoordinateType CvtFromTWIPSV (TWIPS from)
const;
933 nonvirtual CoordinateType CvtFromTWIPSH (TWIPS from)
const;
934 nonvirtual TWIPS CvtToTWIPSV (CoordinateType from)
const;
935 nonvirtual TWIPS CvtToTWIPSH (CoordinateType from)
const;
938 nonvirtual Led_Point CvtFromTWIPS (TWIPS_Point from)
const;
939 nonvirtual TWIPS_Point CvtToTWIPS (Led_Point from)
const;
940 nonvirtual Led_Rect CvtFromTWIPS (TWIPS_Rect from)
const;
941 nonvirtual TWIPS_Rect CvtToTWIPS (Led_Rect from)
const;
944 nonvirtual
void ScrollBitsAndInvalRevealed (
const Led_Rect& windowRect, CoordinateType scrollBy);
945 nonvirtual
void FrameRegion (
const Region& r,
const Color& c);
948 nonvirtual
void FrameRectangle (
const Led_Rect& r, Color c, DistanceType borderWidth);
951#if qStroika_Platform_Windows
952 nonvirtual BOOL BitBlt (
int x,
int y,
int nWidth,
int nHeight, Tablet* pSrcDC,
int xSrc,
int ySrc, DWORD dwRop);
953 nonvirtual BOOL CreateCompatibleDC (Tablet* pDC);
954 nonvirtual COLORREF SetTextColor (COLORREF crColor);
955 nonvirtual COLORREF SetBkColor (COLORREF crColor);
956 nonvirtual BOOL IsPrinting ()
const;
957 nonvirtual BOOL RoundRect (
int x1,
int y1,
int x2,
int y2,
int x3,
int y3);
958 nonvirtual BOOL TextOut (
int x,
int y, LPCTSTR lpszString,
int nCount);
960 nonvirtual
int SetBkMode (
int nBkMode);
961 nonvirtual SIZE GetWindowExt ()
const;
962 nonvirtual SIZE GetViewportExt ()
const;
963 nonvirtual BOOL Rectangle (
int x1,
int y1,
int x2,
int y2);
964 nonvirtual BOOL Rectangle (
const RECT& r);
965 nonvirtual BOOL Rectangle (LPCRECT lpRect);
966 nonvirtual BOOL GetTextMetrics (LPTEXTMETRIC lpMetrics)
const;
967 nonvirtual HBITMAP SelectObject (HBITMAP hBitmap);
969 nonvirtual HFONT SelectObject (HFONT hFont);
971 nonvirtual POINT SetWindowOrg (
int x,
int y);
972 nonvirtual
int GetDeviceCaps (
int nIndex)
const;
973 nonvirtual BOOL
Attach (HDC hDC, OwnDCControl ownsDC = eOwnsDC);
974 nonvirtual HDC Detach ();
977#if qStroika_Platform_Windows
979 nonvirtual HWND GetWindow ()
const;
980 nonvirtual
unsigned int SetTextAlign (
unsigned int nTextAlign);
984 nonvirtual
void MoveTo (
const Led_Point& to);
985 nonvirtual
void LineTo (
const Led_Point& to);
988 nonvirtual
void MeasureText (
const FontMetrics& precomputedFontMetrics,
const Led_tChar* text,
size_t nTChars, DistanceType* charLocations);
989 nonvirtual
void TabbedTextOut (
const FontMetrics& precomputedFontMetrics,
const Led_tChar* text,
size_t nBytes,
990 TextDirection direction, Led_Point outputAt, CoordinateType hTabOrigin,
991 const TabStopList& tabStopList, DistanceType* amountDrawn, CoordinateType hScrollOffset);
994 nonvirtual
void SetBackColor (
const Color& backColor);
995 nonvirtual
void SetForeColor (
const Color& foreColor);
998 nonvirtual
void EraseBackground_SolidHelper (
const Led_Rect& eraseRect,
const Color& eraseColor);
999 nonvirtual
void HilightArea_SolidHelper (
const Led_Rect& hilightArea, Color hilightBackColor, Color hilightForeColor,
1000 Color oldBackColor, Color oldForeColor);
1001 nonvirtual
void HilightArea_SolidHelper (
const Region& hilightArea, Color hilightBackColor, Color hilightForeColor,
1002 Color oldBackColor, Color oldForeColor);
1004#if qStroika_Platform_Windows
1006 class RecolorHelper;
1009 RecolorHelper* fRecolorHelper;
1013 class ClipNarrowAndRestore;
1016 nonvirtual Region GetClip ()
const;
1017 nonvirtual
bool GetClip (Region* r)
const;
1018 nonvirtual
void SetClip ();
1019 nonvirtual
void SetClip (
const Led_Rect& clipTo);
1020 nonvirtual
void SetClip (
const Region& clipTo);
1023 nonvirtual FontMetrics GetFontMetrics ()
const;
1025#if qStroika_Platform_Windows
1030 OwnDCControl fOwnsDC;
1033 mutable DistanceType fLogPixelsV;
1034 mutable DistanceType fLogPixelsH;
1038 friend class OffscreenTablet;
1046 class Tablet::ClipNarrowAndRestore {
1048 ClipNarrowAndRestore (Tablet* tablet);
1049 ClipNarrowAndRestore (Tablet* tablet,
const Led_Rect& clipFurtherTo);
1050 ClipNarrowAndRestore (Tablet* tablet,
const Region& clipFurtherTo);
1051 ~ClipNarrowAndRestore ();
1059#if qStroika_Platform_Windows
1060 class WindowDC :
public Tablet {
1062 WindowDC (HWND hWnd);
1070#if qStroika_Platform_Windows
1073 Bitmap () =
default;
1077 nonvirtual
void DeleteObject ();
1078 nonvirtual
operator HBITMAP ()
const;
1081 nonvirtual Led_Size GetImageSize ()
const;
1082 nonvirtual BOOL CreateCompatibleBitmap (HDC hdc, DistanceType nWidth, DistanceType nHeight);
1083 nonvirtual BOOL CreateCompatibleDIBSection (HDC hdc, DistanceType nWidth, DistanceType nHeight);
1084 nonvirtual
void LoadBitmap (HINSTANCE hInstance, LPCTSTR lpBitmapName);
1087 HBITMAP m_hObject{
nullptr};
1088 Led_Size fImageSize{};
1098 class OffscreenTablet {
1101 ~OffscreenTablet ();
1104 nonvirtual
void Setup (Tablet* origTablet);
1105 nonvirtual Tablet* PrepareRect (
const Led_Rect& currentRowRect, DistanceType extraToAddToBottomOfRect = 0);
1106 nonvirtual
void BlastBitmapToOrigTablet ();
1109 class OT :
public Tablet {
1111 using inherited = Tablet;
1114#if qStroika_Platform_Windows
1115 OT (HDC hdc =
nullptr, OwnDCControl ownsDC = eOwnsDC);
1120 Tablet* fOrigTablet;
1121 Led_Rect fOffscreenRect;
1122 Tablet* fOffscreenTablet;
1123#if qStroika_Platform_Windows
1125 Bitmap fMemoryBitmap;
1127 HBITMAP fOldBitmapInDC;
1141 class GDI_Obj_Selector {
1143#if qStroika_Platform_Windows
1144 GDI_Obj_Selector (Tablet* tablet, HGDIOBJ objToSelect);
1147 ~GDI_Obj_Selector ();
1151#if qStroika_Platform_Windows
1152 HGDIOBJ fRestoreObject;
1153 HGDIOBJ fRestoreAttribObject;
1166 struct Led_Picture {
1170 short picFrameBottom;
1171 short picFrameRight;
1175 short Led_GetMacPictTop (
const Led_Picture* picture);
1176 short Led_GetMacPictLeft (
const Led_Picture* picture);
1177 short Led_GetMacPictBottom (
const Led_Picture* picture);
1178 short Led_GetMacPictRight (
const Led_Picture* picture);
1179 short Led_GetMacPictWidth (
const Led_Picture* picture);
1180 short Led_GetMacPictHeight (
const Led_Picture* picture);
1181 Led_Size Led_GetMacPictSize (
const Led_Picture* picture);
1184#ifndef qStroika_Frameworks_Led_HaveWindowsDIBDefined
1185#define qStroika_Frameworks_Led_HaveWindowsDIBDefined qStroika_Platform_Windows
1188#if !qStroika_Frameworks_Led_HaveWindowsDIBDefined
1190 struct BITMAPINFOHEADER {
1191 unsigned long biSize;
1194 unsigned short biPlanes;
1195 unsigned short biBitCount;
1196 unsigned long biCompression;
1197 unsigned long biSizeImage;
1198 long biXPelsPerMeter;
1199 long biYPelsPerMeter;
1200 unsigned long biClrUsed;
1201 unsigned long biClrImportant;
1203 struct BITMAPCOREHEADER {
1204 unsigned long bcSize;
1205 unsigned short bcWidth;
1206 unsigned short bcHeight;
1207 unsigned short bcPlanes;
1208 unsigned short bcBitCount;
1211 unsigned char rgbBlue;
1212 unsigned char rgbGreen;
1213 unsigned char rgbRed;
1214 unsigned char rgbReserved;
1217 unsigned char rgbtBlue;
1218 unsigned char rgbtGreen;
1219 unsigned char rgbtRed;
1222 BITMAPINFOHEADER bmiHeader;
1223 RGBQUAD bmiColors[1];
1235 using Led_DIB = BITMAPINFO;
1237 Led_Size Led_GetDIBImageSize (
const Led_DIB* dib);
1238 size_t Led_GetDIBPalletByteCount (
const Led_DIB* dib);
1239 size_t Led_GetDIBImageRowByteCount (
const Led_DIB* dib);
1240 size_t Led_GetDIBImageByteCount (
const Led_DIB* dib);
1241 Led_DIB* Led_CloneDIB (
const Led_DIB* dib);
1242 const void* Led_GetDIBBitsPointer (
const Led_DIB* dib);
1244#if qStroika_Platform_Windows
1245 Led_DIB* Led_DIBFromHBITMAP (HDC hDC, HBITMAP hbm);
1248#if qStroika_Frameworks_Led_SupportGDI
1250 void AddRectangleToRegion (Led_Rect addRect, Region* toRgn);
1253#if qStroika_Frameworks_Led_ProvideIMESupport
1265 nonvirtual
bool Available ()
const;
1267 nonvirtual
void ForgetPosition ();
1268 nonvirtual
void NotifyPosition (HWND pWnd,
const SHORT x,
const SHORT y);
1269 nonvirtual
void NotifyOfFontChange (HWND hWnd,
const LOGFONT& lf);
1270 nonvirtual
void IMEOn (HWND pWnd);
1271 nonvirtual
void IMEOff (HWND pWnd);
1272 nonvirtual
void Enable ();
1273 nonvirtual
void Disable ();
1274 nonvirtual wstring GetCompositionResultStringW (HWND hWnd);
1277 nonvirtual
void UpdatePosition (
const HWND hWnd,
const SHORT x,
const SHORT y);
1278 nonvirtual
void SendSimpleMessage (HWND pWnd, UINT fnc, WPARAM wParam);
1280 LRESULT (FAR PASCAL* fSendIMEMessageProc)
1282 BOOL (FAR PASCAL* fIMEEnableProc) (HWND, BOOL);
1283 HIMC (FAR PASCAL* fImmGetContext) (HWND);
1284 BOOL (FAR PASCAL* fImmSetCompositionFont) (HIMC,
const LOGFONT*);
1285 BOOL (FAR PASCAL* fImmReleaseContext) (HWND, HIMC);
1286 LONG (FAR PASCAL* fImmGetCompositionStringW) (HIMC, DWORD, LPVOID, DWORD);
1287 BOOL (FAR PASCAL* fImmSetCompositionWindow) (HIMC,
const void*);
1288 BOOL (FAR PASCAL* fImmSetOpenStatus) (HIMC, BOOL);
1290 bool fWinNlsAvailable;
1295 class _Global_DESTRUCTOR_;
1296 friend class _Global_DESTRUCTOR_;
1300 Led_Rect CenterRectInRect (
const Led_Rect& r,
const Led_Rect& centerIn);
1301#if qStroika_Platform_Windows
1302 void Led_CenterWindowInParent (HWND w);
set< T > Intersection(const set< T > &s1, const set< T > &s2)
String is like std::u32string, except it is much easier to use, often much more space efficient,...
conditional_t< qStroika_Foundation_Characters_SDKUseswchar_t, wchar_t, char > SDKChar
Ptr Attach(PlatformNativeHandle sd)