From 02171eb485d9939c1b35d0ab2686356d5ca08532 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Wed, 13 Aug 2003 18:55:07 +0000 Subject: [PATCH] make explorer bar look more like windows taskbar bar svn path=/trunk/; revision=5560 --- reactos/ChangeLog | 5 + .../subsys/system/explorer/doc/changes.txt | 1 + .../subsys/system/explorer/make_explorer.dsp | 4 + .../subsys/system/explorer/taskbar/ex_bar.c | 257 ++++++++++-------- .../subsys/system/explorer/taskbar/ex_menu.c | 13 +- 5 files changed, 166 insertions(+), 114 deletions(-) diff --git a/reactos/ChangeLog b/reactos/ChangeLog index 9634229037d..21db6ba5bfc 100644 --- a/reactos/ChangeLog +++ b/reactos/ChangeLog @@ -1,3 +1,8 @@ +2003-08-13 Martin Fuchs + + * subsys/system/explorer/taskbar/ex_bar.c, ex_menu.c + make explorer bar look more like windows taskbar bar + 2003-08-09 Martin Fuchs * subsys/system/explorer Subclassing of shell window for drawing diff --git a/reactos/subsys/system/explorer/doc/changes.txt b/reactos/subsys/system/explorer/doc/changes.txt index ec544a3394f..c1697da54f3 100644 --- a/reactos/subsys/system/explorer/doc/changes.txt +++ b/reactos/subsys/system/explorer/doc/changes.txt @@ -14,3 +14,4 @@ 09.08.2003 m. fuchs class DesktopWindow for shell view on the desktop 11.08.2003 m. fuchs class BackgroundWindow for painting of desktop background open child folders by double click in ShellBrowserChild +13.08.2003 m. fuchs make explorer bar look more like windows taskbar bar diff --git a/reactos/subsys/system/explorer/make_explorer.dsp b/reactos/subsys/system/explorer/make_explorer.dsp index 0fa9ff0947d..79734b84582 100644 --- a/reactos/subsys/system/explorer/make_explorer.dsp +++ b/reactos/subsys/system/explorer/make_explorer.dsp @@ -83,6 +83,10 @@ CFG=make_explorer - Win32 Debug # Begin Source File +SOURCE=..\..\..\ChangeLog +# End Source File +# Begin Source File + SOURCE=.\makefile # End Source File # End Target diff --git a/reactos/subsys/system/explorer/taskbar/ex_bar.c b/reactos/subsys/system/explorer/taskbar/ex_bar.c index 572bf31c9e1..f185a81c8fa 100644 --- a/reactos/subsys/system/explorer/taskbar/ex_bar.c +++ b/reactos/subsys/system/explorer/taskbar/ex_bar.c @@ -15,15 +15,20 @@ HFONT tf; #ifdef _PLUGINS -HINSTANCE PlugInsHI[4]; // PlugIns table +HINSTANCE PlugInsHI[4]; // PlugIns table #else struct PluginCalls* PlugInsCallTable[4]; // PlugIn Call table #endif -int PlugNumber = -1; // Number of loaded plugins +int PlugNumber = -1; // Number of loaded plugins LRESULT WINAPI ExplorerBarProc(HWND, UINT, WPARAM, LPARAM); + +//#define TASKBAR_AT_TOP +#define TASKBAR_WIDTH 30 + + // Loads a configuration style given by PInt // FIXME : Load all these values from registry ! // @@ -31,73 +36,77 @@ DWORD LoadProperty(int PInt) { switch(PInt) { - case 1: // WS_EX_Style for creating the bar - return WS_EX_TOPMOST | WS_EX_DLGMODALFRAME; + case 1: // WS_EX_Style for creating the bar + return WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_PALETTEWINDOW; break; - case 2: // WS_Style for creating the bar - return WS_VISIBLE | WS_POPUP | WS_CLIPCHILDREN; + case 2: // WS_Style for creating the bar + return WS_POPUP | WS_THICKFRAME | WS_CLIPCHILDREN | WS_VISIBLE ; break; - case 3: // Start X for the panel - return 0; + case 3: // Start X for the panel + return -2; // hide border break; - case 4: - return 0; // Start Y for the panel + case 4: // Start Y for the panel +#ifdef TASKBAR_AT_TOP + return -2; +#else + return GetSystemMetrics(SM_CYSCREEN)-TASKBAR_WIDTH; +#endif break; case 5: - return GetSystemMetrics(SM_CXSCREEN); // XLen for the panel + return GetSystemMetrics(SM_CXSCREEN)+4; // XLen for the panel break; case 6: - return 32; // YLen for the panel + return TASKBAR_WIDTH+2; // YLen for the panel break; -} + } + return 0; } -// Initializez and creates the Explorer Panel -// HINSTANCE as a parameter -// +// Initialize and create the Explorer Panel HWND InitializeExplorerBar(HINSTANCE hInstance, int nCmdShow) { - HWND ExplorerBar; - WNDCLASS ExplorerBarClass; + HWND ExplorerBar; + WNDCLASS ExplorerBarClass; - ExplorerBarClass.lpszClassName = TEXT("ExplorerBar"); // ExplorerBar classname - ExplorerBarClass.lpfnWndProc = ExplorerBarProc; // Default Explorer Callback Procedure - ExplorerBarClass.style = 0; // Styles - ExplorerBarClass.hInstance = hInstance; // Instance - ExplorerBarClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); // Configurable ???? - ExplorerBarClass.hCursor = LoadCursor(NULL, IDC_ARROW); - ExplorerBarClass.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH); // BackGround - ExplorerBarClass.lpszMenuName = NULL; // No Menu needed for the bar - ExplorerBarClass.cbClsExtra = 0; // Nothing YET! !! - ExplorerBarClass.cbWndExtra = 0; // + ExplorerBarClass.lpszClassName = TEXT("Shell_TrayWnd"); // ExplorerBar classname + ExplorerBarClass.lpfnWndProc = ExplorerBarProc; // Default Explorer Callback Procedure + ExplorerBarClass.style = 0; // Styles + ExplorerBarClass.hInstance = hInstance; // Instance + ExplorerBarClass.hIcon = LoadIcon(0, IDI_APPLICATION); // Configurable ???? + ExplorerBarClass.hCursor = LoadCursor(0, IDC_ARROW); + ExplorerBarClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1); // BackGround + ExplorerBarClass.lpszMenuName = NULL; // No Menu needed for the bar + ExplorerBarClass.cbClsExtra = 0; + ExplorerBarClass.cbWndExtra = 0; - if (RegisterClass(&ExplorerBarClass) == 0) // Cold not register anything :( - { - fprintf(stderr, "Could not register Explorer Bar. Last error was 0x%X\n",GetLastError()); - return NULL; - } + if (!RegisterClass(&ExplorerBarClass)) + { + fprintf(stderr, "Could not register Explorer Bar. Last error was 0x%X\n",GetLastError()); + return 0; + } - ExplorerBar = CreateWindowEx(LoadProperty(1),TEXT("ExplorerBar"), - TEXT("ReactOS Explorer Bar"),LoadProperty(2),LoadProperty(3),LoadProperty(4), - LoadProperty(5), LoadProperty(6), 0, 0, hInstance, 0); - if (ExplorerBar == NULL) - { - fprintf(stderr, "Cold not create Explorer Bar.Last error 0x%X\n",GetLastError()); - return(NULL); - } + ExplorerBar = CreateWindowEx(LoadProperty(1), TEXT("Shell_TrayWnd"), + TEXT("ReactOS Explorer Bar"), LoadProperty(2), LoadProperty(3), LoadProperty(4), + LoadProperty(5), LoadProperty(6), 0, 0, hInstance, 0); + if (!ExplorerBar) + { + fprintf(stderr, "Cold not create Explorer Bar. Last error 0x%X\n",GetLastError()); + return 0; + } - tf = CreateFontA(14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE, - ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons"); + tf = CreateFontA(14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE, + ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons"); - ShowWindow(ExplorerBar, nCmdShow); // Show the bar - return ExplorerBar; + ShowWindow(ExplorerBar, nCmdShow); // Show the bar + + return ExplorerBar; } // ************************************************************************************** -// * GENERAL PLUGIN CONTROL ROUTINES * +// * GENERAL PLUGIN CONTROL ROUTINES * // ************************************************************************************** @@ -110,8 +119,8 @@ static int ReloadPlugInConfiguration(int ID) if (!PP) { - fprintf(stderr,"PLUGIN %d, of Instance %0x ReloadPlugInConfig Failed\n",ID,PlugInsHI[ID]); - return 0; + fprintf(stderr,"PLUGIN %d, of Instance %0x ReloadPlugInConfig Failed\n",ID,PlugInsHI[ID]); + return 0; } #else PReloadConfig PP = PlugInsCallTable[ID]->ReloadPlugInConfiguration; @@ -127,8 +136,8 @@ int QuitPlugIn(int ID) if (!PP) { - fprintf(stderr,"PLUGIN %d, of Instance %0x QuitPlugIn Failed\n",ID,PlugInsHI[ID]); - return 0; + fprintf(stderr,"PLUGIN %d, of Instance %0x QuitPlugIn Failed\n",ID,PlugInsHI[ID]); + return 0; } #else PQuitPlugIn PP = PlugInsCallTable[ID]->QuitPlugIn; @@ -147,8 +156,8 @@ int CallBackPlugIn(int ID, HWND PlgnHandle, UINT Msg, WPARAM wParam, LPARAM lPar PPlugInCallBack PP = (PPlugInCallBack)GetProcAddress(PlugInsHI[ID],/*"_"*/"PlugInMessageProc"); if (!PP) { - fprintf(stderr,"PLUGIN %d, of Instance %0x CallBackPlugIn Failed\n",ID,PlugInsHI[ID]); - return 0; + fprintf(stderr,"PLUGIN %d, of Instance %0x CallBackPlugIn Failed\n",ID,PlugInsHI[ID]); + return 0; } #else PPlugInCallBack PP = PlugInsCallTable[ID]->PlugInMessageProc; @@ -167,8 +176,8 @@ int PostExplorerInfo(int ID, HWND ExplHandle) if (!PP) { - fprintf(stderr,"PLUGIN %d, of Instance %0x PostExplorerInfo Failed\n",ID,PlugInsHI[ID]); - return 0; + fprintf(stderr,"PLUGIN %d, of Instance %0x PostExplorerInfo Failed\n",ID,PlugInsHI[ID]); + return 0; } #else PExplorerInfo PP = PlugInsCallTable[ID]->ExplorerInfo; @@ -191,8 +200,8 @@ int InitializePlugIn(int ID, HWND ExplHandle) PInitializePlugIn PP = (PInitializePlugIn)GetProcAddress(PlugInsHI[ID],/*"_"*/"InitializePlugIn"); if (!PP) { - fprintf(stderr,"PLUGIN %d, of Instance %0x InitializePlugIn Failed\n",ID,PlugInsHI[ID]); - return 0; + fprintf(stderr,"PLUGIN %d, of Instance %0x InitializePlugIn Failed\n",ID,PlugInsHI[ID]); + return 0; } #else PInitializePlugIn PP = PlugInsCallTable[ID]->InitializePlugIn; @@ -206,7 +215,7 @@ int InitPlugin(int ID, HWND ExplWnd) { if (!PostExplorerInfo(ID, ExplWnd)) { - fprintf(stderr, "PLUGIN %d : WARNING : Haven't received Explorer information !\n"); + fprintf(stderr, "PLUGIN %d : WARNING : Haven't received Explorer information !\n"); } if (!InitializePlugIn(ID, ExplWnd)) @@ -228,7 +237,7 @@ int LoadLocalPlugIn(char* fname, HWND ExplWnd) { PlugNumber++; PlugInsHI[PlugNumber]=LoadLibraryA(fname); - if (!(PlugInsHI[PlugNumber])) return 0; // Could not load plugin + if (!(PlugInsHI[PlugNumber])) return 0; // Could not load plugin InitPlugin(PlugNumber); @@ -244,26 +253,26 @@ int LoadAvailablePlugIns(HWND ExplWnd) { #ifdef _PLUGINS - FILE* Conf; // Configuration File; + FILE* Conf; // Configuration File; char line[80]; // Blah Blah Blah int i; int x; int k; - if (!(Conf=fopen("ex_bar.ini","r"))) // Error ! + if (!(Conf=fopen("ex_bar.ini","r"))) // Error ! { fprintf(stderr,"DefaultPlugin : No PLUGIN configuration file found !\n"); return 0; } - fgets(line,80,Conf); // Read how many entries are in the file - k = atoi(line); // atoi it ! We get how many plugIns do we have + fgets(line,80,Conf); // Read how many entries are in the file + k = atoi(line); // atoi it ! We get how many plugIns do we have for (i=0;i=HTSIZEFIRST && res<=HTSIZELAST) { +#ifdef TASKBAR_AT_TOP + if (res == HTBOTTOM) // enable vertical resizing at the lower border +#else + if (res == HTTOP) // enable vertical resizing at the upper border +#endif + return res; + else + return HTCLIENT; // disable any other resizing + } + return res;} - return 0; + case WM_SYSCOMMAND: + if ((wParam&0xFFF0) == SC_SIZE) { +#ifdef TASKBAR_AT_TOP + if (wParam == SC_SIZE+6)// enable vertical resizing at the lower border +#else + if (wParam == SC_SIZE+3)// enable vertical resizing at the upper border +#endif + goto def; + else + return 0; // disable any other resizing + } + goto def; + + default: def: + CallBackPlugIns(hWnd, msg, wParam, lParam); + + return DefWindowProc(hWnd, msg, wParam, lParam); + } + + return 0; } diff --git a/reactos/subsys/system/explorer/taskbar/ex_menu.c b/reactos/subsys/system/explorer/taskbar/ex_menu.c index d59b5b8cf4c..736ffbb9e99 100644 --- a/reactos/subsys/system/explorer/taskbar/ex_menu.c +++ b/reactos/subsys/system/explorer/taskbar/ex_menu.c @@ -29,7 +29,12 @@ static int InitializePlugIn(HWND ExplorerHandle) int i; int x; - fprintf(stderr,"EX_MENU : INITIALIZE PLUGIN call\n"); + HINSTANCE hinst = (HINSTANCE) GetWindowLong(ExplorerHandle, GWL_HINSTANCE); + + fprintf(stderr,"EX_MENU : INITIALIZE PLUGIN call\n"); + + CreateWindow(TEXT("BUTTON"), TEXT("Start"), WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON, + 2, 2, 50, ex_dy-10, ExplorerHandle, NULL, hinst, 0); if (!(Conf=fopen("explorer.lst","r"))) // Error ! { @@ -40,7 +45,6 @@ static int InitializePlugIn(HWND ExplorerHandle) fgets(line,80,Conf); // Read how many entries are in the file epl_Buttons=atoi(line); // atoi it ! - for (i=0;i