118{
119 lab.
lx = left - 1000;
121
122 auto length = bits.size() - 1;
124
125 dc.SetFont(font);
126
127 wxCoord strW, strH, strD, strL;
128 auto strText = lab.
text;
129 auto strUnits = lab.
units;
131
134 dc.GetTextExtent(
str.Translation(), &strW, &strH, &strD, &strL);
135
136 int strPos, strLen, strLeft, strTop;
137 if (orientation == wxHORIZONTAL) {
138 strLen = strW;
139 strPos = pos - strW / 2;
140 if (strPos < 0)
141 strPos = 0;
142 if (strPos + strW >= length)
143 strPos = length - strW;
144 strLeft = left + strPos;
145 if (flip)
146 strTop = top + 4;
147 else
148 strTop = -strH - lead;
149
150 }
151 else {
152 strLen = strH;
153 strPos = pos - strH / 2;
154 if (strPos < 0)
155 strPos = 0;
156 if (strPos + strH >= length)
157 strPos = length - strH;
158 strTop = top + strPos;
159 if (flip)
160 strLeft = left + 5;
161 else
162 strLeft = -strW - 6;
163 }
164
165
166
167
168 if (strPos < 0)
169 return { {}, lab };
170
171
172
173
174 int i;
175 for (i = 0; i < strLen; i++)
176 if (bits[strPos + i])
177 return { {}, lab };
178
179
180
183
184
185
191
192 int rightMargin = spacing;
193 if (strPos + strLen > length - spacing)
194 rightMargin = length - strPos - strLen;
195 strLen += rightMargin;
196
197 for (i = 0; i < strLen; i++)
198 bits[strPos + i] = true;
199
200
202 lab.
units = strUnits;
203 return { { strLeft, strTop, strW, strH }, lab };
204}
Holds a msgid for the translation catalog; may also bind format arguments.
std::optional< TranslatableString > text