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>
* 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
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

View file

@ -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

View file

@ -24,6 +24,11 @@ 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 !
//
@ -32,59 +37,62 @@ DWORD LoadProperty(int PInt)
switch(PInt)
{
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;
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;
case 3: // Start X for the panel
return 0;
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;
ExplorerBarClass.lpszClassName = TEXT("ExplorerBar"); // ExplorerBar classname
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(NULL, IDI_APPLICATION); // Configurable ????
ExplorerBarClass.hCursor = LoadCursor(NULL, IDC_ARROW);
ExplorerBarClass.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH); // BackGround
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; // Nothing YET! !!
ExplorerBarClass.cbWndExtra = 0; //
ExplorerBarClass.cbClsExtra = 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());
return NULL;
return 0;
}
ExplorerBar = CreateWindowEx(LoadProperty(1),TEXT("ExplorerBar"),
TEXT("ReactOS Explorer Bar"),LoadProperty(2),LoadProperty(3),LoadProperty(4),
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 == NULL)
if (!ExplorerBar)
{
fprintf(stderr, "Cold not create Explorer Bar.Last error 0x%X\n",GetLastError());
return(NULL);
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,
@ -92,6 +100,7 @@ HWND InitializeExplorerBar(HINSTANCE hInstance, int nCmdShow)
DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons");
ShowWindow(ExplorerBar, nCmdShow); // Show the bar
return ExplorerBar;
}
@ -340,7 +349,8 @@ int WINAPI WinMain(HINSTANCE hInstance,
fprintf(stderr,"FATAL : No plugin could be loaded ! Exiting !\n");
return 1;
}
while(GetMessage(&msg, NULL, 0, 0))
while(GetMessage(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
@ -357,8 +367,7 @@ LRESULT CALLBACK ExplorerBarProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
PAINTSTRUCT ps;
HDC hDC;
switch(msg)
{
switch(msg) {
case WM_PAINT:
hDC = BeginPaint(hWnd, &ps);
SelectObject(hDC, tf);
@ -374,8 +383,36 @@ LRESULT CALLBACK ExplorerBarProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
PostQuitMessage(0);
break;
default:
CallBackPlugIns(hWnd,msg,wParam,lParam);
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);
return DefWindowProc(hWnd, msg, wParam, lParam);
}

View file

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