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

Print this page




  76 int AwtTrayIcon::sm_instCount = 0;
  77 
  78 /************************************************************************
  79  * AwtTrayIcon methods
  80  */
  81 
  82 AwtTrayIcon::AwtTrayIcon() {
  83     ::ZeroMemory(&m_nid, sizeof(m_nid));
  84 
  85     if (sm_instCount++ == 0 && AwtTrayIcon::sm_msgWindow == NULL) {
  86         sm_msgWindow = AwtTrayIcon::CreateMessageWindow();
  87     }
  88     m_mouseButtonClickAllowed = 0;
  89 }
  90 
  91 AwtTrayIcon::~AwtTrayIcon() {
  92 }
  93 
  94 void AwtTrayIcon::Dispose() {
  95     SendTrayMessage(NIM_DELETE);


  96     UnlinkObjects();
  97 
  98     if (--sm_instCount == 0) {
  99         AwtTrayIcon::DestroyMessageWindow();
 100     }
 101 
 102     AwtObject::Dispose();
 103 }
 104 
 105 LPCTSTR AwtTrayIcon::GetClassName() {
 106     return TEXT("SunAwtTrayIcon");
 107 }
 108 
 109 void AwtTrayIcon::FillClassInfo(WNDCLASS *lpwc)
 110 {
 111     lpwc->style         = 0L;
 112     lpwc->lpfnWndProc   = (WNDPROC)TrayWindowProc;
 113     lpwc->cbClsExtra    = 0;
 114     lpwc->cbWndExtra    = 0;
 115     lpwc->hInstance     = AwtToolkit::GetInstance().GetModuleHandle(),




  76 int AwtTrayIcon::sm_instCount = 0;
  77 
  78 /************************************************************************
  79  * AwtTrayIcon methods
  80  */
  81 
  82 AwtTrayIcon::AwtTrayIcon() {
  83     ::ZeroMemory(&m_nid, sizeof(m_nid));
  84 
  85     if (sm_instCount++ == 0 && AwtTrayIcon::sm_msgWindow == NULL) {
  86         sm_msgWindow = AwtTrayIcon::CreateMessageWindow();
  87     }
  88     m_mouseButtonClickAllowed = 0;
  89 }
  90 
  91 AwtTrayIcon::~AwtTrayIcon() {
  92 }
  93 
  94 void AwtTrayIcon::Dispose() {
  95     SendTrayMessage(NIM_DELETE);
  96     // Destroy the icon to avoid leak of GDI objects
  97     ::DestroyIcon(m_nid.hIcon);
  98     UnlinkObjects();
  99 
 100     if (--sm_instCount == 0) {
 101         AwtTrayIcon::DestroyMessageWindow();
 102     }
 103 
 104     AwtObject::Dispose();
 105 }
 106 
 107 LPCTSTR AwtTrayIcon::GetClassName() {
 108     return TEXT("SunAwtTrayIcon");
 109 }
 110 
 111 void AwtTrayIcon::FillClassInfo(WNDCLASS *lpwc)
 112 {
 113     lpwc->style         = 0L;
 114     lpwc->lpfnWndProc   = (WNDPROC)TrayWindowProc;
 115     lpwc->cbClsExtra    = 0;
 116     lpwc->cbWndExtra    = 0;
 117     lpwc->hInstance     = AwtToolkit::GetInstance().GetModuleHandle(),