configuration dialog for notification icons

svn path=/trunk/; revision=8823
This commit is contained in:
Martin Fuchs 2004-03-21 00:31:14 +00:00
parent a9f6fe5ffb
commit 6a7304ac01
22 changed files with 826 additions and 258 deletions

View file

@ -94,7 +94,6 @@ void CollectProgramsThread::free_dirs()
FindProgramDlg::FindProgramDlg(HWND hwnd)
: super(hwnd),
_list_ctrl(GetDlgItem(hwnd, IDC_MAILS_FOUND)),
//_himl(ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32, 0, 0)),
_thread(collect_programs_callback, hwnd, this),
_sort(_list_ctrl, CompareFunc/*, (LPARAM)this*/)
{
@ -108,8 +107,6 @@ FindProgramDlg::FindProgramDlg(HWND hwnd)
_haccel = LoadAccelerators(g_Globals._hInstance, MAKEINTRESOURCE(IDA_SEARCH_PROGRAM));
ListView_SetImageList(_list_ctrl, g_Globals._icon_cache.get_sys_imagelist(), LVSIL_SMALL);
//ListView_SetImageList(_list_ctrl, _himl, LVSIL_SMALL);
//_idxNoIcon = ImageList_AddIcon(_himl, SmallIcon(IDI_APPICON));
LV_COLUMN column = {LVCF_FMT|LVCF_WIDTH|LVCF_TEXT, LVCFMT_LEFT, 250};
@ -137,11 +134,13 @@ FindProgramDlg::FindProgramDlg(HWND hwnd)
CenterWindow(hwnd);
Refresh();
register_pretranslate(hwnd);
}
FindProgramDlg::~FindProgramDlg()
{
//ImageList_Destroy(_himl);
unregister_pretranslate(_hwnd);
}
@ -261,6 +260,24 @@ void FindProgramDlg::add_entry(const FPDEntry& cache_entry)
ListView_SetItem(_list_ctrl, &item);
}
LRESULT FindProgramDlg::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
{
switch(nmsg) {
case PM_TRANSLATE_MSG: {
MSG* pmsg = (MSG*) lparam;
if (TranslateAccelerator(_hwnd, _haccel, pmsg))
return TRUE;
return FALSE;}
default:
return super::WndProc(nmsg, wparam, lparam);
}
return 0;
}
int FindProgramDlg::Command(int id, int code)
{
if (code == BN_CLICKED) {
@ -277,7 +294,7 @@ int FindProgramDlg::Command(int id, int code)
return super::Command(id, code);
}
return TRUE;
return 0;
}
else if (code == EN_CHANGE) {
switch(id) {
@ -286,10 +303,10 @@ int FindProgramDlg::Command(int id, int code)
break;
}
return TRUE;
return 0;
}
return FALSE;
return 1;
}
void FindProgramDlg::LaunchSelected()
@ -326,7 +343,7 @@ int FindProgramDlg::Notify(int id, NMHDR* pnmh)
if (entry->_icon_id == ICID_UNKNOWN)
entry->extract_icon();
pDispInfo->item.iImage = g_Globals._icon_cache.get_icon(entry->_icon_id).get_sysiml_idx();//ImageList_AddIcon(_himl, g_Globals._icon_cache.get_icon(entry->_icon_id).get_hicon());
pDispInfo->item.iImage = g_Globals._icon_cache.get_icon(entry->_icon_id).get_sysiml_idx();
pDispInfo->item.mask |= LVIF_DI_SETITEM;
return 1;

View file

@ -85,11 +85,8 @@ struct FindProgramDlg : public ResizeController<Dialog>
~FindProgramDlg();
protected:
CommonControlInit _usingCmnCtrl;
HWND _list_ctrl;
HACCEL _haccel;
//HIMAGELIST _himl;
//int _idxNoIcon; // replacement icon
String _lwr_filter;
CollectProgramsThread _thread;
@ -99,6 +96,7 @@ protected:
ListSort _sort;
virtual LRESULT WndProc(UINT, WPARAM, LPARAM);
virtual int Command(int id, int code);
virtual int Notify(int id, NMHDR* pnmh);

View file

@ -35,6 +35,7 @@
#include "../externals.h"
#include "../explorer_intres.h"
#include "../desktop/desktop.h"
#include "../taskbar/traynotify.h"
#include "settings.h"
@ -136,10 +137,10 @@ int DesktopSettingsDlg::Command(int id, int code)
SendMessage(g_Globals._hwndShellView, PM_SET_ICON_ALGORITHM, alignment, 0);
}
return TRUE;
return 0;
}
return FALSE;
return 1;
}
@ -148,19 +149,15 @@ TaskbarSettingsDlg::TaskbarSettingsDlg(HWND hwnd)
{
}
LRESULT TaskbarSettingsDlg::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
int TaskbarSettingsDlg::Command(int id, int code)
{
switch(nmsg) {
case WM_PAINT: {
PaintCanvas canvas(_hwnd);
FillRect(canvas, &canvas.rcPaint, GetStockBrush(GRAY_BRUSH));
break;}
default:
return super::WndProc(nmsg, wparam, lparam);
switch(id) {
case ID_CONFIG_NOTIFYAREA:
Dialog::DoModal(IDD_NOTIFYAREA, WINDOW_CREATOR(TrayNotifyDlg), _hwnd);
return 0;
}
return 0;
return 1;
}
@ -169,17 +166,14 @@ StartmenuSettingsDlg::StartmenuSettingsDlg(HWND hwnd)
{
}
LRESULT StartmenuSettingsDlg::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
int StartmenuSettingsDlg::Command(int id, int code)
{
switch(nmsg) {
case WM_PAINT: {
PaintCanvas canvas(_hwnd);
FillRect(canvas, &canvas.rcPaint, GetStockBrush(DKGRAY_BRUSH));
break;}
default:
return super::WndProc(nmsg, wparam, lparam);
/*
switch(id) {
case ID_CONFIG_NOTIFYAREA:
Dialog::DoModal(IDD_NOTIFYAREA, WINDOW_CREATOR(TrayNotifyDlg), _hwnd);
return 0;
}
return 0;
*/
return 1;
}

View file

@ -66,7 +66,7 @@ struct TaskbarSettingsDlg : public PropSheetPageDlg
TaskbarSettingsDlg(HWND hwnd);
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
virtual int Command(int id, int code);
};
@ -77,5 +77,5 @@ struct StartmenuSettingsDlg : public PropSheetPageDlg
StartmenuSettingsDlg(HWND hwnd);
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
virtual int Command(int id, int code);
};

View file

