diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2016-03-24 01:20:08 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2016-03-24 01:20:08 +0000 |
| commit | 4a31fd7aed27f2429724922f2dc77c83f608c904 (patch) | |
| tree | a5dc238569974398c24b730731eed963c174ab7e /src/drivers | |
| parent | abc12cd376a615af7182b81a435fa2ccb63e4e5d (diff) | |
Provide Fl_Window_Driver accessor methods for public Fl_Window attributes.
These methods are intended to be used instead of pWindow->method()
for better code readability and easier porting of methods from
Fl_Window to Fl_Window_Driver.
New methods: x(), y(), y(), h(), shown(), parent(), border(),
visible(), and visible_r().
We should add more such methods if appropriate.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11414 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 8 | ||||
| -rw-r--r-- | src/drivers/Pico/Fl_Pico_Window_Driver.cxx | 4 | ||||
| -rw-r--r-- | src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx | 4 | ||||
| -rw-r--r-- | src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx | 8 | ||||
| -rw-r--r-- | src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx | 10 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 32 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.cxx | 42 |
7 files changed, 54 insertions, 54 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx index ec1d2cf73..f3fba0131 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx @@ -101,7 +101,7 @@ void Fl_Cocoa_Window_Driver::draw_begin() if (shape_data_) { # if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 if (shape_data_->mask && (&CGContextClipToMask != NULL)) { - CGContextClipToMask(gc, CGRectMake(0,0,pWindow->w(),pWindow->h()), shape_data_->mask); // requires Mac OS 10.4 + CGContextClipToMask(gc, CGRectMake(0,0,w(),h()), shape_data_->mask); // requires Mac OS 10.4 } CGContextSaveGState(gc); # endif @@ -114,13 +114,13 @@ void Fl_Cocoa_Window_Driver::draw_end() // on OS X, windows have no frame. Before OS X 10.7, to resize a window, we drag the lower right // corner. This code draws a little ribbed triangle for dragging. CGContextRef gc = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc(); - if (fl_mac_os_version < 100700 && gc && !pWindow->parent() && pWindow->resizable() && + if (fl_mac_os_version < 100700 && gc && !parent() && pWindow->resizable() && (!size_range_set() || minh() != maxh() || minw() != maxw())) { int dx = Fl::box_dw(pWindow->box())-Fl::box_dx(pWindow->box()); int dy = Fl::box_dh(pWindow->box())-Fl::box_dy(pWindow->box()); if (dx<=0) dx = 1; if (dy<=0) dy = 1; - int x1 = pWindow->w()-dx-1, x2 = x1, y1 = pWindow->h()-dx-1, y2 = y1; + int x1 = w()-dx-1, x2 = x1, y1 = h()-dx-1, y2 = y1; Fl_Color c[4] = { pWindow->color(), fl_color_average(pWindow->color(), FL_WHITE, 0.7f), @@ -229,7 +229,7 @@ void Fl_Cocoa_Window_Driver::hide() { // MacOS X manages a single pointer per application. Make sure that hiding // a toplevel window will not leave us with some random pointer shape, or // worst case, an invisible pointer - if (ip && !pWindow->parent()) pWindow->cursor(FL_CURSOR_DEFAULT); + if (ip && !parent()) pWindow->cursor(FL_CURSOR_DEFAULT); if ( hide_common() ) return; Fl_X::q_release_context(ip); if ( ip->xid == fl_window ) diff --git a/src/drivers/Pico/Fl_Pico_Window_Driver.cxx b/src/drivers/Pico/Fl_Pico_Window_Driver.cxx index d1fb664c8..da8be8097 100644 --- a/src/drivers/Pico/Fl_Pico_Window_Driver.cxx +++ b/src/drivers/Pico/Fl_Pico_Window_Driver.cxx @@ -40,13 +40,13 @@ Fl_Pico_Window_Driver::~Fl_Pico_Window_Driver() int Fl_Pico_Window_Driver::decorated_w() { - return pWindow->w(); + return w(); } int Fl_Pico_Window_Driver::decorated_h() { - return pWindow->h(); + return h(); } // diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx index c7bd1784e..5cc0142a7 100644 --- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx @@ -512,11 +512,11 @@ Window fl_window; //void Fl_Image_Surface::translate(int x, int y) { } //void Fl_Image_Surface::untranslate() { } -void Fl::add_fd(int, int, void (*)(int, void*), void*) +void Fl::add_fd(int, int, Fl_FD_Handler, void*) { } -void Fl::add_fd(int, void (*)(int, void*), void*) +void Fl::add_fd(int, Fl_FD_Handler, void*) { } diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx index 19312ee77..c8983fc41 100644 --- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx @@ -58,12 +58,12 @@ Fl_X *Fl_PicoAndroid_Window_Driver::makeWindow() Fl_PicoAndroid_Screen_Driver *scr = (Fl_PicoAndroid_Screen_Driver*)Fl::screen_driver(); Fl_Group::current(0); - if (pWindow->parent() && !Fl_X::i(pWindow->window())) { + if (parent() && !Fl_X::i(pWindow->window())) { pWindow->set_visible(); return 0L; } Window parent; - if (pWindow->parent()) { + if (parent()) { parent = fl_xid(pWindow->window()); } else { parent = 0; @@ -73,9 +73,9 @@ Fl_X *Fl_PicoAndroid_Window_Driver::makeWindow() x->w = pWindow; x->region = 0; if (!pWindow->force_position()) { -// pNativeWindow = SDL_CreateWindow(pWindow->label(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, pWindow->w(), pWindow->h(), 0); +// pNativeWindow = SDL_CreateWindow(pWindow->label(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w(), h(), 0); } else { -// pNativeWindow = SDL_CreateWindow(pWindow->label(), pWindow->x(), pWindow->y(), pWindow->w(), pWindow->h(), 0); +// pNativeWindow = SDL_CreateWindow(pWindow->label(), x(), y(), w(), h(), 0); } pNativeWindow = scr->pApp->window; // x->xid = SDL_CreateRenderer(pNativeWindow, -1, SDL_RENDERER_ACCELERATED); diff --git a/src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx b/src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx index 354713f19..c18ac639a 100644 --- a/src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx +++ b/src/drivers/PicoSDL/Fl_PicoSDL_Window_Driver.cxx @@ -45,12 +45,12 @@ Fl_PicoSDL_Window_Driver::~Fl_PicoSDL_Window_Driver() Fl_X *Fl_PicoSDL_Window_Driver::makeWindow() { Fl_Group::current(0); - if (pWindow->parent() && !Fl_X::i(pWindow->window())) { + if (parent() && !Fl_X::i(pWindow->window())) { pWindow->set_visible(); return 0L; } Window parent; - if (pWindow->parent()) { + if (parent()) { parent = fl_xid(pWindow->window()); } else { parent = 0; @@ -60,9 +60,9 @@ Fl_X *Fl_PicoSDL_Window_Driver::makeWindow() x->w = pWindow; x->region = 0; if (!pWindow->force_position()) { - pNativeWindow = SDL_CreateWindow(pWindow->label(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, pWindow->w(), pWindow->h(), 0); + pNativeWindow = SDL_CreateWindow(pWindow->label(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w(), h(), 0); } else { - pNativeWindow = SDL_CreateWindow(pWindow->label(), pWindow->x(), pWindow->y(), pWindow->w(), pWindow->h(), 0); + pNativeWindow = SDL_CreateWindow(pWindow->label(), x(), y(), w(), h(), 0); } x->xid = SDL_CreateRenderer(pNativeWindow, -1, SDL_RENDERER_ACCELERATED); x->next = Fl_X::first; @@ -83,7 +83,7 @@ Fl_X *Fl_PicoSDL_Window_Driver::makeWindow() void Fl_PicoSDL_Window_Driver::flush_single() { - if (!pWindow->shown()) return; + if (!shown()) return; pWindow->make_current(); Fl_X *i = Fl_X::i(pWindow); if (!i) return; diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx index c2afc67f3..ebb118ef5 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -94,14 +94,14 @@ int Fl_WinAPI_Window_Driver::decorated_w() { int bt, bx, by; border_width_title_bar_height(bx, by, bt); - return pWindow->w() + 2 * bx; + return w() + 2 * bx; } int Fl_WinAPI_Window_Driver::decorated_h() { int bt, bx, by; border_width_title_bar_height(bx, by, bt); - return pWindow->h() + bt + 2 * by; + return h() + bt + 2 * by; } @@ -248,10 +248,10 @@ static HRGN bitmap2region(Fl_Image* image) { void Fl_WinAPI_Window_Driver::draw_begin() { if (shape_data_) { - if ((shape_data_->lw_ != pWindow->w() || shape_data_->lh_ != pWindow->h()) && shape_data_->shape_) { + if ((shape_data_->lw_ != w() || shape_data_->lh_ != h()) && shape_data_->shape_) { // size of window has changed since last time - shape_data_->lw_ = pWindow->w(); - shape_data_->lh_ = pWindow->h(); + shape_data_->lw_ = w(); + shape_data_->lh_ = h(); Fl_Image* temp = shape_data_->shape_->copy(shape_data_->lw_, shape_data_->lh_); HRGN region = bitmap2region(temp); SetWindowRgn(fl_xid(pWindow), region, TRUE); // the system deletes the region when it's no longer needed @@ -263,13 +263,13 @@ void Fl_WinAPI_Window_Driver::draw_begin() void Fl_WinAPI_Window_Driver::flush_double() { - if (!pWindow->shown()) return; + if (!shown()) return; pWindow->make_current(); // make sure fl_gc is non-zero Fl_X *i = Fl_X::i(pWindow); if (!i) return; // window not yet created if (!i->other_xid) { - i->other_xid = fl_create_offscreen(pWindow->w(), pWindow->h()); + i->other_xid = fl_create_offscreen(w(), h()); pWindow->clear_damage(FL_DAMAGE_ALL); } if (pWindow->damage() & ~FL_DAMAGE_EXPOSE) { @@ -280,7 +280,7 @@ void Fl_WinAPI_Window_Driver::flush_double() fl_end_offscreen(); } - int X,Y,W,H; fl_clip_box(0,0,pWindow->w(),pWindow->h(),X,Y,W,H); + int X,Y,W,H; fl_clip_box(0,0,w(),h(),X,Y,W,H); if (i->other_xid) fl_copy_offscreen(X, Y, W, H, i->other_xid, X, Y); } @@ -289,7 +289,7 @@ void Fl_WinAPI_Window_Driver::flush_overlay() { Fl_Overlay_Window *oWindow = pWindow->as_overlay_window(); - if (!pWindow->shown()) return; + if (!shown()) return; pWindow->make_current(); // make sure fl_gc is non-zero Fl_X *i = Fl_X::i(pWindow); if (!i) return; // window not yet created @@ -298,7 +298,7 @@ void Fl_WinAPI_Window_Driver::flush_overlay() pWindow->clear_damage((uchar)(pWindow->damage()&~FL_DAMAGE_OVERLAY)); if (!i->other_xid) { - i->other_xid = fl_create_offscreen(pWindow->w(), pWindow->h()); + i->other_xid = fl_create_offscreen(w(), h()); pWindow->clear_damage(FL_DAMAGE_ALL); } if (pWindow->damage() & ~FL_DAMAGE_EXPOSE) { @@ -310,7 +310,7 @@ void Fl_WinAPI_Window_Driver::flush_overlay() } if (eraseoverlay) fl_clip_region(0); - int X, Y, W, H; fl_clip_box(0, 0, pWindow->w(), pWindow->h(), X, Y, W, H); + int X, Y, W, H; fl_clip_box(0, 0, w(), h(), X, Y, W, H); if (i->other_xid) fl_copy_offscreen(X, Y, W, H, i->other_xid, X, Y); if (oWindow->overlay_ == oWindow) oWindow->draw_overlay(); @@ -407,7 +407,7 @@ void Fl_Window::default_icons(HICON big_icon, HICON small_icon) { void Fl_WinAPI_Window_Driver::wait_for_expose() { - if (!pWindow->shown()) return; + if (!shown()) return; Fl_X *i = Fl_X::i(pWindow); while (!i || i->wait_for_expose) { Fl::wait(); @@ -430,7 +430,7 @@ void Fl_WinAPI_Window_Driver::make_current() { } void Fl_WinAPI_Window_Driver::label(const char *name,const char *iname) { - if (pWindow->shown() && !pWindow->parent()) { + if (shown() && !parent()) { if (!name) name = ""; size_t l = strlen(name); // WCHAR *lab = (WCHAR*) malloc((l + 1) * sizeof(short)); @@ -568,7 +568,7 @@ void Fl_X::make_fullscreen(int X, int Y, int W, int H) { void Fl_WinAPI_Window_Driver::fullscreen_on() { pWindow->_set_fullscreen(); - Fl_X::i(pWindow)->make_fullscreen(pWindow->x(), pWindow->y(), pWindow->w(), pWindow->h()); + Fl_X::i(pWindow)->make_fullscreen(x(), y(), w(), h()); Fl::handle(FL_FULLSCREEN, pWindow); } @@ -588,7 +588,7 @@ void Fl_WinAPI_Window_Driver::fullscreen_off(int X, int Y, int W, int H) { style |= WS_CAPTION; break; case 2: - if (pWindow->border()) { + if (border()) { style |= WS_THICKFRAME | WS_CAPTION; } break; @@ -596,7 +596,7 @@ void Fl_WinAPI_Window_Driver::fullscreen_off(int X, int Y, int W, int H) { Fl_X::i(pWindow)->xid = xid; // Adjust for decorations (but not if that puts the decorations // outside the screen) - if ((X != pWindow->x()) || (Y != pWindow->y())) { + if ((X != x()) || (Y != y())) { X -= bx; Y -= by+bt; } diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx index dbfee0371..cad3f3c4b 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx @@ -194,7 +194,7 @@ void Fl_X11_Window_Driver::take_focus() void Fl_X11_Window_Driver::draw_begin() { if (shape_data_) { - if (( shape_data_->lw_ != pWindow->w() || shape_data_->lh_ != pWindow->h() ) && shape_data_->shape_) { + if (( shape_data_->lw_ != w() || shape_data_->lh_ != h() ) && shape_data_->shape_) { // size of window has changed since last time combine_mask(); } @@ -204,7 +204,7 @@ void Fl_X11_Window_Driver::draw_begin() void Fl_X11_Window_Driver::flush_double() { - if (!pWindow->shown()) return; + if (!shown()) return; #if USE_XDBE if (can_xdbe()) flush_double_dbe(0); else #endif @@ -216,7 +216,7 @@ void Fl_X11_Window_Driver::flush_double(int erase_overlay) pWindow->make_current(); // make sure fl_gc is non-zero Fl_X *i = Fl_X::i(pWindow); if (!i->other_xid) { - i->other_xid = fl_create_offscreen(pWindow->w(), pWindow->h()); + i->other_xid = fl_create_offscreen(w(), h()); pWindow->clear_damage(FL_DAMAGE_ALL); } if (pWindow->damage() & ~FL_DAMAGE_EXPOSE) { @@ -226,14 +226,14 @@ void Fl_X11_Window_Driver::flush_double(int erase_overlay) fl_window = i->xid; } if (erase_overlay) fl_clip_region(0); - int X,Y,W,H; fl_clip_box(0,0,pWindow->w(),pWindow->h(),X,Y,W,H); + int X,Y,W,H; fl_clip_box(0,0,w(),h(),X,Y,W,H); if (i->other_xid) fl_copy_offscreen(X, Y, W, H, i->other_xid, X, Y); } void Fl_X11_Window_Driver::flush_overlay() { - if (!pWindow->shown()) return; + if (!shown()) return; int erase_overlay = (pWindow->damage()&FL_DAMAGE_OVERLAY); pWindow->clear_damage((uchar)(pWindow->damage()&~FL_DAMAGE_OVERLAY)); #if USE_XDBE @@ -322,8 +322,8 @@ void Fl_X11_Window_Driver::combine_mask() #endif } if (!XShapeCombineMask_f) return; - shape_data_->lw_ = pWindow->w(); - shape_data_->lh_ = pWindow->h(); + shape_data_->lw_ = w(); + shape_data_->lh_ = h(); Fl_Image* temp = shape_data_->shape_->copy(shape_data_->lw_, shape_data_->lh_); Pixmap pbitmap = XCreateBitmapFromData(fl_display, fl_xid(pWindow), (const char*)*temp->data(), @@ -383,7 +383,7 @@ void Fl_X11_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, F { Fl_RGB_Image *r_top, *r_left, *r_bottom, *r_right; top = left = bottom = right = NULL; - if (pWindow->decorated_h() == pWindow->h()) return; + if (pWindow->decorated_h() == h()) return; Window from = fl_window; Fl_Surface_Device *previous = Fl_Surface_Device::surface(); Fl_Display_Device::display_device()->set_current(); @@ -402,22 +402,22 @@ void Fl_X11_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, F fl_window = parent; uchar *rgb; if (htop) { - rgb = fl_read_image(NULL, 0, 0, - (pWindow->w() + 2 * wsides), htop); - r_top = new Fl_RGB_Image(rgb, pWindow->w() + 2 * wsides, htop, 3); + rgb = fl_read_image(NULL, 0, 0, - (w() + 2 * wsides), htop); + r_top = new Fl_RGB_Image(rgb, w() + 2 * wsides, htop, 3); r_top->alloc_array = 1; top = Fl_Shared_Image::get(r_top); } if (wsides) { - rgb = fl_read_image(NULL, 0, htop, -wsides, pWindow->h()); - r_left = new Fl_RGB_Image(rgb, wsides, pWindow->h(), 3); + rgb = fl_read_image(NULL, 0, htop, -wsides, h()); + r_left = new Fl_RGB_Image(rgb, wsides, h(), 3); r_left->alloc_array = 1; left = Fl_Shared_Image::get(r_left); - rgb = fl_read_image(NULL, pWindow->w() + wsides, htop, -wsides, pWindow->h()); - r_right = new Fl_RGB_Image(rgb, wsides, pWindow->h(), 3); + rgb = fl_read_image(NULL, w() + wsides, htop, -wsides, h()); + r_right = new Fl_RGB_Image(rgb, wsides, h(), 3); r_right->alloc_array = 1; right = Fl_Shared_Image::get(r_right); - rgb = fl_read_image(NULL, 0, htop + pWindow->h(), -(pWindow->w() + 2*wsides), hbottom); - r_bottom = new Fl_RGB_Image(rgb, pWindow->w() + 2*wsides, hbottom, 3); + rgb = fl_read_image(NULL, 0, htop + h(), -(w() + 2*wsides), hbottom); + r_bottom = new Fl_RGB_Image(rgb, w() + 2*wsides, hbottom, 3); r_bottom->alloc_array = 1; bottom = Fl_Shared_Image::get(r_bottom); } @@ -426,7 +426,7 @@ void Fl_X11_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, F } void Fl_X11_Window_Driver::wait_for_expose() { - if (!pWindow->shown()) return; + if (!shown()) return; Fl_X *i = Fl_X::i(pWindow); while (!i || i->wait_for_expose) { Fl::wait(); @@ -436,7 +436,7 @@ void Fl_X11_Window_Driver::wait_for_expose() { // make X drawing go into this window (called by subclass flush() impl.) void Fl_X11_Window_Driver::make_current() { - if (!pWindow->shown()) { + if (!shown()) { fl_alert("Fl_Window::make_current(), but window is not shown()."); Fl::fatal("Fl_Window::make_current(), but window is not shown()."); } @@ -453,7 +453,7 @@ void Fl_X11_Window_Driver::make_current() { void Fl_X11_Window_Driver::show_menu() { #if HAVE_OVERLAY - if (!pWindow->shown() && ((Fl_Menu_Window*)pWindow)->overlay() && fl_find_overlay_visual()) { + if (!shown() && ((Fl_Menu_Window*)pWindow)->overlay() && fl_find_overlay_visual()) { XInstallColormap(fl_display, fl_overlay_colormap); fl_background_pixel = int(fl_transparent_pixel); Fl_X::make_xid(pWindow, fl_overlay_visual, fl_overlay_colormap); @@ -497,12 +497,12 @@ void Fl_X11_Window_Driver::unmap() { // the window full screen will lose the size of the border off the // bottom and right. void Fl_X11_Window_Driver::use_border() { - if (pWindow->shown()) Fl_X::i(pWindow)->sendxjunk(); + if (shown()) Fl_X::i(pWindow)->sendxjunk(); } void Fl_X11_Window_Driver::size_range() { Fl_Window_Driver::size_range(); - if (pWindow->shown()) Fl_X::i(pWindow)->sendxjunk(); + if (shown()) Fl_X::i(pWindow)->sendxjunk(); } void Fl_X11_Window_Driver::iconize() { |
