Moved undocumented GTK3 methods to GTK3 class

This commit is contained in:
nathan 2017-05-14 16:58:15 +02:00
parent c4b27add55
commit 8181b72509
2 changed files with 20 additions and 15 deletions

View File

@ -50,7 +50,7 @@ import dorkbox.util.jna.JnaHelper;
* *
* Direct-mapping, See: https://github.com/java-native-access/jna/blob/master/www/DirectMapping.md * Direct-mapping, See: https://github.com/java-native-access/jna/blob/master/www/DirectMapping.md
*/ */
@SuppressWarnings({"Duplicates", "SameParameterValue", "DanglingJavadoc"}) @SuppressWarnings({"Duplicates", "SameParameterValue", "DanglingJavadoc", "DeprecatedIsStillUsed"})
public public
class Gtk { class Gtk {
// For funsies to look at, SyncThing did a LOT of work on compatibility in python (unfortunate for us, but interesting). // For funsies to look at, SyncThing did a LOT of work on compatibility in python (unfortunate for us, but interesting).
@ -777,11 +777,6 @@ class Gtk {
public static native public static native
Pointer gtk_settings_get_default(); Pointer gtk_settings_get_default();
/**
* Returns the style context associated to widget . The returned object is guaranteed to be the same for the lifetime of widget .
*/
public static native Pointer gtk_widget_get_style_context(Pointer widget);
/** /**
* Finds all matching RC styles for a given widget, composites them together, and then creates a GtkStyle representing the composite * Finds all matching RC styles for a given widget, composites them together, and then creates a GtkStyle representing the composite
* appearance. (GTK+ actually keeps a cache of previously created styles, so a new style may not be created.) * appearance. (GTK+ actually keeps a cache of previously created styles, so a new style may not be created.)
@ -803,10 +798,6 @@ class Gtk {
*/ */
public static native boolean gtk_style_lookup_color(Pointer widgetStyle, String color_name, Pointer color); public static native boolean gtk_style_lookup_color(Pointer widgetStyle, String color_name, Pointer color);
/**
* Looks up and resolves a color name in the context color map.
*/
public static native boolean gtk_style_context_lookup_color(Pointer widget, String name, Pointer color);
/** /**
* Adds widget to container . Typically used for simple containers such as GtkWindow, GtkFrame, or GtkButton; for more complicated * Adds widget to container . Typically used for simple containers such as GtkWindow, GtkFrame, or GtkButton; for more complicated
@ -916,20 +907,20 @@ class Gtk {
} }
if (Gtk.isGtk3) { if (Gtk.isGtk3) {
Pointer context = Gtk.gtk_widget_get_style_context(item); Pointer context = Gtk3.gtk_widget_get_style_context(item);
int state = Gtk3.gtk_style_context_get_state(context); int state = Gtk3.gtk_style_context_get_state(context);
GdkRGBAColor gdkColor = new GdkRGBAColor(); GdkRGBAColor gdkColor = new GdkRGBAColor();
boolean success = Gtk.gtk_style_context_lookup_color(context, "fg_color", gdkColor.getPointer()); boolean success = Gtk3.gtk_style_context_lookup_color(context, "fg_color", gdkColor.getPointer());
if (!success) { if (!success) {
success = Gtk.gtk_style_context_lookup_color(context, "text_color", gdkColor.getPointer()); success = Gtk3.gtk_style_context_lookup_color(context, "text_color", gdkColor.getPointer());
} }
if (!success) { if (!success) {
success = Gtk.gtk_style_context_lookup_color(context, "menu_fg_color", gdkColor.getPointer()); success = Gtk3.gtk_style_context_lookup_color(context, "menu_fg_color", gdkColor.getPointer());
} }
if (!success) { if (!success) {
success = Gtk.gtk_style_context_lookup_color(context, "color", gdkColor.getPointer()); success = Gtk3.gtk_style_context_lookup_color(context, "color", gdkColor.getPointer());
} }
if (success) { if (success) {

View File

@ -69,4 +69,18 @@ class Gtk3 {
* @since 3.0 * @since 3.0
*/ */
public static native int gtk_style_context_get_state(Pointer context); public static native int gtk_style_context_get_state(Pointer context);
/**
* Looks up and resolves a color name in the context color map.
*
* @since 3.0 (but not in the documentation...)
*/
public static native boolean gtk_style_context_lookup_color(Pointer widget, String name, Pointer color);
/**
* Returns the style context associated to widget . The returned object is guaranteed to be the same for the lifetime of widget .
*
* @since 3.0 (but not in the documentation...)
*/
public static native Pointer gtk_widget_get_style_context(Pointer widget);
} }