Owen Rudge : shell32: Add status bar to control panel.
Alexandre Julliard
julliard at winehq.org
Fri Jul 25 08:13:40 CDT 2008
Module: wine
Branch: master
Commit: 5800539bb68282e406ea0ad090a08714f1adfd1a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5800539bb68282e406ea0ad090a08714f1adfd1a
Author: Owen Rudge <owen at owenrudge.net>
Date: Thu Jul 24 22:10:41 2008 +0100
shell32: Add status bar to control panel.
---
dlls/shell32/control.c | 70 +++++++++++++++++++++++++++++++++++++++++++-----
dlls/shell32/cpanel.h | 1 +
2 files changed, 64 insertions(+), 7 deletions(-)
diff --git a/dlls/shell32/control.c b/dlls/shell32/control.c
index 89a790a..642e611 100644
--- a/dlls/shell32/control.c
+++ b/dlls/shell32/control.c
@@ -166,6 +166,7 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
}
#define IDC_LISTVIEW 1000
+#define IDC_STATUSBAR 1001
#define NUM_COLUMNS 2
#define LISTVIEW_DEFSTYLE (WS_CHILD | WS_VISIBLE | WS_TABSTOP |\
@@ -173,18 +174,20 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
static BOOL Control_CreateListView (CPanel *panel)
{
- RECT ws;
+ RECT ws, sb;
WCHAR empty_string[] = {0};
WCHAR buf[MAX_STRING_LEN];
LVCOLUMNW lvc;
/* Create list view */
+ GetClientRect(panel->hWndStatusBar, &sb);
GetClientRect(panel->hWnd, &ws);
panel->hWndListView = CreateWindowExW(WS_EX_CLIENTEDGE, WC_LISTVIEWW,
empty_string, LISTVIEW_DEFSTYLE | LVS_ICON,
- 0, 0, ws.right - ws.left, ws.bottom - ws.top,
- panel->hWnd, (HMENU) IDC_LISTVIEW, panel->hInst, NULL);
+ 0, 0, ws.right - ws.left, ws.bottom - ws.top -
+ (sb.bottom - sb.top), panel->hWnd,
+ (HMENU) IDC_LISTVIEW, panel->hInst, NULL);
if (!panel->hWndListView)
return FALSE;
@@ -233,15 +236,23 @@ static void Control_WndProc_Create(HWND hWnd, const CREATESTRUCTW* cs)
CPlItem *item;
LVITEMW lvItem;
INITCOMMONCONTROLSEX icex;
+ INT sb_parts;
SetWindowLongPtrW(hWnd, 0, (LONG_PTR)panel);
panel->hWnd = hWnd;
/* Initialise common control DLL */
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
- icex.dwICC = ICC_LISTVIEW_CLASSES;
+ icex.dwICC = ICC_LISTVIEW_CLASSES | ICC_BAR_CLASSES;
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 */
if (!Control_CreateListView(panel))
return;
@@ -491,6 +502,17 @@ static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg,
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;
@@ -499,12 +521,46 @@ static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg,
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:
{
- 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);
- MoveWindow(panel->hWndListView, 0, 0, rect.right, rect.bottom, TRUE);
+ if (hdwp != NULL)
+ EndDeferWindowPos(hdwp);
return 0;
}
diff --git a/dlls/shell32/cpanel.h b/dlls/shell32/cpanel.h
index b52ad97..23ec5e5 100644
--- a/dlls/shell32/cpanel.h
+++ b/dlls/shell32/cpanel.h
@@ -41,6 +41,7 @@ typedef struct CPanel {
HWND hWndListView;
HIMAGELIST hImageListLarge;
HIMAGELIST hImageListSmall;
+ HWND hWndStatusBar;
} CPanel;
/* structure to reference an individual control panel item */
More information about the wine-cvs
mailing list