|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __WIDGET_H |
|
21 #define __WIDGET_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "config.h" |
|
25 #include <e32base.h> |
|
26 #include <kjs/object.h> |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // MACROS |
|
31 |
|
32 // DATA TYPES |
|
33 |
|
34 // FUNCTION PROTOTYPES |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 class MJSWidgetCallbacks; |
|
39 |
|
40 /** |
|
41 * CWidget |
|
42 * |
|
43 * @lib widgetengine.dll |
|
44 * @since 3.1 |
|
45 */ |
|
46 namespace KJS { |
|
47 |
|
48 class WidgetEventHandler; |
|
49 class JSWrt; |
|
50 |
|
51 struct WidgetPrivate |
|
52 { |
|
53 WidgetPrivate( MJSWidgetCallbacks* callbacks, |
|
54 WidgetEventHandler* showCallback, |
|
55 WidgetEventHandler* hideCallback, |
|
56 WidgetEventHandler* exitCallback, |
|
57 bool visibility) : |
|
58 m_callbacks(callbacks), |
|
59 m_showCallback(showCallback), |
|
60 m_hideCallback(hideCallback), |
|
61 m_exitCallback(exitCallback), |
|
62 m_visibility(visibility), |
|
63 m_wrt(0) |
|
64 { |
|
65 } |
|
66 |
|
67 |
|
68 virtual ~WidgetPrivate() { delete m_exitCallback; |
|
69 delete m_hideCallback; |
|
70 delete m_showCallback; } |
|
71 |
|
72 MJSWidgetCallbacks* m_callbacks; |
|
73 WidgetEventHandler* m_showCallback; |
|
74 WidgetEventHandler* m_hideCallback; |
|
75 WidgetEventHandler* m_exitCallback; |
|
76 bool m_visibility; |
|
77 JSWrt* m_wrt; |
|
78 |
|
79 }; |
|
80 |
|
81 class JSWidget : public JSObject |
|
82 { |
|
83 |
|
84 public: |
|
85 JSWidget(MJSWidgetCallbacks* aWidgetCallbacks); |
|
86 virtual ~JSWidget(); |
|
87 |
|
88 //From JSObject |
|
89 public: |
|
90 JSType type() const; |
|
91 JSValue* getValueProperty(KJS::ExecState*, int token) const; |
|
92 bool getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot); |
|
93 bool canPut(ExecState *exec, const Identifier &propertyName) const; |
|
94 void put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr = None); |
|
95 const ClassInfo* classInfo() const { return &info; } |
|
96 static const ClassInfo info; |
|
97 virtual void mark(); |
|
98 virtual UString toString(ExecState *exec) const; |
|
99 void setVisibility(bool visibility); |
|
100 void handleExit(); |
|
101 |
|
102 enum { |
|
103 openApplication, |
|
104 openURL, |
|
105 preferenceForKey, |
|
106 prepareForTransition, |
|
107 performTransition, |
|
108 setPreferenceForKey, |
|
109 setNavigationEnabled, |
|
110 setDisplayLandscape, |
|
111 setDisplayPortrait, |
|
112 isRotationSupported, |
|
113 identifier, |
|
114 onhide, |
|
115 onremove, |
|
116 onshow, |
|
117 onexit, |
|
118 wrt |
|
119 }; |
|
120 |
|
121 |
|
122 private: |
|
123 WidgetPrivate* d; |
|
124 |
|
125 }; |
|
126 |
|
127 }; |
|
128 |
|
129 #include "Widget.lut.h" |
|
130 |
|
131 #endif |