Owen Rudge : appwiz.cpl: Enable/disable Modify button, and modify title on Remove button, as appropriate.

Alexandre Julliard julliard at winehq.org
Wed Jul 15 09:45:56 CDT 2009


Module: wine
Branch: master
Commit: 812e60476568758f2ffe34f6235bc61480bfd811
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=812e60476568758f2ffe34f6235bc61480bfd811

Author: Owen Rudge <owen at owenrudge.net>
Date:   Tue Jul 14 17:24:40 2009 -0300

appwiz.cpl: Enable/disable Modify button, and modify title on Remove button, as appropriate.

---

 dlls/appwiz.cpl/appwiz.c |   43 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/dlls/appwiz.cpl/appwiz.c b/dlls/appwiz.cpl/appwiz.c
index 5ad4863..1815320 100644
--- a/dlls/appwiz.cpl/appwiz.c
+++ b/dlls/appwiz.cpl/appwiz.c
@@ -73,6 +73,9 @@ typedef struct APPINFO {
 static struct APPINFO *AppInfo = NULL;
 static HINSTANCE hInst;
 
+static WCHAR btnRemove[MAX_STRING_LEN];
+static WCHAR btnModifyRemove[MAX_STRING_LEN];
+
 static const WCHAR openW[] = {'o','p','e','n',0};
 
 /* names of registry keys */
@@ -401,10 +404,42 @@ static inline void EmptyList(void)
  */
 static void UpdateButtons(HWND hWnd)
 {
-    BOOL sel = SendMessageW(GetDlgItem(hWnd, IDL_PROGRAMS), LVM_GETSELECTEDCOUNT, 0, 0) != 0;
+    APPINFO *iter;
+    LVITEMW lvItem;
+    DWORD selitem = SendDlgItemMessageW(hWnd, IDL_PROGRAMS, LVM_GETNEXTITEM, -1,
+       LVNI_FOCUSED | LVNI_SELECTED);
+    BOOL enable_modify = FALSE;
+
+    if (selitem != -1)
+    {
+        lvItem.iItem = selitem;
+        lvItem.mask = LVIF_PARAM;
+
+        if (SendDlgItemMessageW(hWnd, IDL_PROGRAMS, LVM_GETITEMW, 0, (LPARAM) &lvItem))
+        {
+            for (iter = AppInfo; iter; iter = iter->next)
+            {
+                if (iter->id == lvItem.lParam)
+                {
+                    /* Decide whether to display Modify/Remove as one button or two */
+                    enable_modify = (iter->path_modify != NULL);
+
+                    /* Update title as appropriate */
+                    if (iter->path_modify == NULL)
+                        SetWindowTextW(GetDlgItem(hWnd, IDC_ADDREMOVE), btnModifyRemove);
+                    else
+                        SetWindowTextW(GetDlgItem(hWnd, IDC_ADDREMOVE), btnRemove);
+
+                    break;
+                }
+            }
+        }
+    }
 
-    EnableWindow(GetDlgItem(hWnd, IDC_ADDREMOVE), sel);
-    EnableWindow(GetDlgItem(hWnd, IDC_SUPPORT_INFO), sel);
+    /* Enable/disable other buttons if necessary */
+    EnableWindow(GetDlgItem(hWnd, IDC_ADDREMOVE), (selitem != -1));
+    EnableWindow(GetDlgItem(hWnd, IDC_SUPPORT_INFO), (selitem != -1));
+    EnableWindow(GetDlgItem(hWnd, IDC_MODIFY), enable_modify);
 }
 
 /******************************************************************************
@@ -875,6 +910,8 @@ static void StartApplet(HWND hWnd)
     /* Load the strings we will use */
     LoadStringW(hInst, IDS_TAB1_TITLE, tab_title, sizeof(tab_title) / sizeof(tab_title[0]));
     LoadStringW(hInst, IDS_CPL_TITLE, app_title, sizeof(app_title) / sizeof(app_title[0]));
+    LoadStringW(hInst, IDS_REMOVE, btnRemove, sizeof(btnRemove) / sizeof(btnRemove[0]));
+    LoadStringW(hInst, IDS_MODIFY_REMOVE, btnModifyRemove, sizeof(btnModifyRemove) / sizeof(btnModifyRemove[0]));
 
     /* Fill out the PROPSHEETPAGE */
     psp.dwSize = sizeof (PROPSHEETPAGEW);




More information about the wine-cvs mailing list