@ -254,6 +254,17 @@ HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
return hbmp;
}
int ImageList_AddAlphaIcon(HIMAGELIST himl, HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
{
HBITMAP hbmp = create_bitmap_from_icon(hIcon, hbrush_bkgnd, hdc_wnd);
int ret = ImageList_Add(himl, hbmp, 0);
DeleteObject(hbmp);
return ret;
}
int IconCache::s_next_id = ICID_DYNAMIC;
@ -732,6 +743,9 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
// initialize COM and OLE before creating the desktop window
OleInit usingCOM;
// init common controls library
CommonControlInit usingCmnCtrl;
if (startup_desktop) {
g_Globals._desktops.init();

View file

@ -369,6 +369,18 @@ SOURCE=.\res\documents.ico
# End Source File
# Begin Source File
SOURCE=.\res\dot.ico
# End Source File
# Begin Source File
SOURCE=.\res\dot_red.ico
# End Source File
# Begin Source File
SOURCE=.\res\dot_trans.ico
# End Source File
# Begin Source File
SOURCE=.\res\drivebar.bmp
# End Source File
# Begin Source File
@ -446,6 +458,10 @@ SOURCE=.\res\icoalig9.bmp
# End Source File
# Begin Source File
SOURCE=.\res\icon.ico
# End Source File
# Begin Source File
SOURCE=.\res\images.bmp
# End Source File
# Begin Source File
@ -474,6 +490,18 @@ SOURCE=.\res\network.ico
# End Source File
# Begin Source File
SOURCE=.\res\notify.ico
# End Source File
# Begin Source File
SOURCE=.\res\notify_h.ico
# End Source File
# Begin Source File
SOURCE=.\res\notify_t.ico
# End Source File
# Begin Source File
SOURCE=.\res\printer.ico
# End Source File
# Begin Source File
@ -518,6 +546,10 @@ SOURCE=.\taskbar\desktopbar.h
# End Source File
# Begin Source File
SOURCE=.\notifyhook\notifyhook.h
# End Source File
# Begin Source File
SOURCE=.\taskbar\quicklaunch.cpp
# End Source File
# Begin Source File

View file

@ -54,6 +54,8 @@
#define PM_RESIZE_CHILDREN (WM_APP+0x17)
#define PM_GET_WIDTH (WM_APP+0x18)
#define PM_REFRESH (WM_APP+0x1B)
#define CLASSNAME_FRAME TEXT("CabinetWClass") // same class name for frame window as in MS Explorer

View file

@ -37,6 +37,13 @@
#define IDS_MINIMIZE_ALL 33
#define IDS_DESKTOP_NUM 34
#define IDS_VOLUME 35
#define IDS_ITEMS_CUR 36
#define IDS_ITEMS_CONFIGURED 37
#define IDS_ITEMS_VISIBLE 38
#define IDS_ITEMS_HIDDEN 39
#define IDS_NOTIFY_SHOW 40
#define IDS_NOTIFY_HIDE 41
#define IDS_NOTIFY_AUTOHIDE 42
#define IDI_REACTOS 100
#define IDI_EXPLORER 101
#define IDI_STARTMENU 102
@ -60,6 +67,7 @@
#define IDB_LOGOV256 130
#define IDA_SEARCH_PROGRAM 133
#define IDI_APPICON 134
#define IDA_TRAYNOTIFY 134
#define IDI_FLOATING 135
#define IDD_ABOUT_EXPLORER 135
#define IDI_REACTOS_BIG 137
@ -83,6 +91,7 @@
#define IDD_DESKBAR_STARTMENU 154
#define IDB_ICON_ALIGN_1 154
#define IDB_ICON_ALIGN_2 155
#define IDD_NOTIFYAREA 155
#define IDB_ICON_ALIGN_3 156
#define IDB_ICON_ALIGN_4 157
#define IDB_ICON_ALIGN_5 158
@ -92,7 +101,10 @@
#define IDB_ICON_ALIGN_9 162
#define IDI_SPEAKER 162
#define IDB_ICON_ALIGN_10 163
#define IDI_DOT 163
#define IDB_LOGOV16 164
#define IDI_DOT_TRANS 164
#define IDI_DOT_RED 165
#define ID_VIEW_NAME 401
#define ID_VIEW_ALL_ATTRIBUTES 402
#define ID_VIEW_SELECTED_ATTRIBUTES 403
@ -103,19 +115,31 @@
#define IDC_ROS_EXPLORER 1000
#define IDC_ICON_ALIGN_0 1002
#define IDC_ICON_ALIGN_1 1003
#define IDC_NOTIFY_ICONS 1003
#define IDC_ICON_ALIGN_2 1004
#define IDC_ICON_ALIGN_3 1005
#define IDC_ICON_ALIGN_4 1006
#define IDC_NOTIFY_TOOLTIP 1006
#define IDC_ICON_ALIGN_5 1007
#define IDC_NOTIFY_TITLE 1007
#define IDC_ICON_ALIGN_6 1008
#define IDC_NOTIFY_MODULE 1008
#define IDC_ICON_ALIGN_7 1009
#define IDC_LABEL1 1009
#define IDC_ICON_ALIGN_8 1010
#define IDC_LABEL2 1010
#define IDC_ICON_ALIGN_9 1011
#define IDC_LABEL3 1011
#define IDC_ICON_ALIGN_10 1012
#define IDC_WWW 1012
#define IDC_ICON_ALIGN_11 1013
#define IDC_TOPIC 1017
#define IDC_MAILS_FOUND 1018
#define IDC_PICTURE 1019
#define IDC_NOTIFY_SHOW 1020
#define IDC_NOTIFY_HIDE 1021
#define IDC_NOTIFY_AUTOHIDE 1022
#define IDC_LABEL4 1023
#define ID_REFRESH 1704
#define ID_ABOUT_WINEFILE 1705
#define IDC_FILETREE 10001
@ -165,9 +189,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 163
#define _APS_NEXT_RESOURCE_VALUE 166
#define _APS_NEXT_COMMAND_VALUE 40019
#define _APS_NEXT_CONTROL_VALUE 1003
#define _APS_NEXT_CONTROL_VALUE 1024
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View file

@ -133,6 +133,13 @@ BEGIN
IDS_MINIMIZE_ALL "mimimize all windows"
IDS_DESKTOP_NUM "Desktop %d"
IDS_VOLUME "Volume"
IDS_ITEMS_CUR "current items"
IDS_ITEMS_CONFIGURED "configuration"
IDS_ITEMS_VISIBLE "visible"
IDS_ITEMS_HIDDEN "hidden"
IDS_NOTIFY_SHOW "show"
IDS_NOTIFY_HIDE "hide"
IDS_NOTIFY_AUTOHIDE "autohide"
END
#endif // Romanian resources
@ -177,6 +184,11 @@ BEGIN
VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
END
IDA_TRAYNOTIFY ACCELERATORS DISCARDABLE
BEGIN
VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
END
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
@ -445,6 +457,9 @@ IDI_PRINTER ICON DISCARDABLE "res/printer.ico"
IDI_NETWORK ICON DISCARDABLE "res/network.ico"
IDI_COMPUTER ICON DISCARDABLE "res/computer.ico"
IDI_SPEAKER ICON DISCARDABLE "res/speaker.ico"
IDI_DOT ICON DISCARDABLE "res/dot.ico"
IDI_DOT_TRANS ICON DISCARDABLE "res/dot_trans.ico"
IDI_DOT_RED ICON DISCARDABLE "res/dot_red.ico"
/////////////////////////////////////////////////////////////////////////////
//
@ -516,6 +531,13 @@ BEGIN
IDS_MINIMIZE_ALL "alle Fenster minimieren"
IDS_DESKTOP_NUM "Desktop %d"
IDS_VOLUME "Lautstärke"
IDS_ITEMS_CUR "aktuelle Icons"
IDS_ITEMS_CONFIGURED "Konfiguratrion"
IDS_ITEMS_VISIBLE "sichtbar"
IDS_ITEMS_HIDDEN "unsichtbar"
IDS_NOTIFY_SHOW "sichtbar"
IDS_NOTIFY_HIDE "versteckt"
IDS_NOTIFY_AUTOHIDE "automatisch"
END
#endif // German (Germany) resources
@ -523,138 +545,11 @@ END
/////////////////////////////////////////////////////////////////////////////
// French (France) resources
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDM_MAINFRAME MENU PRELOAD DISCARDABLE
BEGIN
POPUP "&Fichier"
BEGIN
MENUITEM "&Fermer", ID_FILE_EXIT
END
POPUP "&Affichage"
BEGIN
MENUITEM "Barre d'&outils", ID_VIEW_TOOL_BAR
MENUITEM "&Extra Bar", ID_VIEW_EXTRA_BAR
MENUITEM "&Drivebar", ID_VIEW_DRIVE_BAR, CHECKED
MENUITEM "Barre d'&état", ID_VIEW_STATUSBAR
MENUITEM SEPARATOR
MENUITEM "F&ull Screen\tCtrl+Shift+S", ID_VIEW_FULLSCREEN
END
POPUP "&Window"
BEGIN
MENUITEM "New &Window", ID_WINDOW_NEW
MENUITEM "Cascading\tShift+F5", ID_WINDOW_CASCADE
MENUITEM "Tile &Horizontally", ID_WINDOW_TILE_HORZ
MENUITEM "Tile &Vertically\tShift+F4", ID_WINDOW_TILE_VERT
MENUITEM "Arrange Automatically", ID_WINDOW_AUTOSORT
MENUITEM "Arrange &Symbols", ID_WINDOW_ARRANGE
MENUITEM "&Refresh\tF5", ID_REFRESH
END
POPUP "A&ide"
BEGIN
MENUITEM "&FAQ Explorateur...", ID_EXPLORER_FAQ
MENUITEM "A propos de l'&explorateur...", ID_ABOUT_WINDOWS
MENUITEM "A propos de l'&OS...", ID_ABOUT_EXPLORER
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Execute"
FONT 8, "MS Shell Dlg"
BEGIN
CONTROL "",101,"Static",SS_SIMPLE | SS_NOPREFIX,3,6,162,10
CONTROL "&Command:",-1,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,3,
18,60,10
EDITTEXT 201,3,29,134,12,ES_AUTOHSCROLL
CONTROL "As &Symbol",214,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3,
45,71,12
DEFPUSHBUTTON "&OK",1,158,6,47,14
PUSHBUTTON "&Cancel",2,158,23,47,14
PUSHBUTTON "&Help",254,158,43,47,14
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_TITLE "Explorateur Reactos"
IDS_START "Démarrer"
IDS_LOGOFF "Déconnexion ..."
IDS_SHUTDOWN "Arrêter..."
IDS_LAUNCH "Exécuter..."
IDS_START_HELP "Aide"
IDS_SEARCH_FILES "Rechercher Fichiers..."
IDS_DOCUMENTS "Documents"
IDS_FAVORITES "Favoris"
IDS_PROGRAMS "Programmes"
IDS_SETTINGS "Paramètres"
IDS_EXPLORE "Explorer"
IDS_EMPTY "(Vide)"
IDS_RECENT "Documents récents"
IDS_ADMIN "Administration"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_NETWORK "Réseaux"
IDS_CONNECTIONS "Connexions réseaux"
IDS_DRIVES "Disques"
IDS_SEARCH_COMPUTER "Recherche Ordinateurs..."
IDS_SETTINGS_MENU "Barre des tâches et menu démarrer"
IDS_CONTROL_PANEL "Panneau de configuration"
IDS_PRINTERS "Imprimantes"
IDS_BROWSE "Parcourir"
IDS_SEARCH_PRG "Recherche Programme..."
IDS_ALL_USERS "Tous les utilisateurs\\"
IDS_SEARCH "Rechercher"
IDS_ABOUT_EXPLORER "A propos de l'explorateur..."
IDS_LAUNCH_MANY_PROGRAMS
"You have selected more than one program.\nAre you sure you want to launch all of them?"
IDS_DESKTOPBAR_SETTINGS "Bureau"
IDS_DESKTOP "Bureau"
IDS_TASKBAR "Taskbar"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_STARTMENU "Startmenu"
IDS_MINIMIZE_ALL "mimimize all windows"
IDS_DESKTOP_NUM "Bureau %d"
IDS_VOLUME "Volume"
END
#endif // French (France) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
@ -911,6 +806,7 @@ STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Taskbar Properties"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "&Notifications...",ID_CONFIG_NOTIFYAREA,153,133,50,14
END
IDD_DESKBAR_STARTMENU DIALOG DISCARDABLE 0, 0, 210, 154
@ -920,6 +816,33 @@ FONT 8, "MS Sans Serif"
BEGIN
END
IDD_NOTIFYAREA DIALOGEX 0, 0, 207, 150
STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_APPWINDOW
CAPTION "Configure Notification Icons"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "Tree1",IDC_NOTIFY_ICONS,"SysTreeView32",TVS_HASLINES |
TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,193,31
LTEXT "&Tooltip Text:",IDC_LABEL1,7,44,40,8
EDITTEXT IDC_NOTIFY_TOOLTIP,55,42,145,14,ES_AUTOHSCROLL
LTEXT "&Window Title:",IDC_LABEL2,7,63,44,8
EDITTEXT IDC_NOTIFY_TITLE,55,60,145,14,ES_AUTOHSCROLL
LTEXT "&Module Path:",IDC_LABEL3,7,81,43,8
EDITTEXT IDC_NOTIFY_MODULE,55,78,145,14,ES_AUTOHSCROLL
GROUPBOX "&Display Mode",IDC_LABEL4,7,95,157,28
CONTROL "&show",IDC_NOTIFY_SHOW,"Button",BS_AUTORADIOBUTTON |
WS_TABSTOP,15,107,33,10
CONTROL "&hide",IDC_NOTIFY_HIDE,"Button",BS_AUTORADIOBUTTON,66,
107,29,10
CONTROL "a&utohide",IDC_NOTIFY_AUTOHIDE,"Button",
BS_AUTORADIOBUTTON,112,107,43,10
DEFPUSHBUTTON "&OK",IDOK,91,129,50,14,WS_GROUP
PUSHBUTTON "&Cancel",IDCANCEL,150,129,50,14
ICON "",IDC_PICTURE,173,100,20,20
END
/////////////////////////////////////////////////////////////////////////////
//
@ -960,6 +883,14 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 147
END
IDD_NOTIFYAREA, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 200
TOPMARGIN, 7
BOTTOMMARGIN, 143
END
END
#endif // APSTUDIO_INVOKED
@ -1015,9 +946,150 @@ BEGIN
IDS_MINIMIZE_ALL "mimimize all windows"
IDS_DESKTOP_NUM "Desktop %d"
IDS_VOLUME "Volume"
IDS_ITEMS_CUR "current items"
IDS_ITEMS_CONFIGURED "configuration"
IDS_ITEMS_VISIBLE "visible"
IDS_ITEMS_HIDDEN "hidden"
IDS_NOTIFY_SHOW "show"
IDS_NOTIFY_HIDE "hide"
IDS_NOTIFY_AUTOHIDE "autohide"
END
#endif // English (U.K.) resources
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// French (France) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDM_MAINFRAME MENU PRELOAD DISCARDABLE
BEGIN
POPUP "&Fichier"
BEGIN
MENUITEM "&Fermer", ID_FILE_EXIT
END
POPUP "&Affichage"
BEGIN
MENUITEM "Barre d'&outils", ID_VIEW_TOOL_BAR
MENUITEM "&Extra Bar", ID_VIEW_EXTRA_BAR
MENUITEM "&Drivebar", ID_VIEW_DRIVE_BAR, CHECKED
MENUITEM "Barre d'&état", ID_VIEW_STATUSBAR
MENUITEM SEPARATOR
MENUITEM "F&ull Screen\tCtrl+Shift+S", ID_VIEW_FULLSCREEN
END
POPUP "&Window"
BEGIN
MENUITEM "New &Window", ID_WINDOW_NEW
MENUITEM "Cascading\tShift+F5", ID_WINDOW_CASCADE
MENUITEM "Tile &Horizontally", ID_WINDOW_TILE_HORZ
MENUITEM "Tile &Vertically\tShift+F4", ID_WINDOW_TILE_VERT
MENUITEM "Arrange Automatically", ID_WINDOW_AUTOSORT
MENUITEM "Arrange &Symbols", ID_WINDOW_ARRANGE
MENUITEM "&Refresh\tF5", ID_REFRESH
END
POPUP "A&ide"
BEGIN
MENUITEM "&FAQ Explorateur...", ID_EXPLORER_FAQ
MENUITEM "A propos de l'&explorateur...", ID_ABOUT_WINDOWS
MENUITEM "A propos de l'&OS...", ID_ABOUT_EXPLORER
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_EXECUTE DIALOG FIXED IMPURE 15, 13, 210, 63
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Execute"
FONT 8, "MS Shell Dlg"
BEGIN
CONTROL "",101,"Static",SS_SIMPLE | SS_NOPREFIX,3,6,162,10
CONTROL "&Command:",-1,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,3,
18,60,10
EDITTEXT 201,3,29,134,12,ES_AUTOHSCROLL
CONTROL "As &Symbol",214,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3,
45,71,12
DEFPUSHBUTTON "&OK",1,158,6,47,14
PUSHBUTTON "&Cancel",2,158,23,47,14
PUSHBUTTON "&Help",254,158,43,47,14
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_TITLE "Explorateur Reactos"
IDS_START "Démarrer"
IDS_LOGOFF "Déconnexion ..."
IDS_SHUTDOWN "Arrêter..."
IDS_LAUNCH "Exécuter..."
IDS_START_HELP "Aide"
IDS_SEARCH_FILES "Rechercher Fichiers..."
IDS_DOCUMENTS "Documents"
IDS_FAVORITES "Favoris"
IDS_PROGRAMS "Programmes"
IDS_SETTINGS "Paramètres"
IDS_EXPLORE "Explorer"
IDS_EMPTY "(Vide)"
IDS_RECENT "Documents récents"
IDS_ADMIN "Administration"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_NETWORK "Réseaux"
IDS_CONNECTIONS "Connexions réseaux"
IDS_DRIVES "Disques"
IDS_SEARCH_COMPUTER "Recherche Ordinateurs..."
IDS_SETTINGS_MENU "Barre des tâches et menu démarrer"
IDS_CONTROL_PANEL "Panneau de configuration"
IDS_PRINTERS "Imprimantes"
IDS_BROWSE "Parcourir"
IDS_SEARCH_PRG "Recherche Programme..."
IDS_ALL_USERS "Tous les utilisateurs\\"
IDS_SEARCH "Rechercher"
IDS_ABOUT_EXPLORER "A propos de l'explorateur..."
IDS_LAUNCH_MANY_PROGRAMS
"You have selected more than one program.\nAre you sure you want to launch all of them?"
IDS_DESKTOPBAR_SETTINGS "Bureau"
IDS_DESKTOP "Bureau"
IDS_TASKBAR "Taskbar"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_STARTMENU "Startmenu"
IDS_MINIMIZE_ALL "mimimize all windows"
IDS_DESKTOP_NUM "Bureau %d"
IDS_VOLUME "Volume"
IDS_ITEMS_CUR "current items"
IDS_ITEMS_CONFIGURED "configuration"
IDS_ITEMS_VISIBLE "visible"
IDS_ITEMS_HIDDEN "hidden"
IDS_NOTIFY_SHOW "show"
IDS_NOTIFY_HIDE "hide"
IDS_NOTIFY_AUTOHIDE "autohide"
END
#endif // French (France) resources
/////////////////////////////////////////////////////////////////////////////
@ -1218,6 +1290,13 @@ BEGIN
IDS_MINIMIZE_ALL "mimimize all windows"
IDS_DESKTOP_NUM "Desktop %d"
IDS_VOLUME "Volume"
IDS_ITEMS_CUR "current items"
IDS_ITEMS_CONFIGURED "configuration"
IDS_ITEMS_VISIBLE "visible"
IDS_ITEMS_HIDDEN "hidden"
IDS_NOTIFY_SHOW "show"
IDS_NOTIFY_HIDE "hide"
IDS_NOTIFY_AUTOHIDE "autohide"
END
#endif // Portuguese (Portugal) resources

View file

@ -141,6 +141,13 @@ protected:
/// create a bitmap from an icon
extern HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd);
/// add icon with alpha channel to imagelist using the specified background color
extern int ImageList_AddAlphaIcon(HIMAGELIST himl, HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd);
/// retrieve icon from window
extern HICON get_window_icon_small(HWND hwnd);
extern HICON get_window_icon_big(HWND hwnd, bool allow_from_class=true);
/// desktop management
#ifdef _USE_HDESK

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -34,20 +34,6 @@
#include "../explorer_intres.h"
static LPARAM TreeView_GetItemData(HWND hwndTreeView, HTREEITEM hItem)
{
TVITEM tvItem;
tvItem.mask = TVIF_PARAM;
tvItem.hItem = hItem;
if (!TreeView_GetItem(hwndTreeView, &tvItem))
return 0;
return tvItem.lParam;
}
ShellBrowserChild::ShellBrowserChild(HWND hwnd, const ShellChildWndInfo& info)
: super(hwnd, info),
_create_info(info)
@ -132,20 +118,18 @@ void ShellBrowserChild::InitializeTree()
TreeView_SetImageList(_left_hwnd, _himlSmall, TVSIL_NORMAL);
TreeView_SetScrollTime(_left_hwnd, 100);
TV_ITEM tvItem;
TV_INSERTSTRUCT tvInsert;
tvInsert.hParent = 0;
tvInsert.hInsertAfter = TVI_LAST;
TV_ITEM& tvItem = tvInsert.item;
tvItem.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN;
tvItem.lParam = (LPARAM)_root._entry;
tvItem.pszText = LPSTR_TEXTCALLBACK;
tvItem.iImage = tvItem.iSelectedImage = I_IMAGECALLBACK;
tvItem.cChildren = 1;
TV_INSERTSTRUCT tvInsert;
tvInsert.hParent = 0;
tvInsert.hInsertAfter = TVI_LAST;
tvInsert.item = tvItem;
HTREEITEM hItem = TreeView_InsertItem(_left_hwnd, &tvInsert);
TreeView_SelectItem(_left_hwnd, hItem);
TreeView_Expand(_left_hwnd, hItem, TVE_EXPAND);

View file

@ -46,6 +46,8 @@ DesktopBar::DesktopBar(HWND hwnd)
: super(hwnd),
_trayIcon(hwnd, ID_TRAY_VOLUME)
{
SetWindowIcon(hwnd, IDI_REACTOS/*IDI_SEARCH*/); // icon in for TrayNotifyDlg
SystemParametersInfo(SPI_GETWORKAREA, 0, &_work_area_org, 0);
}
@ -247,6 +249,9 @@ LRESULT DesktopBar::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
}
break;
case PM_GET_NOTIFYAREA:
return (LRESULT)(HWND)_hwndNotify;
default: def:
return super::WndProc(nmsg, wparam, lparam);
}

