home *** CD-ROM | disk | FTP | other *** search
- /*-------------------------------------------
- pagetaskbar.c
- "taskbar" page of properties
- Kazubon 1997-1999
- ---------------------------------------------*/
-
- #include "tclock.h"
-
- static void OnInit(HWND hDlg);
- static void OnApply(HWND hDlg);
- static void OnStartBtnHide(HWND hDlg);
- static BOOL IsIE4(void);
- static BOOL IsTrayIconsToolbar(void);
-
- extern BOOL g_bApplyTaskbar; // propsheet.c
-
- __inline void SendPSChanged(HWND hDlg)
- {
- g_bApplyTaskbar = TRUE;
- SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)(hDlg), 0);
- }
-
- /*------------------------------------------------
- dialog procedure of this page
- --------------------------------------------------*/
- BOOL CALLBACK PageTaskbarProc(HWND hDlg, UINT message,
- WPARAM wParam, LPARAM lParam)
- {
- switch(message)
- {
- case WM_INITDIALOG:
- OnInit(hDlg);
- return TRUE;
- case WM_COMMAND:
- {
- WORD id, code;
- id = LOWORD(wParam); code = HIWORD(wParam);
- // checked "Hide Start Button", "Start menu from Clock"
- if(id == IDC_STARTBTNHIDE || id == IDC_STARTMENUCLOCK)
- OnStartBtnHide(hDlg);
- // checked other boxes
- else if(id == IDC_STARTBTNFLAT || id == IDC_TASKSWITCHFLAT
- || id == IDC_FLATTRAY || id == IDC_FILLTRAY)
- SendPSChanged(hDlg);
- // "Transparancy"
- else if(id == IDC_BARTRANS && code == EN_CHANGE)
- SendPSChanged(hDlg);
- return TRUE;
- }
- case WM_NOTIFY:
- switch(((NMHDR *)lParam)->code)
- {
- case PSN_APPLY: OnApply(hDlg); break;
- case PSN_HELP: MyHelp(GetParent(hDlg), 10); break;
- }
- return TRUE;
- }
- return FALSE;
- }
-
- /*------------------------------------------------
- initialize
- --------------------------------------------------*/
- void OnInit(HWND hDlg)
- {
- BOOL bTrayIconsToolbar;
- DWORD dw;
-
- CheckDlgButton(hDlg, IDC_STARTBTNHIDE,
- GetMyRegLong("", "StartButtonHide", FALSE));
- CheckDlgButton(hDlg, IDC_STARTMENUCLOCK,
- GetMyRegLong("", "StartMenuClock", FALSE));
- OnStartBtnHide(hDlg);
-
- CheckDlgButton(hDlg, IDC_STARTBTNFLAT,
- GetMyRegLong("", "StartButtonFlat", FALSE));
-
- CheckDlgButton(hDlg, IDC_TASKSWITCHFLAT,
- GetMyRegLong("", "TaskSwitchFlat", FALSE));
- EnableDlgItem(hDlg, IDC_TASKSWITCHFLAT, IsIE4());
-
- CheckDlgButton(hDlg, IDC_FLATTRAY,
- GetMyRegLong("", "FlatTray", FALSE));
-
- bTrayIconsToolbar = IsTrayIconsToolbar();
-
- CheckDlgButton(hDlg, IDC_FILLTRAY,
- GetMyRegLong("", "FillTray", FALSE));
- EnableDlgItem(hDlg, IDC_FILLTRAY, bTrayIconsToolbar);
-
- dw = GetVersion();
- if(!(dw & 0x80000000) && LOBYTE(LOWORD(dw)) >= 5) ; // Win2000
- else
- {
- int i;
- for(i = IDC_CAPBARTRANS; i <= IDC_SPINBARTRANS; i++)
- EnableDlgItem(hDlg, i, FALSE);
- }
-
- dw = GetMyRegLong("", "AlphaTaskbar", 0);
- if(dw > 97) dw = 97;
- SendDlgItemMessage(hDlg, IDC_SPINBARTRANS, UDM_SETRANGE, 0,
- MAKELONG(97, 0));
- SendDlgItemMessage(hDlg, IDC_SPINBARTRANS, UDM_SETPOS, 0,
- (int)(short)dw);
- }
-
- /*------------------------------------------------
- apply - save settings
- --------------------------------------------------*/
- void OnApply(HWND hDlg)
- {
- SetMyRegLong("", "StartButtonHide",
- IsDlgButtonChecked(hDlg, IDC_STARTBTNHIDE));
- SetMyRegLong("", "StartMenuClock",
- IsDlgButtonChecked(hDlg, IDC_STARTMENUCLOCK));
-
- SetMyRegLong("", "StartButtonFlat",
- IsDlgButtonChecked(hDlg, IDC_STARTBTNFLAT));
-
- SetMyRegLong("", "TaskSwitchFlat",
- IsDlgButtonChecked(hDlg, IDC_TASKSWITCHFLAT));
-
- SetMyRegLong("", "FlatTray",
- IsDlgButtonChecked(hDlg, IDC_FLATTRAY));
-
- SetMyRegLong("", "FillTray",
- IsDlgButtonChecked(hDlg, IDC_FILLTRAY));
-
- SetMyRegLong("", "AlphaTaskbar",
- SendDlgItemMessage(hDlg, IDC_SPINBARTRANS, UDM_GETPOS, 0, 0));
- }
-
- /*------------------------------------------------
- checked "Hide start button"
- --------------------------------------------------*/
- void OnStartBtnHide(HWND hDlg)
- {
- BOOL b;
-
- b = IsDlgButtonChecked(hDlg, IDC_STARTBTNHIDE);
- EnableDlgItem(hDlg, IDC_STARTMENUCLOCK, b);
- SendPSChanged(hDlg);
-
- if(b) b = IsDlgButtonChecked(hDlg, IDC_STARTMENUCLOCK);
- }
-
- /*------------------------------------------------
- IE 4 or later ?
- --------------------------------------------------*/
- BOOL IsIE4(void)
- {
- HWND hwnd;
- char classname[80];
- DWORD dw;
-
- dw = GetRegLong(HKEY_CURRENT_USER,
- "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
- "ClassicShell", 0);
- if(dw) return TRUE;
-
- hwnd = FindWindow("Shell_TrayWnd", NULL);
- if(hwnd == NULL) return FALSE;
- hwnd = GetWindow(hwnd, GW_CHILD);
- while(hwnd)
- {
- GetClassName(hwnd, classname, 80);
- if(lstrcmpi(classname, "ReBarWindow32") == 0)
- return TRUE;
- hwnd = GetWindow(hwnd, GW_HWNDNEXT);
- }
- return FALSE;
- }
-
- /*------------------------------------------------
- Is the tray icons "ToolbarWindow32" ?
- --------------------------------------------------*/
- BOOL IsTrayIconsToolbar(void)
- {
- HWND hwnd;
- char classname[80];
-
- hwnd = FindWindow("Shell_TrayWnd", NULL);
- if(hwnd == NULL) return FALSE;
- hwnd = GetWindow(hwnd, GW_CHILD);
- while(hwnd)
- {
- GetClassName(hwnd, classname, 80);
- if(lstrcmpi(classname, "TrayNotifyWnd") == 0)
- break;
- hwnd = GetWindow(hwnd, GW_HWNDNEXT);
- }
- if(hwnd == NULL) return FALSE;
-
- hwnd = GetWindow(hwnd, GW_CHILD);
- while(hwnd)
- {
- GetClassName(hwnd, classname, 80);
- if(lstrcmpi(classname, "ToolbarWindow32") == 0)
- break;
- hwnd = GetWindow(hwnd, GW_HWNDNEXT);
- }
- if(hwnd == NULL) return FALSE;
- return TRUE;
- }
-