diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2016-03-12 22:24:20 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2016-03-12 22:24:20 +0000 |
| commit | e6631a0f7fdc8d3383927bac49f521791cddcc9c (patch) | |
| tree | b753578787e06c5aa2acea4c215063cb34167093 /src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | |
| parent | 4643f3e98c8bfabc262770bca5afc31a8b38c7f5 (diff) | |
Moved the Fl_Window::decorated_*() functions teh Window_Driver
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11356 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx')
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx index 01f5225bd..6e7d546da 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -19,6 +19,7 @@ #include "../../config_lib.h" #include <FL/Fl.H> +#include <FL/Fl_Window.H> #include <FL/Fl_Image.H> #include <FL/Fl_Bitmap.H> #include <FL/Fl_Window.H> @@ -47,6 +48,57 @@ Fl_WinAPI_Window_Driver::~Fl_WinAPI_Window_Driver() } } + +// --- private + +RECT Fl_WinAPI_Window_Driver::border_width_title_bar_height(int &bx, int &by, int &bt) +{ + Fl_Window *win = pWindow; + RECT r = {0,0,0,0}; + bx = by = bt = 0; + if (win->shown() && !win->parent() && win->border() && win->visible()) { + static HMODULE dwmapi_dll = LoadLibrary("dwmapi.dll"); + typedef HRESULT (WINAPI* DwmGetWindowAttribute_type)(HWND hwnd, DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute); + static DwmGetWindowAttribute_type DwmGetWindowAttribute = dwmapi_dll ? + (DwmGetWindowAttribute_type)GetProcAddress(dwmapi_dll, "DwmGetWindowAttribute") : NULL; + int need_r = 1; + if (DwmGetWindowAttribute) { + const DWORD DWMWA_EXTENDED_FRAME_BOUNDS = 9; + if ( DwmGetWindowAttribute(fl_xid(win), DWMWA_EXTENDED_FRAME_BOUNDS, &r, sizeof(RECT)) == S_OK ) { + need_r = 0; + } + } + if (need_r) { + GetWindowRect(fl_xid(win), &r); + } + bx = (r.right - r.left - win->w())/2; + by = bx; + bt = r.bottom - r.top - win->h() - 2*by; + } + return RECT(r); +} + + +// --- window data + +int Fl_WinAPI_Window_Driver::decorated_w() +{ + int bt, bx, by; + border_width_title_bar_height(bx, by, bt); + return pWindow->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; +} + + + + + void Fl_WinAPI_Window_Driver::shape_bitmap_(Fl_Image* b) { shape_data_->shape_ = b; } |
