You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
implement DrawableContainer and copy StateListDrawable from AOSP
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class android_graphics_drawable_DrawableContainer */
|
||||
|
||||
#ifndef _Included_android_graphics_drawable_DrawableContainer
|
||||
#define _Included_android_graphics_drawable_DrawableContainer
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: android_graphics_drawable_DrawableContainer
|
||||
* Method: native_constructor
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_drawable_DrawableContainer_native_1constructor
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_drawable_DrawableContainer
|
||||
* Method: native_selectChild
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_drawable_DrawableContainer_native_1selectChild
|
||||
(JNIEnv *, jobject, jlong, jlong);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#include "../defines.h"
|
||||
#include "../generated_headers/android_graphics_drawable_DrawableContainer.h"
|
||||
|
||||
struct _ContainerPaintable {
|
||||
GObject parent_instance;
|
||||
GdkPaintable *child;
|
||||
};
|
||||
G_DECLARE_FINAL_TYPE(ContainerPaintable, container_paintable, CONTAINER, PAINTABLE, GObject)
|
||||
|
||||
static void container_paintable_snapshot(GdkPaintable *paintable, GdkSnapshot *snapshot, double width, double height) {
|
||||
ContainerPaintable *container = CONTAINER_PAINTABLE(paintable);
|
||||
if (container->child)
|
||||
gdk_paintable_snapshot(container->child, snapshot, width, height);
|
||||
}
|
||||
|
||||
static void container_paintable_init(ContainerPaintable *container_paintable)
|
||||
{
|
||||
}
|
||||
|
||||
static void container_paintable_paintable_init(GdkPaintableInterface *iface)
|
||||
{
|
||||
iface->snapshot = container_paintable_snapshot;
|
||||
}
|
||||
|
||||
static void container_paintable_class_init(ContainerPaintableClass *class) {
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE(ContainerPaintable, container_paintable, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE(GDK_TYPE_PAINTABLE, container_paintable_paintable_init))
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_drawable_DrawableContainer_native_1constructor(JNIEnv *env, jobject this)
|
||||
{
|
||||
return _INTPTR(g_object_new(container_paintable_get_type(), NULL));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_drawable_DrawableContainer_native_1selectChild(JNIEnv *env, jobject this, jlong ptr, jlong child_ptr)
|
||||
{
|
||||
ContainerPaintable *container = CONTAINER_PAINTABLE(_PTR(ptr));
|
||||
container->child = GDK_PAINTABLE(_PTR(child_ptr));
|
||||
gdk_paintable_invalidate_contents(GDK_PAINTABLE(container));
|
||||
}
|
||||
Reference in New Issue
Block a user