Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "E4/CSS/SWT Mapping"

< E4‎ | CSS
Line 1: Line 1:
 
<font size="4" face="Times">How to style SWT widgets using CSS</font>
 
<font size="4" face="Times">How to style SWT widgets using CSS</font>
 
<br><br>
 
<br><br>
 +
<font size="2" face="Times">Widget: Control</font>
 
<table cellpadding="10" border="1">
 
<table cellpadding="10" border="1">
 
<tr>
 
<tr>
<th>SWT Widgets</th>
 
 
<th>SWT Method</th>
 
<th>SWT Method</th>
 
<th>CSS Property Name</th>
 
<th>CSS Property Name</th>
Line 9: Line 9:
 
</tr>
 
</tr>
 
<tr>
 
<tr>
<td>Control</td>
 
 
<td>setBackground(Color)</td>
 
<td>setBackground(Color)</td>
 
<td>background-color</td>
 
<td>background-color</td>
Line 15: Line 14:
 
</tr>
 
</tr>
 
<tr>
 
<tr>
<td>Control</td>
 
 
<td>setBackgroundImage(Image)</td>
 
<td>setBackgroundImage(Image)</td>
 
<td>background-image</td>
 
<td>background-image</td>
Line 21: Line 19:
 
</tr>
 
</tr>
 
<tr>
 
<tr>
<td>Control</td>
 
 
<td></td>
 
<td></td>
 
<td>border-color</td>
 
<td>border-color</td>
Line 27: Line 24:
 
</tr>
 
</tr>
 
<tr>
 
<tr>
<td>Control</td>
 
 
<td></td>
 
<td></td>
 
<td>border-width</td>
 
<td>border-width</td>
Line 33: Line 29:
 
</tr>
 
</tr>
 
<tr>
 
<tr>
<td>Control</td>
 
 
<td></td>
 
<td></td>
 
<td>border-style</td>
 
<td>border-style</td>
Line 39: Line 34:
 
</tr>
 
</tr>
 
<tr>
 
<tr>
<td>Control</td>
 
 
<td>setCurosr(Cursor)</td>
 
<td>setCurosr(Cursor)</td>
 
<td>cursor</td>
 
<td>cursor</td>
Line 45: Line 39:
 
</tr>
 
</tr>
 
<tr>
 
<tr>
<td>Control</td>
 
 
<td>setFont(Font)</td>
 
<td>setFont(Font)</td>
 
<td>font-style<br>
 
<td>font-style<br>
Line 57: Line 50:
 
</tr>
 
</tr>
 
<tr>
 
<tr>
<td>Control</td>
 
 
<td>setForeground(Color)</td>
 
<td>setForeground(Color)</td>
 
<td>color</td>
 
<td>color</td>
 
<td>Button { color: #FF0000 }</td>
 
<td>Button { color: #FF0000 }</td>
 +
</tr>
 +
</table>
 +
<br><br>
 +
<font size="2" face="Times">Widget: CTabFolder</font>
 +
<table cellpadding="10" border="1">
 +
<tr>
 +
<th>SWT Method</th>
 +
<th>CSS Property Name</th>
 +
<th>CSS Example</th>
 
</tr>
 
</tr>
 
<tr>
 
<tr>

Revision as of 11:25, 6 March 2009

How to style SWT widgets using CSS

Widget: Control

SWT Method CSS Property Name CSS Example
setBackground(Color) background-color Button { background-color: #FF0000 }
setBackgroundImage(Image) background-image Button { background-image: some url }
border-color Button { border-color: ##FF0000; }
border-width Button { border-width: 3 }
border-style Button { border-style: dotted }
setCurosr(Cursor) cursor Shell { cursor:crosshair }
setFont(Font) font-style

font-size
font-weight

font-family
Label { font-style: italic;

          font-size: 12;
          font-weight: bold;

          font-family: "Terminal"; }
setForeground(Color) color Button { color: #FF0000 }



Widget: CTabFolder

SWT Method CSS Property Name CSS Example
CTabFolder setBorderVisible(Boolean) border-visible CTabFolder { border-visible: true }
CTabFolder setMaximized(Boolean) maximized CTabFolder { maximized: true }
CTabFolder setMinimized(Boolean) minimized CTabFolder { minimized: true }
CTabFolder setMaximizeVisible(Boolean) maximize-visible CTabFolder { maximize-visible: true }
CTabFolder setMinimizeVisible(Boolean) minimize-visible CTabFolder { minimize-visible: true }
CTabFolder setMRUVisible(Boolean) mru-visible CTabFolder { mru-visible: true }
CTabFolder setShowClose(Boolean) show-close CTabFolder { show-close: true }
CTabFolder setSimple(Boolean) simple CTabFolder { simple: true }
CTabFolder setSingle(Boolean) single CTabFolder { single: true }
CTabFolder setUnselectedCloseVisible(Boolean) unselected-close-visible CTabFolder { unselected-close-visible: true }
CTabFolder setUnselectedImageVisible(Boolean) unselected-image-visible CTabFolder { unselected-image-visible: true }





Pseudo classes which can be used in CSS to style SWT widgets

SWT Widgets CSS Pseudo Selector CSS Example
CTabFolder :selected CTabFolder:selected { background-color: ##FF0000; }
Shell :active Shell:active { background-color: ##FF0000; }
Control :focus CTabFolder:focus { background-color: ##FF0000; }

Back to the top