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:
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r--source/blender/editors/interface/interface_handlers.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 507e0581020..498e2f07ea4 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1240,13 +1240,18 @@ static bool ui_drag_toggle_but_is_supported(const uiBut *but)
/* Button pushed state to compare if other buttons match. Can be more
* then just true or false for toggle buttons with more than 2 states. */
-static int ui_drag_toggle_but_pushed_state(uiBut *but)
+static int ui_drag_toggle_but_pushed_state(bContext *C, uiBut *but)
{
if (but->rnapoin.data == NULL && but->poin == NULL && but->icon) {
- /* Assume icon identifies a unique state, for buttons that
- * work though functions callbacks and don't have an boolean
- * value that indicates the state. */
- return but->icon + but->iconadd;
+ if (but->pushed_state_func) {
+ return but->pushed_state_func(C, but->pushed_state_arg);
+ }
+ else {
+ /* Assume icon identifies a unique state, for buttons that
+ * work though functions callbacks and don't have an boolean
+ * value that indicates the state. */
+ return but->icon + but->iconadd;
+ }
}
else if (ui_but_is_bool(but)) {
return ui_but_is_pushed(but);
@@ -1295,7 +1300,7 @@ static bool ui_drag_toggle_set_xy_xy(
/* execute the button */
if (ui_drag_toggle_but_is_supported(but)) {
/* is it pressed? */
- int pushed_state_but = ui_drag_toggle_but_pushed_state(but);
+ int pushed_state_but = ui_drag_toggle_but_pushed_state(C, but);
if (pushed_state_but != pushed_state) {
UI_but_execute(C, but);
if (do_check) {
@@ -1754,7 +1759,7 @@ static bool ui_but_drag_init(
* typically 'button_activate_exit()' handles this */
ui_apply_but_autokey(C, but);
- drag_info->pushed_state = ui_drag_toggle_but_pushed_state(but);
+ drag_info->pushed_state = ui_drag_toggle_but_pushed_state(C, but);
drag_info->but_cent_start[0] = BLI_rctf_cent_x(&but->rect);
drag_info->but_cent_start[1] = BLI_rctf_cent_y(&but->rect);
copy_v2_v2_int(drag_info->xy_init, &event->x);