Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
WordWrappedTextImager.inl
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4
5namespace Stroika::Frameworks::Led {
6
7#if qStroika_Frameworks_Led_SupportGDI
8 /*
9 ********************************************************************************
10 *************** TrivialWordWrappedImager<TEXTSTORE,IMAGER> *********************
11 ********************************************************************************
12 */
13 template <typename TEXTSTORE, typename IMAGER>
14 /*
15 @METHOD: TrivialWordWrappedImager<TEXTSTORE,IMAGER>::TrivialWordWrappedImager
16 @DESCRIPTION: <p>Two overloaded versions - one protected, and the other public. The protected one
17 does NOT call @'TrivialImager<TEXTSTORE,IMAGER>::SnagAttributesFromTablet' - so you must in your subclass.</p>
18 <p>Most people will just call the public CTOR - as in the class documentation
19 (@'TrivialWordWrappedImager<TEXTSTORE,IMAGER>')</p>
20 */
21 TrivialWordWrappedImager<TEXTSTORE, IMAGER>::TrivialWordWrappedImager (Tablet* t)
22 : TrivialImager<TEXTSTORE, IMAGER> (t)
23 {
24 }
25 template <typename TEXTSTORE, typename IMAGER>
26 TrivialWordWrappedImager<TEXTSTORE, IMAGER>::TrivialWordWrappedImager (Tablet* t, Led_Rect bounds, const Led_tString& initialText)
27 : TrivialImager<TEXTSTORE, IMAGER> (t)
28 {
29 this->SnagAttributesFromTablet ();
30 this->SetWindowRect (bounds);
31 this->GetTextStore ().Replace (0, 0, initialText.c_str (), initialText.length ());
32 }
33 template <typename TEXTSTORE, typename IMAGER>
34 void TrivialWordWrappedImager<TEXTSTORE, IMAGER>::GetLayoutMargins (MultiRowTextImager::RowReference row, CoordinateType* lhs, CoordinateType* rhs) const
35 {
36 Ensure (this->GetWindowRect ().GetWidth () >= 1);
37 if (lhs != nullptr) {
38 *lhs = 0;
39 }
40 if (rhs != nullptr) {
41 *rhs = this->GetWindowRect ().GetWidth ();
42 }
43#if qStroika_Foundation_Debug_AssertionsChecked
44 if (lhs != nullptr and rhs != nullptr) {
45 Ensure (*rhs > *lhs);
46 }
47#endif
48 }
49 template <typename TEXTSTORE, typename IMAGER>
50 /*
51 @METHOD: TrivialWordWrappedImager<TEXTSTORE,IMAGER>::GetHeight
52 @DESCRIPTION: <p>Returns the height - in pixels - of the text in the imager.</p>
53 */
54 inline DistanceType TrivialWordWrappedImager<TEXTSTORE, IMAGER>::GetHeight () const
55 {
56 return this->GetHeightOfRows (0, this->GetRowCount ());
57 }
58#endif
59
60}