@@ -50,6 +50,7 @@ namespace lsp
50
50
51
51
sTextLayout .bind(" text.layout" , this );
52
52
sTextAdjust .bind(" text.adjust" , this );
53
+ sTextClip .bind(" text.clip" , this );
53
54
sFont .bind(" font" , this );
54
55
sHover .bind(" text.hover" , this );
55
56
sConstraints .bind(" size.constraints" , this );
@@ -70,6 +71,7 @@ namespace lsp
70
71
71
72
sTextLayout .set(0 .0f , 0 .0f );
72
73
sTextAdjust .set(TA_NONE);
74
+ sTextClip .set(false );
73
75
sFont .set_size(12 .0f );
74
76
sHover .set(false );
75
77
sConstraints .set(-1 , -1 , -1 , -1 );
@@ -97,6 +99,7 @@ namespace lsp
97
99
sFont (&sProperties ),
98
100
sHover (&sProperties ),
99
101
sText (&sProperties ),
102
+ sTextClip (&sProperties ),
100
103
sConstraints (&sProperties ),
101
104
sPopup (&sProperties )
102
105
{
@@ -135,6 +138,7 @@ namespace lsp
135
138
sFont .bind (" font" , &sStyle );
136
139
sHover .bind (" text.hover" , &sStyle );
137
140
sText .bind (&sStyle , pDisplay->dictionary ());
141
+ sTextClip .bind (" text.clip" , &sStyle );
138
142
sConstraints .bind (" size.constraints" , &sStyle );
139
143
sIPadding .bind (" ipadding" , &sStyle );
140
144
sPopup .bind (NULL );
@@ -159,7 +163,7 @@ namespace lsp
159
163
if (prop->one_of (sTextLayout , sHover ))
160
164
query_draw ();
161
165
162
- if (prop->one_of (sTextAdjust , sFont , sText , sConstraints , sIPadding ))
166
+ if (prop->one_of (sTextAdjust , sTextClip , sFont , sText , sConstraints , sIPadding ))
163
167
query_resize ();
164
168
}
165
169
@@ -181,6 +185,22 @@ namespace lsp
181
185
sFont .get_multitext_parameters (s, &tp, fscaling, &text);
182
186
sIPadding .sub (&size, &sSize , scaling);
183
187
188
+ // Apply text clipping
189
+ const bool clip = sTextClip .get ();
190
+ if (clip)
191
+ {
192
+ r.nLeft = 0 ;
193
+ r.nTop = 0 ;
194
+ r.nWidth = sSize .nWidth ;
195
+ r.nHeight = sSize .nHeight ;
196
+ sIPadding .enter (&r, scaling);
197
+ s->clip_begin (&r);
198
+ }
199
+ lsp_finally {
200
+ if (clip)
201
+ s->clip_end ();
202
+ };
203
+
184
204
// Estimate drawing area
185
205
tp.Height = lsp_max (tp.Height , fp.Height );
186
206
if (tp.Width <= size.nWidth )
@@ -347,10 +367,15 @@ namespace lsp
347
367
e.r = r;
348
368
sFont .get_parameters (pDisplay, e.fscaling , &e.fp );
349
369
350
- // Estimate the size of the label
351
- for (lltl::iterator<prop::String> it = vEstimations.values (); it; ++it)
352
- estimate_string_size (&e, it.get ());
353
- estimate_string_size (&e, &sText );
370
+ if (!sTextClip .get ())
371
+ {
372
+ // Estimate the size of the label
373
+ for (lltl::iterator<prop::String> it = vEstimations.values (); it; ++it)
374
+ estimate_string_size (&e, it.get ());
375
+ estimate_string_size (&e, &sText );
376
+ }
377
+ else
378
+ r->nMinHeight = e.fp .Height ;
354
379
355
380
// Apply size constraints
356
381
sConstraints .apply (r, e.scaling );
0 commit comments