| 1 | /************************************************************************** |
|---|
| 2 | * Copyright (C) 2004-2007 by Michael Medin <michael@medin.name> * |
|---|
| 3 | * * |
|---|
| 4 | * This code is part of NSClient++ - http://trac.nakednuns.org/nscp * |
|---|
| 5 | * * |
|---|
| 6 | * This program is free software; you can redistribute it and/or modify * |
|---|
| 7 | * it under the terms of the GNU General Public License as published by * |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or * |
|---|
| 9 | * (at your option) any later version. * |
|---|
| 10 | * * |
|---|
| 11 | * This program is distributed in the hope that it will be useful, * |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|---|
| 14 | * GNU General Public License for more details. * |
|---|
| 15 | * * |
|---|
| 16 | * You should have received a copy of the GNU General Public License * |
|---|
| 17 | * along with this program; if not, write to the * |
|---|
| 18 | * Free Software Foundation, Inc., * |
|---|
| 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
|---|
| 20 | ***************************************************************************/ |
|---|
| 21 | #pragma once |
|---|
| 22 | |
|---|
| 23 | #include <thread.h> |
|---|
| 24 | |
|---|
| 25 | #define WM_ICON_NOTIFY WM_USER+1 |
|---|
| 26 | #define WM_MY_CLOSE WM_USER+2 |
|---|
| 27 | |
|---|
| 28 | class IconWidget_ { |
|---|
| 29 | public: |
|---|
| 30 | unsigned threadProc(LPVOID lpParameter); |
|---|
| 31 | void exitThread(void); |
|---|
| 32 | |
|---|
| 33 | private: |
|---|
| 34 | void createDialog(void); |
|---|
| 35 | void destroyDialog(void); |
|---|
| 36 | |
|---|
| 37 | private: |
|---|
| 38 | HWND hDlgWnd; |
|---|
| 39 | |
|---|
| 40 | }; |
|---|
| 41 | |
|---|
| 42 | typedef Thread<IconWidget_> IconWidget; |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | namespace TrayIcon |
|---|
| 46 | { |
|---|
| 47 | INT_PTR CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam); |
|---|
| 48 | INT_PTR CALLBACK InjectDialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam); |
|---|
| 49 | INT_PTR CALLBACK LogDialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam); |
|---|
| 50 | void setupUI(); |
|---|
| 51 | |
|---|
| 52 | void removeIcon(HWND hWnd); |
|---|
| 53 | void addIcon(HWND hWnd); |
|---|
| 54 | } |
|---|