Exemplo n.º 1
0
EAPI E_Obj_Dialog *
e_obj_dialog_new(E_Container *con, char *title, char *class_name, char *class_class)
{
   E_Obj_Dialog *od;
   E_Manager *man;
   Evas_Object *o;
   
   if (!con)
     {
	man = e_manager_current_get();
	if (!man) return NULL;
	con = e_container_current_get(man);
	if (!con) con = e_container_number_get(man, 0);
	if (!con) return NULL;
     }
   od = E_OBJECT_ALLOC(E_Obj_Dialog, E_OBJ_DIALOG_TYPE, _e_obj_dialog_free);
   if (!od) return NULL;
   od->win = e_win_new(con);
   if (!od->win)
     {
	free(od);
	return NULL;
     }
   e_win_delete_callback_set(od->win, _e_obj_dialog_cb_delete);
   e_win_resize_callback_set(od->win, _e_obj_dialog_cb_resize);
   od->win->data = od;
   e_win_dialog_set(od->win, 1);
   e_win_name_class_set(od->win, class_name, class_class);
   e_win_title_set(od->win, title);
   
   o = edje_object_add(e_win_evas_get(od->win));
   od->bg_object = o;
   
   e_win_centered_set(od->win, 1);
   od->cb_delete = NULL;
   
   return od;
}
Exemplo n.º 2
0
Ind_Win *
e_mod_ind_win_new(E_Zone *zone) 
{
   Ind_Win *iwin;
   Ecore_X_Window_State states[2];
   Evas_Coord h = 0;

   /* create our new indicator window object */
   iwin = E_OBJECT_ALLOC(Ind_Win, IND_WIN_TYPE, _e_mod_ind_win_cb_free);
   if (!iwin) return NULL;

   h = (il_ind_cfg->height * e_scale);
   iwin->zone = zone;

   /* create new window */
   iwin->win = e_win_new(zone->container);
   iwin->win->data = iwin;

   /* set some properties on the window */
   e_win_title_set(iwin->win, _("Illume Indicator"));
   e_win_name_class_set(iwin->win, "Illume-Indicator", "Illume-Indicator");
   e_win_no_remember_set(iwin->win, EINA_TRUE);

   /* hook into window resize so we can resize our objects */
   e_win_resize_callback_set(iwin->win, _e_mod_ind_win_cb_resize);

   /* set this window to not show in taskbar or pager */
   states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
   states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
   ecore_x_netwm_window_state_set(iwin->win->evas_win, states, 2);

   /* set this window to not accept or take focus */
   ecore_x_icccm_hints_set(iwin->win->evas_win, 0, 0, 0, 0, 0, 0, 0);

   /* create the popup */
   iwin->popup = e_popup_new(zone, 0, 0, zone->w, h);
   e_popup_name_set(iwin->popup, "indicator");
   e_popup_layer_set(iwin->popup, 200);

   /* create our event rectangle */
   iwin->o_event = evas_object_rectangle_add(iwin->win->evas);
   evas_object_color_set(iwin->o_event, 0, 0, 0, 0);
   evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_DOWN, 
                                  _e_mod_ind_win_cb_mouse_down, iwin);
   evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_UP, 
                                  _e_mod_ind_win_cb_mouse_up, iwin);
   evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_MOVE, 
                                  _e_mod_ind_win_cb_mouse_move, iwin);
   evas_object_move(iwin->o_event, 0, 0);
   evas_object_show(iwin->o_event);

   /* create our base object */
   iwin->o_base = edje_object_add(iwin->win->evas);
   if (!e_theme_edje_object_set(iwin->o_base, 
                                "base/theme/modules/illume-indicator", 
                                "modules/illume-indicator/window")) 
     {
        char buff[PATH_MAX];

        snprintf(buff, sizeof(buff), 
                 "%s/e-module-illume-indicator.edj", _ind_mod_dir);
        edje_object_file_set(iwin->o_base, buff, 
                             "modules/illume-indicator/window");
     }
   evas_object_move(iwin->o_base, 0, 0);
   evas_object_show(iwin->o_base);

   e_popup_edje_bg_object_set(iwin->popup, iwin->o_base);

   /* create our gadget container */
   iwin->gadcon = e_gadcon_swallowed_new("illume-indicator", zone->id, 
                                         iwin->o_base, "e.swallow.content");
   edje_extern_object_min_size_set(iwin->gadcon->o_container, zone->w, h);
   e_gadcon_min_size_request_callback_set(iwin->gadcon, 
                                          _e_mod_ind_win_cb_min_size_request, 
                                          iwin);
   e_gadcon_size_request_callback_set(iwin->gadcon, 
                                      _e_mod_ind_win_cb_size_request, iwin);
   e_gadcon_frame_request_callback_set(iwin->gadcon, 
                                       _e_mod_ind_win_cb_frame_request, iwin);
   e_gadcon_orient(iwin->gadcon, E_GADCON_ORIENT_FLOAT);
   e_gadcon_zone_set(iwin->gadcon, zone);
   e_gadcon_ecore_evas_set(iwin->gadcon, iwin->win->ecore_evas);

   e_gadcon_util_menu_attach_func_set(iwin->gadcon, 
                                      _e_mod_ind_win_cb_menu_items_append, 
                                      iwin);
   e_gadcon_populate(iwin->gadcon);

   /* hook into property change so we can adjust w/ e_scale */
   iwin->hdls = 
     eina_list_append(iwin->hdls, 
                      ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, 
                                              _e_mod_ind_win_cb_win_prop, iwin));

   /* hook into zone resize so we can set minimum window width when zone 
    * size changes */
   iwin->hdls = 
     eina_list_append(iwin->hdls, 
                      ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE, 
                                              _e_mod_ind_win_cb_zone_resize, 
                                              iwin));

   iwin->hdls = 
     eina_list_append(iwin->hdls, 
                      ecore_event_handler_add(E_EVENT_BORDER_HIDE, 
                                              _e_mod_ind_win_cb_border_hide, 
                                              iwin));

   iwin->hdls = 
     eina_list_append(iwin->hdls, 
                      ecore_event_handler_add(E_EVENT_BORDER_SHOW, 
                                              _e_mod_ind_win_cb_border_show, 
                                              iwin));

   /* set minimum size of this window & popup */
   e_win_size_min_set(iwin->win, zone->w, h);
   ecore_evas_size_min_set(iwin->popup->ecore_evas, zone->w, h);

   /* position and resize this window */
   e_win_move_resize(iwin->win, zone->x, zone->y, zone->w, h);
   e_popup_move_resize(iwin->popup, zone->x, zone->y, zone->w, h);

   /* show the window */
   e_win_show(iwin->win);
   e_popup_show(iwin->popup);

   /* set this window on proper zone */
   e_border_zone_set(iwin->win->border, zone);
   iwin->win->border->user_skip_winlist = 1;
   iwin->win->border->lock_focus_in = 1;
   iwin->win->border->lock_focus_out = 1;

   /* set this window to be a dock window. This needs to be done after show 
    * as E will sometimes reset the window type */
   ecore_x_netwm_window_type_set(iwin->win->evas_win, ECORE_X_WINDOW_TYPE_DOCK);

   /* tell conformant apps our position and size */
   ecore_x_e_illume_indicator_geometry_set(zone->black_win, zone->x, zone->y, 
                                           zone->w, h);

   return iwin;
}
Exemplo n.º 3
0
E_Win *
e_int_config_theme_import(E_Config_Dialog *parent)
{
   Evas *evas;
   E_Win *win;
   Evas_Object *o, *ofm;
   Import *import;
   E_Config_Dialog_Data *cfdata;
   Evas_Modifier_Mask mask;
   Evas_Coord w, h;
   Eina_Bool kg;

   import = E_NEW(Import, 1);
   if (!import) return NULL;

   win = e_win_new(parent->con);
   if (!win)
     {
        E_FREE(import);
        return NULL;
     }

   evas = e_win_evas_get(win);

   cfdata = E_NEW(E_Config_Dialog_Data, 1);
   import->cfdata = cfdata;
   import->win = win;
   import->parent = parent;

   e_win_title_set(win, _("Select a Theme..."));
   e_win_delete_callback_set(win, _theme_import_cb_delete);
   e_win_resize_callback_set(win, _theme_import_cb_resize);
   e_win_dialog_set(win, 1);
   e_win_name_class_set(win, "E", "_theme_import_dialog");

   o = edje_object_add(evas);
   import->bg_obj = o;
   e_theme_edje_object_set(o, "base/theme/dialog", "e/widgets/dialog/main");
   evas_object_move(o, 0, 0);
   evas_object_show(o);

   o = e_widget_list_add(evas, 1, 1);
   e_widget_on_focus_hook_set(o, _theme_import_cb_wid_focus, import);
   import->box_obj = o;
   edje_object_part_swallow(import->bg_obj, "e.swallow.buttons", o);

   o = evas_object_rectangle_add(evas);
   import->event_obj = o;
   mask = 0;
   kg = evas_object_key_grab(o, "Tab", mask, ~mask, 0);
   if (!kg)
     fprintf(stderr, "ERROR: Unable to redirect \"Tab\" key events to object %p.\n", o);
   mask = evas_key_modifier_mask_get(evas, "Shift");
   kg = evas_object_key_grab(o, "Tab", mask, ~mask, 0);
   if (!kg)
     fprintf(stderr, "ERROR: unable to redirect \"Tab\" key events to object %p.\n", o);
   mask = 0;
   kg = evas_object_key_grab(o, "Return", mask, ~mask, 0);
   if (!kg)
     fprintf(stderr, "ERROR: unable to redirect \"Return\" key events to object %p.\n", o);
   mask = 0;
   kg = evas_object_key_grab(o, "KP_Enter", mask, ~mask, 0);
   if (!kg)
     fprintf(stderr, "ERROR: unable to redirect \"KP_Enter\" key events to object %p.\n", o);
   evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN,
                                  _theme_import_cb_key_down, import);

   o = e_widget_list_add(evas, 0, 0);
   import->content_obj = o;

   ofm = e_widget_fsel_add(evas, e_user_homedir_get(), "/",
                           NULL, NULL,
                           _theme_import_cb_selected, import,
                           _theme_import_cb_changed, import, 1);
   import->fsel_obj = ofm;
   e_widget_list_object_append(o, ofm, 1, 1, 0.5);

   e_widget_size_min_get(o, &w, &h);
   evas_object_size_hint_min_set(o, w, h);
   edje_object_part_swallow(import->bg_obj, "e.swallow.content", o);
   evas_object_show(o);

   import->ok_obj = e_widget_button_add(evas, _("OK"), NULL,
                                        _theme_import_cb_ok, win, cfdata);
   e_widget_list_object_append(import->box_obj, import->ok_obj, 1, 0, 0.5);

   import->cancel_obj = e_widget_button_add(evas, _("Cancel"), NULL,
                                            _theme_import_cb_close,
                                            win, cfdata);
   e_widget_list_object_append(import->box_obj, import->cancel_obj, 1, 0, 0.5);

   e_widget_disabled_set(import->ok_obj, 1);

   e_win_centered_set(win, 1);

   o = import->box_obj;
   e_widget_size_min_get(o, &w, &h);
   evas_object_size_hint_min_set(o, w, h);
   edje_object_part_swallow(import->bg_obj, "e.swallow.buttons", o);

   edje_object_size_min_calc(import->bg_obj, &w, &h);
   evas_object_resize(import->bg_obj, w, h);
   e_win_resize(win, w, h);
   e_win_size_min_set(win, w, h);
   e_win_size_max_set(win, 99999, 99999);
   e_win_show(win);
   e_win_border_icon_set(win, "preferences-desktop-theme");

   win->data = import;

   return win;
}