Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2022-05-21 01:29:32 +0300
committerJulian Eisel <julian@blender.org>2022-05-21 01:53:54 +0300
commit0d7311345295589e9bac034637cf092f74053944 (patch)
tree28140b01e749f326469379f1dca87562375d22dc /source/blender/editors/include/UI_interface.h
parent029e6b51746bc8992c2465351168922545dbdc7a (diff)
UI Code Quality: Resolve frankenstein bit-flag usage for widget drawing
Previously we would pass button state and draw information to widget draw callbacks in a rather hacky way. Some specific flags from `uiBut.flag` were masked out, so their bits could be reused for also passing `uiBut.drawflag` in the same int. Instead this commit introduces a state-info struct that can properly hold all the relevant data. This has the advantage that it's now easier to introduce new state data that needs to be accessible in the widget callbacks. Since we are running out of button flags, we plan to reorganize button flags, and split them up into multiple bitfields. In the widget drawing code, this would have been a hassle earlier. Also had to add a new widget callback to draw blocks as widgets (popup backgrounds), since that would pass block flags where we would usually pass button flags. This wasn't nice, now it's separated more clearly.
Diffstat (limited to 'source/blender/editors/include/UI_interface.h')
-rw-r--r--source/blender/editors/include/UI_interface.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 0e9b191a780..60c95bbb27d 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1649,15 +1649,16 @@ void UI_but_func_identity_compare_set(uiBut *but, uiButIdentityCompareFunc cmp_f
* \param name: Text to display for the item.
* \param poin: Opaque pointer (for use by the caller).
* \param iconid: The icon, #ICON_NONE for no icon.
- * \param state: The buttons state flag, compatible with #uiBut.flag,
- * typically #UI_BUT_DISABLED / #UI_BUT_INACTIVE.
+ * \param but_flag: Button flags (#uiBut.flag) indicating the state of the item, typically
+ * #UI_ACTIVE, #UI_BUT_DISABLED, #UI_BUT_INACTIVE.
+ *
* \return false if there is nothing to add.
*/
bool UI_search_item_add(uiSearchItems *items,
const char *name,
void *poin,
int iconid,
- int state,
+ int but_flag,
uint8_t name_prefix_offset);
/**