4#ifndef _Stroika_Frameworks_Led_GDI_h_
5#define _Stroika_Frameworks_Led_GDI_h_ 1
7#include "Stroika/Frameworks/StroikaPreComp.h"
26#if qStroika_FeatureSupported_XWindows
35namespace Stroika::Frameworks::Led {
38 using Foundation::Characters::String;
45 using CoordinateType = long;
53 using DistanceType =
unsigned long;
70 constexpr explicit TWIPS (
long v);
71 constexpr operator long ()
const;
77 nonvirtual TWIPS& operator+= (
const TWIPS& rhs);
78 nonvirtual TWIPS& operator-= (
const TWIPS& rhs);
79 nonvirtual TWIPS& operator*= (
double rhs);
82 constexpr bool operator== (
const TWIPS&)
const =
default;
85 static const TWIPS kPoint;
86 static const TWIPS kInch;
87 static const TWIPS kOneInch;
89 TWIPS operator+ (
const TWIPS& lhs,
const TWIPS& rhs);
90 TWIPS operator- (
const TWIPS& lhs,
const TWIPS& rhs);
111 TabStopList () =
default;
114 virtual ~TabStopList () =
default;
123 virtual TWIPS ComputeIthTab (
size_t i)
const = 0;
132 virtual TWIPS ComputeTabStopAfterPosition (TWIPS afterPos)
const = 0;
133 nonvirtual DistanceType ComputeTabStopAfterPosition (Tablet* tablet, DistanceType afterPos)
const;
136#if qStroika_Foundation_Common_Platform_Windows
141 FontObject () =
default;
143 nonvirtual
operator HFONT ()
const;
144 nonvirtual
int GetObject (
int nCount, LPVOID lpObject)
const;
145 nonvirtual BOOL DeleteObject ();
146 nonvirtual BOOL CreateFontIndirect (
const LOGFONT* lpLogFont);
147 nonvirtual BOOL
Attach (HFONT hObject);
150 HFONT m_hObject{
nullptr};
154#if qStroika_Foundation_Common_Platform_Windows
159 Brush (COLORREF crColor);
161 nonvirtual
operator HBRUSH ()
const;
162 nonvirtual BOOL
Attach (HBRUSH hObject);
163 nonvirtual BOOL DeleteObject ();
166 HBRUSH m_hObject{
nullptr};
172 template <
typename COORD_TYPE>
175 using CoordinateType = COORD_TYPE;
178 constexpr Point_Base ();
179 constexpr Point_Base (COORD_TYPE newV, COORD_TYPE newH);
180 template <
typename OTHER_POINT_BASE_TYPE>
181 constexpr explicit Point_Base (OTHER_POINT_BASE_TYPE o)
182 : v (COORD_TYPE (o.v))
183 , h (COORD_TYPE (o.h))
194 constexpr strong_ordering operator<=> (
const Point_Base& rhs)
const =
default;
201 template <
typename POINT_TYPE,
typename SIZE_TYPE>
204 using CoordinateType =
typename POINT_TYPE::CoordinateType;
205 using DistanceType =
typename SIZE_TYPE::CoordinateType;
206 using THIS_TYPE = Rect_Base<POINT_TYPE, SIZE_TYPE>;
209 constexpr Rect_Base ();
210 constexpr Rect_Base (CoordinateType newTop, CoordinateType newLeft, DistanceType newHeight, DistanceType newWidth);
211 constexpr Rect_Base (POINT_TYPE origin, SIZE_TYPE size);
214 nonvirtual CoordinateType GetTop ()
const;
215 nonvirtual CoordinateType GetLeft ()
const;
216 nonvirtual CoordinateType GetBottom ()
const;
217 nonvirtual CoordinateType GetRight ()
const;
218 nonvirtual
bool IsEmpty ()
const;
219 nonvirtual DistanceType GetHeight ()
const;
220 nonvirtual DistanceType GetWidth ()
const;
221 nonvirtual POINT_TYPE GetTopLeft ()
const;
222 nonvirtual POINT_TYPE GetTopRight ()
const;
223 nonvirtual POINT_TYPE GetBotRight ()
const;
224 nonvirtual POINT_TYPE GetOrigin ()
const;
225 nonvirtual SIZE_TYPE GetSize ()
const;
226 nonvirtual
bool Contains (POINT_TYPE p)
const;
227 nonvirtual
bool Contains (THIS_TYPE r)
const;
229 nonvirtual
void SetOrigin (POINT_TYPE p);
230 nonvirtual
void SetTop (CoordinateType top);
231 nonvirtual
void SetLeft (CoordinateType left);
232 nonvirtual
void SetBottom (CoordinateType bottom);
233 nonvirtual
void SetRight (CoordinateType right);
238 CoordinateType bottom;
239 CoordinateType right;
242 nonvirtual
const Rect_Base<POINT_TYPE, SIZE_TYPE>& operator+= (
const POINT_TYPE& delta);
243 nonvirtual
const Rect_Base<POINT_TYPE, SIZE_TYPE>& operator-= (
const POINT_TYPE& delta);
244 nonvirtual
const Rect_Base<POINT_TYPE, SIZE_TYPE>& operator*= (
const THIS_TYPE& intersectWith);
249 constexpr strong_ordering operator<=> (
const Rect_Base& rhs)
const =
default;
250 bool operator== (
const Rect_Base& rhs)
const;
256 using Led_Size = Point_Base<DistanceType>;
261 using Led_Point = Point_Base<CoordinateType>;
262 Led_Point operator- (
const Led_Point& lhs,
const Led_Point& rhs);
267 using TWIPS_Point = Point_Base<TWIPS>;
272 using Led_Rect = Rect_Base<Led_Point, Led_Size>;
277 using TWIPS_Rect = Rect_Base<TWIPS_Point, TWIPS_Point>;
279#if qStroika_Frameworks_Led_SupportGDI
286 Region (
const Led_Rect& r);
287 Region (
const Region& from);
289 nonvirtual
const Region& operator= (
const Region& rhs);
292 nonvirtual
bool IsEmpty ()
const;
293 nonvirtual Led_Rect GetBoundingRect ()
const;
296#if qStroika_Foundation_Common_Platform_MacOS
297 Region (RgnHandle rgn);
298 RgnHandle GetOSRep ()
const;
299 RgnHandle GetOSRep ();
303#elif qStroika_Foundation_Common_Platform_Windows
304 operator HRGN ()
const;
305 int CombineRgn (Region* pRgn1, Region* pRgn2,
int nCombineMode);
306 BOOL PtInRegion (
int x,
int y)
const;
307 BOOL PtInRegion (POINT point)
const;
310 BOOL DeleteObject ();
313#if qStroika_Foundation_Common_Platform_MacOS
315#elif qStroika_Foundation_Common_Platform_Windows
319 Region operator* (
const Region& lhs,
const Region& rhs);
320 Region operator+ (
const Region& lhs,
const Region& rhs);
331 using ColorValue =
unsigned short;
334 kColorValueMax = USHRT_MAX
339 constexpr Color (ColorValue redValue, ColorValue greenValue, ColorValue blueValue);
340#if qStroika_Foundation_Common_Platform_Windows
341 explicit Color (COLORREF colorRef);
345 nonvirtual ColorValue GetRed ()
const;
346 nonvirtual ColorValue GetGreen ()
const;
347 nonvirtual ColorValue GetBlue ()
const;
353 static const Color kBlack;
354 static const Color kWhite;
355 static const Color kRed;
356 static const Color kGreen;
357 static const Color kBlue;
358 static const Color kCyan;
359 static const Color kMagenta;
360 static const Color kYellow;
361 static const Color kMaroon;
362 static const Color kOlive;
363 static const Color kNavyBlue;
364 static const Color kPurple;
365 static const Color kTeal;
366 static const Color kGray;
367 static const Color kSilver;
368 static const Color kDarkGreen;
369 static const Color kLimeGreen;
370 static const Color kFuchsia;
371 static const Color kAqua;
374#if qStroika_Foundation_Common_Platform_Windows
375 nonvirtual COLORREF GetOSRep ()
const;
381 constexpr strong_ordering operator<=> (
const Color& rhs)
const =
default;
382 constexpr bool operator== (
const Color& rhs)
const =
default;
396 unsigned int Distance_Squared (
Color lhs,
Color rhs);
397#if qStroika_Foundation_Common_Platform_Windows
398 unsigned int Distance_Squared (COLORREF lhs, COLORREF rhs);
408#if qStroika_Foundation_Common_Platform_Windows
410 Pen (
int nPenStyle,
int nWidth, COLORREF crColor);
412 nonvirtual
operator HPEN ()
const;
413 nonvirtual BOOL Attach (HPEN hObject);
414 nonvirtual BOOL DeleteObject ();
440 eDefaultForScriptJustify
459 eListStyle_None = 9999,
460 eListStyle_Bullet = 23
488 eAtLeastTWIPSSpacing,
492 Rule fRule{eSingleSpace};
496 constexpr LineSpacing () =
default;
497 constexpr LineSpacing (Rule rule);
498 constexpr LineSpacing (Rule rule, TWIPS twips);
499 constexpr LineSpacing (Rule rule,
unsigned lineCount);
502 constexpr bool operator== (
const LineSpacing& rhs)
const;
505 class IncrementalFontSpecification;
520#if qStroika_Foundation_Common_Platform_Windows
528#if qStroika_Foundation_Common_Platform_Windows
532 SDKChar fName[LF_FACESIZE];
535 return ::_tcscmp (fName, rhs.fName) == 0;
538#elif qStroika_FeatureSupported_XWindows
547 nonvirtual SDKString GetFontName ()
const;
548 nonvirtual
void SetFontName (
const SDKString& fontName);
555 nonvirtual
bool GetStyle_Plain ()
const;
556 nonvirtual
void SetStyle_Plain ();
558 nonvirtual
bool GetStyle_Bold ()
const;
559 nonvirtual
void SetStyle_Bold (
bool isBold);
561 nonvirtual
bool GetStyle_Italic ()
const;
562 nonvirtual
void SetStyle_Italic (
bool isItalic);
564 nonvirtual
bool GetStyle_Underline ()
const;
565 nonvirtual
void SetStyle_Underline (
bool isUnderline);
567 enum SubOrSuperScript {
572 nonvirtual SubOrSuperScript GetStyle_SubOrSuperScript ()
const;
573 nonvirtual
void SetStyle_SubOrSuperScript (SubOrSuperScript subOrSuperScript);
575#if qStroika_Foundation_Common_Platform_Windows
576 nonvirtual
bool GetStyle_Strikeout ()
const;
577 nonvirtual
void SetStyle_Strikeout (
bool isStrikeout);
580 using FontSize = uint16_t;
581 nonvirtual FontSize GetPointSize ()
const;
582 nonvirtual
void SetPointSize (FontSize pointSize);
584#if qStroika_Foundation_Common_Platform_Windows
585 nonvirtual
long PeekAtTMHeight ()
const;
586 nonvirtual
void PokeAtTMHeight (
long tmHeight);
589 nonvirtual
Color GetTextColor ()
const;
590 nonvirtual
void SetTextColor (
const Color& textColor);
593#if qStroika_Foundation_Common_Platform_Windows
594 nonvirtual LOGFONT GetOSRep ()
const;
595 nonvirtual
void GetOSRep (LOGFONT* logFont)
const;
596 nonvirtual
void SetOSRep (LOGFONT logFont);
597 nonvirtual
void LightSetOSRep (LOGFONT logFont);
598#elif qStroika_FeatureSupported_XWindows
599 static string mkOSRep (
const string& foundry,
const string& family,
const string& weight,
const string& slant,
const string& pointSize);
600 nonvirtual
string GetOSRep ()
const;
601 nonvirtual
void SetFromOSRep (
const string& osRep);
615 nonvirtual
void MergeIn (
const IncrementalFontSpecification& addInTheseAttributes);
618#if qStroika_Foundation_Common_Platform_Windows
622 bool fBold : 1 {
false};
623 bool fItalics : 1 {
false};
624 bool fUnderline : 1 {
false};
627 SubOrSuperScript fSubOrSuperScript{SubOrSuperScript::eNoSubOrSuperscript};
628 Color fTextColor{Color::kBlack};
645 IncrementalFontSpecification () =
default;
667 nonvirtual FontNameSpecifier GetFontNameSpecifier ()
const;
668 nonvirtual
bool GetFontNameSpecifier_Valid ()
const;
669 nonvirtual
void InvalidateFontNameSpecifier ();
670 nonvirtual
void SetFontNameSpecifier (FontNameSpecifier fontNameSpecifier);
671 nonvirtual
void SetFontName (
const SDKString& fontName);
674 nonvirtual
bool GetStyle_Plain ()
const;
675 nonvirtual
bool GetStyle_Plain_Valid ()
const;
676 nonvirtual
void InvalidateStyles ();
677 nonvirtual
void SetStyle_Plain ();
679 nonvirtual
bool GetStyle_Bold ()
const;
680 nonvirtual
bool GetStyle_Bold_Valid ()
const;
681 nonvirtual
void InvalidateStyle_Bold ();
682 nonvirtual
void SetStyle_Bold (
bool isBold);
684 nonvirtual
bool GetStyle_Italic ()
const;
685 nonvirtual
bool GetStyle_Italic_Valid ()
const;
686 nonvirtual
void InvalidateStyle_Italic ();
687 nonvirtual
void SetStyle_Italic (
bool isItalic);
689 nonvirtual
bool GetStyle_Underline ()
const;
690 nonvirtual
bool GetStyle_Underline_Valid ()
const;
691 nonvirtual
void InvalidateStyle_Underline ();
692 nonvirtual
void SetStyle_Underline (
bool isUnderline);
694 nonvirtual SubOrSuperScript GetStyle_SubOrSuperScript ()
const;
695 nonvirtual
bool GetStyle_SubOrSuperScript_Valid ()
const;
696 nonvirtual
void InvalidateStyle_SubOrSuperScript ();
697 nonvirtual
void SetStyle_SubOrSuperScript (SubOrSuperScript subOrSuperScript);
699#if qStroika_Foundation_Common_Platform_Windows
700 nonvirtual
bool GetStyle_Strikeout ()
const;
701 nonvirtual
bool GetStyle_Strikeout_Valid ()
const;
702 nonvirtual
void InvalidateStyle_Strikeout ();
703 nonvirtual
void SetStyle_Strikeout (
bool isStrikeout);
712 nonvirtual
unsigned short GetPointSize ()
const;
713 nonvirtual
bool GetPointSize_Valid ()
const;
714 nonvirtual
void InvalidatePointSize ();
715 nonvirtual
void SetPointSize (FontSize pointSize);
716#if qStroika_Foundation_Common_Platform_Windows
717 nonvirtual
void PokeAtTMHeight (
long tmHeight);
720 nonvirtual
short GetPointSizeIncrement ()
const;
721 nonvirtual
bool GetPointSizeIncrement_Valid ()
const;
722 nonvirtual
void InvalidatePointSizeIncrement ();
723 nonvirtual
void SetPointSizeIncrement (
short pointSizeIncrement);
725 nonvirtual
Color GetTextColor ()
const;
726 nonvirtual
bool GetTextColor_Valid ()
const;
727 nonvirtual
void InvalidateTextColor ();
728 nonvirtual
void SetTextColor (
const Color& textColor);
731#if qStroika_Foundation_Common_Platform_Windows
732 nonvirtual LOGFONT GetOSRep ()
const;
733 nonvirtual
void GetOSRep (LOGFONT* logFont)
const;
734 nonvirtual
void SetOSRep (LOGFONT logFont);
735 nonvirtual
void LightSetOSRep (LOGFONT logFont);
736 nonvirtual
bool GetDidSetOSRepCallFlag ()
const;
741 bool operator<=> (
const IncrementalFontSpecification& rhs) =
delete;
742 bool operator== (
const IncrementalFontSpecification& rhs)
const;
745 nonvirtual
void MergeIn (
const IncrementalFontSpecification& addInTheseAttributes);
748 bool fFontSpecifierValid : 1 {
false};
749 bool fStyleValid_Bold : 1 {
false};
750 bool fStyleValid_Italic : 1 {
false};
751 bool fStyleValid_Underline : 1 {
false};
752 bool fStyleValid_SubOrSuperScript : 1 {
false};
753#if qStroika_Foundation_Common_Platform_Windows
754 bool fStyleValid_Strikeout : 1 {
false};
755 bool fDidSetOSRepCallFlag : 1 {
false};
757 bool fFontSizeValid : 1 {
false};
758 bool fFontSizeIncrementValid : 1 {
false};
759 bool fTextColorValid : 1 {
false};
762 IncrementalFontSpecification
Intersection (
const IncrementalFontSpecification& lhs,
const IncrementalFontSpecification& rhs);
766 class InstalledFonts {
769#if qStroika_Foundation_Common_Platform_Windows
770 eSkipAtSignFonts = 0x1,
771 eSkipRasterFonts = 0x2,
774#if qStroika_Foundation_Common_Platform_Windows
775 eDefaultFilterOptions = eSkipAtSignFonts | eSkipRasterFonts
777 eDefaultFilterOptions = 0
781#
if qStroika_FeatureSupported_XWindows
784 FilterOptions filterOptions = eDefaultFilterOptions);
787 nonvirtual
const vector<SDKString>& GetUsableFontNames ()
const;
790 FilterOptions fFilterOptions;
791 vector<SDKString> fFontNames;
793#if qStroika_Foundation_Common_Platform_Windows
795 static BOOL FAR PASCAL FontFamilyAdderProc (ENUMLOGFONTEX* pelf, NEWTEXTMETRICEX* ,
int fontType, LPVOID pThis);
800 FontSpecification GetStaticDefaultFont ();
801#if qStroika_Foundation_Common_Platform_Windows
802 FontSpecification GetStaticDefaultFont (BYTE charSet);
805#if qStroika_Frameworks_Led_SupportGDI
817 static Globals& Get ();
820 static Globals* sThe;
823 nonvirtual
void InvalidateGlobals ();
826 nonvirtual DistanceType GetMainScreenLogPixelsH ()
const;
827 nonvirtual DistanceType GetMainScreenLogPixelsV ()
const;
830 DistanceType fLogPixelsH;
831 DistanceType fLogPixelsV;
834 class _Global_DESTRUCTOR_;
835 friend class _Global_DESTRUCTOR_;
839 Led_Rect operator- (
const Led_Rect& lhs,
const Led_Point& rhs);
840 Led_Rect operator+ (Led_Point p, Led_Rect r);
841 Led_Rect operator+ (Led_Rect r, Led_Point p);
842 bool Intersect (
const Led_Rect& lhs,
const Led_Rect& rhs);
843#if qStroika_Frameworks_Led_SupportGDI
844 bool Intersect (
const Led_Rect& lhs,
const Region& rhs);
845 bool Intersect (
const Region& lhs,
const Led_Rect& rhs);
846 bool Intersect (
const Region& lhs,
const Region& rhs);
849 Led_Rect
Intersection (
const Led_Rect& lhs,
const Led_Rect& rhs);
850 Led_Rect operator* (
const Led_Rect& lhs,
const Led_Rect& rhs);
852 Led_Size operator+ (Led_Size lhs, Led_Size rhs);
853 Led_Size operator* (
int lhs, Led_Size rhs);
855 Led_Rect InsetRect (
const Led_Rect& r,
int vBy,
int hBy);
856 Led_Rect EnsureRectInRect (
const Led_Rect& r, Led_Rect enlosingR);
857#if qStroika_Frameworks_Led_SupportGDI
858 Led_Rect EnsureRectOnScreen (
const Led_Rect& r);
861#if qStroika_Foundation_Common_Platform_Windows
862 Led_Point AsLedPoint (POINT p);
863 POINT AsPOINT (Led_Point p);
864 Led_Rect AsLedRect (RECT r);
865 RECT AsRECT (Led_Rect p);
866 SIZE AsSIZE (Led_Size s);
867 Led_Size AsLedSize (SIZE s);
868#elif qStroika_FeatureSupported_XWindows
869 Led_Rect AsLedRect (
const XRectangle& r);
870 XRectangle AsXRect (
const Led_Rect& r);
873#if qStroika_Frameworks_Led_SupportGDI
874 TWIPS Led_CvtScreenPixelsToTWIPSV (CoordinateType from);
875 TWIPS Led_CvtScreenPixelsToTWIPSH (CoordinateType from);
876 CoordinateType Led_CvtScreenPixelsFromTWIPSV (TWIPS from);
877 CoordinateType Led_CvtScreenPixelsFromTWIPSH (TWIPS from);
880#if qStroika_Frameworks_Led_SupportGDI
888#if qStroika_FeatureSupported_XWindows
890 struct PlatformSpecific {
891 DistanceType fAscent;
892 DistanceType fDescent;
893 DistanceType fLeading;
894 DistanceType fMaxCharWidth;
898 FontMetrics () =
default;
899#if qStroika_Foundation_Common_Platform_Windows
900 FontMetrics (
const TEXTMETRIC& from);
901#elif qStroika_FeatureSupported_XWindows
902 FontMetrics (
const PlatformSpecific& from);
904 FontMetrics (
const FontMetrics&) =
default;
905 FontMetrics& operator= (
const FontMetrics& rhs) =
default;
908 nonvirtual DistanceType GetAscent ()
const;
909 nonvirtual DistanceType GetDescent ()
const;
910 nonvirtual DistanceType GetLeading ()
const;
911 nonvirtual DistanceType GetHeight ()
const;
912 nonvirtual DistanceType GetLineHeight ()
const;
915 nonvirtual DistanceType GetMaxCharacterWidth ()
const;
916#if qStroika_Foundation_Common_Platform_Windows
917 nonvirtual DistanceType GetAveCharacterWidth ()
const;
923#if qStroika_Foundation_Common_Platform_Windows
924 operator const TEXTMETRIC* ()
const;
925 operator TEXTMETRIC* ();
929#if qStroika_Foundation_Common_Platform_Windows
930 TEXTMETRIC fPlatformSpecific{};
931#elif qStroika_FeatureSupported_XWindows
932 PlatformSpecific fPlatformSpecific{};
937#if qStroika_Frameworks_Led_SupportGDI
938 Color Led_GetTextColor ();
939 Color Led_GetTextBackgroundColor ();
940 Color Led_GetSelectedTextColor ();
941 Color Led_GetSelectedTextBackgroundColor ();
943 class OffscreenTablet;
946#if qStroika_Frameworks_Led_SupportGDI
956#if qStroika_Foundation_Common_Platform_MacOS
958#elif qStroika_Foundation_Common_Platform_Windows
964 Tablet (HDC hdc =
nullptr, OwnDCControl ownsDC = eOwnsDC);
965#elif qStroika_FeatureSupported_XWindows
966 Tablet (Display* display, Drawable drawable);
973#if qStroika_Foundation_Common_Platform_MacOS
974 nonvirtual
operator GrafPtr ()
const;
975#elif qStroika_Foundation_Common_Platform_Windows
976 nonvirtual
operator HDC ()
const;
980 nonvirtual CoordinateType CvtFromTWIPSV (TWIPS from)
const;
981 nonvirtual CoordinateType CvtFromTWIPSH (TWIPS from)
const;
982 nonvirtual TWIPS CvtToTWIPSV (CoordinateType from)
const;
983 nonvirtual TWIPS CvtToTWIPSH (CoordinateType from)
const;
986 nonvirtual Led_Point CvtFromTWIPS (TWIPS_Point from)
const;
987 nonvirtual TWIPS_Point CvtToTWIPS (Led_Point from)
const;
988 nonvirtual Led_Rect CvtFromTWIPS (TWIPS_Rect from)
const;
989 nonvirtual TWIPS_Rect CvtToTWIPS (Led_Rect from)
const;
992 nonvirtual
void ScrollBitsAndInvalRevealed (
const Led_Rect& windowRect, CoordinateType scrollBy);
993 nonvirtual
void FrameRegion (
const Region& r,
const Color& c);
996 nonvirtual
void FrameRectangle (
const Led_Rect& r, Color c, DistanceType borderWidth);
999#if qStroika_Foundation_Common_Platform_MacOS
1000 nonvirtual
void SetPort ();
1001#elif qStroika_Foundation_Common_Platform_Windows
1002 nonvirtual BOOL BitBlt (
int x,
int y,
int nWidth,
int nHeight, Tablet* pSrcDC,
int xSrc,
int ySrc, DWORD dwRop);
1003 nonvirtual BOOL CreateCompatibleDC (Tablet* pDC);
1004 nonvirtual COLORREF SetTextColor (COLORREF crColor);
1005 nonvirtual COLORREF SetBkColor (COLORREF crColor);
1006 nonvirtual BOOL IsPrinting ()
const;
1007 nonvirtual BOOL RoundRect (
int x1,
int y1,
int x2,
int y2,
int x3,
int y3);
1008 nonvirtual BOOL TextOut (
int x,
int y, LPCTSTR lpszString,
int nCount);
1010 nonvirtual
int SetBkMode (
int nBkMode);
1011 nonvirtual SIZE GetWindowExt ()
const;
1012 nonvirtual SIZE GetViewportExt ()
const;
1013 nonvirtual BOOL Rectangle (
int x1,
int y1,
int x2,
int y2);
1014 nonvirtual BOOL Rectangle (
const RECT& r);
1015 nonvirtual BOOL Rectangle (LPCRECT lpRect);
1016 nonvirtual BOOL GetTextMetrics (LPTEXTMETRIC lpMetrics)
const;
1017 nonvirtual HBITMAP SelectObject (HBITMAP hBitmap);
1019 nonvirtual HFONT SelectObject (HFONT hFont);
1021 nonvirtual POINT SetWindowOrg (
int x,
int y);
1022 nonvirtual
int GetDeviceCaps (
int nIndex)
const;
1023 nonvirtual BOOL
Attach (HDC hDC, OwnDCControl ownsDC = eOwnsDC);
1024 nonvirtual HDC Detach ();
1025#elif qStroika_FeatureSupported_XWindows
1027 nonvirtual
void SetFont (
const FontSpecification& fontSpec);
1030 map<string, XFontStruct*> fFontCache;
1032 kMaxFontCacheSize = 5
1036 nonvirtual
void SetDrawableOrigin (
const Led_Point& origin);
1039 Led_Point fDrawableOrigin;
1042#if qStroika_Foundation_Common_Platform_Windows
1044 nonvirtual HWND GetWindow ()
const;
1045 nonvirtual
unsigned int SetTextAlign (
unsigned int nTextAlign);
1048#if qStroika_FeatureSupported_XWindows
1050 static int IgnoreXErrorHandler (Display* display, XErrorEvent* error);
1053#if qStroika_FeatureSupported_XWindows
1055 nonvirtual
SDKString BestMatchFont (
const FontSpecification& fsp,
const vector<SDKString>& fontsList);
1058 static void ParseFontName (
const SDKString& fontName, SDKString* familyName, SDKString* fontSize, SDKString* fontWeight, SDKString* fontSlant);
1062 nonvirtual
void MoveTo (
const Led_Point& to);
1063 nonvirtual
void LineTo (
const Led_Point& to);
1065#if qStroika_FeatureSupported_XWindows
1067 Led_Point fCurDrawLineLoc;
1071 nonvirtual
void MeasureText (
const FontMetrics& precomputedFontMetrics,
const Led_tChar* text,
size_t nTChars, DistanceType* charLocations);
1072 nonvirtual
void TabbedTextOut (
const FontMetrics& precomputedFontMetrics,
const Led_tChar* text,
size_t nBytes,
1073 TextDirection direction, Led_Point outputAt, CoordinateType hTabOrigin,
1074 const TabStopList& tabStopList, DistanceType* amountDrawn, CoordinateType hScrollOffset);
1077 nonvirtual
void SetBackColor (
const Color& backColor);
1078 nonvirtual
void SetForeColor (
const Color& foreColor);
1081 nonvirtual
void EraseBackground_SolidHelper (
const Led_Rect& eraseRect,
const Color& eraseColor);
1082 nonvirtual
void HilightArea_SolidHelper (
const Led_Rect& hilightArea, Color hilightBackColor, Color hilightForeColor,
1083 Color oldBackColor, Color oldForeColor);
1084 nonvirtual
void HilightArea_SolidHelper (
const Region& hilightArea, Color hilightBackColor, Color hilightForeColor,
1085 Color oldBackColor, Color oldForeColor);
1087#if qStroika_Foundation_Common_Platform_Windows
1089 class RecolorHelper;
1092 RecolorHelper* fRecolorHelper;
1096 class ClipNarrowAndRestore;
1099 nonvirtual Region GetClip ()
const;
1100 nonvirtual
bool GetClip (Region* r)
const;
1101 nonvirtual
void SetClip ();
1102 nonvirtual
void SetClip (
const Led_Rect& clipTo);
1103 nonvirtual
void SetClip (
const Region& clipTo);
1106 nonvirtual FontMetrics GetFontMetrics ()
const;
1108#if qStroika_Foundation_Common_Platform_MacOS
1111#elif qStroika_Foundation_Common_Platform_Windows
1116 OwnDCControl fOwnsDC;
1119 mutable DistanceType fLogPixelsV;
1120 mutable DistanceType fLogPixelsH;
1121#elif qStroika_FeatureSupported_XWindows
1127 mutable XFontStruct* fCachedFontInfo;
1128 map<string, string> fFontMappingCache;
1132 friend class OffscreenTablet;
1140 class Tablet::ClipNarrowAndRestore {
1142 ClipNarrowAndRestore (Tablet* tablet);
1143 ClipNarrowAndRestore (Tablet* tablet,
const Led_Rect& clipFurtherTo);
1144 ClipNarrowAndRestore (Tablet* tablet,
const Region& clipFurtherTo);
1145 ~ClipNarrowAndRestore ();
1153#if qStroika_Foundation_Common_Platform_MacOS
1156 GrafPtr Led_GetCurrentGDIPort ();
1159#if qStroika_Foundation_Common_Platform_Windows
1160 class WindowDC :
public Tablet {
1162 WindowDC (HWND hWnd);
1170#if qStroika_Foundation_Common_Platform_MacOS
1171 class MacPortAndClipRegionEtcSaver {
1173 MacPortAndClipRegionEtcSaver ();
1174 ~MacPortAndClipRegionEtcSaver ();
1180 RGBColor fRGBFgColor;
1181 RGBColor fRGBBkColor;
1186#if qStroika_Foundation_Common_Platform_Windows
1189 Bitmap () =
default;
1193 nonvirtual
void DeleteObject ();
1194 nonvirtual
operator HBITMAP ()
const;
1197 nonvirtual Led_Size GetImageSize ()
const;
1198 nonvirtual BOOL CreateCompatibleBitmap (HDC hdc, DistanceType nWidth, DistanceType nHeight);
1199 nonvirtual BOOL CreateCompatibleDIBSection (HDC hdc, DistanceType nWidth, DistanceType nHeight);
1200 nonvirtual
void LoadBitmap (HINSTANCE hInstance, LPCTSTR lpBitmapName);
1203 HBITMAP m_hObject{
nullptr};
1204 Led_Size fImageSize{};
1214 class OffscreenTablet {
1217 ~OffscreenTablet ();
1220 nonvirtual
void Setup (Tablet* origTablet);
1221 nonvirtual Tablet* PrepareRect (
const Led_Rect& currentRowRect, DistanceType extraToAddToBottomOfRect = 0);
1222 nonvirtual
void BlastBitmapToOrigTablet ();
1225 class OT :
public Tablet {
1227 using inherited = Tablet;
1230#if qStroika_Foundation_Common_Platform_MacOS
1232#elif qStroika_Foundation_Common_Platform_Windows
1233 OT (HDC hdc =
nullptr, OwnDCControl ownsDC = eOwnsDC);
1234#elif qStroika_FeatureSupported_XWindows
1235 OT (Display* display, Drawable drawable);
1240 Tablet* fOrigTablet;
1241 Led_Rect fOffscreenRect;
1242 Tablet* fOffscreenTablet;
1243#if qStroika_Foundation_Common_Platform_MacOS
1244 GDHandle fOrigDevice;
1246 GWorldPtr fOffscreenGWorld;
1247#elif qStroika_Foundation_Common_Platform_Windows
1249 Bitmap fMemoryBitmap;
1251 HBITMAP fOldBitmapInDC;
1252#elif qStroika_FeatureSupported_XWindows
1267 class GDI_Obj_Selector {
1269#if qStroika_Foundation_Common_Platform_Windows
1270 GDI_Obj_Selector (Tablet* tablet, HGDIOBJ objToSelect);
1271#elif qStroika_Foundation_Common_Platform_MacOS || qStroika_FeatureSupported_XWindows
1272 GDI_Obj_Selector (Tablet* tablet,
const Pen& pen);
1275 ~GDI_Obj_Selector ();
1279#if qStroika_Foundation_Common_Platform_Windows
1280 HGDIOBJ fRestoreObject;
1281 HGDIOBJ fRestoreAttribObject;
1282#elif qStroika_Foundation_Common_Platform_MacOS
1289#ifndef qHaveMacPictureDefined
1290#define qHaveMacPictureDefined 0
1301#if qHaveMacPictureDefined
1302 using Led_Picture = Picture;
1304 struct Led_Picture {
1308 short picFrameBottom;
1309 short picFrameRight;
1314 short Led_GetMacPictTop (
const Led_Picture* picture);
1315 short Led_GetMacPictLeft (
const Led_Picture* picture);
1316 short Led_GetMacPictBottom (
const Led_Picture* picture);
1317 short Led_GetMacPictRight (
const Led_Picture* picture);
1318 short Led_GetMacPictWidth (
const Led_Picture* picture);
1319 short Led_GetMacPictHeight (
const Led_Picture* picture);
1320 Led_Size Led_GetMacPictSize (
const Led_Picture* picture);
1321#if qStroika_Foundation_Common_Platform_MacOS
1322 short Led_GetMacPictTop (
const Led_Picture*
const* picture);
1323 short Led_GetMacPictLeft (
const Led_Picture*
const* picture);
1324 short Led_GetMacPictBottom (
const Led_Picture*
const* picture);
1325 short Led_GetMacPictRight (
const Led_Picture*
const* picture);
1326 short Led_GetMacPictWidth (
const Led_Picture*
const* picture);
1327 short Led_GetMacPictHeight (
const Led_Picture*
const* picture);
1328 Led_Size Led_GetMacPictSize (
const Led_Picture*
const* picture);
1332#ifndef qHaveWindowsDIBDefined
1333#define qHaveWindowsDIBDefined qStroika_Foundation_Common_Platform_Windows
1336#if !qHaveWindowsDIBDefined
1338 struct BITMAPINFOHEADER {
1339 unsigned long biSize;
1342 unsigned short biPlanes;
1343 unsigned short biBitCount;
1344 unsigned long biCompression;
1345 unsigned long biSizeImage;
1346 long biXPelsPerMeter;
1347 long biYPelsPerMeter;
1348 unsigned long biClrUsed;
1349 unsigned long biClrImportant;
1351 struct BITMAPCOREHEADER {
1352 unsigned long bcSize;
1353 unsigned short bcWidth;
1354 unsigned short bcHeight;
1355 unsigned short bcPlanes;
1356 unsigned short bcBitCount;
1359 unsigned char rgbBlue;
1360 unsigned char rgbGreen;
1361 unsigned char rgbRed;
1362 unsigned char rgbReserved;
1365 unsigned char rgbtBlue;
1366 unsigned char rgbtGreen;
1367 unsigned char rgbtRed;
1370 BITMAPINFOHEADER bmiHeader;
1371 RGBQUAD bmiColors[1];
1383 using Led_DIB = BITMAPINFO;
1385 Led_Size Led_GetDIBImageSize (
const Led_DIB* dib);
1386 size_t Led_GetDIBPalletByteCount (
const Led_DIB* dib);
1387 size_t Led_GetDIBImageRowByteCount (
const Led_DIB* dib);
1388 size_t Led_GetDIBImageByteCount (
const Led_DIB* dib);
1389 Led_DIB* Led_CloneDIB (
const Led_DIB* dib);
1390 const void* Led_GetDIBBitsPointer (
const Led_DIB* dib);
1392#if qStroika_Foundation_Common_Platform_Windows
1393 Led_DIB* Led_DIBFromHBITMAP (HDC hDC, HBITMAP hbm);
1396#if qStroika_Frameworks_Led_SupportGDI
1398 void AddRectangleToRegion (Led_Rect addRect, Region* toRgn);
1401#if qStroika_Frameworks_Led_ProvideIMESupport
1413 nonvirtual
bool Available ()
const;
1415 nonvirtual
void ForgetPosition ();
1416 nonvirtual
void NotifyPosition (HWND pWnd,
const SHORT x,
const SHORT y);
1417 nonvirtual
void NotifyOfFontChange (HWND hWnd,
const LOGFONT& lf);
1418 nonvirtual
void IMEOn (HWND pWnd);
1419 nonvirtual
void IMEOff (HWND pWnd);
1420 nonvirtual
void Enable ();
1421 nonvirtual
void Disable ();
1422 nonvirtual wstring GetCompositionResultStringW (HWND hWnd);
1425 nonvirtual
void UpdatePosition (
const HWND hWnd,
const SHORT x,
const SHORT y);
1426 nonvirtual
void SendSimpleMessage (HWND pWnd, UINT fnc, WPARAM wParam);
1428 LRESULT (FAR PASCAL* fSendIMEMessageProc)
1430 BOOL (FAR PASCAL* fIMEEnableProc)
1432 HIMC (FAR PASCAL* fImmGetContext)
1434 BOOL (FAR PASCAL* fImmSetCompositionFont)
1435 (HIMC,
const LOGFONT*);
1436 BOOL (FAR PASCAL* fImmReleaseContext)
1438 LONG (FAR PASCAL* fImmGetCompositionStringW)
1439 (HIMC, DWORD, LPVOID, DWORD);
1440 BOOL (FAR PASCAL* fImmSetCompositionWindow)
1441 (HIMC,
const void*);
1442 BOOL (FAR PASCAL* fImmSetOpenStatus)
1445 bool fWinNlsAvailable;
1450 class _Global_DESTRUCTOR_;
1451 friend class _Global_DESTRUCTOR_;
1455 Led_Rect CenterRectInRect (
const Led_Rect& r,
const Led_Rect& centerIn);
1456#if qStroika_Foundation_Common_Platform_Windows
1457 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< qTargetPlatformSDKUseswchar_t, wchar_t, char > SDKChar
basic_string< SDKChar > SDKString
Ptr Attach(PlatformNativeHandle sd)