View file

@ -73,8 +73,6 @@ struct DesktopBar : public TrayIconControllerTemplate<
static HWND Create();
protected:
CommonControlInit _usingCmnCtrl;
RECT _work_area_org;
int _taskbar_pos;

View file

@ -31,7 +31,6 @@
#define IDW_QUICKLAUNCHBAR 101
#define PM_REFRESH (WM_APP+0x1B)
#define PM_UPDATE_DESKTOP (WM_APP+0x1C)
#define IDC_FIRST_QUICK_ID 0x4000

View file

@ -246,7 +246,7 @@ void TaskBar::ShowAppSystemMenu(TaskBarMap::iterator it)
}
static HICON get_window_icon(HWND hwnd)
HICON get_window_icon_small(HWND hwnd)
{
HICON hIcon = 0;
@ -267,8 +267,31 @@ static HICON get_window_icon(HWND hwnd)
if (!hIcon)
SendMessageTimeout(hwnd, WM_QUERYDRAGICON, 0, 0, 0, 1000, (LPDWORD)&hIcon);
return hIcon;
}
HICON get_window_icon_big(HWND hwnd, bool allow_from_class)
{
HICON hIcon = 0;
SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
if (!hIcon)
hIcon = LoadIcon(0, IDI_APPLICATION);
SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
if (!hIcon)
SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
if (allow_from_class) {
if (!hIcon)
hIcon = (HICON)GetClassLong(hwnd, GCL_HICON);
if (!hIcon)
hIcon = (HICON)GetClassLong(hwnd, GCL_HICONSM);
}
if (!hIcon)
SendMessageTimeout(hwnd, WM_QUERYDRAGICON, 0, 0, 0, 1000, (LPDWORD)&hIcon);
return hIcon;
}
@ -298,7 +321,10 @@ BOOL CALLBACK TaskBar::EnumWndProc(HWND hwnd, LPARAM lparam)
found->second._id = pThis->_next_id++;
} else {
HBITMAP hbmp;
HICON hIcon = get_window_icon(hwnd);
HICON hIcon = get_window_icon_small(hwnd);
if (!hIcon)
hIcon = LoadIcon(0, IDI_APPLICATION);
if (hIcon) {
hbmp = create_bitmap_from_icon(hIcon, GetSysColorBrush(COLOR_BTNFACE), WindowCanvas(pThis->_htoolbar));

View file

@ -35,8 +35,6 @@
#include "traynotify.h"
#include "../dialogs/settings.h"
#include "../notifyhook/notifyhook.h"
@ -157,6 +155,11 @@ NotifyInfo& NotifyInfo::operator=(NOTIFYICONDATA* pnid)
_tipText.assign(txt, l);
}
TCHAR title[MAX_PATH];
if (GetWindowText(_hWnd, title, MAX_PATH))
_windowTitle = title;
///@todo test for real changes
_lastChange = GetTickCount();
@ -173,7 +176,7 @@ NotifyArea::NotifyArea(HWND hwnd)
_last_icon_count = 0;
_show_hidden = false;
///@todo read from config file -->
/*@todo read/write from/to config file/registry
NotifyIconConfig cfg;
cfg._tipText = TEXT("FRITZ!fon");
@ -207,11 +210,7 @@ NotifyArea::NotifyArea(HWND hwnd)
_cfg.push_back(cfg);
cfg._windowTitle.erase();
cfg._modulePath = TEXT("xyz"); //@@
cfg._mode = NIM_HIDE;
_cfg.push_back(cfg);
/// <--
*/
}
LRESULT NotifyArea::Init(LPCREATESTRUCT pcs)
@ -292,6 +291,10 @@ LRESULT NotifyArea::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
clock_window->TimerTick();
break;}
case PM_REFRESH:
TimerTick();
break;
case WM_SIZE: {
int cx = LOWORD(lparam);
SetWindowPos(_hwndClock, 0, cx-_clock_width, 0, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
@ -331,10 +334,20 @@ LRESULT NotifyArea::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
)
CancelModes();
NotifyIconSet::iterator found = IconHitTest(Point(lparam));
NotifyIconSet::const_iterator found = IconHitTest(Point(lparam));
if (found != _sorted_icons.end()) {
NotifyInfo& entry = const_cast<NotifyInfo&>(*found); // Why does GCC 3.3 need this additional const_cast ?!
const NotifyInfo& entry = const_cast<NotifyInfo&>(*found); // Why does GCC 3.3 need this additional const_cast ?!
// set activation time stamp
if (nmsg == WM_LBUTTONDOWN || // Some programs need PostMessage() instead of SendMessage().
nmsg == WM_MBUTTONDOWN || // So call SendMessage() only for BUTTONUP and BLCLK messages
#ifdef WM_XBUTTONDOWN
nmsg == WM_XBUTTONDOWN ||
#endif
nmsg == WM_RBUTTONDOWN) {
_icon_map[entry]._lastChange = GetTickCount();
}
// Notify the message if the owner is still alive
if (IsWindow(entry._hWnd)) {
@ -381,7 +394,7 @@ int NotifyArea::Command(int id, int code)
break;
case ID_CONFIG_NOTIFYAREA:
ExplorerPropertySheet(_hwnd);
Dialog::DoModal(IDD_NOTIFYAREA, WINDOW_CREATOR(TrayNotifyDlg), GetParent(_hwnd));
break;
case ID_CONFIG_TIME:
@ -615,7 +628,7 @@ NotifyIconSet::iterator NotifyArea::IconHitTest(const POINT& pos)
#if NOTIFYICON_VERSION>=3 // as of 21.08.2003 missing in MinGW headers
bool NotifyIconConfig::match(const NotifyIconProps& props) const
bool NotifyIconConfig::match(const NotifyIconConfig& props) const
{
if (!_tipText.empty() && !props._tipText.empty())
if (props._tipText == _tipText)
@ -634,26 +647,20 @@ bool NotifyIconConfig::match(const NotifyIconProps& props) const
bool NotifyArea::DetermineHideState(NotifyInfo& entry)
{
for(NotifyIconCfgList::const_iterator it=_cfg.begin(); it!=_cfg.end(); ++it) {
const NotifyIconConfig& cfg = *it;
NotifyIconProps props;
props._tipText = entry._tipText;
TCHAR title[MAX_PATH];
if (GetWindowText(entry._hWnd, title, MAX_PATH))
props._windowTitle = title;
if (entry._modulePath.empty()) {
const String& modulePath = _window_modules[entry._hWnd];
// request module path for new windows (We will get an asynchronous answer by a WM_COPYDATA message.)
if (!modulePath.empty())
props._modulePath = modulePath;
entry._modulePath = modulePath;
else
_hook.GetModulePath(entry._hWnd, _hwnd);
}
if (cfg.match(props)) {
for(NotifyIconCfgList::const_iterator it=_cfg.begin(); it!=_cfg.end(); ++it) {
const NotifyIconConfig& cfg = *it;
if (cfg.match(entry)) {
entry._mode = cfg._mode;
return true;
}
@ -665,6 +672,328 @@ bool NotifyArea::DetermineHideState(NotifyInfo& entry)
#endif
TrayNotifyDlg::TrayNotifyDlg(HWND hwnd)
: super(hwnd),
_tree_ctrl(GetDlgItem(hwnd, IDC_NOTIFY_ICONS)),
_himl(ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR24, 2, 0)),
_pNotifyArea(static_cast<NotifyArea*>(Window::get_window((HWND)SendMessage(g_Globals._hwndDesktopBar, PM_GET_NOTIFYAREA, 0, 0))))
{
_selectedItem = 0;
SetWindowIcon(hwnd, IDI_REACTOS/*IDI_SEARCH*/);
_haccel = LoadAccelerators(g_Globals._hInstance, MAKEINTRESOURCE(IDA_TRAYNOTIFY));
{
WindowCanvas canvas(_hwnd);
HBRUSH hbkgnd = GetStockBrush(WHITE_BRUSH);
ImageList_AddAlphaIcon(_himl, SmallIcon(IDI_DOT), hbkgnd, canvas);
ImageList_AddAlphaIcon(_himl, SmallIcon(IDI_DOT_TRANS), hbkgnd, canvas);
ImageList_AddAlphaIcon(_himl, SmallIcon(IDI_DOT_RED), hbkgnd, canvas);
}
TreeView_SetImageList(_tree_ctrl, _himl, TVSIL_NORMAL);
_resize_mgr.Add(IDC_NOTIFY_ICONS, RESIZE);
_resize_mgr.Add(IDC_LABEL1, MOVE_Y);
_resize_mgr.Add(IDC_NOTIFY_TOOLTIP, RESIZE_X|MOVE_Y);
_resize_mgr.Add(IDC_LABEL2, MOVE_Y);
_resize_mgr.Add(IDC_NOTIFY_TITLE, RESIZE_X|MOVE_Y);
_resize_mgr.Add(IDC_LABEL3, MOVE_Y);
_resize_mgr.Add(IDC_NOTIFY_MODULE, RESIZE_X|MOVE_Y);
_resize_mgr.Add(IDC_LABEL4, MOVE_Y);
_resize_mgr.Add(IDC_NOTIFY_SHOW, MOVE_Y);
_resize_mgr.Add(IDC_NOTIFY_HIDE, MOVE_Y);
_resize_mgr.Add(IDC_NOTIFY_AUTOHIDE,MOVE_Y);
_resize_mgr.Add(IDC_PICTURE, MOVE);
_resize_mgr.Add(IDOK, MOVE);
_resize_mgr.Add(IDCANCEL, MOVE);
_resize_mgr.Resize(+150, +200);
Refresh();
SetTimer(_hwnd, 0, 3000, NULL);
register_pretranslate(hwnd);
}
TrayNotifyDlg::~TrayNotifyDlg()
{
KillTimer(_hwnd, 0);
unregister_pretranslate(_hwnd);
ImageList_Destroy(_himl);
}
void TrayNotifyDlg::Refresh()
{
///@todo refresh incrementally
HiddenWindow hide(_tree_ctrl);
TreeView_DeleteAllItems(_tree_ctrl);
TV_INSERTSTRUCT tvi;
tvi.hParent = 0;
tvi.hInsertAfter = TVI_LAST;
TV_ITEM& tv = tvi.item;
tv.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
ResString str_cur(IDS_ITEMS_CUR);
tv.pszText = (LPTSTR)str_cur.c_str();
tv.iSelectedImage = tv.iImage = 0; // IDI_DOT
_hitemCurrent = TreeView_InsertItem(_tree_ctrl, &tvi);
ResString str_conf(IDS_ITEMS_CONFIGURED);
tv.pszText = (LPTSTR)str_conf.c_str();
tv.iSelectedImage = tv.iImage = 2; // IDI_DOT_RED
_hitemConfig = TreeView_InsertItem(_tree_ctrl, &tvi);
tvi.hParent = _hitemCurrent;
ResString str_visible(IDS_ITEMS_VISIBLE);
tv.pszText = (LPTSTR)str_visible.c_str();
tv.iSelectedImage = tv.iImage = 0; // IDI_DOT
_hitemCurrent_visible = TreeView_InsertItem(_tree_ctrl, &tvi);
ResString str_hidden(IDS_ITEMS_HIDDEN);
tv.pszText = (LPTSTR)str_hidden.c_str();
tv.iSelectedImage = tv.iImage = 1; // IDI_DOT_TRANS
_hitemCurrent_hidden = TreeView_InsertItem(_tree_ctrl, &tvi);
if (_pNotifyArea) {
tv.mask |= TVIF_PARAM;
WindowCanvas canvas(_hwnd);
// insert current (visible and hidden) items
for(NotifyIconMap::const_iterator it=_pNotifyArea->_icon_map.begin(); it!=_pNotifyArea->_icon_map.end(); ++it) {
const NotifyInfo& entry = it->second;
InsertItem(entry._dwState&NIS_HIDDEN? _hitemCurrent_hidden: _hitemCurrent_visible, TVI_LAST, entry, canvas);
}
// insert configured items in tree view
const NotifyIconCfgList& cfg = _pNotifyArea->_cfg;
for(NotifyIconCfgList::const_iterator it=cfg.begin(); it!=cfg.end(); ++it) {
const NotifyIconConfig& cfg_entry = *it;
HICON hicon = 0;
if (!cfg_entry._modulePath.empty()) {
if ((int)ExtractIconEx(cfg_entry._modulePath, 0, NULL, &hicon, 1) <= 0)
hicon = 0;
if (!hicon) {
SHFILEINFO sfi;
if (SHGetFileInfo(cfg_entry._modulePath, 0, &sfi, sizeof(sfi), SHGFI_ICON|SHGFI_SMALLICON))
hicon = sfi.hIcon;
}
}
InsertItem(_hitemConfig, TVI_SORT, cfg_entry, canvas, hicon, cfg_entry._mode);
if (hicon)
DestroyIcon(hicon);
}
// insert new configuration entry
}
TreeView_Expand(_tree_ctrl, _hitemCurrent_visible, TVE_EXPAND);
TreeView_Expand(_tree_ctrl, _hitemCurrent_hidden, TVE_EXPAND);
TreeView_Expand(_tree_ctrl, _hitemCurrent, TVE_EXPAND);
TreeView_Expand(_tree_ctrl, _hitemConfig, TVE_EXPAND);
}
void TrayNotifyDlg::InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyInfo& entry, HDC hdc)
{
InsertItem(hparent, after, entry, hdc, entry._hIcon, entry._mode);
}
void TrayNotifyDlg::InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyIconConfig& entry,
HDC hdc, HICON hicon, NOTIFYICONMODE mode)
{
String mode_str;
switch(mode) {
case NIM_SHOW: mode_str = ResString(IDS_NOTIFY_SHOW); break;
case NIM_HIDE: mode_str = ResString(IDS_NOTIFY_HIDE); break;
case NIM_AUTO: mode_str = ResString(IDS_NOTIFY_AUTOHIDE);
}
FmtString txt(TEXT("%s - %s [%s]"), entry._tipText.c_str(), entry._windowTitle.c_str(), mode_str.c_str());
TV_INSERTSTRUCT tvi;
tvi.hParent = hparent;
tvi.hInsertAfter = after;
TV_ITEM& tv = tvi.item;
tv.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
tv.lParam = (LPARAM)&entry;
tv.pszText = (LPTSTR)txt.c_str();
tv.iSelectedImage = tv.iImage = ImageList_AddAlphaIcon(_himl, hicon, GetStockBrush(WHITE_BRUSH), hdc);
TreeView_InsertItem(_tree_ctrl, &tvi);
}
LRESULT TrayNotifyDlg::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
{
switch(nmsg) {
case PM_TRANSLATE_MSG: {
MSG* pmsg = (MSG*) lparam;
if (TranslateAccelerator(_hwnd, _haccel, pmsg))
return TRUE;
return FALSE;}
case WM_TIMER:
Refresh();
break;
default:
return super::WndProc(nmsg, wparam, lparam);
}
return 0;
}
int TrayNotifyDlg::Command(int id, int code)
{
if (code == BN_CLICKED) {
switch(id) {
case ID_REFRESH:
Refresh();
break;
case IDC_NOTIFY_SHOW:
SetIconMode(NIM_SHOW);
break;
case IDC_NOTIFY_HIDE:
SetIconMode(NIM_HIDE);
break;
case IDC_NOTIFY_AUTOHIDE:
SetIconMode(NIM_AUTO);
break;
case IDOK:
case IDCANCEL:
EndDialog(_hwnd, id);
break;
}
return 0;
}
return 1;
}
int TrayNotifyDlg::Notify(int id, NMHDR* pnmh)
{
switch(pnmh->code) {
case TVN_SELCHANGED: {
NMTREEVIEW* pnmtv = (NMTREEVIEW*)pnmh;
LPARAM lparam = pnmtv->itemNew.lParam;
if (lparam) {
const NotifyIconConfig& entry = *(NotifyIconConfig*)lparam;
SetDlgItemText(_hwnd, IDC_NOTIFY_TOOLTIP, entry._tipText);
SetDlgItemText(_hwnd, IDC_NOTIFY_TITLE, entry._windowTitle);
SetDlgItemText(_hwnd, IDC_NOTIFY_MODULE, entry._modulePath);
CheckRadioButton(_hwnd, IDC_NOTIFY_SHOW, IDC_NOTIFY_AUTOHIDE, IDC_NOTIFY_SHOW+entry._mode);
HICON hicon = 0; //get_window_icon_big(entry._hWnd, false);
// If we could not find an icon associated with the owner window, try to load one from the owning module.
if (!hicon && !entry._modulePath.empty()) {
hicon = ExtractIcon(g_Globals._hInstance, entry._modulePath, 0);
if (!hicon) {
SHFILEINFO sfi;
if (SHGetFileInfo(entry._modulePath, 0, &sfi, sizeof(sfi), SHGFI_ICON|SHGFI_LARGEICON))
hicon = sfi.hIcon;
}
}
if (hicon) {
SendMessage(GetDlgItem(_hwnd, IDC_PICTURE), STM_SETICON, (LPARAM)hicon, 0);
DestroyIcon(hicon);
} else
SendMessage(GetDlgItem(_hwnd, IDC_PICTURE), STM_SETICON, 0, 0);
_selectedItem = pnmtv->itemNew.hItem;
} else {
/*
SetDlgItemText(_hwnd, IDC_NOTIFY_TOOLTIP, NULL);
SetDlgItemText(_hwnd, IDC_NOTIFY_TITLE, NULL);
SetDlgItemText(_hwnd, IDC_NOTIFY_MODULE, NULL);
*/
CheckRadioButton(_hwnd, IDC_NOTIFY_SHOW, IDC_NOTIFY_AUTOHIDE, 0);
}
break;}
}
return 0;
}
void TrayNotifyDlg::SetIconMode(NOTIFYICONMODE mode)
{
LPARAM lparam = TreeView_GetItemData(_tree_ctrl, _selectedItem);
if (!lparam)
return;
NotifyIconConfig& entry = *(NotifyIconConfig*)lparam;
if (entry._mode != mode) {
entry._mode = mode;
// trigger refresh in notify area and this dialog
SendMessage(*_pNotifyArea, PM_REFRESH, 0, 0);
}
if (_pNotifyArea) {
bool found = false;
NotifyIconCfgList& cfg = _pNotifyArea->_cfg;
for(NotifyIconCfgList::iterator it=cfg.begin(); it!=cfg.end(); ++it) {
NotifyIconConfig& cfg_entry = *it;
if (cfg_entry.match(entry)) {
cfg_entry._mode = mode;
++found;
break;
}
}
if (!found) {
// insert new configuration entry
NotifyIconConfig cfg_entry = entry;
cfg_entry._mode = mode;
_pNotifyArea->_cfg.push_back(cfg_entry);
}
}
Refresh();
///@todo select treeview item at new position in tree view -> refresh HTREEITEM in _selectedItem
}
ClockWindow::ClockWindow(HWND hwnd)
: super(hwnd),
_tooltip(hwnd)

View file

@ -35,10 +35,11 @@
#define NOTIFYICON_DIST 20
#define NOTIFYAREA_SPACE 10
#define PM_GETMODULEPATH_CB (WM_APP+0x21)
#define ICON_AUTOHIDE_SECONDS 300
#define PM_GETMODULEPATH_CB (WM_APP+0x21)
#define PM_GET_NOTIFYAREA (WM_APP+0x22)
/// NotifyIconIndex is used for maintaining the order of notification icons.
struct NotifyIconIndex
@ -58,25 +59,22 @@ protected:
enum NOTIFYICONMODE {
NIM_AUTO, NIM_SHOW, NIM_HIDE
NIM_SHOW, NIM_HIDE, NIM_AUTO
};
/// properties used to identify a notification icon
struct NotifyIconProps
{
String _tipText;
String _windowTitle; // To look at the window title and at the window module path of the notify icon owner window
String _modulePath; // to identify notification icons is an extension above XP's behaviour.
}; // (XP seems to store icon image data in the registry instead.)
/// configuration for the display mode of a notification icon
struct NotifyIconConfig : public NotifyIconProps
struct NotifyIconConfig
{
NotifyIconConfig() : _mode(NIM_AUTO) {}
bool match(const NotifyIconProps& props) const;
bool match(const NotifyIconConfig& props) const;
NOTIFYICONMODE _mode;
// properties used to identify a notification icon
String _tipText;
String _windowTitle; // To look at the window title and at the window module path of the notify icon owner window
String _modulePath; // to identify notification icons is an extension above XP's behaviour.
// (XP seems to store icon image data in the registry instead.)
NOTIFYICONMODE _mode;
};
/// list of NotifyIconConfig structures
@ -84,7 +82,7 @@ typedef list<NotifyIconConfig> NotifyIconCfgList;
/// structure for maintaining informations about one notification icon
struct NotifyInfo : public NotifyIconIndex
struct NotifyInfo : public NotifyIconIndex, public NotifyIconConfig
{
NotifyInfo();
@ -99,9 +97,7 @@ struct NotifyInfo : public NotifyIconIndex
DWORD _dwState;
UINT _uCallbackMessage;
UINT _version;
String _tipText;
NOTIFYICONMODE _mode;
DWORD _lastChange; // timer tick value of the last change
};
@ -138,12 +134,8 @@ protected:
WindowHandle _hwndClock;
int _clock_width;
NotifyIconMap _icon_map;
NotifyIconSet _sorted_icons;
int _next_idx;
size_t _last_icon_count;
ToolTip _tooltip;
NotifyHook _hook;
bool _show_hidden;
@ -160,10 +152,46 @@ protected:
NotifyIconSet::iterator IconHitTest(const POINT& pos);
bool DetermineHideState(NotifyInfo& entry);
public: // for TrayNotifyDlg
NotifyIconCfgList _cfg;
NotifyHook _hook;
map<HWND, String> _window_modules;
NotifyIconMap _icon_map;
NotifyIconSet _sorted_icons;
int _next_idx;
size_t _last_icon_count;
};
/// configuration dialog for notification icons
struct TrayNotifyDlg : public ResizeController<Dialog>
{
typedef ResizeController<Dialog> super;
TrayNotifyDlg(HWND hwnd);
~TrayNotifyDlg();
protected:
HWND _tree_ctrl;
HACCEL _haccel;
HIMAGELIST _himl;
NotifyArea* _pNotifyArea;
HTREEITEM _hitemCurrent;
HTREEITEM _hitemCurrent_visible;
HTREEITEM _hitemCurrent_hidden;
HTREEITEM _hitemConfig;
HTREEITEM _selectedItem;
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
virtual int Command(int id, int code);
virtual int Notify(int id, NMHDR* pnmh);
void Refresh();
void InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyInfo&, HDC);
void InsertItem(HTREEITEM hparent, HTREEITEM after, const NotifyIconConfig&, HDC, HICON, NOTIFYICONMODE);
void SetIconMode(NOTIFYICONMODE mode);
};

View file

@ -649,6 +649,11 @@ Dialog::~Dialog()
unregister_dialog(_hwnd);
}
LRESULT Dialog::Init(LPCREATESTRUCT pcs)
{
return TRUE; // set standard focus
}
int Dialog::DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent)
{
Lock lock(GetStaticWindowData()._create_crit_sect); // protect access to s_window_creator and s_new_info
@ -656,6 +661,8 @@ int Dialog::DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent)
s_window_creator = creator;
s_new_info = NULL;
///@todo call Window::pretranslate_msg()
return DialogBoxParam(g_Globals._hInstance, MAKEINTRESOURCE(nid), hwndParent, DialogProc, 0/*lpParam*/);
}
@ -666,6 +673,8 @@ int Dialog::DoModal(UINT nid, CREATORFUNC_INFO creator, const void* info, HWND h
s_window_creator = (CREATORFUNC) creator;
s_new_info = NULL;
///@todo call Window::pretranslate_msg()
return DialogBoxParam(g_Globals._hInstance, MAKEINTRESOURCE(nid), hwndParent, DialogProc, 0/*lpParam*/);
}
@ -676,7 +685,7 @@ INT_PTR CALLBACK Window::DialogProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
if (pThis) {
switch(nmsg) {
case WM_COMMAND:
pThis->Command(LOWORD(wparam), HIWORD(wparam));
SetWindowLong(hwnd, DWL_MSGRESULT, (LPARAM)pThis->Command(LOWORD(wparam), HIWORD(wparam)));
return TRUE; // message has been processed
case WM_NOTIFY:
@ -699,6 +708,8 @@ INT_PTR CALLBACK Window::DialogProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
if (pThis)
return pThis->Init(NULL);
return TRUE;
}
return FALSE; // message has not been processed
@ -713,10 +724,10 @@ int Dialog::Command(int id, int code)
{
if (code == BN_CLICKED) {
EndDialog(_hwnd, id);
return TRUE; // message has been processed
return 0; // message has been processed
}
return FALSE;
return 1;
}
@ -751,8 +762,8 @@ void ResizeManager::HandleSize(int cx, int cy)
const ResizeEntry& e = *it;
RECT move = {0};
if (e._flags & MOVE_LEFT) // Die verschiedenen Transformationsmatrizen in move ließen sich eigentlich
move.left += dx; // cachen oder vorausberechnen, da sie nur von _flags und der Größenänderung abhängig sind.
if (e._flags & MOVE_LEFT)
move.left += dx;
if (e._flags & MOVE_RIGHT)
move.right += dx;
@ -773,15 +784,18 @@ void ResizeManager::HandleSize(int cx, int cy)
if (flags != (SWP_NOMOVE|SWP_NOSIZE)) {
HWND hwnd = GetDlgItem(_hwnd, e._id);
WindowRect rect(hwnd);
ScreenToClient(_hwnd, rect);
rect.left += move.left;
rect.right += move.right;
rect.top += move.top;
rect.bottom += move.bottom;
if (hwnd) {
WindowRect rect(hwnd);
ScreenToClient(_hwnd, rect);
hDWP = DeferWindowPos(hDWP, hwnd, 0, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, flags|SWP_NOACTIVATE|SWP_NOZORDER);
rect.left += move.left;
rect.right += move.right;
rect.top += move.top;
rect.bottom += move.bottom;
hDWP = DeferWindowPos(hDWP, hwnd, 0, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, flags|SWP_NOACTIVATE|SWP_NOZORDER);
}
}
}
@ -791,6 +805,7 @@ void ResizeManager::HandleSize(int cx, int cy)
void ResizeManager::Resize(int dx, int dy)
{
::SetWindowPos(_hwnd, 0, 0, 0, _min_wnd_size.cx+dx, _min_wnd_size.cy+dy, SWP_NOMOVE|SWP_NOACTIVATE);
MoveVisible(_hwnd);
ClientRect clnt_rect(_hwnd);
HandleSize(clnt_rect.right, clnt_rect.bottom);
@ -1358,7 +1373,7 @@ INT_PTR CALLBACK PropSheetPageDlg::DialogProc(HWND hwnd, UINT nmsg, WPARAM wpara
if (pThis) {
switch(nmsg) {
case WM_COMMAND:
pThis->Command(LOWORD(wparam), HIWORD(wparam));
SetWindowLong(hwnd, DWL_MSGRESULT, (LPARAM)pThis->Command(LOWORD(wparam), HIWORD(wparam)));
return TRUE; // message has been processed
case WM_NOTIFY:
@ -1386,6 +1401,8 @@ INT_PTR CALLBACK PropSheetPageDlg::DialogProc(HWND hwnd, UINT nmsg, WPARAM wpara
if (pThis)
return pThis->Init(NULL);
}
return TRUE;
}
return FALSE; // message has not been processed
@ -1395,5 +1412,5 @@ int PropSheetPageDlg::Command(int id, int code)
{
// override call to EndDialog in Dialog::Command();
return FALSE;
return 1;
}

View file

@ -371,6 +371,7 @@ struct Dialog : public Window
static int DoModal(UINT nid, CREATORFUNC_INFO creator, const void* info, HWND hwndParent=0);
protected:
LRESULT Init(LPCREATESTRUCT pcs);
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
int Command(int id, int code);
};
@ -955,6 +956,20 @@ protected:
};
inline LPARAM TreeView_GetItemData(HWND hwndTreeView, HTREEITEM hItem)
{
TVITEM tvItem;
tvItem.mask = TVIF_PARAM;
tvItem.hItem = hItem;
if (!TreeView_GetItem(hwndTreeView, &tvItem))
return 0;
return tvItem.lParam;
}
enum {TRAYBUTTON_LEFT=0, TRAYBUTTON_RIGHT, TRAYBUTTON_MIDDLE};
#define PM_TRAYICON (WM_APP+0x20)