Mercurial > dwindows
comparison mac/dw.m @ 1438:bde7ebced556
Initial layout engine 2.0 for Windows and OS/2...Plus some updates for the Mac code...
Improved auto-window sizing on Windows and added OS/2 and Mac support.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 08 Dec 2011 09:30:32 +0000 |
parents | a50e8b486a1a |
children | 02a329b2b0cd |
comparison
equal
deleted
inserted
replaced
1437:a50e8b486a1a | 1438:bde7ebced556 |
---|---|
2672 else if([window redraw]) | 2672 else if([window redraw]) |
2673 { | 2673 { |
2674 [split splitViewDidResizeSubviews:nil]; | 2674 [split splitViewDidResizeSubviews:nil]; |
2675 } | 2675 } |
2676 } | 2676 } |
2677 | |
2678 /* Advance the current position in the box */ | |
2677 if(thisbox->type == DW_HORZ) | 2679 if(thisbox->type == DW_HORZ) |
2678 currentx += width + (pad * 2); | 2680 currentx += width + (pad * 2); |
2679 if(thisbox->type == DW_VERT) | 2681 if(thisbox->type == DW_VERT) |
2680 currenty += height + (pad * 2); | 2682 currenty += height + (pad * 2); |
2681 } | 2683 } |
8420 void API dw_window_set_size(HWND handle, ULONG width, ULONG height) | 8422 void API dw_window_set_size(HWND handle, ULONG width, ULONG height) |
8421 { | 8423 { |
8422 int _locked_by_me = FALSE; | 8424 int _locked_by_me = FALSE; |
8423 DW_MUTEX_LOCK; | 8425 DW_MUTEX_LOCK; |
8424 NSObject *object = handle; | 8426 NSObject *object = handle; |
8425 NSSize size; | |
8426 size.width = width; | |
8427 size.height = height; | |
8428 | 8427 |
8429 if([ object isKindOfClass:[ NSWindow class ] ]) | 8428 if([ object isKindOfClass:[ NSWindow class ] ]) |
8430 { | 8429 { |
8431 NSWindow *window = handle; | 8430 NSWindow *window = handle; |
8431 Box *thisbox; | |
8432 NSSize size; | |
8433 | |
8434 /* | |
8435 * The following is an attempt to dynamically size a window based on the size of its | |
8436 * children before realization. Only applicable when width or height is less than one. | |
8437 */ | |
8438 if((width < 1 || height < 1) && (thisbox = [[window contentView] box])) | |
8439 { | |
8440 int depth = 0; | |
8441 | |
8442 /* Calculate space requirements */ | |
8443 _resize_box(thisbox, &depth, width, height, 1); | |
8444 | |
8445 /* Might need to take into account the window border here */ | |
8446 if(width < 1) width = thisbox->minwidth; | |
8447 if(height < 1) height = thisbox->minheight; | |
8448 } | |
8449 | |
8450 /* Finally set the size */ | |
8451 size.width = width; | |
8452 size.height = height; | |
8432 [window setContentSize:size]; | 8453 [window setContentSize:size]; |
8433 } | 8454 } |
8434 DW_MUTEX_UNLOCK; | 8455 DW_MUTEX_UNLOCK; |
8435 } | 8456 } |
8436 | 8457 |