|
From: Raymond I. <xw...@ya...> - 2003-09-22 15:41:57
|
From my basic understanding of widgets created in
DynAPI 2.5x I've concluded that the structure used
seems quite ok for normal widgets:
function widgetname(agruments){
this.DynLayer = DynLayer;
this.DynLayer(agruments);
//
}
var p = dynapi.setPrototype('widgetname','DynLayer');
But now that we want to be able to support themes &
skins I would like to suggest that the structure be
upgraded to allow us to add/modify special features
without creating a completely new object:
function widgetname(agruments){
this.DynLayer = DynLayer;
this.DynLayer(agruments);
this.construct(); // create widget components
}
var p = dynapi.setPrototype('widgetname','DynLayer');
p.construct = function(){
// setup addtional object here
};
p.render = function(evnt){
// render or draw the ui here
};
We could also create a base object call "Widget" for
use when creating widgets
function Widget(html,x,y,w,h,color){
this.DynLayer = DynLayer;
this.DynLayer(agruments);
// construct widget components
this.construct();
// render the ui before it's created
this.OnPreCreate(this.render);
// or we could hook the the render() function
// into DynLayer to avoid OnPreCreate overhead?
};
var p = dynapi.setPrototype('Widget','DynLayer');
// Design Properties
p.backColor = 'silver';
// Methods
p.construct = function(){
// setup addtional object here
};
p.render = function(evnt){
// render or draw the ui here
};
p.WidgetSetSize = DynLayer.prototype.setSize;
p.setSize = function(x,y){
this.WidgetSetSize(x,y);
this.render('resize');
}
To simply create a Button widget we could then do the
following:
function Button(caption,x,y,w,h){
this.Widget = Widget;
this.Widget(null,x,y,w,h);
this.caption = caption||'';
}
var p = dynapi.setPrototype('Button','Widget');
p.construct = function(){
this.setTextSelectable(false);
this.enableBlackboard();
this.addchild(new DynLayer(),'lyrCover');
this.lyrCover.setAnchor({left:0,top:0,stretchH:'*',stretchV:'*'});
};
p.render = function(evnt){
if(evnt && !this._created) return null;
if(!evnt||evnt=='caption')
this.setHTML(this.caption);
if(!evnt||evnt=='resize'){
// do something here
}
if(!evnt) {
this.setBgColor(this.backColor);
}
};
p.setCaption = function(t){
this.caption = c||'';
this.render('caption');
};
What do you think about this model?
--
Raymond Irving
--- Raymond Irving <xw...@ya...> wrote:
>
> See docs/docs/quickref.stylemanager.html
>
> We could also look into stylemanager's approach as a
> standard or come up with another.
>
> --
> Raymond Irving
>
> --- Daniel Tiru <de...@ti...> wrote:
> > Hi Raymond!
> >
> > I think this looks good, but i still dont
> understand
> > how the
> > stylemanager works really... It might help me
> > understand the
> > themes/styles a bit better, and the posibility to
> > have a oppinion :)
> >
> > Is there some documentation how it works, i havent
> > found any but maybee
> > i havent been looking that hard? Or maybee some
> step
> > by step example?
> >
> > Regards
> > Daniel
> >
> > -----Original Message-----
> > From: dyn...@li...
> > [mailto:dyn...@li...] On
> > Behalf Of Raymond
> > Irving
> > Sent: den 22 september 2003 01:56
> > To: dyn...@li...
> > Subject: Re: [Dynapi-Dev] Widget Howto
> >
> >
> >
> > You're correct Daniel.
> >
> > I've converted the "how to create a widget" from
> the
> > dynapi set
> http://dynapi.sourceforge.net/doccenter/
> > to
> > DynAPI 3.0 format. See the Tips & Tricks section.
> >
> > I think we need a Standard Widget Model that
> > supports
> > the following:
> >
> > 1) Inheritance
> > 2) Themes/Skins
> >
> > Is it possible for all the developers to come
> > together
> > and let's come up with a design model that can
> > support
> > the above features and others if needed?
> >
> > What ideas do you have in mind?
> >
> > --
> > Raymond Irving
> >
> >
> > --- Daniel Tiru <de...@ti...> wrote:
> > > Hi!
> > >
> > > If someone that have good insight into the
> widget
> > > creation and how they
> > > should be build please write a documentation or
> a
> > > step by step
> > > instruction on how we should continue to build
> the
> > > widgets?
> > >
> > > I think this is quite important as I think most
> of
> > > us are atleast
> > > thinking on making a own widget to deliver to
> the
> > > DYNapi project. So its
> > > best for us all if the widget are build in some
> > > specialway we all
> > > follows.
> > >
> > > Best Regards
> > > Daniel
> > >
> > >
> > >
> > >
> > >
> >
>
-------------------------------------------------------
> > > This sf.net email is sponsored by:ThinkGeek
> > > Welcome to geek heaven.
> > > http://thinkgeek.com/sf
> > > _______________________________________________
> > > Dynapi-Dev mailing list
> > > Dyn...@li...
> > >
> >
>
http://www.mail-archive.com/dyn...@li.../
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site
> > design software
> > http://sitebuilder.yahoo.com
> >
> >
> >
>
-------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > Dynapi-Dev mailing list
> > Dyn...@li...
> >
>
http://www.mail-archive.com/dyn...@li.../
> >
> >
> >
> >
> >
>
-------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > Dynapi-Dev mailing list
> > Dyn...@li...
> >
>
http://www.mail-archive.com/dyn...@li.../
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> http://sitebuilder.yahoo.com
>
>
>
-------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Dynapi-Dev mailing list
> Dyn...@li...
>
http://www.mail-archive.com/dyn...@li.../
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
|