comparison ios/dw.m @ 2693:0dac724f890f

iOS: Fixes for notebook pages. Wasn't always using the pageID.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 01 Nov 2021 01:32:42 +0000
parents 1888d0a08365
children 5c43d1ee9736
comparison
equal deleted inserted replaced
2692:231f9489a38a 2693:0dac724f890f
1949 [page setHidden:NO]; 1949 [page setHidden:NO];
1950 visible = page; 1950 visible = page;
1951 _dw_do_resize(box, frame.size.width, frame.size.height); 1951 _dw_do_resize(box, frame.size.width, frame.size.height);
1952 _dw_handle_resize_events(box); 1952 _dw_handle_resize_events(box);
1953 } 1953 }
1954 _dw_event_handler(self, DW_INT_TO_POINTER(intpageid), _DW_EVENT_SWITCH_PAGE); 1954 _dw_event_handler(self, DW_INT_TO_POINTER([page pageid]), _DW_EVENT_SWITCH_PAGE);
1955 } 1955 }
1956 else
1957 visible = nil;
1956 } 1958 }
1957 -(void)dealloc { 1959 -(void)dealloc {
1958 UserData *root = userdata; 1960 UserData *root = userdata;
1959 _dw_remove_userdata(&root, NULL, TRUE); 1961 _dw_remove_userdata(&root, NULL, TRUE);
1960 dw_signal_disconnect_by_window(self); 1962 dw_signal_disconnect_by_window(self);
7935 if(index != NSNotFound) 7937 if(index != NSNotFound)
7936 { 7938 {
7937 [[notebook tabs] removeSegmentAtIndex:index animated:NO]; 7939 [[notebook tabs] removeSegmentAtIndex:index animated:NO];
7938 [notepage removeFromSuperview]; 7940 [notepage removeFromSuperview];
7939 [views removeObject:notepage]; 7941 [views removeObject:notepage];
7942 index--;
7943 if(index >= 0 && index < [views count])
7944 [[notebook tabs] setSelectedSegmentIndex:index];
7945 else if([views count] > 0)
7946 [[notebook tabs] setSelectedSegmentIndex:0];
7947 [notebook pageChanged:nil];
7940 [notepage release]; 7948 [notepage release];
7941 } 7949 }
7942 } 7950 }
7943 DW_LOCAL_POOL_OUT; 7951 DW_LOCAL_POOL_OUT;
7944 DW_FUNCTION_RETURN_NOTHING; 7952 DW_FUNCTION_RETURN_NOTHING;
7988 NSUInteger index = [views indexOfObject:notepage]; 7996 NSUInteger index = [views indexOfObject:notepage];
7989 7997
7990 if(index != -1) 7998 if(index != -1)
7991 { 7999 {
7992 [[notebook tabs] setSelectedSegmentIndex:index]; 8000 [[notebook tabs] setSelectedSegmentIndex:index];
8001 [notebook pageChanged:nil];
7993 } 8002 }
7994 } 8003 }
7995 DW_FUNCTION_RETURN_NOTHING; 8004 DW_FUNCTION_RETURN_NOTHING;
7996 } 8005 }
7997 8006
8006 DW_FUNCTION_ADD_PARAM3(handle, pageid, text) 8015 DW_FUNCTION_ADD_PARAM3(handle, pageid, text)
8007 DW_FUNCTION_NO_RETURN(dw_notebook_page_set_text) 8016 DW_FUNCTION_NO_RETURN(dw_notebook_page_set_text)
8008 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, pageid, ULONG, text, const char *) 8017 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, pageid, ULONG, text, const char *)
8009 { 8018 {
8010 DWNotebook *notebook = handle; 8019 DWNotebook *notebook = handle;
8011 8020 DWNotebookPage *notepage = _dw_notepage_from_id(notebook, pageid);
8012 [[notebook tabs] setTitle:[NSString stringWithUTF8String:text] forSegmentAtIndex:pageid]; 8021
8022 if(notepage != nil)
8023 {
8024 NSMutableArray<DWNotebookPage *> *views = [notebook views];
8025 NSUInteger index = [views indexOfObject:notepage];
8026
8027 if(index != -1)
8028 [[notebook tabs] setTitle:[NSString stringWithUTF8String:text] forSegmentAtIndex:index];
8029 }
8013 DW_FUNCTION_RETURN_NOTHING; 8030 DW_FUNCTION_RETURN_NOTHING;
8014 } 8031 }
8015 8032
8016 /* 8033 /*
8017 * Sets the text on the specified notebook tab status area. 8034 * Sets the text on the specified notebook tab status area.