src/gui/kernel/qguifunctions_wince.cpp
changeset 33 3e2da88830cd
parent 19 fcece45ef507
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
    74 #endif
    74 #endif
    75 #ifndef SHIDIF_SIZEDLGFULLSCREEN
    75 #ifndef SHIDIF_SIZEDLGFULLSCREEN
    76 #define SHIDIF_SIZEDLGFULLSCREEN 0x0004
    76 #define SHIDIF_SIZEDLGFULLSCREEN 0x0004
    77 #endif
    77 #endif
    78 
    78 
       
    79 #ifndef SHDB_HIDE
       
    80 #define SHDB_HIDE 0x0002
       
    81 #endif
       
    82 
    79 #ifndef SHFS_SHOWTASKBAR
    83 #ifndef SHFS_SHOWTASKBAR
    80 #define SHFS_SHOWTASKBAR 0x0001
    84 #define SHFS_SHOWTASKBAR 0x0001
    81 #endif
    85 #endif
    82 #ifndef SHFS_HIDETASKBAR
    86 #ifndef SHFS_HIDETASKBAR
    83 #define SHFS_HIDETASKBAR 0x0002
    87 #define SHFS_HIDETASKBAR 0x0002
   110 #endif
   114 #endif
   111 
   115 
   112 typedef BOOL (*AygInitDialog)(AygSHINITDLGINFO*);
   116 typedef BOOL (*AygInitDialog)(AygSHINITDLGINFO*);
   113 typedef BOOL (*AygFullScreen)(HWND, DWORD);
   117 typedef BOOL (*AygFullScreen)(HWND, DWORD);
   114 typedef BOOL (*AygSHSipInfo)(UINT, UINT, PVOID, UINT);
   118 typedef BOOL (*AygSHSipInfo)(UINT, UINT, PVOID, UINT);
       
   119 typedef BOOL (*AygSHDoneButton)(HWND, DWORD);
   115 
   120 
   116 static AygInitDialog ptrAygInitDialog = 0;
   121 static AygInitDialog ptrAygInitDialog = 0;
   117 static AygFullScreen ptrAygFullScreen = 0;
   122 static AygFullScreen ptrAygFullScreen = 0;
   118 static AygSHSipInfo  ptrAygSHSipInfo  = 0;
   123 static AygSHSipInfo  ptrAygSHSipInfo  = 0;
       
   124 static AygSHDoneButton ptrAygSHDoneButton = 0;
   119 static bool aygResolved = false;
   125 static bool aygResolved = false;
   120 
   126 
   121 static void resolveAygLibs()
   127 static void resolveAygLibs()
   122 {
   128 {
   123     if (!aygResolved) {
   129     if (!aygResolved) {
   126         if (!ayglib.load())
   132         if (!ayglib.load())
   127             return;
   133             return;
   128         ptrAygInitDialog = (AygInitDialog) ayglib.resolve("SHInitDialog");
   134         ptrAygInitDialog = (AygInitDialog) ayglib.resolve("SHInitDialog");
   129         ptrAygFullScreen = (AygFullScreen) ayglib.resolve("SHFullScreen");
   135         ptrAygFullScreen = (AygFullScreen) ayglib.resolve("SHFullScreen");
   130         ptrAygSHSipInfo  = (AygSHSipInfo)  ayglib.resolve("SHSipInfo");
   136         ptrAygSHSipInfo  = (AygSHSipInfo)  ayglib.resolve("SHSipInfo");
   131     }
   137         ptrAygSHDoneButton = (AygSHDoneButton) ayglib.resolve("SHDoneButton");
   132 }
   138     }
   133 
   139 }
   134 struct DIBINFO : public BITMAPINFO
       
   135 {
       
   136     RGBQUAD arColors[255];
       
   137 
       
   138     operator LPBITMAPINFO() { return (LPBITMAPINFO) this; }
       
   139     operator LPBITMAPINFOHEADER() { return &bmiHeader; }
       
   140     RGBQUAD* ColorTable() { return bmiColors; }
       
   141 };
       
   142 
   140 
   143 int qt_wince_GetDIBits(HDC /*hdc*/ , HBITMAP hSourceBitmap, uint, uint, LPVOID lpvBits, LPBITMAPINFO, uint)
   141 int qt_wince_GetDIBits(HDC /*hdc*/ , HBITMAP hSourceBitmap, uint, uint, LPVOID lpvBits, LPBITMAPINFO, uint)
   144 {
   142 {
   145     if (!lpvBits) {
   143     if (!lpvBits) {
   146         qWarning("::GetDIBits(), lpvBits NULL");
   144         qWarning("::GetDIBits(), lpvBits NULL");
   321         shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN;
   319         shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN;
   322         if (widget->windowFlags() & Qt::WindowCancelButtonHint)
   320         if (widget->windowFlags() & Qt::WindowCancelButtonHint)
   323             shidi.dwFlags |= SHIDIF_CANCELBUTTON;
   321             shidi.dwFlags |= SHIDIF_CANCELBUTTON;
   324         if (widget->windowFlags() & Qt::WindowOkButtonHint)
   322         if (widget->windowFlags() & Qt::WindowOkButtonHint)
   325             shidi.dwFlags |= SHIDIF_DONEBUTTON;
   323             shidi.dwFlags |= SHIDIF_DONEBUTTON;
       
   324         if (!(widget->windowFlags() & (Qt::WindowCancelButtonHint | Qt::WindowOkButtonHint)))
       
   325             shidi.dwFlags |= SHIDIF_CANCELBUTTON;
   326         resolveAygLibs();
   326         resolveAygLibs();
   327         if (ptrAygInitDialog)
   327         if (ptrAygInitDialog)
   328             ptrAygInitDialog(&shidi);
   328             ptrAygInitDialog(&shidi);
   329     } else {
   329     } else {
   330         RECT r;
   330         RECT r;
   331         SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
   331         SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
   332         MoveWindow(hwnd, r.top, r.left, r.right - r.left, r.bottom - r.top, true);
   332         MoveWindow(hwnd, r.top, r.left, r.right - r.left, r.bottom - r.top, true);
   333         SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong (hwnd, GWL_EXSTYLE) | WS_EX_NODRAG);
   333         SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong (hwnd, GWL_EXSTYLE) | WS_EX_NODRAG);
       
   334     }
       
   335 }
       
   336 
       
   337 void qt_wince_unmaximize(QWidget *widget)
       
   338 {
       
   339     if (ptrAygSHDoneButton && qt_wince_is_mobile()
       
   340         && !(widget->windowFlags() & (Qt::WindowCancelButtonHint | Qt::WindowOkButtonHint)))
       
   341     {
       
   342         // Hide the [X] button, we've added in qt_wince_maximize.
       
   343         ptrAygSHDoneButton(widget->winId(), SHDB_HIDE);
   334     }
   344     }
   335 }
   345 }
   336 
   346 
   337 void qt_wince_minimize(HWND hwnd)
   347 void qt_wince_minimize(HWND hwnd)
   338 {
   348 {