Skip to content

Add per-item conditional property to gate generated code - #1855

Merged
Randalphwa merged 3 commits into
mainfrom
platform_conditionals
Sep 12, 2026
Merged

Randalphwa merged 3 commits into
mainfrom
platform_conditionals

Conversation

@Randalphwa

@Randalphwa Randalphwa commented Sep 12, 2026

Copy link
Copy Markdown
Member

Motivation

Platform checks in wxUiEditor only covered Windows/Unix/Mac. This PR allows the dev to also use a conditional in addition to the platform checks. E.g., you can now add something like 'MY_FEATURE_ENABLED' and the to prevent compiling or using the generated code unless condition is true (in addition to the selected platforms being true).

Changes

  • New conditional string prop (prop_conditional) on widgets/windows. Empty by default; when set it gets AND-ed into the platform check during code generation. Defined in interfaces.xml and registered in the enum/help maps so it round-trips and is undoable.
  • Code generation: construction, event bindings, member variables, and the public/protected header sections all pass the conditional through. When an item targets all platforms, it now emits a plain conditional block instead of a platform test.
  • Each language strategy (C++, Python, Ruby, Go, TypeScript, Julia, LuaJIT, Fortran, FFI) spells the condition in its own syntax through a new EmitConditionalOnly.
  • Property grid: the platforms row gets an indented string child for the conditional, via a small ConditionalFlagsProperty subclass.
  • XRC: logs a warning and ignores the property, since XRC cannot express it.

Closes #1557

This is under the Platorms property, and can be used in addition to the 3 platform checkboxes.
@Randalphwa Randalphwa changed the title platform conditionals Add per-item conditional property to gate generated code Sep 12, 2026
@Randalphwa
Randalphwa merged commit 5cb7ec1 into main Sep 12, 2026
7 checks passed
@Randalphwa
Randalphwa deleted the platform_conditionals branch September 12, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add conditional property after the platform property in the wxWindow properties

1 participant