//
+#include "../utility/utility.h"
+#include "../utility/shellclasses.h"
+#include "../utility/shellbrowserimpl.h"
+#include "../utility/window.h"
+
#include "desktop.h"
+#include "../taskbar/desktopbar.h"
#include "../externals.h"
#include "../explorer_intres.h"
// This next part could be improved by working out how much
// space the text actually needs...
-#define DESKTOPBARBAR_HEIGHT 30
rect.left = rect.right - 280;
rect.top = rect.bottom - 56 - DESKTOPBARBAR_HEIGHT;
rect.right = rect.left + 250;
}
+HWND DesktopWindow::Create()
+{
+ IconWindowClass wcDesktop(_T("Progman"), IDI_REACTOS, CS_DBLCLKS);
+ wcDesktop.hbrBackground = (HBRUSH)(COLOR_BACKGROUND+1);
+
+ int width = GetSystemMetrics(SM_CXSCREEN);
+ int height = GetSystemMetrics(SM_CYSCREEN);
+
+ return Window::Create(WINDOW_CREATOR(DesktopWindow),
+ WS_EX_TOOLWINDOW, wcDesktop, _T("Program Manager"), WS_POPUP|WS_VISIBLE|WS_CLIPCHILDREN,
+ 0, 0, width, height, 0);
+}
+
+
LRESULT DesktopWindow::Init(LPCREATESTRUCT pcs)
{
if (super::Init(pcs))
else if (SetShellWindow)
SetShellWindow(_hwnd);
+ // create the explorer bar
+ _desktopBar = DesktopBar::Create();
+
return 0;
}
case WM_CLOSE:
break; // Over-ride close. We need to close desktop some other way.
- default:
+ case WM_SYSCOMMAND:
+ if (wparam == SC_TASKLIST) {
+ if (_desktopBar)
+ SendMessage(_desktopBar, nmsg, wparam, lparam);
+ }
+ goto def;
+
+ default: def:
return super::WndProc(nmsg, wparam, lparam);
}
return 0;
}
-
-
-HWND create_desktop_window()
-{
- IconWindowClass wcDesktop(_T("Progman"), IDI_REACTOS, CS_DBLCLKS);
- wcDesktop.hbrBackground = (HBRUSH)(COLOR_BACKGROUND+1);
-
- int width = GetSystemMetrics(SM_CXSCREEN);
- int height = GetSystemMetrics(SM_CYSCREEN);
-
- return Window::Create(WINDOW_CREATOR(DesktopWindow),
- WS_EX_TOOLWINDOW, wcDesktop, _T("Program Manager"), WS_POPUP|WS_VISIBLE|WS_CLIPCHILDREN,
- 0, 0, width, height, 0);
-}
//
-#include "../utility/utility.h"
-#include "../utility/shellclasses.h"
-#include "../utility/shellbrowserimpl.h"
-#include "../utility/window.h"
-
-#include "../externals.h"
-
-
struct BackgroundWindow : public SubclassedWindow
{
typedef SubclassedWindow super;
DesktopWindow(HWND hwnd);
~DesktopWindow();
+ static HWND Create();
+
STDMETHOD(GetWindow)(HWND* lphwnd)
{
*lphwnd = _hwnd;
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
IShellView* _pShellView;
+ WindowHandle _desktopBar;
};
#include "utility/utility.h"
#include "explorer.h"
+#include "desktop/desktop.h"
+
#include "globals.h"
#include "externals.h"
if (startup_desktop)
{
- hwndDesktop = create_desktop_window();
-
- // Initialize the explorer bar
- HWND hwndExplorerBar = InitializeExplorerBar(hInstance);
-
- // Load plugins
-// LoadAvailablePlugIns(hwndExplorerBar);
+ hwndDesktop = DesktopWindow::Create();
#ifndef _DEBUG //MF: disabled for debugging
{
int ret = explorer_main(hInstance, hwndDesktop, nShowCmd);
-// ReleaseAvailablePlugIns();
-
return ret;
}
// display explorer/file manager window
extern void explorer_show_frame(HWND hwndDesktop, int cmdshow);
- // create desktop window
-extern HWND create_desktop_window();
-
// test for already running desktop instance
extern BOOL IsAnyDesktopRunning();
- // start desktop bar
-extern HWND InitializeExplorerBar(HINSTANCE hInstance);
-
- // load plugins
-extern int LoadAvailablePlugIns(HWND ExplWnd);
-
- // shut down plugins
-extern int ReleaseAvailablePlugIns();
-
#ifdef __cplusplus
} // extern "C"
#include "quicklaunch.h"
-HWND InitializeExplorerBar(HINSTANCE hInstance)
-{
- RECT rect;
-
- rect.left = -2; // hide left border
-#ifdef TASKBAR_AT_TOP
- rect.top = -2; // hide top border
-#else
- rect.top = GetSystemMetrics(SM_CYSCREEN) - DESKTOPBARBAR_HEIGHT;
-#endif
- rect.right = GetSystemMetrics(SM_CXSCREEN) + 2;
- rect.bottom = rect.top + DESKTOPBARBAR_HEIGHT + 2;
-
- return Window::Create(WINDOW_CREATOR(DesktopBar), WS_EX_PALETTEWINDOW,
- BtnWindowClass(CLASSNAME_EXPLORERBAR), TITLE_EXPLORERBAR,
- WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN|WS_VISIBLE,
- rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, 0);
-}
-
-
DesktopBar::DesktopBar(HWND hwnd)
: super(hwnd),
// initialize Common Controls library
}
+HWND DesktopBar::Create()
+{
+ RECT rect;
+
+ rect.left = -2; // hide left border
+#ifdef TASKBAR_AT_TOP
+ rect.top = -2; // hide top border
+#else
+ rect.top = GetSystemMetrics(SM_CYSCREEN) - DESKTOPBARBAR_HEIGHT;
+#endif
+ rect.right = GetSystemMetrics(SM_CXSCREEN) + 2;
+ rect.bottom = rect.top + DESKTOPBARBAR_HEIGHT + 2;
+
+ return Window::Create(WINDOW_CREATOR(DesktopBar), WS_EX_PALETTEWINDOW,
+ BtnWindowClass(CLASSNAME_EXPLORERBAR), TITLE_EXPLORERBAR,
+ WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN|WS_VISIBLE,
+ rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, 0);
+}
+
+
LRESULT DesktopBar::Init(LPCREATESTRUCT pcs)
{
if (super::Init(pcs))
void DesktopBar::RegisterHotkeys()
{
- // register hotkey CTRL+ESC for opening Startmenu
- RegisterHotKey(_hwnd, 0, MOD_CONTROL, VK_ESCAPE);
-
// register hotkey WIN+E opening explorer
- RegisterHotKey(_hwnd, 1, MOD_WIN, 'E');
+ RegisterHotKey(_hwnd, 0, MOD_WIN, 'E');
//TODO: register all common hotkeys
}
void DesktopBar::ProcessHotKey(int id_hotkey)
{
switch(id_hotkey) {
- case 0: ToggleStartmenu(); break;
- case 1: explorer_show_frame(_hwnd, SW_SHOWNORMAL); break;
+ case 0: explorer_show_frame(_hwnd, SW_SHOWNORMAL); break;
//TODO: implement all common hotkeys
}
}
goto def;
else
return 0; // disable any other resizing
- }
+ } else if (wparam == SC_TASKLIST)
+ ToggleStartmenu();
goto def;
case WM_SIZE: {
DesktopBar(HWND hwnd);
~DesktopBar();
+ static HWND Create();
+
protected:
CommonControlInit _usingCmnCtrl;
if (entry._idx == -1)
entry._idx = ++_next_idx;
- Refresh();
+ Refresh(); //TODO: call only if really changes occurred
}
break;
// close startup menu and other popup menus
// This functionality is for tray notification icons missing in MS Windows.
if (nmsg == WM_SETFOCUS)
- CancelModes((HWND)wparam);
+ CancelModes((HWND)wparam); //@@ erronesly cancels desktop bar resize when switching from another process
return DefWindowProc(hwnd, nmsg, wparam, lparam);
}