make explorer bar look more like windows taskbar bar

svn path=/trunk/; revision=5560
This commit is contained in:
Martin Fuchs 2003-08-13 18:55:07 +00:00
parent bfb4755f65
commit 02171eb485
5 changed files with 166 additions and 114 deletions

View file

@ -1,3 +1,8 @@
2003-08-13 Martin Fuchs <martin-fuchs@gmx.net>
* subsys/system/explorer/taskbar/ex_bar.c, ex_menu.c
make explorer bar look more like windows taskbar bar
2003-08-09 Martin Fuchs <martin-fuchs@gmx.net> 2003-08-09 Martin Fuchs <martin-fuchs@gmx.net>
* subsys/system/explorer Subclassing of shell window for drawing * subsys/system/explorer Subclassing of shell window for drawing

View file

@ -14,3 +14,4 @@
09.08.2003 m. fuchs class DesktopWindow for shell view on the desktop 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 11.08.2003 m. fuchs class BackgroundWindow for painting of desktop background
open child folders by double click in ShellBrowserChild open child folders by double click in ShellBrowserChild
13.08.2003 m. fuchs make explorer bar look more like windows taskbar bar

View file

@ -83,6 +83,10 @@ CFG=make_explorer - Win32 Debug
# Begin Source File # Begin Source File
SOURCE=..\..\..\ChangeLog
# End Source File
# Begin Source File
SOURCE=.\makefile SOURCE=.\makefile
# End Source File # End Source File
# End Target # End Target

View file

