summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-10-02 14:11:25 -0400
committerAlexander Kurtakov <akurtako@redhat.com>2012-10-02 22:28:50 +0300
commit09f1692137fcd35dbae7ea8049913ec763ba69df (patch)
tree1b09191229f4c8f41c496da2db0f7b5024db297b /bundles/org.eclipse.swt/Eclipse SWT/gtk/org
parentffe5186c17b22da6dd8ec55ad2dd5f424adf803a (diff)
downloadeclipse.platform.swt-09f1692137fcd35dbae7ea8049913ec763ba69df.tar.gz
eclipse.platform.swt-09f1692137fcd35dbae7ea8049913ec763ba69df.tar.xz
eclipse.platform.swt-09f1692137fcd35dbae7ea8049913ec763ba69df.zip
Replace GtkFontSelection with GtkFontChooser for GTK+ 3.2 and higher
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java32
1 files changed, 29 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java
index 905110d34d..9550665251 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java
@@ -155,7 +155,7 @@ public FontData open () {
byte [] titleBytes;
titleBytes = Converter.wcsToMbcs (null, title, true);
Display display = parent != null ? parent.getDisplay (): Display.getCurrent ();
- handle = OS.gtk_font_selection_dialog_new (titleBytes);
+ handle = gtk_font_chooser_dialog_new (titleBytes);
if (parent!=null) {
long /*int*/ shellHandle = parent.topHandle ();
OS.gtk_window_set_transient_for(handle, shellHandle);
@@ -178,7 +178,7 @@ public FontData open () {
OS.memmove (buffer, fontName, length);
font.dispose();
OS.g_free (fontName);
- OS.gtk_font_selection_dialog_set_font_name (handle, buffer);
+ gtk_font_chooser_set_font (handle, buffer);
}
display.addIdleProc ();
Dialog oldModal = null;
@@ -208,7 +208,7 @@ public FontData open () {
}
boolean success = response == OS.GTK_RESPONSE_OK;
if (success) {
- long /*int*/ fontName = OS.gtk_font_selection_dialog_get_font_name (handle);
+ long /*int*/ fontName = gtk_font_chooser_get_font (handle);
int length = OS.strlen (fontName);
byte [] buffer = new byte [length + 1];
OS.memmove (buffer, fontName, length);
@@ -284,4 +284,30 @@ public void setFontList (FontData [] fontData) {
public void setRGB (RGB rgb) {
this.rgb = rgb;
}
+
+long /*int*/ gtk_font_chooser_get_font(long /*int*/ fontchooser) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 2, 0)) {
+ return OS.gtk_font_chooser_get_font(fontchooser);
+ } else {
+ return OS.gtk_font_selection_dialog_get_font_name(fontchooser);
+ }
+}
+
+long /*int*/ gtk_font_chooser_dialog_new (byte[] title) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 2, 0)) {
+ return OS.gtk_font_chooser_dialog_new (title, 0);
+ } else {
+ return OS.gtk_font_selection_dialog_new (title);
+ }
+}
+
+
+void gtk_font_chooser_set_font(long /*int*/ fsd, byte[] fontname) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 2, 0)) {
+ OS.gtk_font_chooser_set_font(fsd, fontname);
+ } else {
+ OS.gtk_font_selection_dialog_set_font_name(fsd, fontname);
+ }
+}
+
}