mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
Rudimentiary drivebar support added.
svn path=/trunk/; revision=3358
This commit is contained in:
parent
7376639aea
commit
2cac3f921d
3 changed files with 177 additions and 76 deletions
|
@ -44,6 +44,7 @@
|
||||||
// Global Variables:
|
// Global Variables:
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
void ConfigureDriveBar(HWND hDriveBar)
|
void ConfigureDriveBar(HWND hDriveBar)
|
||||||
{
|
{
|
||||||
static DWORD dwLogicalDrivesSaved;
|
static DWORD dwLogicalDrivesSaved;
|
||||||
|
@ -53,6 +54,7 @@ void ConfigureDriveBar(HWND hDriveBar)
|
||||||
|
|
||||||
if (dwLogicalDrives != dwLogicalDrivesSaved) {
|
if (dwLogicalDrives != dwLogicalDrivesSaved) {
|
||||||
TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP};
|
TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP};
|
||||||
|
COMBOBOXEXITEM cbei;
|
||||||
int btn = 1;
|
int btn = 1;
|
||||||
PTSTR p;
|
PTSTR p;
|
||||||
int count = SendMessage(hDriveBar, TB_BUTTONCOUNT, 0, 0);
|
int count = SendMessage(hDriveBar, TB_BUTTONCOUNT, 0, 0);
|
||||||
|
@ -71,8 +73,11 @@ void ConfigureDriveBar(HWND hDriveBar)
|
||||||
drivebarBtn.idCommand = ID_DRIVE_FIRST;
|
drivebarBtn.idCommand = ID_DRIVE_FIRST;
|
||||||
for (p = Globals.drives; *p;) {
|
for (p = Globals.drives; *p;) {
|
||||||
// insert drive letter
|
// insert drive letter
|
||||||
TCHAR b[3] = { tolower(*p) };
|
// TCHAR b[3] = { tolower(*p) };
|
||||||
SendMessage(hDriveBar, TB_ADDSTRING, 0, (LPARAM)b);
|
// SendMessage(hDriveBar, TB_ADDSTRING, 0, (LPARAM)b);
|
||||||
|
TCHAR szVolumeNameBuffer[MAX_PATH];
|
||||||
|
TCHAR vol[MAX_PATH] = { tolower(*p) };
|
||||||
|
SendMessage(hDriveBar, TB_ADDSTRING, 0, (LPARAM)vol);
|
||||||
switch(GetDriveType(p)) {
|
switch(GetDriveType(p)) {
|
||||||
case DRIVE_REMOVABLE: drivebarBtn.iBitmap = 1; break;
|
case DRIVE_REMOVABLE: drivebarBtn.iBitmap = 1; break;
|
||||||
case DRIVE_CDROM: drivebarBtn.iBitmap = 3; break;
|
case DRIVE_CDROM: drivebarBtn.iBitmap = 3; break;
|
||||||
|
@ -81,26 +86,43 @@ void ConfigureDriveBar(HWND hDriveBar)
|
||||||
default:/*DRIVE_FIXED*/ drivebarBtn.iBitmap = 2;
|
default:/*DRIVE_FIXED*/ drivebarBtn.iBitmap = 2;
|
||||||
}
|
}
|
||||||
SendMessage(hDriveBar, TB_INSERTBUTTON, btn, (LPARAM)&drivebarBtn);
|
SendMessage(hDriveBar, TB_INSERTBUTTON, btn, (LPARAM)&drivebarBtn);
|
||||||
|
|
||||||
|
vol[0] = toupper(vol[0]);
|
||||||
|
vol[1] = _T(':'); vol[2] = _T('\\'); vol[3] = _T('\0');
|
||||||
|
if (drivebarBtn.iBitmap != 1 /*DRIVE_REMOVABLE*/ &&
|
||||||
|
GetVolumeInformation(vol, szVolumeNameBuffer,
|
||||||
|
sizeof(szVolumeNameBuffer)/sizeof(TCHAR),
|
||||||
|
NULL, NULL, NULL, NULL, 0) &&
|
||||||
|
szVolumeNameBuffer[0] != _T('\0')) {
|
||||||
|
vol[2] = _T(' '); vol[3] = _T('['); vol[4] = _T('\0');
|
||||||
|
_tcscat(vol, szVolumeNameBuffer);
|
||||||
|
_tcscat(vol, _T("] "));
|
||||||
|
} else {
|
||||||
|
vol[2] = _T(' ');
|
||||||
|
}
|
||||||
|
// cbei.mask = CBEIF_TEXT | CBEIF_INDENT | CBEIF_IMAGE| CBEIF_SELECTEDIMAGE;
|
||||||
|
cbei.mask = CBEIF_TEXT/* | CBEIF_IMAGE*/;
|
||||||
|
cbei.iItem = btn - 1;
|
||||||
|
cbei.pszText = vol;
|
||||||
|
cbei.cchTextMax = _tcslen(cbei.pszText);
|
||||||
|
cbei.iImage = drivebarBtn.iBitmap;
|
||||||
|
// cbei.iSelectedImage = IInf[iCnt].iSelectedImage;
|
||||||
|
// cbei.iIndent = IInf[iCnt].iIndent;
|
||||||
|
SendMessage(Globals.hDriveCombo, CBEM_INSERTITEM, 0, (LPARAM)&cbei);
|
||||||
|
|
||||||
drivebarBtn.idCommand++;
|
drivebarBtn.idCommand++;
|
||||||
drivebarBtn.iString++;
|
drivebarBtn.iString++;
|
||||||
while(*p++);
|
while(*p++);
|
||||||
//
|
|
||||||
// SendMessage(Globals.hDriveCombo, CB_INSERTSTRING, btn, (LPARAM)b);
|
|
||||||
// SendMessage(Globals.hDriveCombo, CB_ADDSTRING, 0, (LPARAM)b);
|
|
||||||
// SendMessage(Globals.hDriveCombo, WM_SETTEXT, 0, (LPARAM)lpszWord);
|
|
||||||
// SendMessage(Globals.hDriveCombo, CB_ADDSTRING, 0, (LPARAM)&b);
|
|
||||||
//
|
|
||||||
++btn;
|
++btn;
|
||||||
}
|
}
|
||||||
dwLogicalDrivesSaved = dwLogicalDrives;
|
dwLogicalDrivesSaved = dwLogicalDrives;
|
||||||
|
|
||||||
// SendMessage(Globals.hDriveCombo, CB_SHOWDROPDOWN, (WPARAM)TRUE, (LPARAM)0);
|
// SendMessage(Globals.hDriveCombo, CB_SHOWDROPDOWN, (WPARAM)TRUE, (LPARAM)0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
|
|
||||||
{
|
{
|
||||||
COMBOBOXEXITEM cbei;
|
#define MAX_ITEMS 7
|
||||||
int iCnt;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int iImage;
|
int iImage;
|
||||||
|
@ -109,42 +131,35 @@ void ConfigureDriveBar(HWND hDriveBar)
|
||||||
LPTSTR pszText;
|
LPTSTR pszText;
|
||||||
} ITEMINFO, *PITEMINFO;
|
} ITEMINFO, *PITEMINFO;
|
||||||
|
|
||||||
#define MAX_ITEMS 15
|
|
||||||
|
|
||||||
ITEMINFO IInf[] = {
|
ITEMINFO IInf[] = {
|
||||||
{ 0, 3, 0, _T("first")},
|
{ 0, 3, 0, _T("A:")},
|
||||||
{ 1, 4, 1, _T("second")},
|
{ 1, 4, 1, _T("C: [SYSTEM]")},
|
||||||
{ 2, 5, 2, _T("third")},
|
{ 2, 5, 2, _T("D:")},
|
||||||
{ 0, 3, 0, _T("fourth")},
|
{ 0, 3, 0, _T("E: [SOFT_RAID_1]")},
|
||||||
{ 1, 4, 1, _T("fifth")},
|
{ 1, 4, 1, _T("F: [DATAVOL]")},
|
||||||
{ 2, 5, 2, _T("sixth")},
|
{ 2, 5, 2, _T("sixth")},
|
||||||
{ 0, 3, 0, _T("seventh")},
|
{ 0, 3, 0, _T("seventh")},
|
||||||
{ 1, 4, 1, _T("eighth")},
|
|
||||||
{ 2, 5, 2, _T("ninth")},
|
|
||||||
{ 0, 3, 0, _T("tenth")},
|
|
||||||
{ 1, 4, 1, _T("eleventh")},
|
|
||||||
{ 2, 5, 2, _T("twelfth")},
|
|
||||||
{ 0, 3, 0, _T("thirteenth")},
|
|
||||||
{ 1, 4, 1, _T("fourteenth")},
|
|
||||||
{ 2, 5, 2, _T("fifteenth")}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (iCnt = 0; iCnt < MAX_ITEMS; iCnt++) {
|
COMBOBOXEXITEM cbei;
|
||||||
|
int iCnt;
|
||||||
|
|
||||||
cbei.mask = CBEIF_TEXT | CBEIF_INDENT | CBEIF_IMAGE| CBEIF_SELECTEDIMAGE;
|
for (iCnt = 0; iCnt < MAX_ITEMS; iCnt++) {
|
||||||
|
// cbei.mask = CBEIF_TEXT | CBEIF_INDENT | CBEIF_IMAGE| CBEIF_SELECTEDIMAGE;
|
||||||
|
cbei.mask = CBEIF_TEXT;
|
||||||
cbei.iItem = iCnt;
|
cbei.iItem = iCnt;
|
||||||
cbei.pszText = IInf[iCnt].pszText;
|
cbei.pszText = IInf[iCnt].pszText;
|
||||||
cbei.cchTextMax = sizeof(IInf[iCnt].pszText);
|
// cbei.cchTextMax = sizeof(IInf[iCnt].pszText);
|
||||||
cbei.iImage = IInf[iCnt].iImage;
|
cbei.cchTextMax = _tcslen(IInf[iCnt].pszText);
|
||||||
cbei.iSelectedImage = IInf[iCnt].iSelectedImage;
|
// cbei.iImage = IInf[iCnt].iImage;
|
||||||
cbei.iIndent = IInf[iCnt].iIndent;
|
// cbei.iSelectedImage = IInf[iCnt].iSelectedImage;
|
||||||
}
|
// cbei.iIndent = IInf[iCnt].iIndent;
|
||||||
|
|
||||||
|
|
||||||
SendMessage(Globals.hDriveCombo, CBEM_INSERTITEM, 0, (LPARAM)&cbei);
|
SendMessage(Globals.hDriveCombo, CBEM_INSERTITEM, 0, (LPARAM)&cbei);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
void _GetFreeSpaceEx(void)
|
void _GetFreeSpaceEx(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -371,24 +371,8 @@ static void toggle_child(HWND hWnd, UINT cmd, HWND hchild)
|
||||||
resize_frame_client(hWnd);
|
resize_frame_client(hWnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
static BOOL cmd_drive_select(HWND hWnd, UINT cmd)
|
||||||
//
|
|
||||||
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
|
|
||||||
//
|
|
||||||
// PURPOSE: Processes WM_COMMAND messages for the main frame window.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
{
|
||||||
UINT cmd = LOWORD(wParam);
|
|
||||||
HWND hChildWnd;
|
|
||||||
// HWND hwndClient = (HWND)SendMessage(Globals.hMDIClient, WM_MDIGETACTIVE, 0, 0);
|
|
||||||
// if (hwndClient)
|
|
||||||
// if (SendMessage(hwndClient, WM_DISPATCH_COMMAND, wParam, lParam))
|
|
||||||
// return 0;
|
|
||||||
|
|
||||||
if (cmd >= ID_DRIVE_FIRST && cmd <= (ID_DRIVE_FIRST + 0xFF)) {
|
|
||||||
TCHAR drv[_MAX_DRIVE];
|
TCHAR drv[_MAX_DRIVE];
|
||||||
//TCHAR path[MAX_PATH];
|
//TCHAR path[MAX_PATH];
|
||||||
//ChildWnd* pChildWnd;
|
//ChildWnd* pChildWnd;
|
||||||
|
@ -408,10 +392,49 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
//GetCurrentDirectory(MAX_PATH, path); //@@ letztes Verzeichnis pro Laufwerk speichern
|
//GetCurrentDirectory(MAX_PATH, path); //@@ letztes Verzeichnis pro Laufwerk speichern
|
||||||
//CreateChildWindow(path);
|
//CreateChildWindow(path);
|
||||||
CreateChildWindow(cmd - ID_DRIVE_FIRST);
|
CreateChildWindow(cmd - ID_DRIVE_FIRST);
|
||||||
|
|
||||||
// pChildWnd = alloc_child_window(path);
|
// pChildWnd = alloc_child_window(path);
|
||||||
// if (!create_child_window(pChildWnd))
|
// if (!create_child_window(pChildWnd))
|
||||||
// free(pChildWnd);
|
// free(pChildWnd);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL OnComboBoxCmd(HWND hWnd, WPARAM wParam)
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
switch (HIWORD(wParam)) {
|
||||||
|
case CBN_SELCHANGE:
|
||||||
|
index = SendMessage(Globals.hDriveCombo, CB_GETCURSEL, 0, 0);
|
||||||
|
cmd_drive_select(hWnd, index + ID_DRIVE_FIRST);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
|
||||||
|
//
|
||||||
|
// PURPOSE: Processes WM_COMMAND messages for the main frame window.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
UINT cmd = LOWORD(wParam);
|
||||||
|
HWND hChildWnd;
|
||||||
|
// HWND hwndClient = (HWND)SendMessage(Globals.hMDIClient, WM_MDIGETACTIVE, 0, 0);
|
||||||
|
// if (hwndClient)
|
||||||
|
// if (SendMessage(hwndClient, WM_DISPATCH_COMMAND, wParam, lParam))
|
||||||
|
// return 0;
|
||||||
|
|
||||||
|
if ((HWND)lParam == Globals.hDriveCombo) {
|
||||||
|
return OnComboBoxCmd(hWnd, wParam);
|
||||||
|
}
|
||||||
|
if (cmd >= ID_DRIVE_FIRST && cmd <= (ID_DRIVE_FIRST + 0xFF)) {
|
||||||
|
cmd_drive_select(hWnd, cmd);
|
||||||
} else {
|
} else {
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case ID_WINDOW_CLOSEALL:
|
case ID_WINDOW_CLOSEALL:
|
||||||
|
@ -422,7 +445,6 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
if (!SendMessage(hChildWnd, WM_QUERYENDSESSION, 0, 0))
|
if (!SendMessage(hChildWnd, WM_QUERYENDSESSION, 0, 0))
|
||||||
SendMessage(Globals.hMDIClient, WM_MDIDESTROY, (WPARAM)hChildWnd, 0);
|
SendMessage(Globals.hMDIClient, WM_MDIDESTROY, (WPARAM)hChildWnd, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_DISK_COPY_DISK:
|
case ID_DISK_COPY_DISK:
|
||||||
CopyDisk(hWnd);
|
CopyDisk(hWnd);
|
||||||
break;
|
break;
|
||||||
|
@ -699,6 +721,44 @@ typedef struct _TBBUTTON {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LRESULT OnDriveBoxNotify(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
LPNMHDR nmhdr = (LPNMHDR)lParam;
|
||||||
|
|
||||||
|
// if (nmhdr->code == NM_HOVER || nmhdr->code == NM_NCHITTEST) return 0;
|
||||||
|
|
||||||
|
// switch (((LPNMHDR)lParam)->code) {
|
||||||
|
switch (nmhdr->code) {
|
||||||
|
case NM_OUTOFMEMORY:
|
||||||
|
case NM_CLICK:
|
||||||
|
case NM_DBLCLK:
|
||||||
|
case NM_RETURN:
|
||||||
|
case NM_RCLICK:
|
||||||
|
case NM_RDBLCLK:
|
||||||
|
case NM_SETFOCUS:
|
||||||
|
case NM_KILLFOCUS:
|
||||||
|
break;
|
||||||
|
|
||||||
|
#if (_WIN32_IE >= 0x0300)
|
||||||
|
case NM_CUSTOMDRAW:
|
||||||
|
case NM_HOVER:
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (_WIN32_IE >= 0x0400)
|
||||||
|
case NM_NCHITTEST:
|
||||||
|
case NM_KEYDOWN:
|
||||||
|
case NM_RELEASEDCAPTURE:
|
||||||
|
case NM_SETCURSOR:
|
||||||
|
case NM_CHAR:
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG)
|
// FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG)
|
||||||
|
@ -731,7 +791,15 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
|
|
||||||
|
if (((LPNMHDR)lParam)->idFrom == IDW_DRIVEBOX) {
|
||||||
|
// return OnDriveBoxNotify(hWnd, wParam, lParam);
|
||||||
|
return OnDriveBoxNotify(hWnd, wParam, lParam);
|
||||||
|
//return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((LPNMHDR)lParam)->idFrom == IDW_TOOLBAR) {
|
||||||
if (MsgNotify(hWnd, message, wParam, lParam)) return TRUE;
|
if (MsgNotify(hWnd, message, wParam, lParam)) return TRUE;
|
||||||
|
}
|
||||||
// return MsgNotify(hWnd, message, wParam, lParam);
|
// return MsgNotify(hWnd, message, wParam, lParam);
|
||||||
switch (((LPNMHDR)lParam)->code) {
|
switch (((LPNMHDR)lParam)->code) {
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
|
@ -139,9 +139,13 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
|
|
||||||
INITCOMMONCONTROLSEX icc = {
|
INITCOMMONCONTROLSEX icc = {
|
||||||
sizeof(INITCOMMONCONTROLSEX),
|
sizeof(INITCOMMONCONTROLSEX),
|
||||||
ICC_BAR_CLASSES
|
ICC_BAR_CLASSES | ICC_USEREX_CLASSES
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
|
||||||
|
// icex.dwICC = ICC_USEREX_CLASSES;
|
||||||
|
|
||||||
|
|
||||||
// TCHAR path[MAX_PATH];
|
// TCHAR path[MAX_PATH];
|
||||||
|
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC(0);
|
||||||
|
@ -267,9 +271,23 @@ typedef struct _TBBUTTON {
|
||||||
// Create the edit control. Notice that the parent of
|
// Create the edit control. Notice that the parent of
|
||||||
// the toolbar, is used as the parent of the edit control.
|
// the toolbar, is used as the parent of the edit control.
|
||||||
//hWndEdit = CreateWindowEx(0L, WC_COMBOBOXEX, NULL, WS_CHILD | WS_BORDER | WS_VISIBLE
|
//hWndEdit = CreateWindowEx(0L, WC_COMBOBOXEX, NULL, WS_CHILD | WS_BORDER | WS_VISIBLE
|
||||||
Globals.hDriveCombo = CreateWindowEx(0L, _T("ComboBox"), NULL, WS_CHILD | WS_BORDER | WS_VISIBLE
|
#if 0
|
||||||
| CBS_DROPDOWNLIST | ES_LEFT | ES_AUTOVSCROLL | ES_MULTILINE,
|
Globals.hDriveCombo = CreateWindowEx(0L, _T("ComboBox"), NULL,
|
||||||
|
WS_CHILD | WS_BORDER | WS_VISIBLE | CBS_DROPDOWNLIST | ES_LEFT | ES_AUTOVSCROLL | ES_MULTILINE,
|
||||||
10, 0, DRIVEBOX_WIDTH, DRIVEBOX_HEIGHT, Globals.hMainWnd, (HMENU)IDW_DRIVEBOX, hInstance, 0);
|
10, 0, DRIVEBOX_WIDTH, DRIVEBOX_HEIGHT, Globals.hMainWnd, (HMENU)IDW_DRIVEBOX, hInstance, 0);
|
||||||
|
#else
|
||||||
|
Globals.hDriveCombo = CreateWindowEx(0, WC_COMBOBOXEX, NULL,
|
||||||
|
WS_CHILD | WS_BORDER | WS_VISIBLE | CBS_DROPDOWN,
|
||||||
|
// No size yet--resize after setting image list.
|
||||||
|
10, // Vertical position of Combobox
|
||||||
|
0, // Horizontal position of Combobox
|
||||||
|
200, // Sets the width of Combobox
|
||||||
|
100, // Sets the height of Combobox
|
||||||
|
Globals.hMainWnd,
|
||||||
|
(HMENU)IDW_DRIVEBOX,
|
||||||
|
hInstance,
|
||||||
|
NULL);
|
||||||
|
#endif
|
||||||
// Set the toolbar window as the parent of the edit control
|
// Set the toolbar window as the parent of the edit control
|
||||||
// window. You must set the toolbar as the parent of the edit
|
// window. You must set the toolbar as the parent of the edit
|
||||||
// control for it to appear embedded in the toolbar.
|
// control for it to appear embedded in the toolbar.
|
||||||
|
|
Loading…
Reference in a new issue