@ -15,15 +15,20 @@
HFONT tf; HFONT tf;
#ifdef _PLUGINS #ifdef _PLUGINS
HINSTANCE PlugInsHI[4]; // PlugIns table HINSTANCE PlugInsHI[4]; // PlugIns table
#else #else
struct PluginCalls* PlugInsCallTable[4]; // PlugIn Call table struct PluginCalls* PlugInsCallTable[4]; // PlugIn Call table
#endif #endif
int PlugNumber = -1; // Number of loaded plugins int PlugNumber = -1; // Number of loaded plugins
LRESULT WINAPI ExplorerBarProc(HWND, UINT, WPARAM, LPARAM); LRESULT WINAPI ExplorerBarProc(HWND, UINT, WPARAM, LPARAM);
//#define TASKBAR_AT_TOP
#define TASKBAR_WIDTH 30
// Loads a configuration style given by PInt // Loads a configuration style given by PInt
// FIXME : Load all these values from registry ! // FIXME : Load all these values from registry !
// //
@ -31,73 +36,77 @@ DWORD LoadProperty(int PInt)
{ {
switch(PInt) switch(PInt)
{ {
case 1: // WS_EX_Style for creating the bar case 1: // WS_EX_Style for creating the bar
return WS_EX_TOPMOST | WS_EX_DLGMODALFRAME; return WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_PALETTEWINDOW;
break; break;
case 2: // WS_Style for creating the bar case 2: // WS_Style for creating the bar
return WS_VISIBLE | WS_POPUP | WS_CLIPCHILDREN; return WS_POPUP | WS_THICKFRAME | WS_CLIPCHILDREN | WS_VISIBLE ;
break; break;
case 3: // Start X for the panel case 3: // Start X for the panel
return 0; return -2; // hide border
break; break;
case 4: case 4: // Start Y for the panel
return 0; // Start Y for the panel #ifdef TASKBAR_AT_TOP
return -2;
#else
return GetSystemMetrics(SM_CYSCREEN)-TASKBAR_WIDTH;
#endif
break; break;
case 5: case 5:
return GetSystemMetrics(SM_CXSCREEN); // XLen for the panel return GetSystemMetrics(SM_CXSCREEN)+4; // XLen for the panel
break; break;
case 6: case 6:
return 32; // YLen for the panel return TASKBAR_WIDTH+2; // YLen for the panel
break; break;
} }
return 0; return 0;
} }
// Initializez and creates the Explorer Panel // Initialize and create the Explorer Panel
// HINSTANCE as a parameter
//
HWND InitializeExplorerBar(HINSTANCE hInstance, int nCmdShow) HWND InitializeExplorerBar(HINSTANCE hInstance, int nCmdShow)
{ {
HWND ExplorerBar; HWND ExplorerBar;
WNDCLASS ExplorerBarClass; WNDCLASS ExplorerBarClass;
ExplorerBarClass.lpszClassName = TEXT("ExplorerBar"); // ExplorerBar classname ExplorerBarClass.lpszClassName = TEXT("Shell_TrayWnd"); // ExplorerBar classname
ExplorerBarClass.lpfnWndProc = ExplorerBarProc; // Default Explorer Callback Procedure ExplorerBarClass.lpfnWndProc = ExplorerBarProc; // Default Explorer Callback Procedure
ExplorerBarClass.style = 0; // Styles ExplorerBarClass.style = 0; // Styles
ExplorerBarClass.hInstance = hInstance; // Instance ExplorerBarClass.hInstance = hInstance; // Instance
ExplorerBarClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); // Configurable ???? ExplorerBarClass.hIcon = LoadIcon(0, IDI_APPLICATION); // Configurable ????
ExplorerBarClass.hCursor = LoadCursor(NULL, IDC_ARROW); ExplorerBarClass.hCursor = LoadCursor(0, IDC_ARROW);
ExplorerBarClass.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH); // BackGround ExplorerBarClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1); // BackGround
ExplorerBarClass.lpszMenuName = NULL; // No Menu needed for the bar ExplorerBarClass.lpszMenuName = NULL; // No Menu needed for the bar
ExplorerBarClass.cbClsExtra = 0; // Nothing YET! !! ExplorerBarClass.cbClsExtra = 0;
ExplorerBarClass.cbWndExtra = 0; // ExplorerBarClass.cbWndExtra = 0;
if (RegisterClass(&ExplorerBarClass) == 0) // Cold not register anything :( if (!RegisterClass(&ExplorerBarClass))
{ {
fprintf(stderr, "Could not register Explorer Bar. Last error was 0x%X\n",GetLastError()); fprintf(stderr, "Could not register Explorer Bar. Last error was 0x%X\n",GetLastError());
return NULL; return 0;
} }
ExplorerBar = CreateWindowEx(LoadProperty(1),TEXT("ExplorerBar"), ExplorerBar = CreateWindowEx(LoadProperty(1), TEXT("Shell_TrayWnd"),
TEXT("ReactOS Explorer Bar"),LoadProperty(2),LoadProperty(3),LoadProperty(4), TEXT("ReactOS Explorer Bar"), LoadProperty(2), LoadProperty(3), LoadProperty(4),
LoadProperty(5), LoadProperty(6), 0, 0, hInstance, 0); LoadProperty(5), LoadProperty(6), 0, 0, hInstance, 0);
if (ExplorerBar == NULL) if (!ExplorerBar)
{ {
fprintf(stderr, "Cold not create Explorer Bar.Last error 0x%X\n",GetLastError()); fprintf(stderr, "Cold not create Explorer Bar. Last error 0x%X\n",GetLastError());
return(NULL); return 0;
} }
tf = CreateFontA(14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE, tf = CreateFontA(14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE,
ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons"); DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons");
ShowWindow(ExplorerBar, nCmdShow); // Show the bar ShowWindow(ExplorerBar, nCmdShow); // Show the bar
return ExplorerBar;
return ExplorerBar;
} }
// ************************************************************************************** // **************************************************************************************
// * GENERAL PLUGIN CONTROL ROUTINES * // * GENERAL PLUGIN CONTROL ROUTINES *
// ************************************************************************************** // **************************************************************************************
@ -110,8 +119,8 @@ static int ReloadPlugInConfiguration(int ID)
if (!PP) if (!PP)
{ {
fprintf(stderr,"PLUGIN %d, of Instance %0x ReloadPlugInConfig Failed\n",ID,PlugInsHI[ID]); fprintf(stderr,"PLUGIN %d, of Instance %0x ReloadPlugInConfig Failed\n",ID,PlugInsHI[ID]);
return 0; return 0;
} }
#else #else
PReloadConfig PP = PlugInsCallTable[ID]->ReloadPlugInConfiguration; PReloadConfig PP = PlugInsCallTable[ID]->ReloadPlugInConfiguration;
@ -127,8 +136,8 @@ int QuitPlugIn(int ID)
if (!PP) if (!PP)
{ {
fprintf(stderr,"PLUGIN %d, of Instance %0x QuitPlugIn Failed\n",ID,PlugInsHI[ID]); fprintf(stderr,"PLUGIN %d, of Instance %0x QuitPlugIn Failed\n",ID,PlugInsHI[ID]);
return 0; return 0;
} }
#else #else
PQuitPlugIn PP = PlugInsCallTable[ID]->QuitPlugIn; 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"); PPlugInCallBack PP = (PPlugInCallBack)GetProcAddress(PlugInsHI[ID],/*"_"*/"PlugInMessageProc");
if (!PP) if (!PP)
{ {
fprintf(stderr,"PLUGIN %d, of Instance %0x CallBackPlugIn Failed\n",ID,PlugInsHI[ID]); fprintf(stderr,"PLUGIN %d, of Instance %0x CallBackPlugIn Failed\n",ID,PlugInsHI[ID]);
return 0; return 0;
} }
#else #else
PPlugInCallBack PP = PlugInsCallTable[ID]->PlugInMessageProc; PPlugInCallBack PP = PlugInsCallTable[ID]->PlugInMessageProc;
@ -167,8 +176,8 @@ int PostExplorerInfo(int ID, HWND ExplHandle)
if (!PP) if (!PP)
{ {
fprintf(stderr,"PLUGIN %d, of Instance %0x PostExplorerInfo Failed\n",ID,PlugInsHI[ID]); fprintf(stderr,"PLUGIN %d, of Instance %0x PostExplorerInfo Failed\n",ID,PlugInsHI[ID]);
return 0; return 0;
} }
#else #else
PExplorerInfo PP = PlugInsCallTable[ID]->ExplorerInfo; PExplorerInfo PP = PlugInsCallTable[ID]->ExplorerInfo;
@ -191,8 +200,8 @@ int InitializePlugIn(int ID, HWND ExplHandle)
PInitializePlugIn PP = (PInitializePlugIn)GetProcAddress(PlugInsHI[ID],/*"_"*/"InitializePlugIn"); PInitializePlugIn PP = (PInitializePlugIn)GetProcAddress(PlugInsHI[ID],/*"_"*/"InitializePlugIn");
if (!PP) if (!PP)
{ {
fprintf(stderr,"PLUGIN %d, of Instance %0x InitializePlugIn Failed\n",ID,PlugInsHI[ID]); fprintf(stderr,"PLUGIN %d, of Instance %0x InitializePlugIn Failed\n",ID,PlugInsHI[ID]);
return 0; return 0;
} }
#else #else
PInitializePlugIn PP = PlugInsCallTable[ID]->InitializePlugIn; PInitializePlugIn PP = PlugInsCallTable[ID]->InitializePlugIn;
@ -206,7 +215,7 @@ int InitPlugin(int ID, HWND ExplWnd)
{ {
if (!PostExplorerInfo(ID, 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)) if (!InitializePlugIn(ID, ExplWnd))
@ -228,7 +237,7 @@ int LoadLocalPlugIn(char* fname, HWND ExplWnd)
{ {
PlugNumber++; PlugNumber++;
PlugInsHI[PlugNumber]=LoadLibraryA(fname); PlugInsHI[PlugNumber]=LoadLibraryA(fname);
if (!(PlugInsHI[PlugNumber])) return 0; // Could not load plugin if (!(PlugInsHI[PlugNumber])) return 0; // Could not load plugin
InitPlugin(PlugNumber); InitPlugin(PlugNumber);
@ -244,26 +253,26 @@ int LoadAvailablePlugIns(HWND ExplWnd)
{ {
#ifdef _PLUGINS #ifdef _PLUGINS
FILE* Conf; // Configuration File; FILE* Conf; // Configuration File;
char line[80]; // Blah Blah Blah char line[80]; // Blah Blah Blah
int i; int i;
int x; int x;
int k; 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"); fprintf(stderr,"DefaultPlugin : No PLUGIN configuration file found !\n");
return 0; return 0;
} }
fgets(line,80,Conf); // Read how many entries are in the file 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 k = atoi(line); // atoi it ! We get how many plugIns do we have
for (i=0;i<k;i++) for (i=0;i<k;i++)
{ // Read stuff :) { // Read stuff :)
fgets(line,80,Conf); fgets(line,80,Conf);
for (x=0;line[x];x++) if (line[x]<14){line[x]=0;break;} for (x=0;line[x];x++) if (line[x]<14){line[x]=0;break;}
if (!LoadLocalPlugIn(line,ExplWnd)) PlugNumber--; if (!LoadLocalPlugIn(line,ExplWnd)) PlugNumber--;
} }
@ -271,20 +280,20 @@ int LoadAvailablePlugIns(HWND ExplWnd)
#else #else
// static initialisation of plugins // static initialisation of plugins
PlugInsCallTable[++PlugNumber] = &plugincalls_Menu; PlugInsCallTable[++PlugNumber] = &plugincalls_Menu;
InitPlugin(PlugNumber, ExplWnd); InitPlugin(PlugNumber, ExplWnd);
PlugInsCallTable[++PlugNumber] = &plugincalls_Shutdown; PlugInsCallTable[++PlugNumber] = &plugincalls_Shutdown;
InitPlugin(PlugNumber, ExplWnd); InitPlugin(PlugNumber, ExplWnd);
PlugInsCallTable[++PlugNumber] = &plugincalls_Clock; PlugInsCallTable[++PlugNumber] = &plugincalls_Clock;
InitPlugin(PlugNumber, ExplWnd); InitPlugin(PlugNumber, ExplWnd);
#endif #endif
return PlugNumber+1; // Just one plugin loaded for now ! return PlugNumber+1; // Just one plugin loaded for now !
} }
// Release all available plugins // Release all available plugins
@ -294,7 +303,7 @@ int ReleaseAvailablePlugIns()
{ {
int i; int i;
for (i=0;i<PlugNumber+1;i++) for (i=0;i<PlugNumber+1;i++)
QuitPlugIn(i); QuitPlugIn(i);
return i; return i;
} }
@ -305,7 +314,7 @@ int CallBackPlugIns(HWND PlgnHandle, UINT Msg, WPARAM wParam, LPARAM lParam)
{ {
int i; int i;
for (i=0;i<PlugNumber+1;i++) for (i=0;i<PlugNumber+1;i++)
CallBackPlugIn(i, PlgnHandle, Msg, wParam, lParam); CallBackPlugIn(i, PlgnHandle, Msg, wParam, lParam);
return 1; return 1;
} }
@ -319,9 +328,9 @@ int CallBackPlugIns(HWND PlgnHandle, UINT Msg, WPARAM wParam, LPARAM lParam)
/* /*
int WINAPI WinMain(HINSTANCE hInstance, int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, LPSTR lpszCmdLine,
int nCmdShow) int nCmdShow)
{ {
MSG msg; MSG msg;
HWND ExplHnd; HWND ExplHnd;
@ -330,20 +339,21 @@ int WINAPI WinMain(HINSTANCE hInstance,
// //
if (!(ExplHnd=InitializeExplorerBar(hInstance, nCmdShow))) if (!(ExplHnd=InitializeExplorerBar(hInstance, nCmdShow)))
{ {
fprintf(stderr,"FATAL : Explorer bar could not be initialized properly ! Exiting !\n"); fprintf(stderr,"FATAL : Explorer bar could not be initialized properly ! Exiting !\n");
return 1; return 1;
} }
// Load plugins ! // Load plugins !
if (!LoadAvailablePlugIns(ExplHnd)) if (!LoadAvailablePlugIns(ExplHnd))
{ {
fprintf(stderr,"FATAL : No plugin could be loaded ! Exiting !\n"); fprintf(stderr,"FATAL : No plugin could be loaded ! Exiting !\n");
return 1; return 1;
} }
while(GetMessage(&msg, NULL, 0, 0))
while(GetMessage(&msg, 0, 0, 0))
{ {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
DeleteObject(tf); DeleteObject(tf);
@ -354,30 +364,57 @@ int WINAPI WinMain(HINSTANCE hInstance,
LRESULT CALLBACK ExplorerBarProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK ExplorerBarProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hDC; HDC hDC;
switch(msg) switch(msg) {
{ case WM_PAINT:
case WM_PAINT: hDC = BeginPaint(hWnd, &ps);
hDC = BeginPaint(hWnd, &ps); SelectObject(hDC, tf);
SelectObject(hDC, tf); EndPaint(hWnd, &ps);
EndPaint(hWnd, &ps); CallBackPlugIns(hWnd,msg,wParam,lParam);
CallBackPlugIns(hWnd,msg,wParam,lParam); break;
break;
case WM_CLOSE: case WM_CLOSE:
// Over-ride close. We close desktop with shutdown button // Over-ride close. We close desktop with shutdown button
break; break;
case WM_DESTROY: case WM_DESTROY:
PostQuitMessage(0); PostQuitMessage(0);
break; break;
default: case WM_NCHITTEST: {
CallBackPlugIns(hWnd,msg,wParam,lParam); LRESULT res = DefWindowProc(hWnd, msg, wParam, lParam);
return DefWindowProc(hWnd, msg, wParam, lParam); if (res>=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;
} }

View file

@ -29,7 +29,12 @@ static int InitializePlugIn(HWND ExplorerHandle)
int i; int i;
int x; 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 ! 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 fgets(line,80,Conf); // Read how many entries are in the file
epl_Buttons=atoi(line); // atoi it ! epl_Buttons=atoi(line); // atoi it !
for (i=0;i<epl_Buttons;i++) for (i=0;i<epl_Buttons;i++)
{ {
fgets(ttl,80,Conf); // Read stuff :) fgets(ttl,80,Conf); // Read stuff :)
@ -54,8 +58,8 @@ static int InitializePlugIn(HWND ExplorerHandle)
strcpy(epl_line[i],line); strcpy(epl_line[i],line);
epl_AppButtons[i] = CreateWindow( epl_AppButtons[i] = CreateWindow(
TEXT("BUTTON"),ttl/*@@*/,WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, TEXT("BUTTON"),ttl/*@@*/, WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
(i*102)+2, 2, 100, ex_dy-10, ExplorerHandle, NULL, (HINSTANCE) GetWindowLong(ExplorerHandle, GWL_HINSTANCE),NULL); 60+(i*102)+2, 2, 100, ex_dy-10, ExplorerHandle, NULL, hinst, 0);
} }
return 1; return 1;
@ -159,6 +163,7 @@ static int PlugInMessageProc(HWND PlgnHandle, UINT Msg, WPARAM wParam, LPARAM lP
} }
break; break;
} }
return 1; return 1;
} }