jackwootton at gmail.com
Mon Jul 6 08:27:05 PDT 2009
On Mon, Jul 6, 2009 at 3:43 PM, 胡 波<h3282129 at yahoo.com.cn> wrote:
> Thank you for your answer!
> I think that our idea may be different.I want to extend subobject "widget"
> to "window"object in webkit .because I want to add some application to
> widget object,and make it inherited from the window object.
> can you help me ? thank you!!
Sorry, I wasn't aware WebKit had a widget property of the window object.
If you are asking how do you extend the widget object that already
belongs to the window object then you need to:
1. Retrieve a reference to the window object, I think you may need to
2. Convert the object retrieved in step 1 (KJS::Window object) to a
JSObjectRef using JSObjectRef winRef = toRef(window);
object to retrieve the widget JSObjectRef object.
4. Once you have the widget JSObjectRef, then I assume you can add new
methods or properties to it.
Maybe someone else who knows more about this, or understands your
request better, may be able to help you.
> --- 09年7月6日，周一, Jack Wootton <jackwootton at gmail.com> 写道：
> 发件人: Jack Wootton <jackwootton at gmail.com>
> 收件人: "胡 波" <h3282129 at yahoo.com.cn>
> 抄送: webkit-dev at lists.webkit.org
> 日期: 2009年7月6日,周一,下午5:22
> On Sat, Jul 4, 2009 at 4:52 PM, 胡 波<h3282129 at yahoo.com.cn> wrote:
>> Thank you very much!
>> I understand your steps,But I do not understand the implement process! In
>> the samples you provide with me , I do not find the .cpp file. I want to
>> a sample for windows.Can you help me?
>> my aim:"widget" object is the same the "history" object,for
>> example,to:"widget" object: window.widget.(property/method),:to :"history"
>> thank you!
> In the JSPong example I linked, the first thing to look at should
> probably be PongAI.js. Since this gives you an idea of what is being
> achieved. Then read the ReadMe.txt to get an overview of the different
> classes involved. You could then have a look at JSShape.m is where the
> "ball" class is constructed and it's properties are associated with
> Objective C implementation (by adding static values to the class
> There is one oddity though, I do not understand why NSObject is
> that developers didn't have to inherit from classes in this
> manner...that the API did this for them. Maybe someone on this
> mailing list can help clarify this?
>> --- 09年7月4日，周六, Jack Wootton <jackwootton at gmail.com> 写道：
>> 发件人: Jack Wootton jackwootton at gmail.com
>> 收件人: "胡 波" <h3282129 at yahoo.com.cn>
>> 抄送: webkit-dev at lists.webkit.org
>> 日期: 2009年7月4日,周六,上午12:26
>> To add, it maybe useful to look at the following files in the
>> easy to understand.)
>> There are also some example programs that do what you want to do, only
>> with different objects.
>> JSPong: http://developer.apple.com/SampleCode/JSPong/index.html
>> More programs can be found here:
>> 2009/7/3 Jack Wootton <jackwootton at gmail.com>:
>>> Are you saying you wan to add a 'widget' property to the Window
>>> help you:
>>> Here is the API:
>>> If this is what you wish to do, then the following is a rough guide of
>>> what you need to do:
>>> 1. Create an empty class definition, you can create an empty class
>>> definition using kJSClassDefinitionEmpty.
>>> 2. Use the class definition with the JSCoreAPI method "JSClassCreate"
>>> to create your class.
>>> 3. Use your new class with JSObjectMake to create your new JSObject
>>> (this will be your widget object).
>>> 4 Use JSObjectSetProperty to add your new JSObject as a property of
>>> the Window object.
>>> On Fri, Jul 3, 2009 at 4:51 PM, 胡 波<h3282129 at yahoo.com.cn> wrote:
>>>> make it inherit window object. That is to say,when the widget object is
>>>> extended, and we can use it by the window.widget.(method/property) in
>>>> html document?
>>>> webkit-dev mailing list
>>>> webkit-dev at lists.webkit.org
More information about the webkit-dev