comparison android/dw.cpp @ 2495:5664c91d03fb

Android: Attempts to sort out the various issues... still not working but... Wanted to commit so I can change locations later tonight.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 03 May 2021 01:17:40 +0000
parents b3e28eed0e50
children 3bf2f08fdc45
comparison
equal deleted inserted replaced
2494:b3e28eed0e50 2495:5664c91d03fb
87 JNIEXPORT void JNICALL 87 JNIEXPORT void JNICALL
88 Java_org_dbsoft_dwindows_DWindows_dwindowsInit(JNIEnv* env, jobject obj, jstring path) 88 Java_org_dbsoft_dwindows_DWindows_dwindowsInit(JNIEnv* env, jobject obj, jstring path)
89 { 89 {
90 static int runcount = 0; 90 static int runcount = 0;
91 91
92 /* Safety check to prevent multiple initializations */ 92 /* Safety check to prevent multiple initializations...
93 * In the simulator I get multiple calls, and code only works on the second call.
94 * On actual hardware we only get called once... so this works around that.
95 */
96 #if defined(__arm__) || defined(__aarch64__)
97 if(runcount == 0)
98 #else
93 if(runcount == 1) 99 if(runcount == 1)
100 #endif
94 { 101 {
95 char *arg = strdup(env->GetStringUTFChars((jstring) path, NULL)); 102 char *arg = strdup(env->GetStringUTFChars((jstring) path, NULL));
96 103
97 /* Save our class object pointer for later */ 104 /* Save our class object pointer for later */
98 _dw_obj = env->NewGlobalRef(obj); 105 _dw_obj = env->NewGlobalRef(obj);
301 } 308 }
302 /* Notebook page change event */ 309 /* Notebook page change event */
303 case 15: 310 case 15:
304 { 311 {
305 int (* API switchpagefunc)(HWND, unsigned long, void *) = (int (* API)(HWND, unsigned long, void *))handler->signalfunction; 312 int (* API switchpagefunc)(HWND, unsigned long, void *) = (int (* API)(HWND, unsigned long, void *))handler->signalfunction;
306 int pageid = DW_POINTER_TO_INT(params[3]); 313 unsigned long pageID = DW_POINTER_TO_INT(params[3]);
307 314
308 return switchpagefunc(handler->window, pageid, handler->data); 315 return switchpagefunc(handler->window, pageID, handler->data);
309 } 316 }
310 /* Tree expand event */ 317 /* Tree expand event */
311 case 16: 318 case 16:
312 { 319 {
313 int (* API treeexpandfunc)(HWND, HTREEITEM, void *) = (int (* API)(HWND, HTREEITEM, void *))handler->signalfunction; 320 int (* API treeexpandfunc)(HWND, HTREEITEM, void *) = (int (* API)(HWND, HTREEITEM, void *))handler->signalfunction;
362 /* A more simple method for quicker calls */ 369 /* A more simple method for quicker calls */
363 JNIEXPORT void JNICALL 370 JNIEXPORT void JNICALL
364 Java_org_dbsoft_dwindows_DWindows_eventHandlerSimple(JNIEnv* env, jobject obj, jobject obj1, jint message) { 371 Java_org_dbsoft_dwindows_DWindows_eventHandlerSimple(JNIEnv* env, jobject obj, jobject obj1, jint message) {
365 void *params[8] = { NULL }; 372 void *params[8] = { NULL };
366 373
374 _dw_event_handler(obj1, params, message);
375 }
376
377 /* A more simple method for quicker calls */
378 JNIEXPORT void JNICALL
379 Java_org_dbsoft_dwindows_DWindows_eventHandlerNotebook(JNIEnv* env, jobject obj, jobject obj1, jint message, jlong pageID) {
380 void *params[8] = { NULL };
381
382 params[3] = DW_INT_TO_POINTER(pageID);
367 _dw_event_handler(obj1, params, message); 383 _dw_event_handler(obj1, params, message);
368 } 384 }
369 385
370 /* Handler for Timer events */ 386 /* Handler for Timer events */
371 JNIEXPORT jint JNICALL 387 JNIEXPORT jint JNICALL
812 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). 828 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
813 * pad: Number of pixels to pad around the box. 829 * pad: Number of pixels to pad around the box.
814 * Returns: 830 * Returns:
815 * A handle to a scrollbox or NULL on failure. 831 * A handle to a scrollbox or NULL on failure.
816 */ 832 */
817 HWND API dw_scrollbox_new( int type, int pad ) 833 HWND API dw_scrollbox_new(int type, int pad)
818 { 834 {
819 return 0; 835 /* TODO: Just create a normal box for now */
836 return dw_box_new(type, pad);
820 } 837 }
821 838
822 /* 839 /*
823 * Returns the position of the scrollbar in the scrollbox. 840 * Returns the position of the scrollbar in the scrollbox.
824 * Parameters: 841 * Parameters: