Bug 501483

Summary: Consider deprecation of CLabel
Product: [Eclipse Project] Platform Reporter: Mickael Istria <mistria>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, ericwill, psuzzi
Version: 4.6Keywords: triaged
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 501482    
Bug Blocks:    

Description Mickael Istria CLA 2016-09-15 05:37:38 EDT
+++ This bug was initially created as a clone of Bug #501482 +++

It would be worth investigating the feature gap between CLabel and regular Label, and see whether:
1. there is none, so CLabel should be deprecated
2. there is some, but some CLabel feature could properly be ported to regular Combo, so we could plan a port of feature and then deprecate CLabel
3. There is a major one, and we should document it in Javadoc

Currently, CLabel doc says

"""
 * A Label which supports aligned text and/or an image and different border styles.
 * <p>
 * If there is not enough space a CLabel uses the following strategy to fit the
 * information into the available space:
 * <pre>
 * 		ignores the indent in left align mode
 * 		ignores the image and the gap
 * 		shortens the text by replacing the center portion of the label with an ellipsis
 * 		shortens the text by removing the center portion of the label
 * </pre>
 * <p>
 * <dl>
 * <dt><b>Styles:</b>
 * <dd>LEFT, RIGHT, CENTER, SHADOW_IN, SHADOW_OUT, SHADOW_NONE</dd>
"""

Is it something we could also do with a regular Label?
Comment 1 Eric Williams CLA 2016-09-15 10:25:03 EDT
(In reply to Mickael Istria from comment #0)
> 
> Currently, CLabel doc says
> 
> """
>  * A Label which supports aligned text and/or an image and different border
> styles.
>  * <p>
>  * If there is not enough space a CLabel uses the following strategy to fit
> the
>  * information into the available space:
>  * <pre>
>  * 		ignores the indent in left align mode
>  * 		ignores the image and the gap
>  * 		shortens the text by replacing the center portion of the label with an
> ellipsis
>  * 		shortens the text by removing the center portion of the label
>  * </pre>
>  * <p>
>  * <dl>
>  * <dt><b>Styles:</b>
>  * <dd>LEFT, RIGHT, CENTER, SHADOW_IN, SHADOW_OUT, SHADOW_NONE</dd>
> """
> 
> Is it something we could also do with a regular Label?

I believe this functionality is supported in GTK3, both with a regular GtkLabel, and with GtkBox + GtkLabel/GtkImage/whatever. We had to do a similar thing with menus, where instead of using GtkImageMenuItem we used a GtkBox stuffed with a GtkMenuItem + GtkImage/checkboxes/whatever.

Generally I'm in favor of this idea since non-native GTK widgets (CLabel, CCombo, StyledText, etc.) are composed solely of SwtFixed, which can be a headache to debug.