James Hawkins : msi: Update controls based on a property when that property changes.

Alexandre Julliard julliard at winehq.org
Thu Feb 28 06:21:49 CST 2008


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

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Wed Feb 27 22:11:39 2008 -0600

msi: Update controls based on a property when that property changes.

---

 dlls/msi/dialog.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c
index 4ab25f9..e084bf8 100644
--- a/dlls/msi/dialog.c
+++ b/dlls/msi/dialog.c
@@ -50,12 +50,14 @@ extern HINSTANCE msi_hInstance;
 struct msi_control_tag;
 typedef struct msi_control_tag msi_control;
 typedef UINT (*msi_handler)( msi_dialog *, msi_control *, WPARAM );
+typedef void (*msi_update)( msi_dialog *, msi_control * );
 
 struct msi_control_tag
 {
     struct list entry;
     HWND hwnd;
     msi_handler handler;
+    msi_update update;
     LPWSTR property;
     LPWSTR value;
     HBITMAP hBitmap;
@@ -564,6 +566,16 @@ static HICON msi_load_icon( MSIDATABASE *db, LPCWSTR text, UINT attributes )
     return msi_load_image( db, text, IMAGE_ICON, cx, cy, flags );
 }
 
+static void msi_dialog_update_controls( msi_dialog *dialog, LPCWSTR property )
+{
+    msi_control *control;
+
+    LIST_FOR_EACH_ENTRY( control, &dialog->controls, msi_control, entry )
+    {
+        if ( !lstrcmpW( control->property, property ) && control->update )
+            control->update( dialog, control );
+    }
+}
 
 /* called from the Control Event subscription code */
 void msi_dialog_handle_event( msi_dialog* dialog, LPCWSTR control, 
@@ -855,6 +867,7 @@ static UINT msi_dialog_checkbox_control( msi_dialog *dialog, MSIRECORD *rec )
     control = msi_dialog_add_control( dialog, rec, szButton,
                                 BS_CHECKBOX | BS_MULTILINE | WS_TABSTOP );
     control->handler = msi_dialog_checkbox_handler;
+    control->update = msi_dialog_checkbox_sync_state;
     prop = MSI_RecordGetString( rec, 9 );
     if( prop )
     {
@@ -3083,6 +3096,7 @@ static UINT msi_dialog_set_property( msi_dialog *dialog, LPCWSTR event, LPCWSTR
         if( strcmpW( szNullArg, arg ) )
             deformat_string( dialog->package, arg, &arg_fmt );
         MSI_SetPropertyW( dialog->package, prop, arg_fmt );
+        msi_dialog_update_controls( dialog, prop );
         msi_free( arg_fmt );
     }
     else




More information about the wine-cvs mailing list