Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_button_group.cc
- This file was moved from source/blender/editors/interface/interface_button_group.c.
| Show All 12 Lines | |||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Button Groups | /** \name Button Groups | ||||
| * \{ */ | * \{ */ | ||||
| void ui_block_new_button_group(uiBlock *block, uiButtonGroupFlag flag) | void ui_block_new_button_group(uiBlock *block, uiButtonGroupFlag flag) | ||||
| { | { | ||||
| /* Don't create a new group if there is a "lock" on new groups. */ | /* Don't create a new group if there is a "lock" on new groups. */ | ||||
| if (!BLI_listbase_is_empty(&block->button_groups)) { | if (!BLI_listbase_is_empty(&block->button_groups)) { | ||||
| uiButtonGroup *last_button_group = block->button_groups.last; | uiButtonGroup *last_button_group = static_cast<uiButtonGroup *>(block->button_groups.last); | ||||
| if (last_button_group->flag & UI_BUTTON_GROUP_LOCK) { | if (last_button_group->flag & UI_BUTTON_GROUP_LOCK) { | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| uiButtonGroup *new_group = MEM_mallocN(sizeof(uiButtonGroup), __func__); | uiButtonGroup *new_group = MEM_cnew<uiButtonGroup>(__func__); | ||||
| BLI_listbase_clear(&new_group->buttons); | |||||
| new_group->flag = flag; | new_group->flag = flag; | ||||
| BLI_addtail(&block->button_groups, new_group); | BLI_addtail(&block->button_groups, new_group); | ||||
| } | } | ||||
| void ui_button_group_add_but(uiBlock *block, uiBut *but) | void ui_button_group_add_but(uiBlock *block, uiBut *but) | ||||
| { | { | ||||
| if (BLI_listbase_is_empty(&block->button_groups)) { | if (BLI_listbase_is_empty(&block->button_groups)) { | ||||
| ui_block_new_button_group(block, 0); | ui_block_new_button_group(block, uiButtonGroupFlag(0)); | ||||
| } | } | ||||
| uiButtonGroup *current_button_group = block->button_groups.last; | uiButtonGroup *current_button_group = static_cast<uiButtonGroup *>(block->button_groups.last); | ||||
| /* We can't use the button directly because adding it to | /* We can't use the button directly because adding it to | ||||
| * this list would mess with its `prev` and `next` pointers. */ | * this list would mess with its `prev` and `next` pointers. */ | ||||
| LinkData *button_link = BLI_genericNodeN(but); | LinkData *button_link = BLI_genericNodeN(but); | ||||
| BLI_addtail(¤t_button_group->buttons, button_link); | BLI_addtail(¤t_button_group->buttons, button_link); | ||||
| } | } | ||||
| static void button_group_free(uiButtonGroup *button_group) | static void button_group_free(uiButtonGroup *button_group) | ||||
| Show All 25 Lines | |||||