comparison mac/dw.m @ 840:2967934fb587

Implemented the fix for the scrollbox problem on the Mac (that was discovered on Windows)
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 29 Mar 2011 17:36:57 +0000
parents 8e0405435d0a
children 5103d132c3cd
comparison
equal deleted inserted replaced
839:ccfa5173659f 840:2967934fb587
697 697
698 /* Subclass for a scrollbox type */ 698 /* Subclass for a scrollbox type */
699 @interface DWScrollBox : NSScrollView 699 @interface DWScrollBox : NSScrollView
700 { 700 {
701 void *userdata; 701 void *userdata;
702 id box;
702 } 703 }
703 -(void *)userdata; 704 -(void *)userdata;
704 -(void)setUserdata:(void *)input; 705 -(void)setUserdata:(void *)input;
706 -(void)setBox:(void *)input;
707 -(id)box;
705 @end 708 @end
706 709
707 @implementation DWScrollBox 710 @implementation DWScrollBox
708 -(void *)userdata { return userdata; } 711 -(void *)userdata { return userdata; }
709 -(void)setUserdata:(void *)input { userdata = input; } 712 -(void)setUserdata:(void *)input { userdata = input; }
713 -(void)setBox:(void *)input { box = input; }
714 -(id)box { return box; }
710 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; } 715 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; }
711 @end 716 @end
712 717
713 /* Subclass for a entryfield type */ 718 /* Subclass for a entryfield type */
714 @interface DWEntryField : NSTextField 719 @interface DWEntryField : NSTextField
2618 */ 2623 */
2619 HWND API dw_scrollbox_new( int type, int pad ) 2624 HWND API dw_scrollbox_new( int type, int pad )
2620 { 2625 {
2621 DWScrollBox *scrollbox = [[DWScrollBox alloc] init]; 2626 DWScrollBox *scrollbox = [[DWScrollBox alloc] init];
2622 DWBox *box = dw_box_new(type, pad); 2627 DWBox *box = dw_box_new(type, pad);
2628 DWBox *tmpbox = dw_box_new(DW_VERT, 0);
2629 dw_box_pack_start(tmpbox, box, 1, 1, TRUE, TRUE, 0);
2623 [scrollbox setHasVerticalScroller:YES]; 2630 [scrollbox setHasVerticalScroller:YES];
2624 [scrollbox setHasHorizontalScroller:YES]; 2631 [scrollbox setHasHorizontalScroller:YES];
2625 [scrollbox setBorderType:NSNoBorder]; 2632 [scrollbox setBorderType:NSNoBorder];
2626 [scrollbox setDrawsBackground:NO]; 2633 [scrollbox setDrawsBackground:NO];
2627 [scrollbox setDocumentView:box]; 2634 [scrollbox setBox:box];
2635 [scrollbox setDocumentView:tmpbox];
2628 return scrollbox; 2636 return scrollbox;
2629 } 2637 }
2630 2638
2631 /* 2639 /*
2632 * Returns the position of the scrollbar in the scrollbox 2640 * Returns the position of the scrollbar in the scrollbox
2684 view = [window contentView]; 2692 view = [window contentView];
2685 } 2693 }
2686 else if([ object isMemberOfClass:[ DWScrollBox class ] ]) 2694 else if([ object isMemberOfClass:[ DWScrollBox class ] ])
2687 { 2695 {
2688 DWScrollBox *scrollbox = box; 2696 DWScrollBox *scrollbox = box;
2689 view = [scrollbox documentView]; 2697 view = [scrollbox box];
2690 } 2698 }
2691 2699
2692 thisbox = [view box]; 2700 thisbox = [view box];
2693 thisitem = thisbox->items; 2701 thisitem = thisbox->items;
2694 object = item; 2702 object = item;
2792 view = [window contentView]; 2800 view = [window contentView];
2793 } 2801 }
2794 else if([ object isMemberOfClass:[ DWScrollBox class ] ]) 2802 else if([ object isMemberOfClass:[ DWScrollBox class ] ])
2795 { 2803 {
2796 DWScrollBox *scrollbox = box; 2804 DWScrollBox *scrollbox = box;
2797 view = [scrollbox documentView]; 2805 view = [scrollbox box];
2798 } 2806 }
2799 2807
2800 thisbox = [view box]; 2808 thisbox = [view box];
2801 thisitem = thisbox->items; 2809 thisitem = thisbox->items;
2802 object = item; 2810 object = item;