Allow wixstdba special controls to have declarative text.
Fixes 6855
Sean Hall committed
Aug 10, 2022 at 19:24 UTC
0a97d7aafcbb564b7bc9f4e754f39055fd38ae4f
8 files changed
+141
-114
src/api/burn/balutil/inc/BAFunctions.h
+1
-1
@@ -164,7 +164,7 @@ struct BA_FUNCTIONS_ONTHEMECONTROLLOADING_RESULTS
164
DWORD cbSize;
165
BOOL fProcessed;
166
WORD wId;
167
- BOOL fDisableAutomaticFunctionality;
167
+ DWORD dwAutomaticBehaviorType;
168
};
169
170
struct BA_FUNCTIONS_ONTHEMECONTROLWMCOMMAND_ARGS
src/api/burn/balutil/inc/BalBaseBAFunctions.h
+1
-1
@@ -947,7 +947,7 @@ public: // IBAFunctions
947
__in LPCWSTR /*wzName*/,
948
__inout BOOL* /*pfProcessed*/,
949
__inout WORD* /*pwId*/,
950
- __inout BOOL* /*pfDisableAutomaticFunctionality*/
950
+ __inout DWORD* /*pdwAutomaticBehaviorType*/
951
)
952
{
953
return S_OK;
src/api/burn/balutil/inc/BalBaseBAFunctionsProc.h
+1
-1
@@ -30,7 +30,7 @@ static HRESULT BalBaseBAFunctionsProcOnThemeControlLoading(
30
__inout BA_FUNCTIONS_ONTHEMECONTROLLOADING_RESULTS* pResults
31
)
32
{
33
- return pBAFunctions->OnThemeControlLoading(pArgs->wzName, &pResults->fProcessed, &pResults->wId, &pResults->fDisableAutomaticFunctionality);
33
+ return pBAFunctions->OnThemeControlLoading(pArgs->wzName, &pResults->fProcessed, &pResults->wId, &pResults->dwAutomaticBehaviorType);
34
}
35
36
static HRESULT BalBaseBAFunctionsProcOnThemeControlWmCommand(
src/api/burn/balutil/inc/IBAFunctions.h
+1
-1
@@ -36,7 +36,7 @@ DECLARE_INTERFACE_IID_(IBAFunctions, IBootstrapperApplication, "0FB445ED-17BD-49
36
__in LPCWSTR wzName,
37
__inout BOOL* pfProcessed,
38
__inout WORD* pwId,
39
- __inout BOOL* pfDisableAutomaticFunctionality
39
+ __inout DWORD* pdwAutomaticBehaviorType
40
) = 0;
41
42
// OnThemeControlWmCommand - Called when WM_COMMAND is received for a control.
src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
+27
-26
@@ -3409,7 +3409,7 @@ private:
3409
3410
fProcessed = TRUE;
3411
pResults->wId = pAssignControl->wId;
3412
- pResults->fDisableAutomaticFunctionality = pAssignControl->fDisableAutomaticFunctionality;
3412
+ pResults->dwAutomaticBehaviorType = pAssignControl->dwAutomaticBehaviorType;
3413
ExitFunction();
3414
}
3415
}
@@ -3421,7 +3421,7 @@ private:
3421
3422
themeControlLoadingResults.cbSize = sizeof(themeControlLoadingResults);
3423
themeControlLoadingResults.wId = pResults->wId;
3424
- themeControlLoadingResults.fDisableAutomaticFunctionality = pResults->fDisableAutomaticFunctionality;
3424
+ themeControlLoadingResults.dwAutomaticBehaviorType = pResults->dwAutomaticBehaviorType;
3425
3426
hr = m_pfnBAFunctionsProc(BA_FUNCTIONS_MESSAGE_ONTHEMECONTROLLOADING, &themeControlLoadingArgs, &themeControlLoadingResults, m_pvBAFunctionsProcContext);
3427
@@ -3437,7 +3437,7 @@ private:
3437
{
3438
fProcessed = TRUE;
3439
pResults->wId = themeControlLoadingResults.wId;
3440
- pResults->fDisableAutomaticFunctionality = themeControlLoadingResults.fDisableAutomaticFunctionality;
3440
+ pResults->dwAutomaticBehaviorType = themeControlLoadingResults.dwAutomaticBehaviorType;
3441
}
3442
}
3443
}
@@ -4594,6 +4594,7 @@ public:
4594
) : CBalBaseBootstrapperApplication(pEngine, 3, 3000)
4595
{
4596
THEME_ASSIGN_CONTROL_ID* pAssignControl = NULL;
4597
+ DWORD dwAutomaticBehaviorType = THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_ENABLED | THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_VISIBLE | THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_ACTION | THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_VALUE;
4598
4599
m_hModule = hModule;
4600
m_command = { };
@@ -4674,161 +4675,161 @@ public:
4675
pAssignControl->wId = WIXSTDBA_CONTROL_INSTALL_BUTTON;
4676
pAssignControl->wzName = L"InstallButton";
4677
pAssignControl->ppControl = &m_pControlInstallButton;
4677
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4678
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4679
m_pControlInstallButton = NULL;
4680
++pAssignControl;
4681
4682
pAssignControl->wId = WIXSTDBA_CONTROL_EULA_RICHEDIT;
4683
pAssignControl->wzName = L"EulaRichedit";
4684
pAssignControl->ppControl = &m_pControlEulaRichedit;
4684
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4685
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4686
m_pControlEulaRichedit = NULL;
4687
++pAssignControl;
4688
4689
pAssignControl->wId = WIXSTDBA_CONTROL_EULA_LINK;
4690
pAssignControl->wzName = L"EulaHyperlink";
4691
pAssignControl->ppControl = &m_pControlEulaHyperlink;
4691
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4692
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4693
m_pControlEulaHyperlink = NULL;
4694
++pAssignControl;
4695
4696
pAssignControl->wId = WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX;
4697
pAssignControl->wzName = L"EulaAcceptCheckbox";
4698
pAssignControl->ppControl = &m_pControlEulaAcceptCheckbox;
4698
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4699
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4700
m_pControlEulaAcceptCheckbox = NULL;
4701
++pAssignControl;
4702
4703
pAssignControl->wId = WIXSTDBA_CONTROL_REPAIR_BUTTON;
4704
pAssignControl->wzName = L"RepairButton";
4705
pAssignControl->ppControl = &m_pControlRepairButton;
4705
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4706
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4707
m_pControlRepairButton = NULL;
4708
++pAssignControl;
4709
4710
pAssignControl->wId = WIXSTDBA_CONTROL_UNINSTALL_BUTTON;
4711
pAssignControl->wzName = L"UninstallButton";
4712
pAssignControl->ppControl = &m_pControlUninstallButton;
4712
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4713
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4714
m_pControlUninstallButton = NULL;
4715
++pAssignControl;
4716
4717
pAssignControl->wId = WIXSTDBA_CONTROL_CACHE_PROGRESS_PACKAGE_TEXT;
4718
pAssignControl->wzName = L"CacheProgressPackageText";
4719
pAssignControl->ppControl = &m_pControlCacheProgressPackageText;
4719
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4720
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4721
m_pControlCacheProgressPackageText = NULL;
4722
++pAssignControl;
4723
4724
pAssignControl->wId = WIXSTDBA_CONTROL_CACHE_PROGRESS_BAR;
4725
pAssignControl->wzName = L"CacheProgressbar";
4726
pAssignControl->ppControl = &m_pControlCacheProgressbar;
4726
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4727
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4728
m_pControlCacheProgressbar = NULL;
4729
++pAssignControl;
4730
4731
pAssignControl->wId = WIXSTDBA_CONTROL_CACHE_PROGRESS_TEXT;
4732
pAssignControl->wzName = L"CacheProgressText";
4733
pAssignControl->ppControl = &m_pControlCacheProgressText;
4733
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4734
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4735
m_pControlCacheProgressText = NULL;
4736
++pAssignControl;
4737
4738
pAssignControl->wId = WIXSTDBA_CONTROL_EXECUTE_PROGRESS_PACKAGE_TEXT;
4739
pAssignControl->wzName = L"ExecuteProgressPackageText";
4740
pAssignControl->ppControl = &m_pControlExecuteProgressPackageText;
4740
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4741
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4742
m_pControlExecuteProgressPackageText = NULL;
4743
++pAssignControl;
4744
4745
pAssignControl->wId = WIXSTDBA_CONTROL_EXECUTE_PROGRESS_BAR;
4746
pAssignControl->wzName = L"ExecuteProgressbar";
4747
pAssignControl->ppControl = &m_pControlExecuteProgressbar;
4747
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4748
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4749
m_pControlExecuteProgressbar = NULL;
4750
++pAssignControl;
4751
4752
pAssignControl->wId = WIXSTDBA_CONTROL_EXECUTE_PROGRESS_TEXT;
4753
pAssignControl->wzName = L"ExecuteProgressText";
4754
pAssignControl->ppControl = &m_pControlExecuteProgressText;
4754
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4755
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4756
m_pControlExecuteProgressText = NULL;
4757
++pAssignControl;
4758
4759
pAssignControl->wId = WIXSTDBA_CONTROL_EXECUTE_PROGRESS_ACTIONDATA_TEXT;
4760
pAssignControl->wzName = L"ExecuteProgressActionDataText";
4761
pAssignControl->ppControl = &m_pControlExecuteProgressActionDataText;
4761
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4762
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4763
m_pControlExecuteProgressActionDataText = NULL;
4764
++pAssignControl;
4765
4766
pAssignControl->wId = WIXSTDBA_CONTROL_OVERALL_PROGRESS_PACKAGE_TEXT;
4767
pAssignControl->wzName = L"OverallProgressPackageText";
4768
pAssignControl->ppControl = &m_pControlOverallProgressPackageText;
4768
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4769
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4770
m_pControlOverallProgressPackageText = NULL;
4771
++pAssignControl;
4772
4773
pAssignControl->wId = WIXSTDBA_CONTROL_OVERALL_PROGRESS_BAR;
4774
pAssignControl->wzName = L"OverallProgressbar";
4775
pAssignControl->ppControl = &m_pControlOverallProgressbar;
4775
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4776
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4777
m_pControlOverallProgressbar = NULL;
4778
++pAssignControl;
4779
4780
pAssignControl->wId = WIXSTDBA_CONTROL_OVERALL_CALCULATED_PROGRESS_BAR;
4781
pAssignControl->wzName = L"OverallCalculatedProgressbar";
4782
pAssignControl->ppControl = &m_pControlOverallCalculatedProgressbar;
4782
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4783
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4784
m_pControlOverallCalculatedProgressbar = NULL;
4785
++pAssignControl;
4786
4787
pAssignControl->wId = WIXSTDBA_CONTROL_OVERALL_PROGRESS_TEXT;
4788
pAssignControl->wzName = L"OverallProgressText";
4789
pAssignControl->ppControl = &m_pControlOverallProgressText;
4789
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4790
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4791
m_pControlOverallProgressText = NULL;
4792
++pAssignControl;
4793
4794
pAssignControl->wId = WIXSTDBA_CONTROL_PROGRESS_CANCEL_BUTTON;
4795
pAssignControl->wzName = L"ProgressCancelButton";
4796
pAssignControl->ppControl = &m_pControlProgressCancelButton;
4796
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4797
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4798
m_pControlProgressCancelButton = NULL;
4799
++pAssignControl;
4800
4801
pAssignControl->wId = WIXSTDBA_CONTROL_LAUNCH_BUTTON;
4802
pAssignControl->wzName = L"LaunchButton";
4803
pAssignControl->ppControl = &m_pControlLaunchButton;
4803
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4804
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4805
m_pControlLaunchButton = NULL;
4806
++pAssignControl;
4807
4808
pAssignControl->wId = WIXSTDBA_CONTROL_SUCCESS_RESTART_BUTTON;
4809
pAssignControl->wzName = L"SuccessRestartButton";
4810
pAssignControl->ppControl = &m_pControlSuccessRestartButton;
4810
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4811
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4812
m_pControlSuccessRestartButton = NULL;
4813
++pAssignControl;
4814
4815
pAssignControl->wId = WIXSTDBA_CONTROL_FAILURE_LOGFILE_LINK;
4816
pAssignControl->wzName = L"FailureLogFileLink";
4817
pAssignControl->ppControl = &m_pControlFailureLogFileLink;
4817
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4818
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4819
m_pControlFailureLogFileLink = NULL;
4820
++pAssignControl;
4821
4822
pAssignControl->wId = WIXSTDBA_CONTROL_FAILURE_MESSAGE_TEXT;
4823
pAssignControl->wzName = L"FailureMessageText";
4824
pAssignControl->ppControl = &m_pControlFailureMessageText;
4824
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4825
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4826
m_pControlFailureMessageText = NULL;
4827
++pAssignControl;
4828
4829
pAssignControl->wId = WIXSTDBA_CONTROL_FAILURE_RESTART_BUTTON;
4830
pAssignControl->wzName = L"FailureRestartButton";
4831
pAssignControl->ppControl = &m_pControlFailureRestartButton;
4831
- pAssignControl->fDisableAutomaticFunctionality = TRUE;
4832
+ pAssignControl->dwAutomaticBehaviorType = dwAutomaticBehaviorType;
4833
m_pControlFailureRestartButton = NULL;
4834
4835
C_ASSERT(LAST_WIXSTDBA_CONTROL == WIXSTDBA_CONTROL_FAILURE_RESTART_BUTTON + 1);
src/libs/dutil/WixToolset.DUtil/inc/thmutil.h
+22
-3
@@ -57,6 +57,20 @@ typedef enum THEME_CONTROL_DATA
57
THEME_CONTROL_DATA_HOVER = 1,
58
} THEME_CONTROL_DATA;
59
60
+typedef enum THEME_CONTROL_AUTOMATIC_BEHAVIOR_TYPE
61
+{
62
+ THEME_CONTROL_AUTOMATIC_BEHAVIOR_ALL = 0x0,
63
+ THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_ENABLED = 0x1,
64
+ THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_VISIBLE = 0x2,
65
+ THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_ACTION = 0x4,
66
+ // For form controls like editboxes and checkboxes,
67
+ // the value will not be automatically persisted to a variable and
68
+ // the control's value will only be changed by the user.
69
+ THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_VALUE = 0x8,
70
+ // This has no effect on editboxes since their text is their value.
71
+ THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_TEXT = 0x10,
72
+} THEME_CONTROL_AUTOMATIC_BEHAVIOR_TYPE;
73
+
74
typedef enum THEME_CONTROL_TYPE
75
{
76
THEME_CONTROL_TYPE_UNKNOWN,
@@ -196,7 +210,7 @@ struct THEME_ASSIGN_CONTROL_ID
210
WORD wId; // id to apply to control
211
LPCWSTR wzName; // name of control to match
212
const THEME_CONTROL** ppControl;
199
- BOOL fDisableAutomaticFunctionality; // prevent declarative functionality from interfering with the application's imperative code
213
+ DWORD dwAutomaticBehaviorType; // prevent declarative functionality from interfering with the application's imperative code
214
};
215
216
const WORD THEME_FIRST_ASSIGN_CONTROL_ID = 0x4000; // Recommended first control id to be assigned.
@@ -224,7 +238,12 @@ typedef struct _THEME_CONTROL
238
239
LPWSTR sczEnableCondition;
240
LPWSTR sczVisibleCondition;
227
- BOOL fDisableAutomaticFunctionality;
241
+
242
+ BOOL fAutomaticEnabled;
243
+ BOOL fAutomaticVisible;
244
+ BOOL fAutomaticAction;
245
+ BOOL fAutomaticValue;
246
+ BOOL fAutomaticText;
247
248
union
249
{
@@ -472,7 +491,7 @@ typedef struct _THEME_LOADINGCONTROL_RESULTS
491
// Due to this value being packed into 16 bits for many system window messages, this is restricted to a WORD.
492
WORD wId;
493
// Used to prevent declarative functionality from interfering with the application's imperative code.
475
- BOOL fDisableAutomaticFunctionality;
494
+ DWORD dwAutomaticBehaviorType;
495
} THEME_LOADINGCONTROL_RESULTS;
496
497
src/libs/dutil/WixToolset.DUtil/thmutil.cpp
+87
-80
@@ -296,7 +296,7 @@ static HRESULT OnLoadingControl(
296
__in THEME* pTheme,
297
__in const THEME_CONTROL* pControl,
298
__inout WORD* pwId,
299
- __inout BOOL* pfDisableAutomaticFunctionality
299
+ __inout DWORD* pdwAutomaticBehaviorType
300
);
301
static HRESULT LoadControls(
302
__in THEME* pTheme,
@@ -5016,7 +5016,7 @@ static void OnBrowseDirectory(
5016
}
5017
5018
// Since editbox changes aren't immediately saved off, we have to treat them differently.
5019
- if (pTargetControl && !pTargetControl->fDisableAutomaticFunctionality && (!fSetVariable || THEME_CONTROL_TYPE_EDITBOX == pTargetControl->type))
5019
+ if (pTargetControl && pTargetControl->fAutomaticValue && THEME_CONTROL_TYPE_EDITBOX == pTargetControl->type)
5020
{
5021
fSetVariable = FALSE;
5022
hr = ThemeSetTextControl(pTargetControl, sczPath);
@@ -5045,7 +5045,7 @@ static BOOL OnButtonClicked(
5045
5046
if (THEME_CONTROL_TYPE_BUTTON == pControl->type || THEME_CONTROL_TYPE_COMMANDLINK == pControl->type)
5047
{
5048
- if (!pControl->fDisableAutomaticFunctionality && pControl->cActions)
5048
+ if (pControl->fAutomaticAction && pControl->cActions)
5049
{
5050
fHandled = TRUE;
5051
THEME_ACTION* pChosenAction = pControl->pDefaultAction;
@@ -5103,7 +5103,7 @@ static BOOL OnButtonClicked(
5103
}
5104
}
5105
}
5106
- else if (!pControl->fDisableAutomaticFunctionality && (pTheme->pfnSetNumericVariable || pTheme->pfnSetStringVariable))
5106
+ else if (pControl->fAutomaticValue && (pTheme->pfnSetNumericVariable || pTheme->pfnSetStringVariable))
5107
{
5108
BOOL fRefresh = FALSE;
5109
@@ -5558,7 +5558,7 @@ static HRESULT ShowControl(
5558
THEME_PAGE* pPage = ThemeGetPage(pTheme, dwPageId);
5559
5560
// Save the editbox value if necessary (other control types save their values immediately).
5561
- if (pTheme->pfnSetStringVariable && !pControl->fDisableAutomaticFunctionality &&
5561
+ if (pTheme->pfnSetStringVariable && pControl->fAutomaticValue &&
5562
fSaveEditboxes && THEME_CONTROL_TYPE_EDITBOX == pControl->type && pControl->sczName && *pControl->sczName)
5563
{
5564
hr = ThemeGetTextControl(pControl, &sczText);
@@ -5585,102 +5585,102 @@ static HRESULT ShowControl(
5585
BOOL fEnabled = !(pControl->dwInternalStyle & INTERNAL_CONTROL_STYLE_DISABLED);
5586
BOOL fVisible = !(pControl->dwInternalStyle & INTERNAL_CONTROL_STYLE_HIDDEN);
5587
5588
- if (!pControl->fDisableAutomaticFunctionality)
5588
+ if (pTheme->pfnEvaluateCondition)
5589
{
5590
- if (pTheme->pfnEvaluateCondition)
5590
+ // If the control has a VisibleCondition, check if it's true.
5591
+ if (pControl->sczVisibleCondition && pControl->fAutomaticVisible)
5592
{
5592
- // If the control has a VisibleCondition, check if it's true.
5593
- if (pControl->sczVisibleCondition)
5594
- {
5595
- hr = pTheme->pfnEvaluateCondition(pControl->sczVisibleCondition, &fVisible, pTheme->pvVariableContext);
5596
- ThmExitOnFailure(hr, "Failed to evaluate VisibleCondition: %ls", pControl->sczVisibleCondition);
5597
- }
5598
-
5599
- // If the control has an EnableCondition, check if it's true.
5600
- if (pControl->sczEnableCondition)
5601
- {
5602
- hr = pTheme->pfnEvaluateCondition(pControl->sczEnableCondition, &fEnabled, pTheme->pvVariableContext);
5603
- ThmExitOnFailure(hr, "Failed to evaluate EnableCondition: %ls", pControl->sczEnableCondition);
5604
- }
5593
+ hr = pTheme->pfnEvaluateCondition(pControl->sczVisibleCondition, &fVisible, pTheme->pvVariableContext);
5594
+ ThmExitOnFailure(hr, "Failed to evaluate VisibleCondition: %ls", pControl->sczVisibleCondition);
5595
}
5596
5607
- // Try to format each control's text based on context, except for editboxes since their text comes from the user.
5608
- if (pTheme->pfnFormatString && ((pControl->sczText && *pControl->sczText) || pControl->cConditionalText) && THEME_CONTROL_TYPE_EDITBOX != pControl->type)
5597
+ // If the control has an EnableCondition, check if it's true.
5598
+ if (pControl->sczEnableCondition && pControl->fAutomaticEnabled)
5599
{
5610
- LPCWSTR wzText = pControl->sczText;
5611
- LPCWSTR wzNote = pControl->sczNote;
5600
+ hr = pTheme->pfnEvaluateCondition(pControl->sczEnableCondition, &fEnabled, pTheme->pvVariableContext);
5601
+ ThmExitOnFailure(hr, "Failed to evaluate EnableCondition: %ls", pControl->sczEnableCondition);
5602
+ }
5603
+ }
5604
5613
- if (pTheme->pfnEvaluateCondition)
5605
+ // Try to format each control's text based on context, except for editboxes since their text comes from the user.
5606
+ if (pTheme->pfnFormatString && pControl->fAutomaticText && ((pControl->sczText && *pControl->sczText) || pControl->cConditionalText) && THEME_CONTROL_TYPE_EDITBOX != pControl->type)
5607
+ {
5608
+ LPCWSTR wzText = pControl->sczText;
5609
+ LPCWSTR wzNote = pControl->sczNote;
5610
+
5611
+ if (pTheme->pfnEvaluateCondition)
5612
+ {
5613
+ // As documented in the xsd, if there are multiple conditions that are true at the same time then the behavior is undefined.
5614
+ // This is the current implementation and can change at any time.
5615
+ for (DWORD j = 0; j < pControl->cConditionalText; ++j)
5616
{
5615
- // As documented in the xsd, if there are multiple conditions that are true at the same time then the behavior is undefined.
5616
- // This is the current implementation and can change at any time.
5617
- for (DWORD j = 0; j < pControl->cConditionalText; ++j)
5618
- {
5619
- THEME_CONDITIONAL_TEXT* pConditionalText = pControl->rgConditionalText + j;
5617
+ THEME_CONDITIONAL_TEXT* pConditionalText = pControl->rgConditionalText + j;
5618
5621
- if (pConditionalText->sczCondition)
5622
- {
5623
- BOOL fCondition = FALSE;
5619
+ if (pConditionalText->sczCondition)
5620
+ {
5621
+ BOOL fCondition = FALSE;
5622
5625
- hr = pTheme->pfnEvaluateCondition(pConditionalText->sczCondition, &fCondition, pTheme->pvVariableContext);
5626
- ThmExitOnFailure(hr, "Failed to evaluate condition: %ls", pConditionalText->sczCondition);
5623
+ hr = pTheme->pfnEvaluateCondition(pConditionalText->sczCondition, &fCondition, pTheme->pvVariableContext);
5624
+ ThmExitOnFailure(hr, "Failed to evaluate condition: %ls", pConditionalText->sczCondition);
5625
5628
- if (fCondition)
5629
- {
5630
- wzText = pConditionalText->sczText;
5631
- break;
5632
- }
5626
+ if (fCondition)
5627
+ {
5628
+ wzText = pConditionalText->sczText;
5629
+ break;
5630
}
5631
}
5632
+ }
5633
5636
- if (THEME_CONTROL_TYPE_COMMANDLINK == pControl->type)
5634
+ if (THEME_CONTROL_TYPE_COMMANDLINK == pControl->type)
5635
+ {
5636
+ for (DWORD j = 0; j < pControl->CommandLink.cConditionalNotes; ++j)
5637
{
5638
- for (DWORD j = 0; j < pControl->CommandLink.cConditionalNotes; ++j)
5639
- {
5640
- THEME_CONDITIONAL_TEXT* pConditionalNote = pControl->CommandLink.rgConditionalNotes + j;
5638
+ THEME_CONDITIONAL_TEXT* pConditionalNote = pControl->CommandLink.rgConditionalNotes + j;
5639
5642
- if (pConditionalNote->sczCondition)
5643
- {
5644
- BOOL fCondition = FALSE;
5640
+ if (pConditionalNote->sczCondition)
5641
+ {
5642
+ BOOL fCondition = FALSE;
5643
5646
- hr = pTheme->pfnEvaluateCondition(pConditionalNote->sczCondition, &fCondition, pTheme->pvVariableContext);
5647
- ThmExitOnFailure(hr, "Failed to evaluate note condition: %ls", pConditionalNote->sczCondition);
5644
+ hr = pTheme->pfnEvaluateCondition(pConditionalNote->sczCondition, &fCondition, pTheme->pvVariableContext);
5645
+ ThmExitOnFailure(hr, "Failed to evaluate note condition: %ls", pConditionalNote->sczCondition);
5646
5649
- if (fCondition)
5650
- {
5651
- wzNote = pConditionalNote->sczText;
5652
- break;
5653
- }
5647
+ if (fCondition)
5648
+ {
5649
+ wzNote = pConditionalNote->sczText;
5650
+ break;
5651
}
5652
}
5653
}
5654
}
5655
+ }
5656
5659
- if (wzText && *wzText)
5660
- {
5661
- hr = pTheme->pfnFormatString(wzText, &sczText, pTheme->pvVariableContext);
5662
- ThmExitOnFailure(hr, "Failed to format string: %ls", wzText);
5663
- }
5664
- else
5665
- {
5666
- ReleaseNullStr(sczText);
5667
- }
5668
-
5669
- ThemeSetTextControl(pControl, sczText);
5657
+ if (wzText && *wzText)
5658
+ {
5659
+ hr = pTheme->pfnFormatString(wzText, &sczText, pTheme->pvVariableContext);
5660
+ ThmExitOnFailure(hr, "Failed to format string: %ls", wzText);
5661
+ }
5662
+ else
5663
+ {
5664
+ ReleaseNullStr(sczText);
5665
+ }
5666
5671
- if (wzNote && *wzNote)
5672
- {
5673
- hr = pTheme->pfnFormatString(wzNote, &sczText, pTheme->pvVariableContext);
5674
- ThmExitOnFailure(hr, "Failed to format note: %ls", wzNote);
5675
- }
5676
- else
5677
- {
5678
- ReleaseNullStr(sczText);
5679
- }
5667
+ ThemeSetTextControl(pControl, sczText);
5668
5681
- ::SendMessageW(pControl->hWnd, BCM_SETNOTE, 0, reinterpret_cast<WPARAM>(sczText));
5669
+ if (wzNote && *wzNote)
5670
+ {
5671
+ hr = pTheme->pfnFormatString(wzNote, &sczText, pTheme->pvVariableContext);
5672
+ ThmExitOnFailure(hr, "Failed to format note: %ls", wzNote);
5673
+ }
5674
+ else
5675
+ {
5676
+ ReleaseNullStr(sczText);
5677
}
5678
5679
+ ::SendMessageW(pControl->hWnd, BCM_SETNOTE, 0, reinterpret_cast<WPARAM>(sczText));
5680
+ }
5681
+
5682
+ if (pControl->fAutomaticValue)
5683
+ {
5684
// If this is a named control, do variable magic.
5685
if (pControl->sczName && *pControl->sczName)
5686
{
@@ -6010,7 +6010,7 @@ static HRESULT OnLoadingControl(
6010
__in THEME* pTheme,
6011
__in const THEME_CONTROL* pControl,
6012
__inout WORD* pwId,
6013
- __inout BOOL* pfDisableAutomaticFunctionality
6013
+ __inout DWORD* pdwAutomaticBehaviorType
6014
)
6015
{
6016
HRESULT hr = S_OK;
@@ -6030,7 +6030,7 @@ static HRESULT OnLoadingControl(
6030
if (SUCCEEDED(hr))
6031
{
6032
*pwId = loadingControlResults.wId;
6033
- *pfDisableAutomaticFunctionality = loadingControlResults.fDisableAutomaticFunctionality;
6033
+ *pdwAutomaticBehaviorType = loadingControlResults.dwAutomaticBehaviorType;
6034
}
6035
}
6036
@@ -6232,9 +6232,16 @@ static HRESULT LoadControls(
6232
6233
// Default control ids to the next id, unless there is a specific id to assign to a control.
6234
WORD wControlId = THEME_FIRST_AUTO_ASSIGN_CONTROL_ID;
6235
- hr = OnLoadingControl(pTheme, pControl, &wControlId, &pControl->fDisableAutomaticFunctionality);
6235
+ DWORD dwAutomaticBehaviorType = THEME_CONTROL_AUTOMATIC_BEHAVIOR_ALL;
6236
+ hr = OnLoadingControl(pTheme, pControl, &wControlId, &dwAutomaticBehaviorType);
6237
ThmExitOnFailure(hr, "ThmLoadingControl failed.");
6238
6239
+ pControl->fAutomaticEnabled = THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_ENABLED != (THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_ENABLED & dwAutomaticBehaviorType);
6240
+ pControl->fAutomaticVisible = THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_VISIBLE != (THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_VISIBLE & dwAutomaticBehaviorType);
6241
+ pControl->fAutomaticAction = THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_ACTION != (THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_ACTION & dwAutomaticBehaviorType);
6242
+ pControl->fAutomaticText = THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_TEXT != (THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_TEXT & dwAutomaticBehaviorType);
6243
+ pControl->fAutomaticValue = THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_VALUE != (THEME_CONTROL_AUTOMATIC_BEHAVIOR_EXCLUDE_VALUE & dwAutomaticBehaviorType);
6244
+
6245
// This range is reserved for thmutil. The process will run out of available window handles before reaching the end of the range.
6246
if (THEME_FIRST_AUTO_ASSIGN_CONTROL_ID <= wControlId && THEME_FIRST_ASSIGN_CONTROL_ID > wControlId)
6247
{
@@ -6250,7 +6257,7 @@ static HRESULT LoadControls(
6257
BOOL fDisabled = pControl->dwStyle & WS_DISABLED;
6258
6259
// If the control is supposed to be initially visible and it has a VisibleCondition, check if it's true.
6253
- if (fVisible && pControl->sczVisibleCondition && pTheme->pfnEvaluateCondition && !pControl->fDisableAutomaticFunctionality)
6260
+ if (fVisible && pControl->sczVisibleCondition && pTheme->pfnEvaluateCondition && pControl->fAutomaticVisible)
6261
{
6262
hr = pTheme->pfnEvaluateCondition(pControl->sczVisibleCondition, &fVisible, pTheme->pvVariableContext);
6263
ThmExitOnFailure(hr, "Failed to evaluate VisibleCondition: %ls", pControl->sczVisibleCondition);
@@ -6269,7 +6276,7 @@ static HRESULT LoadControls(
6276
}
6277
6278
// If the control is supposed to be initially enabled and it has an EnableCondition, check if it's true.
6272
- if (!fDisabled && pControl->sczEnableCondition && pTheme->pfnEvaluateCondition && !pControl->fDisableAutomaticFunctionality)
6279
+ if (!fDisabled && pControl->sczEnableCondition && pTheme->pfnEvaluateCondition && pControl->fAutomaticEnabled)
6280
{
6281
BOOL fEnable = TRUE;
6282
src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp
+1
-1
@@ -48,7 +48,7 @@ public: // IBAFunctions
48
__in LPCWSTR wzName,
49
__inout BOOL* pfProcessed,
50
__inout WORD* pwId,
51
- __inout BOOL* /*pfDisableAutomaticFunctionality*/
51
+ __inout DWORD* /*pdwAutomaticBehaviorType*/
52
)
53
{
54
if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, wzName, -1, L"InstallTestButton", -1))