/** * @brief Sets the group of the radio-button * @param radio_button a radio-button * @param group the group to use */ void etk_radio_button_group_set(Etk_Radio_Button *radio_button, Eina_List **group) { Etk_Toggle_Button *toggle_button; Etk_Bool active; if (!(toggle_button = ETK_TOGGLE_BUTTON(radio_button)) || (group && (radio_button->group == group))) return; if (radio_button->group) { *radio_button->group = eina_list_remove(*radio_button->group, radio_button); if (!(*radio_button->group)) { free(radio_button->group); radio_button->group = NULL; } } if (!group) { group = malloc(sizeof(Eina_List *)); *group = NULL; active = ETK_TRUE; } else active = ETK_FALSE; *group = eina_list_append(*group, radio_button); radio_button->group = group; etk_object_notify(ETK_OBJECT(radio_button), "group"); radio_button->can_uncheck = ETK_TRUE; etk_toggle_button_active_set(toggle_button, active); }
/* This function is called when the radio-button is turned on: it deactivates all * the other radio-buttons of the group, and activate the given radio-button */ static void _etk_radio_button_active_set(Etk_Toggle_Button *toggle_button, Etk_Bool active) { Etk_Radio_Button *radio_button; Etk_Toggle_Button *tb; Eina_List *l; if (!(radio_button = ETK_RADIO_BUTTON(toggle_button)) || toggle_button->active == active) return; if (!toggle_button->active || (toggle_button->active && radio_button->can_uncheck)) { toggle_button->active = active; etk_signal_emit(ETK_TOGGLE_BUTTON_TOGGLED_SIGNAL, ETK_OBJECT(toggle_button)); etk_object_notify(ETK_OBJECT(toggle_button), "active"); if (toggle_button->active) { /* Deactivate the current active button of the group */ for (l = *radio_button->group; l; l = l->next) { tb = ETK_TOGGLE_BUTTON(l->data); if (tb != toggle_button && tb->active) { ETK_RADIO_BUTTON(tb)->can_uncheck = ETK_TRUE; etk_toggle_button_active_set(tb, ETK_FALSE); } } } radio_button->can_uncheck = ETK_FALSE; } }
/* Destroys the radio-button */ static void _etk_radio_button_destructor(Etk_Radio_Button *radio_button) { if (!radio_button || !radio_button->group) return; *radio_button->group = eina_list_remove(*radio_button->group, radio_button); if (!(*radio_button->group)) free(radio_button->group); else if (ETK_TOGGLE_BUTTON(radio_button)->active) etk_toggle_button_active_set(ETK_TOGGLE_BUTTON((*radio_button->group)->data), ETK_TRUE); }
void emphasis_configgui_autoset(Emphasis_Config_Gui *configgui) { Emphasis_Config *config; config = config_load(); if(config->port) { etk_range_value_set(ETK_RANGE(configgui->port), config->port); } if(config->hostname) { etk_entry_text_set(ETK_ENTRY(configgui->hostname), config->hostname); } if(config->password) { etk_entry_text_set(ETK_ENTRY(configgui->password), config->password); } if(!mpc_assert_status(MPD_PLAYER_STOP) || mpc_get_crossfade()) { etk_range_value_set(ETK_RANGE(configgui->xfade), mpc_get_crossfade()); } else { etk_range_value_set(ETK_RANGE(configgui->xfade), config->crossfade); } etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(configgui->stop), config->stop_on_exit); etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(configgui->aspect), config->keep_aspect); config_free(config); }
void image_frame_update(void) { //Etk_Combobox_Item *item = NULL; const char *im; //Stop signal propagation etk_signal_block("value-changed",ETK_OBJECT(UI_BorderLeftSpinner), ETK_CALLBACK(_image_border_spinners_value_changed_cb), (void*)BORDER_LEFT); etk_signal_block("value-changed",ETK_OBJECT(UI_BorderRightSpinner), ETK_CALLBACK(_image_border_spinners_value_changed_cb), (void*)BORDER_RIGHT); etk_signal_block("value-changed",ETK_OBJECT(UI_BorderTopSpinner), ETK_CALLBACK(_image_border_spinners_value_changed_cb), (void*)BORDER_TOP); etk_signal_block("value-changed",ETK_OBJECT(UI_BorderBottomSpinner), ETK_CALLBACK(_image_border_spinners_value_changed_cb), (void*)BORDER_BOTTOM); etk_signal_block("value-changed",ETK_OBJECT(UI_ImageAlphaSlider), ETK_CALLBACK(_image_AlphaSlider_value_changed_cb), NULL); etk_signal_block("icon-selected", ETK_OBJECT(UI_ImageBrowserIconbox), ETK_CALLBACK(_image_browser_iconbox_selected_cb), NULL); etk_signal_block("toggled", ETK_OBJECT(UI_BorderMiddleCheck), ETK_CALLBACK(_image_BorderMiddleCheck_toggled_cb), NULL); if (!etk_string_length_get(Cur.state)) return; if (!etk_string_length_get(Cur.part)) return; image_tweenlist_populate(); etk_widget_disabled_set(UI_DeleteTweenButton, TRUE); etk_widget_disabled_set(UI_MoveDownTweenButton, TRUE); etk_widget_disabled_set(UI_MoveUpTweenButton, TRUE); /* Update Image Browser */ image_browser_update(); //Set the images label for normal image im = edje_edit_state_image_get(edje_o, Cur.part->string, Cur.state->string); if (im) { etk_label_set(ETK_LABEL(UI_ImageNameLabel), im); edje_edit_string_free(im); } else { etk_label_set(ETK_LABEL(UI_ImageNameLabel), "none"); } //Set alpha and borders int alpha, t, l, r, b; edje_edit_state_color_get(edje_o, Cur.part->string, Cur.state->string, NULL, NULL, NULL, &alpha); edje_edit_state_image_border_get(edje_o, Cur.part->string, Cur.state->string, &l, &r, &t, &b); etk_range_value_set(ETK_RANGE(UI_ImageAlphaSlider), alpha); etk_range_value_set(ETK_RANGE(UI_BorderLeftSpinner), l); etk_range_value_set(ETK_RANGE(UI_BorderRightSpinner), r); etk_range_value_set(ETK_RANGE(UI_BorderTopSpinner), t); etk_range_value_set(ETK_RANGE(UI_BorderBottomSpinner), b); etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(UI_BorderMiddleCheck), edje_edit_state_image_border_fill_get(edje_o, Cur.part->string, Cur.state->string)); //ReEnable Signal Propagation etk_signal_unblock("value-changed", ETK_OBJECT(UI_BorderLeftSpinner), _image_border_spinners_value_changed_cb, (void*)BORDER_LEFT); etk_signal_unblock("value-changed", ETK_OBJECT(UI_BorderRightSpinner), _image_border_spinners_value_changed_cb, (void*)BORDER_RIGHT); etk_signal_unblock("value-changed", ETK_OBJECT(UI_BorderTopSpinner), _image_border_spinners_value_changed_cb, (void*)BORDER_TOP); etk_signal_unblock("value-changed", ETK_OBJECT(UI_BorderBottomSpinner), _image_border_spinners_value_changed_cb, (void*)BORDER_BOTTOM); etk_signal_unblock("value-changed", ETK_OBJECT(UI_ImageAlphaSlider), _image_AlphaSlider_value_changed_cb, NULL); etk_signal_unblock("icon-selected", ETK_OBJECT(UI_ImageBrowserIconbox), ETK_CALLBACK(_image_browser_iconbox_selected_cb), NULL); etk_signal_unblock("toggled", ETK_OBJECT(UI_BorderMiddleCheck), ETK_CALLBACK(_image_BorderMiddleCheck_toggled_cb), NULL); }
void state_frame_update(void) { const char* cc; //Stop signal propagation etk_signal_block("text-changed", ETK_OBJECT(UI_StateEntry), _group_NamesEntry_text_changed_cb, NULL); etk_signal_block("value-changed", ETK_OBJECT(UI_AspectMinSpinner), ETK_CALLBACK(_state_AspectSpinner_value_changed_cb), NULL); etk_signal_block("value-changed", ETK_OBJECT(UI_AspectMaxSpinner), ETK_CALLBACK(_state_AspectSpinner_value_changed_cb), NULL); etk_signal_block("active-item-changed", ETK_OBJECT(UI_AspectComboBox), ETK_CALLBACK(_state_AspectComboBox_changed_cb), NULL); etk_signal_block("value-changed", ETK_OBJECT(UI_StateMinWSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_block("value-changed", ETK_OBJECT(UI_StateMinHSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_block("value-changed", ETK_OBJECT(UI_StateMaxWSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_block("value-changed", ETK_OBJECT(UI_StateMaxHSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_block("value-changed", ETK_OBJECT(UI_StateAlignVSpinner), ETK_CALLBACK(_text_FontAlignSpinner_value_changed_cb), (void*)STATE_ALIGNV_SPINNER); etk_signal_block("value-changed", ETK_OBJECT(UI_StateAlignHSpinner), ETK_CALLBACK(_text_FontAlignSpinner_value_changed_cb), (void*)STATE_ALIGNH_SPINNER); etk_signal_block("toggled", ETK_OBJECT(UI_StateVisibleCheck), ETK_CALLBACK(_state_VisibleCheck_toggled_cb), NULL); etk_signal_block("text-changed", ETK_OBJECT(UI_StateCCEntry), ETK_CALLBACK(_state_CCEntry_text_changed_cb), NULL); if (etk_string_length_get(Cur.state)) { //Set description name & index etk_entry_text_set(ETK_ENTRY(UI_StateEntry),Cur.state->string); etk_widget_hide(ETK_WIDGET(UI_StateEntryImage)); if (!strcmp(Cur.state->string, "default 0.00")) etk_widget_disabled_set(ETK_WIDGET(UI_StateEntry), ETK_TRUE); else etk_widget_disabled_set(ETK_WIDGET(UI_StateEntry), ETK_FALSE); //Set aspect min & max etk_range_value_set(ETK_RANGE(UI_AspectMinSpinner), edje_edit_state_aspect_min_get(edje_o, Cur.part->string, Cur.state->string)); etk_range_value_set(ETK_RANGE(UI_AspectMaxSpinner), edje_edit_state_aspect_max_get(edje_o, Cur.part->string, Cur.state->string)); //Set aspect pref Combo etk_combobox_active_item_set(ETK_COMBOBOX(UI_AspectComboBox), etk_combobox_nth_item_get(ETK_COMBOBOX(UI_AspectComboBox), edje_edit_state_aspect_pref_get(edje_o, Cur.part->string, Cur.state->string))); //Set min e max size etk_range_value_set(ETK_RANGE(UI_StateMinWSpinner), edje_edit_state_min_w_get(edje_o, Cur.part->string, Cur.state->string)); etk_range_value_set(ETK_RANGE(UI_StateMinHSpinner), edje_edit_state_min_h_get(edje_o, Cur.part->string, Cur.state->string)); etk_range_value_set(ETK_RANGE(UI_StateMaxWSpinner), edje_edit_state_max_w_get(edje_o, Cur.part->string, Cur.state->string)); etk_range_value_set(ETK_RANGE(UI_StateMaxHSpinner), edje_edit_state_max_h_get(edje_o, Cur.part->string, Cur.state->string)); //Set description align & valign etk_range_value_set(ETK_RANGE(UI_StateAlignHSpinner), edje_edit_state_align_x_get(edje_o, Cur.part->string, Cur.state->string)); etk_range_value_set(ETK_RANGE(UI_StateAlignVSpinner), edje_edit_state_align_y_get(edje_o, Cur.part->string, Cur.state->string)); //Set visible checkbox etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(UI_StateVisibleCheck), edje_edit_state_visible_get(edje_o, Cur.part->string, Cur.state->string)); //Set Color Class Entry cc = edje_edit_state_color_class_get(edje_o, Cur.part->string, Cur.state->string); etk_entry_text_set(ETK_ENTRY(UI_StateCCEntry), cc); edje_edit_string_free(cc); } //ReEnable Signal Propagation etk_signal_unblock("text-changed", ETK_OBJECT(UI_StateEntry), _group_NamesEntry_text_changed_cb, NULL); etk_signal_unblock("value-changed", ETK_OBJECT(UI_AspectMinSpinner), ETK_CALLBACK(_state_AspectSpinner_value_changed_cb), NULL); etk_signal_unblock("value-changed", ETK_OBJECT(UI_AspectMaxSpinner), ETK_CALLBACK(_state_AspectSpinner_value_changed_cb), NULL); etk_signal_unblock("active-item-changed", ETK_OBJECT(UI_AspectComboBox), ETK_CALLBACK(_state_AspectComboBox_changed_cb), NULL); etk_signal_unblock("value-changed", ETK_OBJECT(UI_StateMinWSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_unblock("value-changed", ETK_OBJECT(UI_StateMinHSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_unblock("value-changed", ETK_OBJECT(UI_StateMaxWSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_unblock("value-changed", ETK_OBJECT(UI_StateMaxHSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_unblock("value-changed", ETK_OBJECT(UI_StateAlignVSpinner), ETK_CALLBACK(_text_FontAlignSpinner_value_changed_cb), (void*)STATE_ALIGNV_SPINNER); etk_signal_unblock("value-changed", ETK_OBJECT(UI_StateAlignHSpinner), ETK_CALLBACK(_text_FontAlignSpinner_value_changed_cb), (void*)STATE_ALIGNH_SPINNER); etk_signal_unblock("toggled", ETK_OBJECT(UI_StateVisibleCheck), ETK_CALLBACK(_state_VisibleCheck_toggled_cb), NULL); etk_signal_unblock("text-changed", ETK_OBJECT(UI_StateCCEntry), ETK_CALLBACK(_state_CCEntry_text_changed_cb), NULL); }
void ew_toggle_button_active_set(Entrance_Widget ew, int state) { etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(ew->owner), state); }
/* TODO : documentation */ void emphasis_player_toggle_full(Emphasis_Player_Gui *player, int value) { etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(player->full.full) , value); etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(player->small.full), value); }