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

@ -24,6 +24,11 @@ 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 !
// //
@ -32,59 +37,62 @@ 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,
@ -92,6 +100,7 @@ HWND InitializeExplorerBar(HINSTANCE hInstance, int nCmdShow)
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;
} }
@ -340,7 +349,8 @@ int WINAPI WinMain(HINSTANCE hInstance,
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);
@ -357,8 +367,7 @@ LRESULT CALLBACK ExplorerBarProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
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);
@ -374,8 +383,36 @@ LRESULT CALLBACK ExplorerBarProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
PostQuitMessage(0); PostQuitMessage(0);
break; break;
default: case WM_NCHITTEST: {
LRESULT res = 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;}
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); CallBackPlugIns(hWnd, msg, wParam, lParam);
return DefWindowProc(hWnd, msg, wParam, lParam); return DefWindowProc(hWnd, msg, wParam, lParam);
} }

View file

@ -29,8 +29,13 @@ static int InitializePlugIn(HWND ExplorerHandle)
int i; int i;
int x; int x;
HINSTANCE hinst = (HINSTANCE) GetWindowLong(ExplorerHandle, GWL_HINSTANCE);
fprintf(stderr,"EX_MENU : INITIALIZE PLUGIN call\n"); 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 !
{ {
fprintf(stderr,"DefaultPlugin : No configuration file found !\n"); fprintf(stderr,"DefaultPlugin : No configuration file found !\n");
@ -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 :)
@ -55,7 +59,7 @@ static int InitializePlugIn(HWND ExplorerHandle)
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;
} }