Works pretty neat. Good.

Thanks,
Sanjeev

On Sat, Feb 25, 2012 at 5:13 AM, Enlightenment SVN <
no-re...@enlightenment.org> wrote:

> Log:
> elev8: Implement naviframe object.
>
>  Included naviframe.js is adapted from pager.js.
>
>
>
> Author:       acidx
> Date:         2012-02-24 12:13:40 -0800 (Fri, 24 Feb 2012)
> New Revision: 68428
> Trac:         http://trac.enlightenment.org/e/changeset/68428
>
> Added:
>  trunk/PROTO/elev8/data/javascript/naviframe.js
> Modified:
>  trunk/PROTO/elev8/src/modules/elm/elev8_elm.cc
>
> Modified: trunk/PROTO/elev8/src/modules/elm/elev8_elm.cc
> ===================================================================
> --- trunk/PROTO/elev8/src/modules/elm/elev8_elm.cc      2012-02-24
> 17:58:50 UTC (rev 68427)
> +++ trunk/PROTO/elev8/src/modules/elm/elev8_elm.cc      2012-02-24
> 20:13:40 UTC (rev 68428)
> @@ -5858,6 +5858,90 @@
>   { NULL, NULL, NULL },
>  };
>
> +class CElmNaviframe : public CEvasObject {
> +protected:
> +   CPropHandler<CElmNaviframe> prop_handler;
> +
> +public:
> +   CElmNaviframe(CEvasObject *parent, Local<Object> obj) :
> +       CEvasObject(),
> +       prop_handler(property_list_base)
> +     {
> +        eo = elm_naviframe_add(parent->top_widget_get());
> +        construct(eo, obj);
> +        get_object()->Set(String::New("pop"),
> FunctionTemplate::New(pop)->GetFunction());
> +        get_object()->Set(String::New("push"),
> FunctionTemplate::New(push)->GetFunction());
> +     }
> +
> +   static Handle<Value> pop(const Arguments& args)
> +     {
> +        CEvasObject *self = eo_from_info(args.This());
> +        CElmNaviframe *naviFrame = static_cast<CElmNaviframe *>(self);
> +
> +        if (elm_naviframe_top_item_get(naviFrame->get()))
> +           elm_naviframe_item_pop(naviFrame->get());
> +
> +        return Undefined();
> +     }
> +
> +   static Handle<Value> push(const Arguments& args)
> +     {
> +        CEvasObject *self = eo_from_info(args.This());
> +        CElmNaviframe *naviFrame = static_cast<CElmNaviframe *>(self);
> +        CEvasObject *prev_btn, *next_btn, *content;
> +        bool has_prev_btn = false, has_next_btn = false;
> +
> +        if (!args[0]->IsObject())
> +           return ThrowException(Exception::Error(String::New("Parameter
> 1 should be an object description")));
> +
> +        if (!args[1]->IsString())
> +           return ThrowException(Exception::Error(String::New("Parameter
> 2 should be a string")));
> +
> +        if (args.Length() >= 3) {
> +           if (!args[2]->IsObject())
> +              return
> ThrowException(Exception::Error(String::New("Parameter 3 should either be
> undefined or an object description")));
> +           has_prev_btn = true;
> +        }
> +
> +        if (args.Length() >= 4) {
> +           if (!args[3]->IsObject())
> +              return
> ThrowException(Exception::Error(String::New("Parameter 4 should either be
> undefined or an object description")));
> +           has_next_btn = true;
> +        }
> +
> +        content = realize_one(naviFrame, args[0]);
> +        if (!content)
> +           return ThrowException(Exception::Error(String::New("Could not
> create content from description")));
> +
> +        if (has_prev_btn)
> +          {
> +             prev_btn = realize_one(naviFrame, args[2]->ToObject());
> +             if (!prev_btn)
> +               return ThrowException(Exception::Error(String::New("Could
> not create back button from description")));
> +          }
> +        if (has_next_btn)
> +          {
> +             next_btn = realize_one(naviFrame, args[3]->ToObject());
> +             if (!next_btn)
> +               return ThrowException(Exception::Error(String::New("Could
> not create next button from description")));
> +          }
> +
> +        String::Utf8Value titleParam(args[1]->ToString());
> +        elm_naviframe_item_push(naviFrame->get(),
> +                                *titleParam,
> +                                has_prev_btn ? prev_btn->get() : 0,
> +                                has_next_btn ? next_btn->get() : 0,
> +                                content->get(),
> +                                0);
> +        return Undefined();
> +     }
> +};
> +
> +template<> CEvasObject::CPropHandler<CElmNaviframe>::property_list
> +CEvasObject::CPropHandler<CElmNaviframe>::list[] = {
> +  { NULL, NULL, NULL },
> +};
> +
>  class CElmGrid : public CEvasObject {
>  protected:
>    CPropHandler<CElmGrid> prop_handler;
> @@ -6241,6 +6325,8 @@
>      eo = new CElmNotify(parent,obj);
>    else if (!strcmp(*str, "pager"))
>      eo = new CElmPager(parent,obj);
> +   else if (!strcmp(*str, "naviframe"))
> +     eo = new CElmNaviframe(parent,obj);
>    else if (!strcmp(*str, "grid"))
>      eo = new CElmGrid(parent,obj);
>
>
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to