comparison android/DWindows.kt @ 2796:0c534743b7a9

Android: Allow passing a menu window handle to dw_window_destroy(). Internally if it is a menu, instead of following the Window/View code path, instead pass the handle to menuDestroy().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 15 Jul 2022 23:58:19 +0000
parents 5c61aba17b69
children 62837ceeec46
comparison
equal deleted inserted replaced
2795:5c61aba17b69 2796:0c534743b7a9
3196 windowSwitchWindow(index) 3196 windowSwitchWindow(index)
3197 } 3197 }
3198 } 3198 }
3199 } 3199 }
3200 3200
3201 fun windowDestroy(window: View): Int { 3201 fun windowDestroy(window: Any): Int {
3202 var retval: Int = 1 // DW_ERROR_GENERAL 3202 var retval: Int = 1 // DW_ERROR_GENERAL
3203 3203
3204 if(windowLayout != null) { 3204 if(window is DWMenu) {
3205 menuDestroy(window as DWMenu)
3206 retval = 0 // DW_ERROR_NONE
3207 } else if(windowLayout != null && window is View) {
3205 waitOnUiThread { 3208 waitOnUiThread {
3206 val adapter: DWTabViewPagerAdapter = windowLayout!!.adapter as DWTabViewPagerAdapter 3209 val adapter: DWTabViewPagerAdapter = windowLayout!!.adapter as DWTabViewPagerAdapter
3207 val index = adapter.viewList.indexOf(window) 3210 val index = adapter.viewList.indexOf(window)
3208 3211
3209 // We need to have at least 1 window... 3212 // We need to have at least 1 window...