Hi all, particularly Raster could be of help here.

Our friend Rui from elmdentica is trying to achieve a supposedly
simple use case with genlist that uses a text part TEXTBLOCK with
text.min: 0 1, to limit the width but expand on height.

In order to help him I tried to do a small test, but it turns out that
for some weird reason the min calc is totally screwed, at least the
size assigned by genlist to the item is very off. One can try the
attached example.

You can comment everything and leave just the "msg" part, but it is
still buggy. The one liners seem correct.

As this may be a bug with Edje, that is about to be released, I'd like
someone else to check it out as well. (Probably it is not as elm_entry
works fine).

BR,

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: [email protected]
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
#include <Elementary.h>
#ifndef ELM_LIB_QUICKLAUNCH

#include <limits.h>
#include <stdlib.h>

static const struct item_desc {
   const char *icon;
   const char *msg;
} item_descs[] = {
  {"home", "This is a possibly long message with text that should wrap if there is not enough horizontal space"},
  {"close", "short text"},
  {"edit", "Several core EFL libraries have now been released as beta. There may be some minor bugs, but most if not all are gone. We invite input, especially on bugs, and any patches you may have to fix them. You can get the beta releases of Eina, Eet, Evas, Ecore, Embryo, Edje, Efreet, E_Dbus and Eeze here. There are also snapshots of Elementary and Enlightenment available from here. They are not considered stable at this time, but do work. They go together with the beta release above. You can also get the above libraries in their beta (and snapshot) state if you check out SVN revision 52995."},
  {"apps", "one liner!"},
  {"clock", "Enlightenment is not just a window manager for Linux/X11 and others, but also a whole suite of libraries to help you create beautiful user interfaces with much less work than doing it the old fashioned way and fighting with traditional toolkits, not to mention a traditional window manager. It covers uses from small mobile devices like phones all the way to powerful multi-core desktops (which are the primary development environment)."},
  {"folder", "<b>Enlightenment Foundation Libraries (EFL)</b><br>These provide both a semi-traditional toolkit set in Elementary as well as the object canvas (Evas) and powerful abstracted objects (Edje) that you can combine, mix and match, even layer on top of each other with alpha channels and events in-tact. It has 3D transformations for all objects and more.<br>A simple overview of the EFL (Enlightenment Foundation Libraries) stack is here. There is more to this, but this gives a quick overview of where it fits in."},
  {NULL, NULL}
};

static char *
_label_get(void *data, Evas_Object *lst, const char *part)
{
   const struct item_desc *it = data;
   return strdup(it->msg);
}

static Evas_Object *
_icon_get(void *data, Evas_Object *lst, const char *part)
{
   const struct item_desc *it = data;
   Evas_Object *ic = elm_icon_add(lst);
   elm_icon_scale_set(ic, 1, 1);
   elm_icon_standard_set(ic, it->icon);
   return ic;
}

static const Elm_Genlist_Item_Class item_cls = {
  "elmdentica", {_label_get, _icon_get, NULL, NULL}
};

EAPI int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *bg, *lst;
   char path[PATH_MAX];
   size_t count;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   elm_finger_size_set(4); /* default is 40 or so and this limits the list item height, of course this is just good for testing. */

   if (!realpath("./t-elmdentica.edj", path))
     {
        EINA_LOG_CRIT("no theme overlay: ./t-elmdentica.edj");
        return 1;
     }
   elm_theme_extension_add(NULL, path);

   win = elm_win_add(NULL, "test-elmdentica", ELM_WIN_BASIC);
   elm_win_title_set(win, "test-elmdentica");
   elm_win_autodel_set(win, EINA_TRUE);

   bg = elm_bg_add(win);
   evas_object_size_hint_weight_set(bg, 1.0, 1.0);
   elm_win_resize_object_add(win, bg);
   evas_object_show(bg);

   lst = elm_genlist_add(win);
   elm_genlist_compress_mode_set(lst, EINA_TRUE);
   evas_object_size_hint_weight_set(lst, 1.0, 1.0);
   elm_win_resize_object_add(win, lst);
   evas_object_show(lst);

   for (count = 0; count < 10; count++)
     {
        const struct item_desc *itr;
        for (itr = item_descs; itr->icon != NULL; itr++)
          elm_genlist_item_append(lst, &item_cls, itr, NULL, 0, NULL, NULL);
     }

   evas_object_resize(win, 320, 240);
   evas_object_show(win);

   elm_run();
   elm_shutdown();
   return 0;
}
#endif
ELM_MAIN()
collections {
   styles {
      style { name: "msg_style";
         base: "font=Sans font_size=10 color=#000 wrap=word";
         tag:  "br" "\n";
         tag:  "b" "+ font=Sans:style=Bold";
      }
   }

   group { name: "elm/genlist/item_compress/elmdentica/default";
      alias: "elm/genlist/item_compress_odd/elmdentica/default";

      alias: "elm/genlist/item/elmdentica/default";
      alias: "elm/genlist/item_odd/elmdentica/default";

      data {
         item: "labels" "msg";
         item: "icons" "icon";
      }
      parts {
         part { name: "icon";
            type: SWALLOW;
            description { state: "default" 0.0;
               align: 0.5 0.0;
               aspect_preference: HORIZONTAL;
               rel2 {
                  relative: 0.0 0.0;
                  offset: 99 99;
               }
            }
         }

         part { name: "limit-min-size";
            type: RECT;
            mouse_events: 0;
            description { state: "default" 0.0;
               color: 0 0 0 0;
               min: 100 100;
            }
         }

         part { name: "bg";
            type: RECT;
            mouse_events: 0;
            description { state: "default" 0.0;
               color: 200 200 200 255;
               rel1.offset: 105 5;
               rel2.offset: -5 -5;
            }
         }

         part { name: "msg";
            type: TEXTBLOCK;
            mouse_events: 0;
            description { state: "default" 0.0;
               rel1 {
                  relative: 0.0 0.0;
                  offset: 110 10;
               }
               rel2 {
                  relative: 1.0 1.0;
                  offset: -11 -11;
               }
               align: 0 0;
               fixed: 1 0;
               text {
                  style: "msg_style";
                  min: 0 1;
               }
            }
         }

         part { name: "sep";
            type: RECT;
            mouse_events: 0;
            description { state: "default" 0.0;
               color: 32 32 32 255;
               rel1 {
                  relative: 0.0 1.0;
                  offset: 0 -1;
               }
               rel2 {
                  relative: 1.0 1.0;
                  offset: -1 -1;
               }
            }
         }
      }
   }
}
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to