diff options
author | miniak <milan.burda@gmail.com> | 2009-07-01 09:50:07 (GMT) |
---|---|---|
committer | Marius Storm-Olsen <marius@trolltech.com> | 2009-07-01 09:51:18 (GMT) |
commit | 22ab94871c4a924e37eca720a1620da2e1a7259d (patch) | |
tree | 2a8a065b1fb7db76e2651a0340071dc8d8b666a8 /src/activeqt/container/qaxwidget.cpp | |
parent | 5db6c3b72d3c28f55f14883767d29db3441b1b66 (diff) | |
download | Qt-22ab94871c4a924e37eca720a1620da2e1a7259d.zip Qt-22ab94871c4a924e37eca720a1620da2e1a7259d.tar.gz Qt-22ab94871c4a924e37eca720a1620da2e1a7259d.tar.bz2 |
src/activeqt: Remove QT_WA and non-Unicode code paths, dropping Win9x and NT support
Also, buffer sizes passed to Registry APIs were incorrect.
Merge-request: 604
Reviewed-by: Marius Storm-Olsen <marius@trolltech.com>
Diffstat (limited to 'src/activeqt/container/qaxwidget.cpp')
-rw-r--r-- | src/activeqt/container/qaxwidget.cpp | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp index ebec872..615887f 100644 --- a/src/activeqt/container/qaxwidget.cpp +++ b/src/activeqt/container/qaxwidget.cpp @@ -37,11 +37,6 @@ ** ****************************************************************************/ -#ifndef UNICODE -#define UNICODE -#endif - - #include "qaxwidget.h" #ifndef QT_NO_WIN_ACTIVEQT @@ -470,7 +465,7 @@ static QAbstractEventDispatcher::EventFilter previous_filter = 0; #if defined(Q_WS_WINCE) static int filter_ref = 0; #else -static const char *qaxatom = "QAxContainer4_Atom"; +static const wchar_t *qaxatom = L"QAxContainer4_Atom"; #endif // The filter procedure listening to user interaction on the control @@ -714,7 +709,7 @@ bool QAxClientSite::activateObject(bool initialized, const QByteArray &data) BSTR userType; HRESULT result = m_spOleObject->GetUserType(USERCLASSTYPE_SHORT, &userType); if (result == S_OK) { - widget->setWindowTitle(QString::fromUtf16((const ushort *)userType)); + widget->setWindowTitle(QString::fromWCharArray(userType)); CoTaskMemFree(userType); } } else { @@ -984,10 +979,7 @@ HRESULT WINAPI QAxClientSite::TranslateAccelerator(LPMSG lpMsg, DWORD /*grfModif eventTranslated = false; if (lpMsg->message == WM_KEYDOWN && !lpMsg->wParam) return S_OK; - QT_WA_INLINE( - SendMessage(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam), - SendMessageA(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam) - ); + SendMessage(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam); return S_OK; } @@ -1173,15 +1165,15 @@ HRESULT WINAPI QAxClientSite::InsertMenus(HMENU /*hmenuShared*/, LPOLEMENUGROUPW #endif } -static int menuItemEntry(HMENU menu, int index, MENUITEMINFOA item, QString &text, QPixmap &/*icon*/) +static int menuItemEntry(HMENU menu, int index, MENUITEMINFO item, QString &text, QPixmap &/*icon*/) { if (item.fType == MFT_STRING && item.cch) { - char *titlebuf = new char[item.cch+1]; + wchar_t *titlebuf = new wchar_t[item.cch + 1]; item.dwTypeData = titlebuf; item.cch++; - ::GetMenuItemInfoA(menu, index, true, &item); - text = QString::fromLocal8Bit(titlebuf); - delete []titlebuf; + ::GetMenuItemInfo(menu, index, true, &item); + text = QString::fromWCharArray(titlebuf); + delete [] titlebuf; return MFT_STRING; } #if 0 @@ -1191,7 +1183,7 @@ static int menuItemEntry(HMENU menu, int index, MENUITEMINFOA item, QString &tex GetBitmapDimensionEx(hbm, &bmsize); QPixmap pixmap(1,1); QSize sz(MAP_LOGHIM_TO_PIX(bmsize.cx, pixmap.logicalDpiX()), - MAP_LOGHIM_TO_PIX(bmsize.cy, pixmap.logicalDpiY())); + MAP_LOGHIM_TO_PIX(bmsize.cy, pixmap.logicalDpiY())); pixmap.resize(bmsize.cx, bmsize.cy); if (!pixmap.isNull()) { @@ -1215,11 +1207,11 @@ QMenu *QAxClientSite::generatePopup(HMENU subMenu, QWidget *parent) if (count) popup = new QMenu(parent); for (int i = 0; i < count; ++i) { - MENUITEMINFOA item; - memset(&item, 0, sizeof(MENUITEMINFOA)); - item.cbSize = sizeof(MENUITEMINFOA); + MENUITEMINFO item; + memset(&item, 0, sizeof(MENUITEMINFO)); + item.cbSize = sizeof(MENUITEMINFO); item.fMask = MIIM_ID | MIIM_TYPE | MIIM_SUBMENU; - ::GetMenuItemInfoA(subMenu, i, true, &item); + ::GetMenuItemInfo(subMenu, i, true, &item); QAction *action = 0; QMenu *popupMenu = 0; @@ -1295,11 +1287,11 @@ HRESULT WINAPI QAxClientSite::SetMenu(HMENU hmenuShared, HOLEMENU holemenu, HWND int count = GetMenuItemCount(hmenuShared); for (int i = 0; i < count; ++i) { - MENUITEMINFOA item; - memset(&item, 0, sizeof(MENUITEMINFOA)); - item.cbSize = sizeof(MENUITEMINFOA); + MENUITEMINFO item; + memset(&item, 0, sizeof(MENUITEMINFO)); + item.cbSize = sizeof(MENUITEMINFO); item.fMask = MIIM_ID | MIIM_TYPE | MIIM_SUBMENU; - ::GetMenuItemInfoA(hmenuShared, i, true, &item); + ::GetMenuItemInfo(hmenuShared, i, true, &item); QAction *action = 0; QMenu *popupMenu = 0; @@ -1379,7 +1371,7 @@ int QAxClientSite::qt_metacall(QMetaObject::Call call, int isignal, void **argv) OleMenuItem oleItem = menuItemMap.value(action); if (oleItem.hMenu) - ::PostMessageA(m_menuOwner, WM_COMMAND, oleItem.id, 0); + ::PostMessage(m_menuOwner, WM_COMMAND, oleItem.id, 0); return -1; #endif } @@ -1404,7 +1396,7 @@ HRESULT WINAPI QAxClientSite::RemoveMenus(HMENU /*hmenuShared*/) HRESULT WINAPI QAxClientSite::SetStatusText(LPCOLESTR pszStatusText) { - QStatusTipEvent tip(QString::fromUtf16((const ushort *)(BSTR)pszStatusText)); + QStatusTipEvent tip(QString::fromWCharArray(pszStatusText)); QApplication::sendEvent(widget, &tip); return S_OK; } @@ -1513,7 +1505,7 @@ HRESULT WINAPI QAxClientSite::SetActiveObject(IOleInPlaceActiveObject *pActiveOb AX_DEBUG(QAxClientSite::SetActiveObject); if (pszObjName && widget) - widget->setWindowTitle(QString::fromUtf16((const ushort *)(BSTR)pszObjName)); + widget->setWindowTitle(QString::fromWCharArray(pszObjName)); if (m_spInPlaceActiveObject) { if (!inPlaceModelessEnabled) @@ -1952,12 +1944,12 @@ bool QAxWidget::createHostWindow(bool initialized, const QByteArray &data) container->activateObject(initialized, data); #if !defined(Q_OS_WINCE) - ATOM filter_ref = FindAtomA(qaxatom); + ATOM filter_ref = FindAtom(qaxatom); #endif if (!filter_ref) previous_filter = QAbstractEventDispatcher::instance()->setEventFilter(axc_FilterProc); #if !defined(Q_OS_WINCE) - AddAtomA(qaxatom); + AddAtom(qaxatom); #else ++filter_ref; #endif @@ -1992,10 +1984,10 @@ void QAxWidget::clear() return; if (!control().isEmpty()) { #if !defined(Q_OS_WINCE) - ATOM filter_ref = FindAtomA(qaxatom); + ATOM filter_ref = FindAtom(qaxatom); if (filter_ref) DeleteAtom(filter_ref); - filter_ref = FindAtomA(qaxatom); + filter_ref = FindAtom(qaxatom); if (!filter_ref) { #else if (!filter_ref && !--filter_ref) { |