summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java51
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FontDialog.java8
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java9
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java18
11 files changed, 114 insertions, 23 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java
index e44af7a1ed..17d54572af 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java
@@ -461,6 +461,11 @@ public void cut () {
OS.PtTextModifyText (handle, start [0], end [0], start [0], buffer, buffer.length);
}
+byte [] defaultFont () {
+ Display display = getDisplay ();
+ return display.TEXT_FONT;
+}
+
void deregister () {
super.deregister ();
int child = OS.PtWidgetChildBack (handle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java
index f29771c326..101f2e1cfa 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java
@@ -179,6 +179,11 @@ void createScrollBars () {
}
}
+byte [] defaultFont () {
+ Display display = getDisplay ();
+ return display.TITLE_FONT;
+}
+
void createScrolledHandle (int parentHandle) {
int etches = OS.Pt_ALL_ETCHES | OS.Pt_ALL_OUTLINES;
int [] args = new int [] {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
index 6a14a58cd1..49861a5512 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
@@ -455,6 +455,7 @@ void createWidget (int index) {
super.createWidget (index);
setZOrder ();
realizeWidget ();
+ setDefaultFont ();
}
int defaultBackground () {
@@ -530,12 +531,14 @@ public Font getFont () {
OS.Pt_ARG_TEXT_FONT, 0, 0,
OS.Pt_ARG_LIST_FONT, 0, 0,
OS.Pt_ARG_TITLE_FONT, 0, 0,
+ OS.Pt_ARG_GAUGE_FONT, 0, 0,
};
OS.PtGetResources (handle, args.length / 3, args);
byte [] font;
int ptr = args [1];
if (ptr == 0) ptr = args [4];
if (ptr == 0) ptr = args [7];
+ if (ptr == 0) ptr = args [11];
if (ptr == 0) {
font = defaultFont ();
} else {
@@ -1973,6 +1976,11 @@ void setBackgroundPixel (int pixel) {
OS.PtSetResource (handle, OS.Pt_ARG_FILL_COLOR, pixel, 0);
}
+void setDefaultFont () {
+ Display display = getDisplay ();
+ if (display.defaultFont != null) setFont (defaultFont ());
+}
+
/**
* Sets the font that the receiver will use to paint textual information
* to the font specified by the argument, or to the default font for that
@@ -1992,13 +2000,17 @@ public void setFont (Font font) {
checkWidget();
byte[] buffer;
if (font != null) {
- if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (font.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
buffer = font.handle;
} else {
- buffer = defaultFont();
+ buffer = defaultFont ();
}
- int ptr = OS.malloc (buffer.length);
- OS.memmove (ptr, buffer, buffer.length);
+ setFont (buffer);
+}
+
+void setFont (byte [] font) {
+ int ptr = OS.malloc (font.length);
+ OS.memmove (ptr, font, font.length);
setFont (ptr);
OS.free (ptr);
}
@@ -2008,6 +2020,7 @@ void setFont (int font) {
OS.Pt_ARG_TEXT_FONT, font, 0,
OS.Pt_ARG_LIST_FONT, font, 0,
OS.Pt_ARG_TITLE_FONT, font, 0,
+ OS.Pt_ARG_GAUGE_FONT, font, 0,
};
OS.PtSetResources (handle, args.length / 3, args);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java
index 02c40e5a9e..cd3dcaa33f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java
@@ -111,7 +111,7 @@ public class Display extends Device {
/* Sync/Async Widget Communication */
Synchronizer synchronizer = new Synchronizer (this);
- Thread thread = Thread.currentThread ();
+ Thread thread;
/* Display Shutdown */
Runnable [] disposeList;
@@ -230,7 +230,8 @@ public class Display extends Device {
int INFO_FOREGROUND, INFO_BACKGROUND, TEXT_FOREGROUND, TEXT_BACKGROUND;
/* Fonts */
- byte [] TEXT_FONT, LIST_FONT;
+ byte [] defaultFont;
+ byte [] TEXT_FONT, LIST_FONT, TITLE_FONT, GAUGE_FONT, GROUP_FONT;
/* Images */
int nullImage;
@@ -366,10 +367,10 @@ protected void checkDevice () {
if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
}
-synchronized void checkDisplay () {
+static synchronized void checkDisplay (Thread thread) {
for (int i=0; i<Displays.length; i++) {
if (Displays [i] != null && Displays [i].thread == thread) {
- error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
}
}
}
@@ -425,7 +426,7 @@ String convertToLf (String text) {
protected void create (DeviceData data) {
checkSubclass ();
- checkDisplay ();
+ checkDisplay (thread = Thread.currentThread ());
createDisplay (data);
register ();
if (Default == null) Default = this;
@@ -816,7 +817,8 @@ public Color getSystemColor (int id) {
*/
public Font getSystemFont () {
checkDevice ();
- return Font.photon_new (this, TEXT_FONT);
+ byte [] font = defaultFont != null ? defaultFont : TEXT_FONT;
+ return Font.photon_new (this, font);
}
/**
@@ -1036,20 +1038,43 @@ void initializeWidgetColors () {
}
void initializeWidgetFonts () {
+ String property = System.getProperty ("swt.system.font");
+ if (property != null) {
+ defaultFont = Converter.wcsToMbcs (null, property, true);
+ TEXT_FONT = LIST_FONT = GAUGE_FONT = TITLE_FONT = defaultFont;
+ GROUP_FONT = Converter.wcsToMbcs (null, property + "b", true);
+ return;
+ }
OS.PtSetParentWidget (0);
+
int shellHandle = OS.PtCreateWidget (OS.PtWindow (), 0, 0, null);
+ int [] args = new int [] {OS.Pt_ARG_TITLE_FONT, 0, 0};
+ OS.PtGetResources (shellHandle, args.length / 3, args);
+ int length = OS.strlen (args [1]);
+ GROUP_FONT = TITLE_FONT = new byte [length + 1];
+ OS.memmove (TITLE_FONT, args [1], length);
+
int listHandle = OS.PtCreateWidget (OS.PtList (), shellHandle, 0, null);
- int [] args = {OS.Pt_ARG_LIST_FONT, 0, 0};
+ args = new int [] {OS.Pt_ARG_LIST_FONT, 0, 0};
OS.PtGetResources (listHandle, args.length / 3, args);
- int count = OS.strlen (args [1]);
- LIST_FONT = new byte [count + 1];
- OS.memmove (LIST_FONT, args [1], count);
+ length = OS.strlen (args [1]);
+ LIST_FONT = new byte [length + 1];
+ OS.memmove (LIST_FONT, args [1], length);
+
int textHandle = OS.PtCreateWidget (OS.PtText (), shellHandle, 0, null);
args = new int [] {OS.Pt_ARG_TEXT_FONT, 0, 0};
OS.PtGetResources (textHandle, args.length / 3, args);
- count = OS.strlen (args [1]);
- TEXT_FONT = new byte [count + 1];
- OS.memmove (TEXT_FONT, args [1], count);
+ length = OS.strlen (args [1]);
+ TEXT_FONT = new byte [length + 1];
+ OS.memmove (TEXT_FONT, args [1], length);
+
+ int scrollHandle = OS.PtCreateWidget (OS.PtScrollbar (), shellHandle, 0, null);
+ args = new int [] {OS.Pt_ARG_GAUGE_FONT, 0, 0};
+ OS.PtGetResources (scrollHandle, args.length / 3, args);
+ length = OS.strlen (args [1]);
+ GAUGE_FONT = new byte [length + 1];
+ OS.memmove (GAUGE_FONT, args [1], length);
+
OS.PtDestroyWidget (shellHandle);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FontDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FontDialog.java
index 5e80fcc0eb..d56d2c20d7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FontDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/FontDialog.java
@@ -141,10 +141,10 @@ public FontData open () {
int fontPtr = OS.PtFontSelection (parentHandle, null, title, font, OS.PHFONT_ALL_SYMBOLS, flags, null);
if (fontPtr != 0) {
- int length = OS.strlen(fontPtr);
- font = new byte[length];
- OS.memmove(font, fontPtr, length);
- fontData = FontData.photon_new(font);
+ int length = OS.strlen (fontPtr);
+ font = new byte [length + 1];
+ OS.memmove (font, fontPtr, length);
+ fontData = FontData.photon_new (font);
}
return fontData;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java
index e42aea9d2e..2c8870e20b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java
@@ -109,7 +109,7 @@ protected void checkSubclass () {
void createHandle (int index) {
state |= HANDLE;
Display display = getDisplay ();
- int clazz = display.PtPane;
+ int clazz = display.PtContainer;
int parentHandle = parent.parentingHandle ();
int [] args = {
OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
@@ -118,6 +118,11 @@ void createHandle (int index) {
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
+byte [] defaultFont () {
+ Display display = getDisplay ();
+ return display.GROUP_FONT;
+}
+
/**
* Returns the receiver's text, which is the string that the
* is used as the <em>title</em>. If the text has not previously
@@ -189,7 +194,7 @@ int processPaint (int damage) {
public void setText (String string) {
checkWidget();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
- int flags = OS.Pt_SHOW_TITLE | OS.Pt_ETCH_TITLE_AREA | OS.Pt_GRADIENT_TITLE_AREA;
+ int flags = OS.Pt_SHOW_TITLE | OS.Pt_ETCH_TITLE_AREA;
byte [] buffer = Converter.wcsToMbcs (null, stripMnemonics (string), true);
int ptr = OS.malloc (buffer.length);
OS.memmove (ptr, buffer, buffer.length);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java
index e4caff1df1..5cac066988 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java
@@ -112,6 +112,11 @@ void createHandle (int index) {
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
+byte [] defaultFont () {
+ Display display = getDisplay ();
+ return display.GAUGE_FONT;
+}
+
int processPaint (int damage) {
OS.PtSuperClassDraw (OS.PtProgress (), handle, damage);
return super.processPaint (damage);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java
index eeee41a460..c4c43e56ad 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java
@@ -134,6 +134,11 @@ void createHandle (int index) {
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
+byte [] defaultFont () {
+ Display display = getDisplay ();
+ return display.TITLE_FONT;
+}
+
void drawBand (int x, int y, int width, int height) {
if (parent == null) return;
if (parent.isDisposed ()) return;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java
index aa775c6881..255b070a8f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java
@@ -141,6 +141,11 @@ void createHandle (int index) {
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
+byte [] defaultFont () {
+ Display display = getDisplay ();
+ return display.GAUGE_FONT;
+}
+
/**
* Returns the amount that the receiver's value will be
* modified by when the up/down (or right/left) arrows
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java
index f96a10231d..04d80e18be 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java
@@ -175,6 +175,11 @@ void createHandle (int index) {
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
+byte [] defaultFont () {
+ Display display = getDisplay ();
+ return display.GAUGE_FONT;
+}
+
/**
* Returns the amount that the receiver's value will be
* modified by when the up/down (or right/left) arrows
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java
index 1addfdb092..abb728ce6a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java
@@ -256,6 +256,11 @@ void createHandle (int index) {
}
}
+void createWidget (int index) {
+ super.createWidget (index);
+ setDefaultFont ();
+}
+
void deregister () {
super.deregister ();
if ((style & SWT.DROP_DOWN) != 0) {
@@ -627,6 +632,11 @@ public void setControl (Control control) {
}
}
+void setDefaultFont () {
+ Display display = getDisplay ();
+ if (display.defaultFont != null) setFont (parent.defaultFont ());
+}
+
/**
* Sets the receiver's disabled image to the argument, which may be
* null indicating that no disabled image should be displayed.
@@ -694,11 +704,19 @@ boolean setFocus () {
return OS.PtIsFocused(focusHandle) != 0;
}
+void setFont (byte [] font) {
+ int ptr = OS.malloc (font.length);
+ OS.memmove (ptr, font, font.length);
+ setFont (ptr);
+ OS.free (ptr);
+}
+
void setFont (int font) {
int [] args = {
OS.Pt_ARG_TEXT_FONT, font, 0,
OS.Pt_ARG_LIST_FONT, font, 0,
OS.Pt_ARG_TITLE_FONT, font, 0,
+ OS.Pt_ARG_GAUGE_FONT, font, 0,
};
OS.PtSetResources (handle, args.length / 3, args);
if ((style & SWT.DROP_DOWN) != 0) {