On 2/18/19 2:19 PM, Nikolay Sivov wrote:
On 2/18/19 3:09 PM, Gabriel Ivăncescu wrote:
+static BOOL is_singlesel_NODATA(const LB_DESCR *descr) +{ + return (descr->style & (LBS_NODATA | LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == LBS_NODATA; +}
+static BOOL is_multisel_NODATA(const LB_DESCR *descr) +{ + return (descr->style & LBS_NODATA) && (descr->style & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)); +}
This has to be consistent with existing IS_MULTISELECT(), both for naming and usage throughout the code.
Could the same be achieved with IS_MULTISELECT() and direct style check for LBS_NODATA?
Shortcuts with is_singlesel_NODATA() also seem avoidable, if we don't need to allocate anything in this case, can we just check for descr->items != NULL?
That's basically what I was trying to suggest since first version of such helpers appeared.
Hi Nikolay,
So you want me to use a macro? Or just all-caps naming? Or all lowercase?
And we can't check for descr->items != NULL since it's used in places where it can be NULL, in this case for normal listbox it will allocate the space (e.g. resize_storage).
I think I had it with manual checks originally but was told to move it into a helper.