Exemplo n.º 1
0
/**
 * @brief Associates a response-id to the button. This way, when the button will be clicked, the "response" signal
 * of the dialog will be emitted with this response-id. This function might be useful if you pack the button yourself,
 * without using etk_dialog_pack_button_in_action_area() or etk_dialog_button_add()
 * @param dialog a dialog
 * @param button the button to associate to the dialog and to the response-id
 * @param response_id the response-id to associate to the button
 * @note The button doesn't have to be packed in the dialog
 */
void etk_dialog_button_response_id_set(Etk_Dialog *dialog, Etk_Button *button, int response_id)
{
   int *id;

   if (!dialog || !button)
      return;

   id = malloc(sizeof(int));
   *id = response_id;
   etk_object_data_set_full(ETK_OBJECT(button), "_Etk_Dialog::Response_Id", id, free);

   etk_signal_disconnect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button), ETK_CALLBACK(_etk_dialog_button_clicked_cb), dialog);
   etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button), ETK_CALLBACK(_etk_dialog_button_clicked_cb), dialog);
}
Exemplo n.º 2
0
/* Called when an event occurs on the resize grip of the statusbar */
static void _etk_statusbar_resize_grip_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
{
   Etk_Statusbar *statusbar;

   if (!(statusbar = ETK_STATUSBAR(data)))
      return;

   if (strcmp(emission, "mouse,in") == 0)
      etk_toplevel_pointer_push(etk_widget_toplevel_parent_get(ETK_WIDGET(statusbar)), ETK_POINTER_RESIZE_BR);
   else if (strcmp(emission, "mouse,out") == 0)
      etk_toplevel_pointer_pop(etk_widget_toplevel_parent_get(ETK_WIDGET(statusbar)), ETK_POINTER_RESIZE_BR);
   else if (strcmp(emission, "mouse,down,1") == 0)
   {
      Etk_Toplevel *window;

      if (!(window = etk_widget_toplevel_parent_get(ETK_WIDGET(statusbar))) || !ETK_IS_WINDOW(window))
         return;

      etk_window_geometry_get(ETK_WINDOW(window), NULL, NULL, &statusbar->window_width, &statusbar->window_height);
      etk_signal_connect_by_code(ETK_WIDGET_MOUSE_MOVE_SIGNAL, ETK_OBJECT(statusbar), ETK_CALLBACK(_etk_statusbar_mouse_move_cb), NULL);
   }
   else if (strcmp(emission, "mouse,up,1") == 0)
      etk_signal_disconnect_by_code(ETK_WIDGET_MOUSE_MOVE_SIGNAL, ETK_OBJECT(statusbar), ETK_CALLBACK(_etk_statusbar_mouse_move_cb), NULL);
}