< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.cpp

Print this page




 692     }
 693 
 694     // convert it into DDB to make CustomCursor work on WIN95
 695     hBitmap = CreateDIBitmap(hDC,
 696                              (BITMAPINFOHEADER*)&bmhHeader,
 697                              CBM_INIT,
 698                              (void *)ptrImageData,
 699                              (BITMAPINFO*)&bmhHeader,
 700                              DIB_RGB_COLORS);
 701 
 702     ::DeleteObject(hbmpBitmap);
 703     ::ReleaseDC(hW, hDC);
 704 //  ::GdiFlush();
 705     return hBitmap;
 706 }
 707 
 708 void AwtTrayIcon::SetToolTip(LPCTSTR tooltip)
 709 {
 710     if (tooltip == NULL) {
 711         m_nid.szTip[0] = '\0';
 712     } else if (lstrlen(tooltip) > TRAY_ICON_TOOLTIP_MAX_SIZE) {
 713         _tcsncpy(m_nid.szTip, tooltip, TRAY_ICON_TOOLTIP_MAX_SIZE);
 714         m_nid.szTip[TRAY_ICON_TOOLTIP_MAX_SIZE - 1] = '\0';
 715     } else {
 716         _tcscpy_s(m_nid.szTip, TRAY_ICON_TOOLTIP_MAX_SIZE, tooltip);
 717     }
 718 
 719     SendTrayMessage(NIM_MODIFY);
 720 }
 721 
 722 void AwtTrayIcon::_SetToolTip(void *param)
 723 {
 724     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 725     SetToolTipStruct *sts = (SetToolTipStruct *)param;
 726     jobject self = sts->trayIcon;
 727     jstring jtooltip = sts->tooltip;
 728     AwtTrayIcon *trayIcon = NULL;
 729     LPCTSTR tooltipStr = NULL;
 730 
 731     PDATA pData;
 732     JNI_CHECK_PEER_GOTO(self, ret);


 797 void AwtTrayIcon::DisplayMessage(LPCTSTR caption, LPCTSTR text, LPCTSTR msgType)
 798 {
 799     m_nid.uFlags |= NIF_INFO;
 800     m_nid.uTimeout = 10000;
 801 
 802     if (lstrcmp(msgType, TEXT("ERROR")) == 0) {
 803         m_nid.dwInfoFlags = NIIF_ERROR;
 804     } else if (lstrcmp(msgType, TEXT("WARNING")) == 0) {
 805         m_nid.dwInfoFlags = NIIF_WARNING;
 806     } else if (lstrcmp(msgType, TEXT("INFO")) == 0) {
 807         m_nid.dwInfoFlags = NIIF_INFO;
 808     } else if (lstrcmp(msgType, TEXT("NONE")) == 0) {
 809         m_nid.dwInfoFlags = NIIF_NONE;
 810     } else {
 811         m_nid.dwInfoFlags = NIIF_NONE;
 812     }
 813 
 814     if (caption[0] == '\0') {
 815         m_nid.szInfoTitle[0] = '\0';
 816 
 817     } else if (lstrlen(caption) > TRAY_ICON_BALLOON_TITLE_MAX_SIZE) {
 818 
 819         _tcsncpy(m_nid.szInfoTitle, caption, TRAY_ICON_BALLOON_TITLE_MAX_SIZE);
 820         m_nid.szInfoTitle[TRAY_ICON_BALLOON_TITLE_MAX_SIZE - 1] = '\0';
 821 
 822     } else {
 823         _tcscpy_s(m_nid.szInfoTitle, TRAY_ICON_BALLOON_TITLE_MAX_SIZE, caption);
 824     }
 825 
 826     if (text[0] == '\0') {
 827         m_nid.szInfo[0] = ' ';
 828         m_nid.szInfo[1] = '\0';
 829 
 830     } else if (lstrlen(text) > TRAY_ICON_BALLOON_INFO_MAX_SIZE) {
 831 
 832         _tcsncpy(m_nid.szInfo, text, TRAY_ICON_BALLOON_INFO_MAX_SIZE);
 833         m_nid.szInfo[TRAY_ICON_BALLOON_INFO_MAX_SIZE - 1] = '\0';
 834 
 835     } else {
 836         _tcscpy_s(m_nid.szInfo, TRAY_ICON_BALLOON_INFO_MAX_SIZE, text);
 837     }
 838 
 839     SendTrayMessage(NIM_MODIFY);
 840     m_nid.uFlags &= ~NIF_INFO;
 841 }
 842 
 843 void AwtTrayIcon::_DisplayMessage(void *param)
 844 {
 845     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 846     DisplayMessageStruct *dms = (DisplayMessageStruct *)param;
 847     jobject self = dms->trayIcon;
 848     jstring jcaption = dms->caption;
 849     jstring jtext = dms-> text;
 850     jstring jmsgType = dms->msgType;




 692     }
 693 
 694     // convert it into DDB to make CustomCursor work on WIN95
 695     hBitmap = CreateDIBitmap(hDC,
 696                              (BITMAPINFOHEADER*)&bmhHeader,
 697                              CBM_INIT,
 698                              (void *)ptrImageData,
 699                              (BITMAPINFO*)&bmhHeader,
 700                              DIB_RGB_COLORS);
 701 
 702     ::DeleteObject(hbmpBitmap);
 703     ::ReleaseDC(hW, hDC);
 704 //  ::GdiFlush();
 705     return hBitmap;
 706 }
 707 
 708 void AwtTrayIcon::SetToolTip(LPCTSTR tooltip)
 709 {
 710     if (tooltip == NULL) {
 711         m_nid.szTip[0] = '\0';
 712     } else if (lstrlen(tooltip) >= TRAY_ICON_TOOLTIP_MAX_SIZE) {
 713         _tcsncpy(m_nid.szTip, tooltip, TRAY_ICON_TOOLTIP_MAX_SIZE);
 714         m_nid.szTip[TRAY_ICON_TOOLTIP_MAX_SIZE - 1] = '\0';
 715     } else {
 716         _tcscpy_s(m_nid.szTip, TRAY_ICON_TOOLTIP_MAX_SIZE, tooltip);
 717     }
 718 
 719     SendTrayMessage(NIM_MODIFY);
 720 }
 721 
 722 void AwtTrayIcon::_SetToolTip(void *param)
 723 {
 724     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 725     SetToolTipStruct *sts = (SetToolTipStruct *)param;
 726     jobject self = sts->trayIcon;
 727     jstring jtooltip = sts->tooltip;
 728     AwtTrayIcon *trayIcon = NULL;
 729     LPCTSTR tooltipStr = NULL;
 730 
 731     PDATA pData;
 732     JNI_CHECK_PEER_GOTO(self, ret);


 797 void AwtTrayIcon::DisplayMessage(LPCTSTR caption, LPCTSTR text, LPCTSTR msgType)
 798 {
 799     m_nid.uFlags |= NIF_INFO;
 800     m_nid.uTimeout = 10000;
 801 
 802     if (lstrcmp(msgType, TEXT("ERROR")) == 0) {
 803         m_nid.dwInfoFlags = NIIF_ERROR;
 804     } else if (lstrcmp(msgType, TEXT("WARNING")) == 0) {
 805         m_nid.dwInfoFlags = NIIF_WARNING;
 806     } else if (lstrcmp(msgType, TEXT("INFO")) == 0) {
 807         m_nid.dwInfoFlags = NIIF_INFO;
 808     } else if (lstrcmp(msgType, TEXT("NONE")) == 0) {
 809         m_nid.dwInfoFlags = NIIF_NONE;
 810     } else {
 811         m_nid.dwInfoFlags = NIIF_NONE;
 812     }
 813 
 814     if (caption[0] == '\0') {
 815         m_nid.szInfoTitle[0] = '\0';
 816 
 817     } else if (lstrlen(caption) >= TRAY_ICON_BALLOON_TITLE_MAX_SIZE) {
 818 
 819         _tcsncpy(m_nid.szInfoTitle, caption, TRAY_ICON_BALLOON_TITLE_MAX_SIZE);
 820         m_nid.szInfoTitle[TRAY_ICON_BALLOON_TITLE_MAX_SIZE - 1] = '\0';
 821 
 822     } else {
 823         _tcscpy_s(m_nid.szInfoTitle, TRAY_ICON_BALLOON_TITLE_MAX_SIZE, caption);
 824     }
 825 
 826     if (text[0] == '\0') {
 827         m_nid.szInfo[0] = ' ';
 828         m_nid.szInfo[1] = '\0';
 829 
 830     } else if (lstrlen(text) >= TRAY_ICON_BALLOON_INFO_MAX_SIZE) {
 831 
 832         _tcsncpy(m_nid.szInfo, text, TRAY_ICON_BALLOON_INFO_MAX_SIZE);
 833         m_nid.szInfo[TRAY_ICON_BALLOON_INFO_MAX_SIZE - 1] = '\0';
 834 
 835     } else {
 836         _tcscpy_s(m_nid.szInfo, TRAY_ICON_BALLOON_INFO_MAX_SIZE, text);
 837     }
 838 
 839     SendTrayMessage(NIM_MODIFY);
 840     m_nid.uFlags &= ~NIF_INFO;
 841 }
 842 
 843 void AwtTrayIcon::_DisplayMessage(void *param)
 844 {
 845     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 846     DisplayMessageStruct *dms = (DisplayMessageStruct *)param;
 847     jobject self = dms->trayIcon;
 848     jstring jcaption = dms->caption;
 849     jstring jtext = dms-> text;
 850     jstring jmsgType = dms->msgType;


< prev index next >