Ignore:
Timestamp:
Nov 2, 2009, 3:00:35 PM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: QSystemTrayIcon: Implemented reaction to notification messages from the system tray and emitting them as signals.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/util/qsystemtrayicon_pm.cpp

    r260 r277  
    4646#ifndef QT_NO_SYSTEMTRAYICON
    4747
     48#include "qapplication.h"
     49#include "qdesktopwidget.h"
    4850#include "qt_os2.h"
    4951
     
    133135    switch(msg->msg) {
    134136
    135         case WM_XST_MYNOTIFY:
    136         {
    137             // @todo
     137        case WM_XST_MYNOTIFY: {
     138            switch (SHORT2FROMMP(msg->mp1)) {
     139                case XST_IN_MOUSE: {
     140                    PXSTMOUSEMSG pMsg = (PXSTMOUSEMSG)msg->mp2;
     141                    switch (pMsg->ulMouseMsg) {
     142                        case WM_BUTTON1CLICK:
     143                            emit q->activated(QSystemTrayIcon::Trigger);
     144                            break;
     145                        case WM_BUTTON1DBLCLK:
     146                            emit q->activated(QSystemTrayIcon::DoubleClick);
     147                            break;
     148                        case WM_BUTTON3CLICK:
     149                            emit q->activated(QSystemTrayIcon::MiddleClick);
     150                            break;
     151                        default:
     152                            break;
     153                    }
     154                    break;
     155                }
     156                case XST_IN_CONTEXT: {
     157                    PXSTCONTEXTMSG pMsg = (PXSTCONTEXTMSG)msg->mp2;
     158                    if (q->contextMenu()) {
     159                        QPoint gpos(pMsg->ptsPointerPos.x,
     160                                    // flip y coordinate
     161                                    QApplication::desktop()->height() -
     162                                        (pMsg->ptsPointerPos.y + 1));
     163                        q->contextMenu()->popup(gpos);
     164                        q->contextMenu()->activateWindow();
     165                        // Must be activated for proper keyboardfocus and
     166                        // menu closing on OS/2
     167                    }
     168                    emit q->activated(QSystemTrayIcon::Context);
     169                    break;
     170                }
     171                default:
     172                    break;
     173            }
    138174            break;
    139175        }
    140176
    141         default:
    142         {
    143             if (msg->msg == WM_XST_CREATED)
    144             {
     177        default: {
     178            if (msg->msg == WM_XST_CREATED) {
    145179                addToTray();
    146180                return true;
Note: See TracChangeset for help on using the changeset viewer.