Mercurial > dwindows
comparison mac/dw.m @ 1040:7ea8a428e0cc
Attempt at adding support for groupboxes to dw_window_set/get_font() on Mac.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 26 May 2011 09:25:27 +0000 |
parents | cbac281970a9 |
children | 6a57bf20d8f9 |
comparison
equal
deleted
inserted
replaced
1039:860d6e73f8bb | 1040:7ea8a428e0cc |
---|---|
7225 { | 7225 { |
7226 [object lockFocus]; | 7226 [object lockFocus]; |
7227 [font set]; | 7227 [font set]; |
7228 [object unlockFocus]; | 7228 [object unlockFocus]; |
7229 } | 7229 } |
7230 if([object isKindOfClass:[NSControl class]]) | 7230 if([object isMemberOfClass:[DWGroupBox class]]) |
7231 { | |
7232 [object setTitleFont:font]; | |
7233 } | |
7234 else if([object isKindOfClass:[NSControl class]]) | |
7231 { | 7235 { |
7232 [object setFont:font]; | 7236 [object setFont:font]; |
7233 [[object cell] setFont:font]; | 7237 [[object cell] setFont:font]; |
7234 } | 7238 } |
7235 else if([object isMemberOfClass:[DWRender class]]) | 7239 else if([object isMemberOfClass:[DWRender class]]) |
7248 * handle: The window handle from which to obtain the font. | 7252 * handle: The window handle from which to obtain the font. |
7249 */ | 7253 */ |
7250 char * API dw_window_get_font(HWND handle) | 7254 char * API dw_window_get_font(HWND handle) |
7251 { | 7255 { |
7252 id object = handle; | 7256 id object = handle; |
7253 | 7257 NSFont *font = nil; |
7254 if([object isKindOfClass:[NSControl class]] || [object isMemberOfClass:[DWRender class]]) | 7258 |
7255 { | 7259 if([object isMemberOfClass:[DWGroupBox class]]) |
7256 NSFont *font = [object font]; | 7260 { |
7261 font = [object titleFont]; | |
7262 } | |
7263 else if([object isKindOfClass:[NSControl class]] || [object isMemberOfClass:[DWRender class]]) | |
7264 { | |
7265 font = [object font]; | |
7266 } | |
7267 if(font) | |
7268 { | |
7257 NSString *fontname = [font fontName]; | 7269 NSString *fontname = [font fontName]; |
7258 NSString *output = [NSString stringWithFormat:@"%d.%s", (int)[font pointSize], [fontname UTF8String]]; | 7270 NSString *output = [NSString stringWithFormat:@"%d.%s", (int)[font pointSize], [fontname UTF8String]]; |
7259 return strdup([output UTF8String]); | 7271 return strdup([output UTF8String]); |
7260 } | 7272 } |
7261 return NULL; | 7273 return NULL; |