Mercurial > dwindows
comparison mac/dw.m @ 1101:d7eafaa054ab
Added support for dw_window_redraw() causing splitbar panes to redraw without
having to wait for a resize event from window resizing or splitbar movement.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 26 Jul 2011 00:25:57 +0000 |
parents | 13ea7575d9e8 |
children | cfe7d2b6bc16 |
comparison
equal
deleted
inserted
replaced
1100:13ea7575d9e8 | 1101:d7eafaa054ab |
---|---|
688 } | 688 } |
689 -(void)setUserdata:(void *)input { userdata = input; } | 689 -(void)setUserdata:(void *)input { userdata = input; } |
690 @end | 690 @end |
691 | 691 |
692 @interface DWWindow : NSWindow | 692 @interface DWWindow : NSWindow |
693 { | |
694 int redraw; | |
695 } | |
693 -(void)sendEvent:(NSEvent *)theEvent; | 696 -(void)sendEvent:(NSEvent *)theEvent; |
694 -(void)keyDown:(NSEvent *)theEvent; | 697 -(void)keyDown:(NSEvent *)theEvent; |
695 -(void)mouseDragged:(NSEvent *)theEvent; | 698 -(void)mouseDragged:(NSEvent *)theEvent; |
699 -(int)redraw; | |
700 -(void)setRedraw:(int)val; | |
696 @end | 701 @end |
697 | 702 |
698 @implementation DWWindow | 703 @implementation DWWindow |
699 -(void)sendEvent:(NSEvent *)theEvent { if([theEvent type] == NSKeyDown) { _event_handler(self, theEvent, 2); } [super sendEvent:theEvent]; } | 704 -(void)sendEvent:(NSEvent *)theEvent { if([theEvent type] == NSKeyDown) { _event_handler(self, theEvent, 2); } [super sendEvent:theEvent]; } |
700 -(void)keyDown:(NSEvent *)theEvent { } | 705 -(void)keyDown:(NSEvent *)theEvent { } |
701 -(void)mouseDragged:(NSEvent *)theEvent { _event_handler(self, theEvent, 5); } | 706 -(void)mouseDragged:(NSEvent *)theEvent { _event_handler(self, theEvent, 5); } |
707 -(int)redraw { return redraw; } | |
708 -(void)setRedraw:(int)val { redraw = val; } | |
702 @end | 709 @end |
703 | 710 |
704 /* Subclass for a render area type */ | 711 /* Subclass for a render area type */ |
705 @interface DWRender : NSControl | 712 @interface DWRender : NSControl |
706 { | 713 { |
2556 [textfield setFrameOrigin:NSMakePoint(0,0)]; | 2563 [textfield setFrameOrigin:NSMakePoint(0,0)]; |
2557 [textfield setFrameSize:NSMakeSize(size.width-20,size.height)]; | 2564 [textfield setFrameSize:NSMakeSize(size.width-20,size.height)]; |
2558 [stepper setFrameOrigin:NSMakePoint(size.width-20,0)]; | 2565 [stepper setFrameOrigin:NSMakePoint(size.width-20,0)]; |
2559 [stepper setFrameSize:NSMakeSize(20,size.height)]; | 2566 [stepper setFrameSize:NSMakeSize(20,size.height)]; |
2560 } | 2567 } |
2561 else if([handle isMemberOfClass:[DWSplitBar class]] && size.width > 20 && size.height > 20) | 2568 else if([handle isMemberOfClass:[DWSplitBar class]]) |
2562 { | 2569 { |
2563 DWSplitBar *split = (DWSplitBar *)handle; | 2570 DWSplitBar *split = (DWSplitBar *)handle; |
2571 DWWindow *window = (DWWindow *)[split window]; | |
2564 float percent = [split percent]; | 2572 float percent = [split percent]; |
2565 | 2573 |
2566 if(percent > 0) | 2574 if(percent > 0 && size.width > 20 && size.height > 20) |
2567 { | 2575 { |
2568 dw_splitbar_set(handle, percent); | 2576 dw_splitbar_set(handle, percent); |
2569 [split setPercent:0]; | 2577 [split setPercent:0]; |
2578 } | |
2579 else if([window redraw]) | |
2580 { | |
2581 [split splitViewDidResizeSubviews:nil]; | |
2570 } | 2582 } |
2571 } | 2583 } |
2572 if(thisbox->type == DW_HORZ) | 2584 if(thisbox->type == DW_HORZ) |
2573 currentx += width + vectorx + (pad * 2); | 2585 currentx += width + vectorx + (pad * 2); |
2574 if(thisbox->type == DW_VERT) | 2586 if(thisbox->type == DW_VERT) |
7658 * Parameters: | 7670 * Parameters: |
7659 * handle: Toplevel window handle to be redrawn. | 7671 * handle: Toplevel window handle to be redrawn. |
7660 */ | 7672 */ |
7661 void API dw_window_redraw(HWND handle) | 7673 void API dw_window_redraw(HWND handle) |
7662 { | 7674 { |
7663 NSWindow *window = handle; | 7675 DWWindow *window = handle; |
7676 [window setRedraw:YES]; | |
7664 [[window contentView] showWindow]; | 7677 [[window contentView] showWindow]; |
7665 [window flushWindow]; | 7678 [window flushWindow]; |
7679 [window setRedraw:NO]; | |
7666 } | 7680 } |
7667 | 7681 |
7668 /* | 7682 /* |
7669 * Makes the window topmost. | 7683 * Makes the window topmost. |
7670 * Parameters: | 7684 * Parameters: |