Mercurial > dwindows
comparison mac/dw.m @ 807:f7016a38bedd
Fix for dw_window_set_text() on buttons not working.
Implemented dw_mle_get_size() returning the line count.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 24 Mar 2011 15:42:50 +0000 |
parents | 16964b141964 |
children | c0641a6d4258 |
comparison
equal
deleted
inserted
replaced
806:16964b141964 | 807:f7016a38bedd |
---|---|
3677 { | 3677 { |
3678 NSScrollView *sv = handle; | 3678 NSScrollView *sv = handle; |
3679 DWMLE *mle = [sv documentView]; | 3679 DWMLE *mle = [sv documentView]; |
3680 NSTextStorage *ts = [mle textStorage]; | 3680 NSTextStorage *ts = [mle textStorage]; |
3681 NSMutableString *ms = [ts mutableString]; | 3681 NSMutableString *ms = [ts mutableString]; |
3682 | 3682 NSUInteger numberOfLines, index, stringLength = [ms length]; |
3683 *bytes = [ms length]; | 3683 |
3684 *lines = 0; /* TODO: Line count */ | 3684 for(index=0, numberOfLines=0; index < stringLength; numberOfLines++) |
3685 index = NSMaxRange([ms lineRangeForRange:NSMakeRange(index, 0)]); | |
3686 | |
3687 *bytes = stringLength; | |
3688 *lines = numberOfLines; | |
3685 } | 3689 } |
3686 | 3690 |
3687 /* | 3691 /* |
3688 * Deletes text from an MLE box. | 3692 * Deletes text from an MLE box. |
3689 * Parameters: | 3693 * Parameters: |
6411 { | 6415 { |
6412 int _locked_by_me = FALSE; | 6416 int _locked_by_me = FALSE; |
6413 DW_MUTEX_LOCK; | 6417 DW_MUTEX_LOCK; |
6414 NSObject *object = handle; | 6418 NSObject *object = handle; |
6415 | 6419 |
6416 if([ object isKindOfClass:[ NSControl class ] ]) | 6420 if([ object isKindOfClass:[ NSWindow class ] ] || [ object isKindOfClass:[ NSButton class ] ]) |
6421 { | |
6422 id window = handle; | |
6423 [window setTitle:[ NSString stringWithUTF8String:text ]]; | |
6424 } | |
6425 else if([ object isKindOfClass:[ NSControl class ] ]) | |
6417 { | 6426 { |
6418 NSControl *control = handle; | 6427 NSControl *control = handle; |
6419 [control setStringValue:[ NSString stringWithUTF8String:text ]]; | 6428 [control setStringValue:[ NSString stringWithUTF8String:text ]]; |
6420 } | |
6421 else if([ object isKindOfClass:[ NSWindow class ] ]) | |
6422 { | |
6423 NSWindow *window = handle; | |
6424 [window setTitle:[ NSString stringWithUTF8String:text ]]; | |
6425 } | 6429 } |
6426 DW_MUTEX_UNLOCK; | 6430 DW_MUTEX_UNLOCK; |
6427 } | 6431 } |
6428 | 6432 |
6429 /* | 6433 /* |