Companion to the FWL_STYLE_WGT -> WidgetStyle Mask conversion. Convert the FWL widget state bits into a scoped WidgetState enum and store CFWL_Widget::Properties::states_ as Mask<WidgetState>.Wrap lines 9, 11, 13
Properties{{}, FWL_STYLEEXT_DTP_ShortDateFormat, {}},public:
uint32_t styles_ = FWL_STYLE_WGT_Child; // Mask of FWL_STYLE_*_*.
uint32_t style_exts_ = 0; // Mask of FWL_STYLEEXT_*_*.
Mask<WidgetState> states_;
Shouldn't the first argument also be 0?
Although I do remember another CL did change the type of styles_.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Companion to the FWL_STYLE_WGT -> WidgetStyle Mask conversion. Convert the FWL widget state bits into a scoped WidgetState enum and store CFWL_Widget::Properties::states_ as Mask<WidgetState>.Wrap lines 9, 11, 13
Done
public:
uint32_t styles_ = FWL_STYLE_WGT_Child; // Mask of FWL_STYLE_*_*.
uint32_t style_exts_ = 0; // Mask of FWL_STYLEEXT_*_*.
Mask<WidgetState> states_;Shouldn't the first argument also be 0?
Although I do remember another CL did change the type of styles_.
awesome! styles_ is still uint32_t here, so only the third field (now Mask<WidgetState>) needed {}. Reverted the first arg back to 0, and fixed the same unnecessary change in cfwl_edit.cpp.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
SetStates(WidgetState::kCaretHighlight);Up to you, if you want to avoid the head-scratching between the plural name of the method and the singular variable name, you could write `SetStates({WidgetState::kCaretHighlight});` but do as you like.
if (properties_.states_ & WidgetState::kFocused && !rtCaret.IsEmpty()) {pre-existing:: suggest parens around & though not needed.
virtual void RemoveStates(Mask<WidgetState> states);pre-existing: It's always bugged me (but not enough to do anything about it) that set and remove aren't direct antonyms: set and clear, add and remove, but we're mixing the two. Want to change it to ClearStates while we at it?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Up to you, if you want to avoid the head-scratching between the plural name of the method and the singular variable name, you could write `SetStates({WidgetState::kCaretHighlight});` but do as you like.
Done
if (properties_.states_ & WidgetState::kFocused && !rtCaret.IsEmpty()) {pre-existing:: suggest parens around & though not needed.
Done
pre-existing: It's always bugged me (but not enough to do anything about it) that set and remove aren't direct antonyms: set and clear, add and remove, but we're mixing the two. Want to change it to ClearStates while we at it?
for sure, always leave a place cleaner than you found it!
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Replace FWL_STATE defines with WidgetState enum and Mask
Companion to the FWL_STYLE_WGT -> WidgetStyle Mask conversion. Convert
the FWL widget state bits into a scoped WidgetState enum and store
CFWL_Widget::Properties::states_ as Mask<WidgetState>.
Includes the per-widget state values that share the same states_ field
(checkbox kCheckbox*/kHovered/kPressed, pushbutton kPushbuttonDefault,
caret kCaretHighlight). The pushbutton 'default' bit aliases the same
bit position as kCheckboxChecked, mirroring the existing layout where
the bit is reused for whichever widget owns the field at runtime.
SetStates(), RemoveStates(), and GetStates() are tightened to use
Mask<WidgetState>. Caret's local kStateHighlight constant moves into the
same enum as kCaretHighlight.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |