Mercurial > dwindows
comparison mac/dw.m @ 1795:9304241b7b33
Added new dw_window_set_focus() function and attempted to fix...
Intial focus after a subsequent dw_window_show() on Mac.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 24 Sep 2012 23:24:25 +0000 |
parents | b0bdec1b820c |
children | aedf5903db0a |
comparison
equal
deleted
inserted
replaced
1794:97b1edb41d44 | 1795:9304241b7b33 |
---|---|
8238 | 8238 |
8239 if([ object isMemberOfClass:[ DWWindow class ] ]) | 8239 if([ object isMemberOfClass:[ DWWindow class ] ]) |
8240 { | 8240 { |
8241 DWWindow *window = handle; | 8241 DWWindow *window = handle; |
8242 NSRect rect = [[window contentView] frame]; | 8242 NSRect rect = [[window contentView] frame]; |
8243 id defaultitem = [window initialFirstResponder]; | |
8243 | 8244 |
8244 if([window isMiniaturized]) | 8245 if([window isMiniaturized]) |
8245 { | 8246 { |
8246 [window deminiaturize:nil]; | 8247 [window deminiaturize:nil]; |
8247 } | 8248 } |
8284 { | 8285 { |
8285 /* Fix incorrect repeat in displaying textured windows */ | 8286 /* Fix incorrect repeat in displaying textured windows */ |
8286 [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge]; | 8287 [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge]; |
8287 [window setContentBorderThickness:0.0 forEdge:NSMinYEdge]; | 8288 [window setContentBorderThickness:0.0 forEdge:NSMinYEdge]; |
8288 } | 8289 } |
8290 if(defaultitem) | |
8291 { | |
8292 /* If there is a default item set, make it first responder */ | |
8293 [window makeFirstResponder:defaultitem]; | |
8294 } | |
8289 } | 8295 } |
8290 return 0; | 8296 return 0; |
8291 } | 8297 } |
8292 | 8298 |
8293 /* | 8299 /* |
8485 } | 8491 } |
8486 } | 8492 } |
8487 } | 8493 } |
8488 | 8494 |
8489 /* | 8495 /* |
8496 * Sets the current focus item for a window/dialog. | |
8497 * Parameters: | |
8498 * handle: Handle to the dialog item to be focused. | |
8499 * Remarks: | |
8500 * This is for use after showing the window/dialog. | |
8501 */ | |
8502 void API dw_window_set_focus(HWND handle) | |
8503 { | |
8504 id object = handle; | |
8505 | |
8506 [[object window] makeFirstResponder:object]; | |
8507 } | |
8508 | |
8509 /* | |
8490 * Sets the default focus item for a window/dialog. | 8510 * Sets the default focus item for a window/dialog. |
8491 * Parameters: | 8511 * Parameters: |
8492 * window: Toplevel window or dialog. | 8512 * window: Toplevel window or dialog. |
8493 * defaultitem: Handle to the dialog item to be default. | 8513 * defaultitem: Handle to the dialog item to be default. |
8514 * Remarks: | |
8515 * This is for use before showing the window/dialog. | |
8494 */ | 8516 */ |
8495 void API dw_window_default(HWND handle, HWND defaultitem) | 8517 void API dw_window_default(HWND handle, HWND defaultitem) |
8496 { | 8518 { |
8497 DWWindow *window = handle; | 8519 DWWindow *window = handle; |
8498 id object = defaultitem; | 8520 id object = defaultitem; |