Commit 5800539b authored by Owen Rudge's avatar Owen Rudge Committed by Alexandre Julliard

shell32: Add status bar to control panel.

parent 238cdf71
...@@ -166,6 +166,7 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) ...@@ -166,6 +166,7 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
} }
#define IDC_LISTVIEW 1000 #define IDC_LISTVIEW 1000
#define IDC_STATUSBAR 1001
#define NUM_COLUMNS 2 #define NUM_COLUMNS 2
#define LISTVIEW_DEFSTYLE (WS_CHILD | WS_VISIBLE | WS_TABSTOP |\ #define LISTVIEW_DEFSTYLE (WS_CHILD | WS_VISIBLE | WS_TABSTOP |\
...@@ -173,18 +174,20 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) ...@@ -173,18 +174,20 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
static BOOL Control_CreateListView (CPanel *panel) static BOOL Control_CreateListView (CPanel *panel)
{ {
RECT ws; RECT ws, sb;
WCHAR empty_string[] = {0}; WCHAR empty_string[] = {0};
WCHAR buf[MAX_STRING_LEN]; WCHAR buf[MAX_STRING_LEN];
LVCOLUMNW lvc; LVCOLUMNW lvc;
/* Create list view */ /* Create list view */
GetClientRect(panel->hWndStatusBar, &sb);
GetClientRect(panel->hWnd, &ws); GetClientRect(panel->hWnd, &ws);
panel->hWndListView = CreateWindowExW(WS_EX_CLIENTEDGE, WC_LISTVIEWW, panel->hWndListView = CreateWindowExW(WS_EX_CLIENTEDGE, WC_LISTVIEWW,
empty_string, LISTVIEW_DEFSTYLE | LVS_ICON, empty_string, LISTVIEW_DEFSTYLE | LVS_ICON,
0, 0, ws.right - ws.left, ws.bottom - ws.top, 0, 0, ws.right - ws.left, ws.bottom - ws.top -
panel->hWnd, (HMENU) IDC_LISTVIEW, panel->hInst, NULL); (sb.bottom - sb.top), panel->hWnd,
(HMENU) IDC_LISTVIEW, panel->hInst, NULL);
if (!panel->hWndListView) if (!panel->hWndListView)
return FALSE; return FALSE;
...@@ -233,15 +236,23 @@ static void Control_WndProc_Create(HWND hWnd, const CREATESTRUCTW* cs) ...@@ -233,15 +236,23 @@ static void Control_WndProc_Create(HWND hWnd, const CREATESTRUCTW* cs)
CPlItem *item; CPlItem *item;
LVITEMW lvItem; LVITEMW lvItem;
INITCOMMONCONTROLSEX icex; INITCOMMONCONTROLSEX icex;
INT sb_parts;
SetWindowLongPtrW(hWnd, 0, (LONG_PTR)panel); SetWindowLongPtrW(hWnd, 0, (LONG_PTR)panel);
panel->hWnd = hWnd; panel->hWnd = hWnd;
/* Initialise common control DLL */ /* Initialise common control DLL */
icex.dwSize = sizeof(INITCOMMONCONTROLSEX); icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_LISTVIEW_CLASSES; icex.dwICC = ICC_LISTVIEW_CLASSES | ICC_BAR_CLASSES;
InitCommonControlsEx(&icex); InitCommonControlsEx(&icex);
/* create the status bar */
if (!(panel->hWndStatusBar = CreateStatusWindowW(WS_CHILD | WS_VISIBLE | CCS_BOTTOM | SBARS_SIZEGRIP, NULL, hWnd, IDC_STATUSBAR)))
return;
sb_parts = -1;
SendMessageW(panel->hWndStatusBar, SB_SETPARTS, 1, (LPARAM) &sb_parts);
/* create the list view */ /* create the list view */
if (!Control_CreateListView(panel)) if (!Control_CreateListView(panel))
return; return;
...@@ -491,6 +502,17 @@ static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg, ...@@ -491,6 +502,17 @@ static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg,
return 0; return 0;
} }
case LVN_ITEMCHANGED:
{
CPlItem *item = Control_GetCPlItem_From_ListView(panel);
/* update the status bar if item is valid */
if (item)
SetWindowTextW(panel->hWndStatusBar,
item->applet->info[item->id].szInfo);
return 0;
}
} }
break; break;
...@@ -499,12 +521,46 @@ static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg, ...@@ -499,12 +521,46 @@ static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg,
break; break;
} }
case WM_MENUSELECT:
/* check if this is an applet */
if ((LOWORD(lParam1) >= IDM_CPANEL_APPLET_BASE) &&
(LOWORD(lParam1) <= IDM_CPANEL_APPLET_BASE + panel->total_subprogs))
{
CPlItem *item = Control_GetCPlItem_From_MenuID(hWnd, LOWORD(lParam1));
/* update the status bar if item is valid */
if (item)
SetWindowTextW(panel->hWndStatusBar, item->applet->info[item->id].szInfo);
}
else
SetWindowTextW(panel->hWndStatusBar, NULL);
return 0;
case WM_SIZE: case WM_SIZE:
{ {
RECT rect; HDWP hdwp;
RECT sb;
hdwp = BeginDeferWindowPos(2);
if (hdwp == NULL)
break;
GetClientRect(panel->hWndStatusBar, &sb);
hdwp = DeferWindowPos(hdwp, panel->hWndListView, NULL, 0, 0,
LOWORD(lParam2), HIWORD(lParam2) - (sb.bottom - sb.top),
SWP_NOZORDER | SWP_NOMOVE);
if (hdwp == NULL)
break;
hdwp = DeferWindowPos(hdwp, panel->hWndStatusBar, NULL, 0, 0,
LOWORD(lParam2), LOWORD(lParam1), SWP_NOZORDER | SWP_NOMOVE);
GetClientRect(hWnd, &rect); if (hdwp != NULL)
MoveWindow(panel->hWndListView, 0, 0, rect.right, rect.bottom, TRUE); EndDeferWindowPos(hdwp);
return 0; return 0;
} }
......
...@@ -41,6 +41,7 @@ typedef struct CPanel { ...@@ -41,6 +41,7 @@ typedef struct CPanel {
HWND hWndListView; HWND hWndListView;
HIMAGELIST hImageListLarge; HIMAGELIST hImageListLarge;
HIMAGELIST hImageListSmall; HIMAGELIST hImageListSmall;
HWND hWndStatusBar;
} CPanel; } CPanel;
/* structure to reference an individual control panel item */ /* structure to reference an individual control panel item */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment