diff options
| author | Manolo Gouy <Manolo> | 2011-11-12 13:06:54 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2011-11-12 13:06:54 +0000 |
| commit | 409afd29cc021db64c98dff1502c62206c1ed94e (patch) | |
| tree | 3686bd4da08ccff1eeb344926cac05ca0d7a3464 /src | |
| parent | 4fbc7664222c056f78ed5606774434e7b31ca119 (diff) | |
Mac OS: more accurate definition of the Window system-specific type.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9170 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_cocoa.mm | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 143004ff2..58cda0e71 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -1028,7 +1028,7 @@ void fl_open_callback(void (*cb)(const char *)) { w = Fl::next_window(w); } if (w) { - [(FLWindow*)Fl_X::i(w)->xid makeKeyWindow]; + [Fl_X::i(w)->xid makeKeyWindow]; } } fl_unlock_function(); @@ -1059,7 +1059,7 @@ void fl_open_callback(void (*cb)(const char *)) { Fl_X *x; FLWindow *top = 0, *topModal = 0, *topNonModal = 0; for (x = Fl_X::first;x;x = x->next) { - FLWindow *cw = (FLWindow*)x->xid; + FLWindow *cw = x->xid; Fl_Window *win = x->w; if (win && cw && [cw isVisible]) { if (win->modal()) { @@ -1107,7 +1107,7 @@ void fl_open_callback(void (*cb)(const char *)) { FLWindow *top = 0; // sort in all regular windows for (x = Fl_X::first;x;x = x->next) { - FLWindow *cw = (FLWindow*)x->xid; + FLWindow *cw = x->xid; Fl_Window *win = x->w; if (win && cw) { if (win->modal()) { @@ -1119,7 +1119,7 @@ void fl_open_callback(void (*cb)(const char *)) { } // now sort in all modals for (x = Fl_X::first;x;x = x->next) { - FLWindow *cw = (FLWindow*)x->xid; + FLWindow *cw = x->xid; Fl_Window *win = x->w; if (win && cw && [cw isVisible]) { if (win->modal()) { @@ -1130,7 +1130,7 @@ void fl_open_callback(void (*cb)(const char *)) { } // finally all non-modals for (x = Fl_X::first;x;x = x->next) { - FLWindow *cw = (FLWindow*)x->xid; + FLWindow *cw = x->xid; Fl_Window *win = x->w; if (win && cw && [cw isVisible]) { if (win->non_modal()) { @@ -1991,7 +1991,7 @@ void Fl_X::make(Fl_Window* w) } if (w->as_gl_window()) { // if creating a sub-GL-window while (win->window()) win = win->window(); - [(FLWindow*)Fl_X::i(win)->xid setContainsGLsubwindow:YES]; + [Fl_X::i(win)->xid setContainsGLsubwindow:YES]; } fl_show_iconic = 0; } @@ -2153,8 +2153,8 @@ void Fl_Window::size_range_() { NSSize minSize = { minw, minh + bt }; NSSize maxSize = { maxw?maxw:32000, maxh?maxh + bt:32000 }; if (i && i->xid) { - [(NSWindow*)i->xid setMinSize:minSize]; - [(NSWindow*)i->xid setMaxSize:maxSize]; + [i->xid setMinSize:minSize]; + [i->xid setMaxSize:maxSize]; } } @@ -2187,8 +2187,7 @@ void Fl_Window::label(const char *name, const char *mininame) { Fl_Widget::label(name); iconlabel_ = mininame; if (shown() || i) { - NSWindow* nsw = (NSWindow*)i->xid; - q_set_window_title(nsw, name, mininame); + q_set_window_title(i->xid, name, mininame); } } @@ -2209,12 +2208,12 @@ void Fl_Window::show() { Fl_X::make(this); } else { if ( !parent() ) { - if ([(NSWindow*)i->xid isMiniaturized]) { + if ([i->xid isMiniaturized]) { i->w->redraw(); - [(NSWindow*)i->xid deminiaturize:nil]; + [i->xid deminiaturize:nil]; } if (!fl_capture) { - [(NSWindow*)i->xid makeKeyAndOrderFront:nil]; + [i->xid makeKeyAndOrderFront:nil]; } } } @@ -2251,12 +2250,12 @@ void Fl_Window::resize(int X,int Y,int W,int H) { dim.origin.y = main_screen_height - (Y + H); dim.size.width = W; dim.size.height = H + bt; - [(NSWindow*)i->xid setFrame:dim display:YES]; + [i->xid setFrame:dim display:YES]; } else { NSPoint pt; pt.x = X; pt.y = main_screen_height - (Y + h()); - [(NSWindow*)i->xid setFrameOrigin:pt]; + [i->xid setFrameOrigin:pt]; } } resize_from_system = 0; @@ -2293,7 +2292,7 @@ void Fl_Window::make_current() NSView *current_focus = [NSView focusView]; // sometimes current_focus is set to a non-FLTK view: don't touch that if ( [current_focus isKindOfClass:[FLView class]] ) [current_focus unlockFocus]; - [[(NSWindow*)i->xid contentView] lockFocus]; + [[i->xid contentView] lockFocus]; i->gc = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; fl_gc = i->gc; Fl_Region fl_window_region = XRectangleRegion(0,0,w(),h()); @@ -2310,7 +2309,7 @@ void Fl_Window::make_current() // and escapes even clipping!!! // it gets activated when needed (e.g., draw text) CGContextSetShouldAntialias(fl_gc, false); - CGFloat hgt = [[(NSWindow*)fl_window contentView] frame].size.height; + CGFloat hgt = [[fl_window contentView] frame].size.height; CGContextTranslateCTM(fl_gc, 0.5, hgt-0.5f); CGContextScaleCTM(fl_gc, 1.0f, -1.0f); // now 0,0 is top-left point of the window win = this; @@ -2637,18 +2636,18 @@ void Fl_X::relink(Fl_Window *w, Fl_Window *wp) { void Fl_X::destroy() { // subwindows share their xid with their parent window, so should not close it if (!subwindow && w && !w->parent() && xid) { - NSView *topview = [(NSWindow *)xid contentView]; + NSView *topview = [xid contentView]; if ( [NSView focusView] == topview ) { [topview unlockFocus]; } [topview release]; - [(NSWindow *)xid close]; + [xid close]; } } void Fl_X::map() { if (w && xid) { - [(NSWindow *)xid orderFront:nil]; + [xid orderFront:nil]; } //+ link to window list if (w && w->parent()) { @@ -2659,7 +2658,7 @@ void Fl_X::map() { void Fl_X::unmap() { if (w && !w->parent() && xid) { - [(NSWindow *)xid orderOut:nil]; + [xid orderOut:nil]; } if (w && Fl_X::i(w)) Fl_X::i(w)->unlink(); @@ -2737,7 +2736,7 @@ Fl_Region Fl_X::intersect_region_and_rect(Fl_Region current, int x,int y,int w, } void Fl_X::collapse() { - [(NSWindow *)xid miniaturize:nil]; + [xid miniaturize:nil]; } static NSImage *CGBitmapContextToNSImage(CGContextRef c) @@ -3184,7 +3183,7 @@ void *Fl_Sys_Menu_Bar::doMenuOrItemOperation(Fl_Sys_Menu_Bar::menuOrItemOperatio void Fl_X::set_key_window() { - [(NSWindow*)xid makeKeyWindow]; + [xid makeKeyWindow]; } static NSImage *imageFromText(const char *text, int *pwidth, int *pheight) @@ -3268,7 +3267,7 @@ int Fl::dnd(void) } else { while(win->window()) win = win->window(); } - NSView *myview = [(NSWindow*)Fl_X::i(win)->xid contentView]; + NSView *myview = [Fl_X::i(win)->xid contentView]; NSEvent *theEvent = [NSApp currentEvent]; int width, height; @@ -3356,7 +3355,7 @@ CGImageRef Fl_X::CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, i WindowRef Fl_X::window_ref() { - return (WindowRef)[(FLWindow*)xid windowRef]; + return (WindowRef)[xid windowRef]; } // so a CGRect matches exactly what is denoted x,y,w,h for clipping purposes |
