Changeset 18
- Timestamp:
- 04/07/08 05:48:42 (4 years ago)
- Files:
-
- trunk/examples/behavior/behavior.exe (modified) (previous)
- trunk/examples/behavior/behavior.res (modified) (previous)
- trunk/examples/behavior/build.bat (modified) (1 diff)
- trunk/examples/behavior/resources/language.kfg (modified) (2 diffs)
- trunk/examples/htmlayout/build.bat (modified) (1 diff)
- trunk/examples/htmlayout/msvs_start_page.exe (modified) (previous)
- trunk/examples/sumatrapdf/build.bat (modified) (1 diff)
- trunk/examples/sumatrapdf/pdfviewer.exe (modified) (previous)
- trunk/import/flowerd/common.d (modified) (9 diffs)
- trunk/import/flowerd/config.d (modified) (2 diffs)
- trunk/import/flowerd/dfl.d (modified) (10 diffs)
- trunk/import/flowerd/sharedlib.d (added)
- trunk/import/flowerd/skin.d (modified) (3 diffs)
- trunk/import/flowerd/syncexec.d (modified) (6 diffs)
- trunk/import/htmlayout/behaviors/translatable.d (modified) (3 diffs)
- trunk/import/htmlayout/capi.d (modified) (20 diffs)
- trunk/import/htmlayout/element.d (modified) (23 diffs)
- trunk/import/htmlayout/events.d (modified) (2 diffs)
- trunk/import/htmlayout/htmlayout.d (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/examples/behavior/build.bat
r17 r18 2 2 3 3 set HTMLAYOUT_FILES=../../import/htmlayout/capi.d ../../import/htmlayout/events.d ../../import/htmlayout/element.d ../../import/htmlayout/htmlayout.d ../../import/htmlayout/behaviors/translatable.d 4 set FLOWERD_FILES=../../import/flowerd/dfl.d ../../import/flowerd/common.d ../../import/flowerd/config.d4 set FLOWERD_FILES=../../import/flowerd/dfl.d ../../import/flowerd/common.d ../../import/flowerd/config.d ../../import/flowerd/sharedlib.d 5 5 set DFL_STUFF=-version=DFL_import_libs -L/exet:nt/su:windows:4.0 6 6 trunk/examples/behavior/resources/language.kfg
r17 r18 5 5 2::ÐМглОйÑкО 6 6 title::ÐбÑÑМеМОе 7 header::ÐеЌП ÑÑÑаÑОÑ7 header::ÐеЌПМÑÑÑаÑÐžÑ 8 8 en:: 9 9 button:: … … 12 12 2::English 13 13 title::Explanation 14 header::Demo 14 header::Demonstration trunk/examples/htmlayout/build.bat
r17 r18 2 2 3 3 set HTMLAYOUT_FILES=../../import/htmlayout/capi.d ../../import/htmlayout/events.d ../../import/htmlayout/element.d ../../import/htmlayout/htmlayout.d 4 set FLOWERD_FILES=../../import/flowerd/dfl.d ../../import/flowerd/common.d 4 set FLOWERD_FILES=../../import/flowerd/dfl.d ../../import/flowerd/common.d ../../import/flowerd/sharedlib.d 5 5 set DFL_STUFF=-version=DFL_import_libs -L/exet:nt/su:windows:4.0 6 6 trunk/examples/sumatrapdf/build.bat
r17 r18 2 2 3 3 set HTMLAYOUT_FILES=../../import/htmlayout/capi.d ../../import/htmlayout/events.d ../../import/htmlayout/element.d ../../import/htmlayout/htmlayout.d 4 set FLOWERD_FILES=../../import/flowerd/dfl.d ../../import/flowerd/common.d 4 set FLOWERD_FILES=../../import/flowerd/dfl.d ../../import/flowerd/common.d ../../import/flowerd/sharedlib.d 5 5 set DFL_STUFF=-version=DFL_import_libs -L/exet:nt/su:windows:4.0 6 6 trunk/import/flowerd/common.d
r17 r18 7 7 import tango.text.Util; 8 8 9 alias ulong Hash; 9 //alias ulong Hash; 10 alias uint Hash; 10 11 11 12 Hash dhash(char[] s) … … 16 17 } 17 18 18 template shash(char [] s, Hash sofar=0) 19 { 20 static if (s.length == 0) const shash = sofar; 21 else const shash = shash!(s[1 .. length], sofar * 11 + s[0]); 19 template Shash(char [] s, Hash sofar=0) 20 { 21 static if (s.length == 0) const Shash = sofar; 22 else const Shash = Shash!(s[1 .. length], sofar * 11 + s[0]); 23 } 24 25 template Itoa(int i) 26 { 27 static if(i < 0) 28 const char[] Itoa = "-" ~ Itoa!(-i); 29 else static if(i >= 10) 30 const char[] Itoa = Itoa!(i / 10) ~ "0123456789"[i % 10]; 31 else 32 const char[] Itoa = "" ~ "0123456789"[i % 10]; 22 33 } 23 34 … … 77 88 } 78 89 90 //todo: add function to work with multiple items 79 91 class Array 80 92 { … … 112 124 ar=ar[0..index]~ar[index+len..ar.length]; 113 125 return true; 126 } 127 128 static bool contains(T)(T[] ar,T item,uint start=0) 129 { 130 return index(ar,item,start)<ar.length; 114 131 } 115 132 … … 131 148 if(Array.movei(ar,ar.length-1,index)==false) return false; 132 149 ar[index]=item; 150 return true; 151 } 152 153 static bool insert(T)(ref T[] ar,T[] items,uint index=uint.max) 154 { 155 if(index==uint.max) index=ar.length; 156 if(index>ar.length) return false; 157 ar=ar[0..index]~items~ar[index..$]; 133 158 return true; 134 159 } … … 191 216 class GrowStack(T) 192 217 { 193 this(uint step=5,T bad=T.init){this.bad=bad;this.step=(step==0?1:step);} 194 195 void push(T item) 218 this(uint step=32,uint initial=0,T bad=T.init) 219 { 220 if(initial) stack.length=initial; 221 this.bad=bad; 222 this.step=(step==0?1:step); 223 } 224 225 T push(T item) 196 226 { 197 227 if(pointer==stack.length) stack.length=stack.length+step; 198 stack[pointer++]=item; 199 } 200 201 T unpush() 202 { 203 T ret=pop(); 204 if(stack.length) stack.length=stack.length-1; 205 return ret; 228 return stack[pointer++]=item; 229 } 230 231 void pusha(T[] items) 232 { 233 if(items.length==0) return; 234 uint end=pointer+items.length; 235 if(end>stack.length) stack.length=stack.length+step*(end/step+(end%step==0?0:1)); 236 stack[pointer..end]=items; 237 pointer=end; 206 238 } 207 239 … … 211 243 if(pointer>0) --pointer; 212 244 return ret; 245 } 246 247 T[] popa(uint len) 248 { 249 if(len==0 || len>pointer) return null; 250 else 251 { 252 auto ret=stack[pointer-len..pointer]; 253 pointer-=len; 254 return ret; 255 } 213 256 } 214 257 … … 270 313 } 271 314 315 //todo: NOT TESTED 316 bool remove(uint index,uint len=1) 317 { 318 if(index+len>pointer) return false; 319 else if(Array.removei(stack,index,len)) 320 { 321 pointer-=len; 322 return true; 323 } 324 else return false; 325 } 326 327 //todo: NOT TESTED 328 bool insert(T[] items,uint pos) 329 { 330 if(pos>pointer) return false; 331 if(Array.insert(stack,items,pos)) 332 { 333 pointer+=items.length; 334 return true; 335 } 336 else return false; 337 } 338 272 339 void opCatAssign(T v){push(v);} 273 340 GrowStack!(T) opCat(T v){push(v);return this;} … … 280 347 } 281 348 282 uint size(){return stack.length;} 349 uint limit(){return stack.length;} 350 uint limit(uint i) 351 { 352 stack.length=i; 353 return pointer>i?pointer=i:i; 354 } 283 355 T[] slice(){if(pointer) return stack[0..pointer]; else return null;} 284 void empty(){if(stack.length) delete stack; stack=null; }356 void empty(){if(stack.length) delete stack; stack=null; pointer=0;} 285 357 T bad; 286 358 trunk/import/flowerd/config.d
r17 r18 11 11 //todo: ConfigNode get is not handling ivalid paths, like multiple slashes or paths ending in slash 12 12 //todo: Config.load should accept filters, to load only specific nodes 13 //todo: ConfigNode.merge to merge with another ConfigNode 14 //todo: Config.merge to merge with another Config 13 15 14 16 class ConfigNode … … 27 29 const DEFTYPE=STRING; 28 30 29 ~this(){remove();}31 //~this(){remove();} 30 32 31 33 static ConfigNode opCall(char[] name,char[] value=null,uint type=DEFTYPE) trunk/import/flowerd/dfl.d
r17 r18 33 33 class HLayoutControl : HLayout 34 34 { 35 this(HWND parent)36 {37 ctrl=new HControl;38 ctrl.parent=Control.fromHandle(cast(dfl.internal.winapi.HANDLE)parent);39 ready=true;40 super(ctrl.handle);41 }42 43 this(Control parent)44 {45 ctrl=new HControl;46 ctrl.parent=parent;47 ready=true;48 super(ctrl.handle);49 }50 51 35 class HControl : Control 52 36 { 53 37 void wndProc(inout Message msg) 54 38 { 55 if( ready)39 if(mReady) 56 40 { 57 41 BOOL bHandled; … … 67 51 } 68 52 69 HWND handle(){return ctrl.handle;} 70 71 HControl ctrl; 72 bool ready; 53 this(HWND parent) 54 { 55 mControl=new HControl; 56 mControl.parent=Control.fromHandle(cast(dfl.internal.winapi.HANDLE)parent); 57 mReady=true; 58 super(mControl.handle); 59 } 60 61 this(Control parent) 62 { 63 mControl=new HControl; 64 mControl.parent=parent; 65 mReady=true; 66 super(mControl.handle); 67 } 68 69 HWND handle(){return mControl.handle;} 70 71 protected: 72 HControl mControl; 73 bool mReady; 73 74 } 74 75 75 76 class HLayoutForm : HLayoutControl 76 77 { 77 Form opCast() {return form;}78 79 78 class HForm : Form 80 79 { … … 88 87 { 89 88 super.onClosing(args); 90 if(!args.cancel) ready=false; 91 } 92 } 93 94 HForm form; 95 96 HWND handle(){return form.handle;} 89 if(!args.cancel) mReady=false; 90 } 91 } 97 92 98 93 this() 99 94 { 100 95 syncCtor(); 101 form=new HForm;102 form.visible=false;103 super( form);104 ctrl.dock=DockStyle.FILL;96 mForm=new HForm; 97 mForm.visible=false; 98 super(mForm); 99 mControl.dock=DockStyle.FILL; 105 100 } 106 101 107 102 ~this(){syncDtor();} 108 103 109 mixin SyncExec; 104 void run(char[][] argv=null) 105 { 106 this.argv=argv; 107 main(); 108 Application.run(mForm,&execute); 109 } 110 111 Form opCast(){return mForm;} 112 HForm form(){return mForm;} 113 HWND handle(){return mForm.handle;} 114 115 mixin SyncExec!(HLayoutForm); 116 mixin TimerExec!(HLayoutForm); 117 118 protected: 119 120 HForm mForm; 121 char[][] argv; 122 void main(){} 110 123 } 111 124 112 125 class HLiteControl : HLite 113 126 { 114 this() 115 { 116 //init(); 117 } 127 this(){} 118 128 119 129 this(HWND parent) 120 130 { 121 ctrl=new HControl;122 ctrl.parent=Control.fromHandle(cast(dfl.internal.winapi.HANDLE)parent);131 mControl=new HControl; 132 mControl.parent=Control.fromHandle(cast(dfl.internal.winapi.HANDLE)parent); 123 133 } 124 134 125 135 this(Control parent) 126 136 { 127 ctrl=new HControl; 128 ctrl.parent=parent; 129 } 130 131 HWND handle(){return ctrl.handle;} 132 HControl ctrl; 137 mControl=new HControl; 138 mControl.parent=parent; 139 } 140 141 HWND handle(){return mControl.handle;} 133 142 134 143 class HControl : Control//DoubleBufferedControl … … 219 228 bool onUpdateUI() 220 229 { 221 ctrl.update();230 mControl.update(); 222 231 return true; 223 232 } … … 225 234 bool onRefreshArea(HRefreshArea e) 226 235 { 227 ctrl.invalidate(Rect(cast(dfl.internal.winapi.RECT*)&e.area()));228 // ctrl.updateGraphics(Rect(&e.area));236 mControl.invalidate(Rect(cast(dfl.internal.winapi.RECT*)&e.area())); 237 //mControl.updateGraphics(Rect(&e.area)); 229 238 return true; 230 239 } … … 235 244 if(last!=e.id) 236 245 { 237 ctrl.cursor(new Cursor(cast(dfl.internal.winapi.HANDLE)LoadCursorA(null,e.res)));246 mControl.cursor(new Cursor(cast(dfl.internal.winapi.HANDLE)LoadCursorA(null,e.res))); 238 247 last=e.id; 239 248 } … … 243 252 bool onSetTimer(HSetTimer e) 244 253 { 245 if(e.time==0) KillTimer(ctrl.handle,e.id);254 if(e.time==0) return(KillTimer(mControl.handle,e.id)!=0); 246 255 else 247 256 { 248 if(!SetTimer(ctrl.handle,e.id,e.time,&traverseTimerEvent)) return true; 249 mTimers[ctrl.handle]=this; 250 } 251 return true; 257 if(SetTimer(mControl.handle,e.id,e.time,&traverseTimerEvent)!=0) 258 { 259 mTimers[mControl.handle]=this; 260 return true; 261 } 262 } 263 return false; 252 264 } 253 265 … … 275 287 } 276 288 289 protected: 277 290 static extern(Windows) void traverseTimerEvent(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) 278 291 { … … 282 295 } 283 296 297 HControl mControl; 284 298 static HLite[HWND] mTimers; 285 299 } … … 287 301 class HLiteForm : HLiteControl 288 302 { 289 Form opCast() {return form;} 290 291 Form form; 303 class HForm : Form 304 { 305 void pack() 306 { 307 clientSize=Size(minWidth,minHeight); 308 } 309 } 310 311 Form opCast() {return mForm;} 312 HWND handle(){return mForm.handle;} 313 HForm form(){return mForm;} 292 314 293 315 this() 294 316 { 295 317 syncCtor(); 296 form=newForm;297 form.visible=false;298 super( form);299 ctrl.dock=DockStyle.FILL;318 mForm=new HForm; 319 mForm.visible=false; 320 super(mForm); 321 mControl.dock=DockStyle.FILL; 300 322 } 301 323 302 324 ~this() {syncDtor();} 303 325 304 mixin SyncExec; 305 306 HWND handle(){return form.handle;} 326 void run(char[][] argv=null) 327 { 328 this.argv=argv; 329 main(); 330 Application.run(mForm,&execute); 331 } 332 333 mixin SyncExec!(HLiteForm); 334 mixin TimerExec!(HLiteForm); 307 335 308 336 void onKeyDown(KeyEventArgs kea) 309 337 { 310 ctrl.onKeyDown(kea);338 mControl.onKeyDown(kea); 311 339 } 312 340 313 341 void onKeyUp(KeyEventArgs kea) 314 342 { 315 ctrl.onKeyUp(kea);343 mControl.onKeyUp(kea); 316 344 } 317 345 318 346 void onKeyPress(KeyPressEventArgs kea) 319 347 { 320 ctrl.onKeyPress(kea); 321 } 322 } 348 mControl.onKeyPress(kea); 349 } 350 351 protected: 352 353 HForm mForm; 354 char[][] argv; 355 void main(){} 356 } trunk/import/flowerd/skin.d
r17 r18 7 7 module flowerd.skin; 8 8 9 public import htmlayout.htmlayout; 10 import tango.sys.win32.Types; 11 import tango.sys.win32.Macros; 9 12 import flowerd.syncexec; 10 11 class SkinnedForm 12 { 13 this(){syncCtor();} 14 ~this(){syncDtor();} 15 13 import tango.stdc.stringz; 14 15 version(WIN32_import_libs) 16 { 17 //pragma(lib,"user32.lib"); 18 //pragma(lib,"kernel32.lib"); 19 //pragma(lib,"shell32.lib"); 20 pragma(lib,"gdi32.lib"); 21 //pragma(lib,"user32.lib"); 22 //pragma(lib,"uuid.lib"); 23 //pragma(lib,"comdlg32.lib"); 24 //pragma(lib,"ole32.lib"); 25 //pragma(lib,"oleaut32.lib"); 26 //pragma(lib,"advapi32.lib"); 27 //pragma(lib,"comctl32.lib"); 28 } 29 30 extern(Windows) 31 { 32 WINBOOL GetMessageW(LPMSG, HWND, UINT, UINT); 33 WINBOOL GetMessageA(LPMSG, HWND, UINT, UINT); 34 WINBOOL TranslateMessage(LPMSG); 35 LONG DispatchMessageW(LPMSG); 36 LONG DispatchMessageA(LPMSG); 37 WINBOOL PostMessageA(HWND, UINT, WPARAM, LPARAM); 38 HMODULE GetModuleHandleA(LPCSTR); 39 void PostQuitMessage(int); 40 ATOM RegisterClassExA(LPWNDCLASSEX); 41 WINBOOL ShowWindow(HWND, int); 42 WINBOOL IsWindowVisible(HWND); 43 WINBOOL UpdateWindow(HWND); 44 WINBOOL SetWindowPos(HWND, HWND, int, int, int, int, UINT); 45 WINBOOL SetWindowTextW(HWND, LPCWSTR); 46 WINBOOL SetWindowTextA(HWND, LPCSTR); 47 HWND CreateWindowExA(DWORD, LPCSTR, LPCSTR, DWORD, int, int, int, int, HWND, HMENU, HINST, LPVOID); 48 HWND CreateWindowExW(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINST, LPVOID); 49 WINBOOL GetWindowPlacement(HWND, WINDOWPLACEMENT*); 50 int MapWindowPoints(HWND, HWND, LPPOINT, UINT); 51 LRESULT DefWindowProcA(HWND, UINT, WPARAM, LPARAM); 52 LRESULT DefWindowProcW(HWND, UINT, WPARAM, LPARAM); 53 WINBOOL GetWindowRect(HWND, LPRECT); 54 WINBOOL DestroyWindow(HWND); 55 HCURSOR SetCursor(HCURSOR); 56 HCURSOR LoadCursorA(HINST, LPCSTR); 57 } 58 59 const WS_EX_LAYERED=0x00080000; 60 int GET_X_LPARAM(LPARAM lParam){return cast(int)cast(short)LOWORD(lParam);} 61 int GET_Y_LPARAM(LPARAM lParam){return cast(int)cast(short)HIWORD(lParam);} 62 63 class HSkinLayout : HLayout 64 { 65 this() 66 { 67 mWindow = SkinnedWindow(); 68 mWindow.msgHandler=&msgHandler; 69 super(handle); 70 syncCtor(); 71 } 72 73 ~this() 74 { 75 syncDtor(); 76 } 77 78 mixin SkinnedForm!(HSkinLayout); 79 } 80 81 /*class HSkinLite : HLite 82 { 83 mixin SkinnedForm!(HSkinLite); 84 }*/ 85 86 template SkinnedForm(THIS_TYPE) 87 { 16 88 bool run(char[][] argv) 17 89 { … … 19 91 20 92 // Perform application initialization: 21 if (!init()) return false;93 if (!init()) return false; 22 94 23 95 main(); 96 97 mWindow.show; 98 mWindow.update; 24 99 25 100 // Main message loop: 26 while (GetMessage W(&msg, null, 0, 0))101 while (GetMessageA(&msg, null, 0, 0)) 27 102 { 28 103 // execute asynchronous tasks in GUI thread. … … 30 105 31 106 TranslateMessage(&msg); 32 DispatchMessageW(&msg); 33 } 34 35 return msg.wParam; 36 } 37 38 mixin SyncExec; 107 DispatchMessageA(&msg); 108 } 109 110 return cast(bool)msg.wParam; 111 } 112 113 SkinnedWindow window(){return mWindow;} 114 HWND handle(){return mWindow.handle;} 115 116 mixin SyncExec!(THIS_TYPE); 117 mixin TimerExec!(THIS_TYPE); 39 118 40 119 protected: 120 121 LRESULT msgHandler(uint msg,WPARAM wParam,LPARAM lParam,out bool handled) 122 { 123 return defProcND(msg,wParam,lParam,handled); 124 } 125 41 126 bool init() 42 127 { 43 htmlayout::window* pwnd = htmlayout::window::create( 0, 0, 300, 300, L"Hello world!" ); 128 if(mWindow is null) 129 { 130 mWindow = SkinnedWindow(); 131 mWindow.msgHandler=&msgHandler; 132 } 133 134 mWindow.init(this); 44 135 45 //hWnd = CreateWindowEx(WS_EX_APPWINDOW, szWindowClass, szWindowClass, WS_POPUP | WS_SYSMENU | WS_CLIPCHILDREN | WS_VISIBLE, 46 // 0, 0, 300, 300, NULL, NULL, hInstance, NULL); 47 48 if (!pwnd->hwnd) 49 { 50 return FALSE; 51 } 52 53 ShowWindow(pwnd->hwnd, nCmdShow); 54 UpdateWindow(pwnd->hwnd); 55 56 return TRUE; 57 } 136 return true; 137 } 138 58 139 void main(){} 59 140 char[] argv; 60 HINSTANCE hInst; 61 } 62 63 64 /+class SkinnedWindow 65 { 66 67 public: 68 HWND hwnd; 141 SkinnedWindow mWindow; 142 } 143 144 145 class SkinnedWindow 146 { 147 HWND handle(){return mHandle;} 148 149 static SkinnedWindow opCall(int x=CW_USEDEFAULT, int y=CW_USEDEFAULT, int width=CW_USEDEFAULT, int height=CW_USEDEFAULT) //CW_USEDEFAULT 150 { 151 static const CLASSNAME8="HTMLayoutSkinnedWindow\0"; 152 static const CLASSNAME16="HTMLayoutSkinnedWindow\0"w; 153 auto hInstance=GetModuleHandleA(null); 154 155 static bool registered; 156 if(registered == false) 157 { 158 WNDCLASSEX wcex; 159 wcex.cbSize = WNDCLASSEX.sizeof; 160 161 wcex.style = CS_HREDRAW | CS_VREDRAW; 162 wcex.lpfnWndProc = &wndProc; 163 wcex.cbClsExtra = 0; 164 wcex.cbWndExtra = 0; 165 wcex.hInstance = hInstance; 166 //wcex.hIcon = LoadIconA(hInstance, (LPCTSTR)IDI_SKIN); 167 wcex.hCursor = LoadCursorA(null, IDC_ARROW); 168 wcex.hbrBackground = cast(HBRUSH)(COLOR_WINDOW+1); 169 wcex.lpszMenuName = null; 170 wcex.lpszClassName = CLASSNAME8.ptr; 171 //wcex.hIconSm = LoadIconA(wcex.hInstance, (LPCTSTR)IDI_SKINSMALL); 172 173 if(RegisterClassExA(&wcex)) registered=true; 174 else return null; 175 } 176 177 //const style = WS_POPUP | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX | WS_VISIBLE; 178 const style = WS_OVERLAPPEDWINDOW | WS_VISIBLE; 179 auto h = CreateWindowExA(WS_EX_APPWINDOW /*WS_EX_LAYERED*/, CLASSNAME8.ptr, null, style, x, y, width, height, null, null, hInstance, null); 180 181 return new SkinnedWindow(h); 182 } 183 184 HCURSOR cursor(HCURSOR c){return SetCursor(c);} 185 186 bool minimize(){return ShowWindow(mHandle,SW_MINIMIZE)!=FALSE;} 187 188 bool maximize(){return ShowWindow(mHandle,SW_MAXIMIZE)!=FALSE;} 189 190 bool restore(){return ShowWindow(mHandle,SW_RESTORE)!=FALSE;} 191 192 bool visible(bool bShow=true){return ShowWindow(mHandle,bShow?SW_SHOW:SW_HIDE)!=FALSE;} 193 194 bool hide(){return visible(false);} 195 196 bool show(){return visible(true);} 197 198 bool visible(){return IsWindowVisible(mHandle)!=FALSE;} 199 200 bool update(){return UpdateWindow(mHandle)!=FALSE;} 201 202 bool size(int x,int y){return SetWindowPos(mHandle,null,0,0,x,y,SWP_NOMOVE)!=FALSE;} 203 204 bool position(int x,int y){return SetWindowPos(mHandle,null,x,y,0,0,SWP_NOSIZE)!=FALSE;} 205 206 void init(HLayoutBase layout) 207 { 208 if(layout is null) return; 209 else mLayout=layout; 210 auto r=layout.rootElement; 211 if(r is null) return; 212 213 mBody = r.getTag("body")[0]; 214 mCaption = r.getId("skin_caption"); 215 if((mButton_min = r.getId("skin_minimize")) !is null) mButton_min.handleEvent(delegate(HBehaviorEvent p) 216 { 217 if(p.cmd!=BUTTON_CLICK) return false; 218 return (cast(SkinnedWindow)p.param).minimize; 219 },this); 220 if((mButton_max = r.getId("skin_maximize")) !is null) mButton_max.handleEvent(delegate(HBehaviorEvent p) 221 { 222 if(p.cmd!=BUTTON_CLICK) return false; 223 with(cast(SkinnedWindow)p.param) 224 { 225 if(maximized) return restore; 226 else return maximize; 227 } 228 },this); 229 if((mButton_close = r.getId("skin_close")) !is null) mButton_close.handleEvent(delegate(HBehaviorEvent p) 230 { 231 if(p.cmd!=BUTTON_CLICK) return false; 232 PostMessageA((cast(SkinnedWindow)p.param).mHandle,WM_CLOSE,0,0); 233 return true; 234 },this); 235 mButton_icon = r.getId("skin_icon"); 236 mCorner = r.getId("skin_corner"); 237 238 auto h=r.getTag("head"); 239 if(h.length) 240 { 241 h=h[0].getTag("title"); 242 if(h.length) caption=h[0].innerText; 243 } 244 } 245 246 void caption(char[] text) 247 { 248 SetWindowTextA(mHandle,toStringz(text)); 249 if(mCaption) 250 { 251 mCaption.innerText=text; 252 mCaption.update; 253 } 254 } 255 256 bool minimized() 257 { 258 WINDOWPLACEMENT wp; 259 GetWindowPlacement(mHandle,&wp); 260 return wp.showCmd == SW_SHOWMINIMIZED; 261 } 262 263 bool maximized() 264 { 265 WINDOWPLACEMENT wp; 266 GetWindowPlacement(mHandle,&wp); 267 return wp.showCmd == SW_SHOWMAXIMIZED; 268 } 269 270 LRESULT delegate(uint,WPARAM,LPARAM,out bool) msgHandler; 271 272 protected: 273 274 this(HWND h) 275 { 276 if(h is null) throw new Exception("Invalid handle passed to SkinnedWindow.this!"); 277 mWindows[h]=this; 278 } 279 280 int mHitTest(int x, int y) 281 { 282 auto pt = POINT(x,y); 283 MapWindowPoints(cast(HWND)HWND_DESKTOP,mHandle,&pt,1u); 284 285 if(mButton_icon && mButton_icon.isInside(pt)) return HTSYSMENU; 286 287 if(mCaption && mCaption.isInside(pt)) return HTCAPTION; 288 289 if(mCorner && mCorner.isInside(pt)) return HTBOTTOMRIGHT; 290 291 if(mBody) 292 { 293 auto body_rc = mBody.location(ROOT_RELATIVE | CONTENT_BOX); 69 294 70 dom::element body; 71 dom::element caption; 72 dom::element button_min; 73 dom::element button_max; 74 dom::element button_icon; 75 dom::element button_close; 76 dom::element corner; 295 if(PtInRect(body_rc, pt)) return HTCLIENT; 77 296 78 static window* create( int x, int y, int width, int height, const wchar_t* caption = 0 ); 79 static window* self(HWND hWnd) { return (window*)::GetWindowLongPtr(hWnd,GWLP_USERDATA); } 297 if( pt.y < body_rc.top + 10 ) 298 { 299 if( pt.x < body_rc.left + 10 ) return HTTOPLEFT; 300 if( pt.x > body_rc.right - 10 ) return HTTOPRIGHT; 301 } 80 302 81 void set_caption( const wchar_t* text ); 303 else if( pt.y > body_rc.bottom - 10 ) 304 { 305 if( pt.x < body_rc.left + 10 ) return HTBOTTOMLEFT; 306 if( pt.x > body_rc.right - 10 ) return HTBOTTOMRIGHT; 307 } 82 308 83 static ATOM register_class(HINSTANCE hInstance); 84 85 protected: 86 window(): event_handler(HANDLE_BEHAVIOR_EVENT) {} 87 88 int hit_test( int x, int y ); 89 HELEMENT root(); 90 bool is_minimized() const; 91 bool is_maximized() const; 92 93 virtual BOOL on_event (HELEMENT he, HELEMENT target, BEHAVIOR_EVENTS type, UINT_PTR reason ); 94 95 static void self(HWND hWnd, window* inst) { ::SetWindowLongPtr(hWnd,GWLP_USERDATA, LONG_PTR(inst)); } 96 static LRESULT CALLBACK win_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 97 98 static HINSTANCE hinstance; 99 100 101 } 102 103 104 HINSTANCE window::hinstance = 0; 105 106 const wchar_t CLASSNAME[] = L"htmlayout::window"; 107 108 // register window class 109 110 ATOM window::register_class(HINSTANCE hInstance) 111 { 112 hinstance = hInstance; 113 114 WNDCLASSEXW wcex; 115 116 wcex.cbSize = sizeof(WNDCLASSEX); 117 118 wcex.style = CS_HREDRAW | CS_VREDRAW; 119 wcex.lpfnWndProc = (WNDPROC)win_proc; 120 wcex.cbClsExtra = 0; 121 wcex.cbWndExtra = 0; 122 wcex.hInstance = hInstance; 123 wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_SKIN); 124 wcex.hCursor = LoadCursor(NULL, IDC_ARROW); 125 wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); 126 wcex.lpszMenuName = 0; 127 wcex.lpszClassName = CLASSNAME; 128 wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SKINSMALL); 129 130 return RegisterClassExW(&wcex); 131 } 132 133 #ifndef WS_EX_LAYERED 134 #define WS_EX_LAYERED 0x00080000 135 #endif 136 137 // create window instance 138 139 window* window::create( int x, int y, int width, int height, const wchar_t* caption ) 140 { 141 window* pw = new window(); 142 143 UINT style = WS_POPUP | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX; 144 pw->hwnd = CreateWindowExW( WS_EX_LAYERED, CLASSNAME, NULL, style , 145 x, y, width, height, NULL, NULL, hinstance, NULL); 146 // pw->hwnd = CreateWindowExW( 0, CLASSNAME, NULL, style , 147 // x, y, width, height, NULL, NULL, hinstance, NULL); 148 self(pw->hwnd,pw); 149 HTMLayoutSetCallback(pw->hwnd,&callback,pw); 150 PBYTE pb; DWORD cb; 151 if(load_resource_data(L"DEFAULT",pb,cb)) 152 { 153 HTMLayoutLoadHtml(pw->hwnd,pb,cb); 154 155 dom::element r = pw->root(); 156 157 pw->body = r.find_first("body"); 158 pw->caption = r.get_element_by_id("caption"); 159 pw->button_min = r.get_element_by_id("minimize"); 160 pw->button_max = r.get_element_by_id("maximize"); 161 pw->button_icon = r.get_element_by_id("icon"); 162 pw->button_close = r.get_element_by_id("close"); 163 pw->corner = r.get_element_by_id("corner"); 164 165 attach_event_handler(pw->hwnd, pw); 166 167 pw->set_caption(caption); 168 169 } 170 return pw; 171 } 172 173 void window::set_caption( const wchar_t* text ) 174 { 175 if(text) 176 { 177 ::SetWindowTextW(hwnd,text); 178 if( caption.is_valid() ) 179 { 180 caption.set_text(text); 181 caption.update(true); 182 } 183 } 184 } 185 186 187 HELEMENT window::root() 188 { 189 return dom::element::root_element(hwnd); 190 } 191 192 int window::hit_test( int x, int y ) 193 { 194 195 POINT pt; pt.x = x; pt.y = y; 196 ::MapWindowPoints(HWND_DESKTOP,hwnd,&pt,1); 197 198 if( caption.is_valid() && caption.is_inside(pt) ) 199 return HTCAPTION; 200 201 if( button_icon.is_valid() && button_icon.is_inside(pt) ) 202 return HTSYSMENU; 203 204 if( corner.is_valid() && corner.is_inside(pt) ) 205 return HTBOTTOMRIGHT; 206 207 RECT body_rc = body.get_location(ROOT_RELATIVE | CONTENT_BOX); 208 209 if( PtInRect(&body_rc, pt) ) 210 return HTCLIENT; 211 212 if( pt.y < body_rc.top + 10 ) 213 { 214 if( pt.x < body_rc.left + 10 ) 215 return HTTOPLEFT; 216 if( pt.x > body_rc.right - 10 ) 217 return HTTOPRIGHT; 218 } 219 else if( pt.y > body_rc.bottom - 10 ) 220 { 221 if( pt.x < body_rc.left + 10 ) 222 return HTBOTTOMLEFT; 223 if( pt.x > body_rc.right - 10 ) 224 return HTBOTTOMRIGHT; 225 } 226 227 if( pt.y < body_rc.top ) 228 return HTTOP; 229 if( pt.y > body_rc.bottom ) 230 return HTBOTTOM; 231 if( pt.x < body_rc.left ) 232 return HTLEFT; 233 if( pt.x > body_rc.right ) 234 return HTRIGHT; 235 236 237 return HTCLIENT; 238 239 } 240 241 BOOL window::on_event (HELEMENT he, HELEMENT target, BEHAVIOR_EVENTS type, UINT_PTR reason ) 242 { 243 if( type != BUTTON_CLICK) 244 return FALSE; // handling only button clicks here. 245 246 if( target == button_min) 247 { 248 ::ShowWindow(hwnd,SW_MINIMIZE); 249 return TRUE; 250 } 251 if( target == button_max) 252 { 253 if( is_maximized()) 254 ::ShowWindow(hwnd,SW_RESTORE); 255 else 256 ::ShowWindow(hwnd,SW_MAXIMIZE); 257 258 return TRUE; 259 } 260 if( target == button_close) 261 { 262 ::PostMessage(hwnd, WM_CLOSE, 0,0); 263 return TRUE; 264 } 265 266 // click on some other button 267 dom::element button = target; 268 ::MessageBoxW(button.get_element_hwnd(true),button.get_attribute("id"), L"Click on the button with id:", MB_OK); 269 270 return FALSE; 271 } 272 273 bool window::is_minimized() const 274 { 275 WINDOWPLACEMENT wp; 276 GetWindowPlacement(hwnd,&wp); 277 return wp.showCmd == SW_SHOWMINIMIZED; 278 } 279 280 bool window::is_maximized() const 281 { 282 WINDOWPLACEMENT wp; 283 GetWindowPlacement(hwnd,&wp); 284 return wp.showCmd == SW_SHOWMAXIMIZED; 285 } 286 287 LRESULT CALLBACK window::win_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 288 { 289 LRESULT lResult; 290 BOOL bHandled; 291 292 // HTMLayout + 293 // HTMLayout could be created as separate window 294 // using CreateWindow API. 295 // But in this case we are attaching HTMLayout functionality 296 // to the existing window delegating windows message handling to 297 // HTMLayoutProcND function. 298 lResult = HTMLayoutProcND(hwnd,message,wParam,lParam, &bHandled); 299 if(bHandled) 300 return lResult; 301 // HTMLayout - 302 303 window* me = self(hwnd); 304 305 switch (message) 306 { 307 308 case WM_NCHITTEST: 309 if(me) 310 return me->hit_test( GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) ); 311 break; 312 313 case WM_NCACTIVATE: 314 // change active state here 315 break; 316 317 case WM_NCCALCSIZE: return 0; // we have no non-client areas. 318 case WM_NCPAINT: return 0; // we have no non-client areas. 319 320 case WM_GETMINMAXINFO: 321 { 322 LRESULT lr = DefWindowProc(hwnd, message, wParam, lParam); 323 MINMAXINFO* pmmi = (MINMAXINFO*)lParam; 324 pmmi->ptMinTrackSize.x = ::HTMLayoutGetMinWidth(hwnd); 325 RECT rc; GetWindowRect(hwnd,&rc); 326 pmmi->ptMinTrackSize.y = ::HTMLayoutGetMinHeight(hwnd, rc.right - rc.left); 327 return lr; 328 } 329 330 331 332 case WM_CLOSE: 333 ::DestroyWindow(hwnd); 334 return 0; 335 336 case WM_DESTROY: 337 delete me; // delete window instance! 338 self(hwnd,0); 339 PostQuitMessage(0); 340 return 0; 341 342 } 343 return DefWindowProc(hwnd, message, wParam, lParam); 344 } 345 346 } 347 348 +/ 309 if( pt.y < body_rc.top ) return HTTOP; 310 if( pt.y > body_rc.bottom ) return HTBOTTOM; 311 if( pt.x < body_rc.left ) return HTLEFT; 312 if( pt.x > body_rc.right ) return HTRIGHT; 313 } 314 315 return HTCLIENT; 316 } 317 318 static SkinnedWindow[HWND] mWindows; 319 320 extern(Windows) static LRESULT wndProc(HWND mHandle, UINT message, WPARAM wParam, LPARAM lParam) 321 { 322 auto me = mHandle in mWindows; 323 if(me && me.msgHandler) 324 { 325 bool bHandled; 326 auto ret=me.msgHandler(message,wParam,lParam,bHandled); 327 if(bHandled) return ret; 328 } 329 /*if(me) 330 { 331 BOOL bHandled; 332 auto ret=HTMLayoutProcND(mHandle,message,wParam,lParam, &bHandled); 333 if(bHandled) return ret; 334 }*/ 335 336 switch (message) 337 { 338 case WM_NCHITTEST: 339 if(me) return me.mHitTest(GET_X_LPARAM(lParam),GET_Y_LPARAM(lParam)); 340 break; 341 342 case WM_NCACTIVATE: 343 if(me && me.mBody) 344 { 345 if(wParam) {if(me.mBody.delClass("skin_inactive")) me.mBody.update;} 346 else {if(me.mBody.addClass("skin_inactive")) me.mBody.update;} 347 } 348 break; 349 350 case WM_NCCALCSIZE: return 0; // we have no non-client areas. 351 case WM_NCPAINT: return 0; // we have no non-client areas. 352 353 case WM_GETMINMAXINFO: 354 { 355 if(me && me.mLayout) 356 { 357 auto m1=cast(HLayout)me.mLayout; 358 auto m2=m1?null:cast(HLite)me.mLayout; 359 360 LRESULT lr = DefWindowProcA(mHandle, message, wParam, lParam); 361 MINMAXINFO* pmmi = cast(MINMAXINFO*)lParam; 362 pmmi.ptMinTrackSize.x = m1?m1.minWidth:m2.minWidth; 363 RECT rc; 364 GetWindowRect(mHandle,&rc); 365 pmmi.ptMinTrackSize.y = m1?m1.minHeight(rc.right - rc.left):m2.minHeight; 366 return lr; 367 } 368 else return 0; 369 } 370 371 case WM_CLOSE: 372 DestroyWindow(mHandle); 373 return 0; 374 375 case WM_DESTROY: 376 mWindows.remove(mHandle); 377 if(me) delete *me; // delete window instance! 378 PostQuitMessage(0); 379 return 0; 380 381 default: 382 break; 383 } 384 385 return DefWindowProcA(mHandle, message, wParam, lParam); 386 } 387 388 HWND mHandle; 389 HLayoutBase mLayout; 390 HElement mBody,mCaption,mButton_min,mButton_max,mButton_icon,mButton_close,mCorner; 391 } trunk/import/flowerd/syncexec.d
r17 r18 11 11 public import tango.core.sync.Mutex; 12 12 13 extern(Windows) BOOL PostMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); 13 extern(Windows) 14 { 15 alias VOID function(HWND, UINT, UINT, DWORD) TIMERPROC; 16 UINT SetTimer(HWND hWnd, UINT nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc); 17 BOOL KillTimer(HWND hWnd, UINT uIDEvent); 18 BOOL PostMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); 19 } 14 20 15 21 /*class GuiQueue … … 21 27 }*/ 22 28 29 //the interval delegate should return false to stop the interval and true to continue 30 template TimerExec(THIS_TYPE) 31 { 32 uint setInterval(uint time,bool delegate(uint,Object) dg,Object param=null) {return mSetTimer(time,new TIMEREXEC_BOOL1(dg,param));} 33 uint setInterval(uint time,bool delegate(uint) dg) {return mSetTimer(time,new TIMEREXEC_BOOL2(dg));} 34 uint setInterval(uint time,bool delegate(Object) dg,Object param=null) {return mSetTimer(time,new TIMEREXEC_BOOL1A(dg,param));} 35 uint setInterval(uint time,bool delegate() dg) {return mSetTimer(time,new TIMEREXEC_BOOL2A(dg));} 36 uint setInterval(uint time,void delegate(uint,Object) dg,Object param=null) {return mSetTimer(time,new TIMEREXEC_VOID1(dg,param,true));} 37 uint setInterval(uint time,void delegate(uint) dg) {return mSetTimer(time,new TIMEREXEC_VOID2(dg,true));} 38 uint setInterval(uint time,void delegate(Object) dg,Object param=null) {return mSetTimer(time,new TIMEREXEC_VOID1A(dg,param,true));} 39 uint setInterval(uint time,void delegate() dg) {return mSetTimer(time,new TIMEREXEC_VOID2A(dg,true));} 40 uint setTimeout(uint time,void delegate(uint,Object) dg,Object param=null) {return mSetTimer(time,new TIMEREXEC_VOID1(dg,param,false));} 41 uint setTimeout(uint time,void delegate(uint) dg) {return mSetTimer(time,new TIMEREXEC_VOID2(dg,false));} 42 uint setTimeout(uint time,void delegate(Object) dg,Object param=null) {return mSetTimer(time,new TIMEREXEC_VOID1A(dg,param,false));} 43 uint setTimeout(uint time,void delegate() dg) {return mSetTimer(time,new TIMEREXEC_VOID2A(dg,false));} 44 45 bool clearTimer(uint id) 46 { 47 if(KillTimer(null,id)!=0) 48 { 49 auto t=id in mTimers; 50 if(t) delete *t; 51 return true; 52 } 53 else return false; 54 } 55 56 protected: 57 58 uint mSetTimer(uint time,TIMEREXEC t) 59 { 60 if(time==0) return 0; 61 t.id=cast(uint)SetTimer(null,0,time,&mTimerProc); 62 if(t.id==0) {delete t;return 0;} 63 mTimers[t.id]=t; 64 return t.id; 65 } 66 67 static extern(Windows) void mTimerProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) 68 { 69 auto t=idEvent in mTimers; 70 if(t && t.exec()==false) t.outer.clearTimer(idEvent); 71 } 72 73 class TIMEREXEC 74 { 75 this(Object o=null) {param=o;} 76 ~this(){mTimers.remove(id);} 77 bool exec(){return false;} 78 79 uint id; 80 Object param; 81 } 82 83 class TIMEREXEC_BOOL1 : THIS_TYPE.TIMEREXEC 84 { 85 this(bool delegate(uint,Object) dg,Object o) {this.dg=dg; super(o);} 86 bool exec(){return dg(id,param);} 87 88 bool delegate(uint,Object) dg; 89 } 90 91 class TIMEREXEC_BOOL2 : THIS_TYPE.TIMEREXEC 92 { 93 this(bool delegate(uint) dg) {this.dg=dg;} 94 bool exec(){return dg(id);} 95 96 bool delegate(uint) dg; 97 } 98 99 class TIMEREXEC_BOOL1A : THIS_TYPE.TIMEREXEC 100 { 101 this(bool delegate(Object) dg,Object o) {this.dg=dg; super(o);} 102 bool exec(){return dg(param);} 103 104 bool delegate(Object) dg; 105 } 106 107 class TIMEREXEC_BOOL2A : THIS_TYPE.TIMEREXEC 108 { 109 this(bool delegate() dg) {this.dg=dg;} 110 bool exec(){return dg();} 111 112 bool delegate() dg; 113 } 114 115 class TIMEREXEC_VOID1 : THIS_TYPE.TIMEREXEC 116 { 117 this(void delegate(uint,Object) dg,Object o,bool ret) {this.dg=dg; this.ret=ret; super(o);} 118 bool exec(){dg(id,param);return ret;} 119 120 bool ret; 121 void delegate(uint,Object) dg; 122 } 123 124 class TIMEREXEC_VOID2 : THIS_TYPE.TIMEREXEC 125 { 126 this(void delegate(uint) dg,bool ret) {this.dg=dg; this.ret=ret;} 127 bool exec(){dg(id);return ret;} 128 129 bool ret; 130 void delegate(uint) dg; 131 } 132 133 class TIMEREXEC_VOID1A : THIS_TYPE.TIMEREXEC 134 { 135 this(void delegate(Object) dg,Object o,bool ret) {this.dg=dg; this.ret=ret; super(o);} 136 bool exec(){dg(param);return ret;} 137 138 bool ret; 139 void delegate(Object) dg; 140 } 141 142 class TIMEREXEC_VOID2A : THIS_TYPE.TIMEREXEC 143 { 144 this(void delegate() dg,bool ret) {this.dg=dg; this.ret=ret;} 145 bool exec(){dg();return ret;} 146 147 bool ret; 148 void delegate() dg; 149 } 150 151 static TIMEREXEC[uint] mTimers; 152 } 153 23 154 // this one needs to be created as singleton - one instance per GUI thread(s) 24 template SyncExec( )155 template SyncExec(THIS_TYPE) 25 156 { 26 157 void syncCtor() … … 31 162 mGuiThreads[mThread]=true; 32 163 mGuard=new Mutex; 164 //mGuard2=new Mutex; 33 165 } 34 166 … … 37 169 mGuiThreads.remove(mThread); 38 170 delete mGuard; 39 } 40 41 void asyncExec(void delegate(Object) exec,Object param=null) 42 { 43 auto job=new SyncJob; 44 job.param=param; 45 job.exec=exec; 171 //delete mGuard2; 172 } 173 174 void asyncExec(void delegate(Object) dg,Object param=null) 175 { 176 auto job=new SYNCEXEC_1(dg,param); 177 mAsyncExec(job); 178 } 179 180 void asyncExec(void delegate() dg) 181 { 182 auto job=new SYNCEXEC_2(dg); 183 mAsyncExec(job); 184 } 185 186 /* these hang sometimes 187 void syncExec(void delegate() dg) 188 { 189 auto th=Thread.getThis; 190 if(th is mThread) dg(); 191 else 192 { 193 synchronized(mGuard2) 194 { 195 if(bSyncExecDone==false || bASyncExecDone==false) throw new Exception("Calling syncExec from syncExec is not possible!"); 196 bSyncExecDone=false; 197 } 198 asyncExec(dg); 199 while(bSyncExecDone==false) th.yield; 200 } 201 } 202 203 void syncExec(void delegate(Object) dg,Object param=null) 204 { 205 auto th=Thread.getThis; 206 if(th is mThread) dg(param); 207 else 208 { 209 synchronized(mGuard2) 210 { 211 if(bSyncExecDone==false || bASyncExecDone==false) throw new Exception("Calling syncExec from syncExec is not possible!"); 212 bSyncExecDone=false; 213 } 214 asyncExec(dg,param); 215 while(bSyncExecDone==false) th.yield; 216 } 217 } 218 */ 219 220 // Place this call after GetMessage()/PeekMessage() in main loop 221 void execute() 222 { 223 if(Thread.getThis !is mThread) throw new Exception("Calling SyncExec.execute from a wrong thread!"); 224 synchronized(mGuard) 225 { 226 //bASyncExecDone=false; 227 SYNCEXEC next; 228 while((next = pop()) !is null) 229 { 230 next.exec(); // do it 231 delete next; 232 } 233 //bSyncExecDone=true; 234 //bASyncExecDone=true; 235 } 236 } 237 238 protected: 239 void mAsyncExec(SYNCEXEC job) 240 { 46 241 synchronized(mGuard) 47 242 { … … 53 248 } 54 249 55 void syncExec(void delegate() exec){syncExec(delegate(Object o){exec();});} 56 57 void syncExec(void delegate(Object) exec,Object param=null) 58 { 59 auto th=Thread.getThis; 60 if(th is mThread) exec(param); 61 else 62 { 63 bSyncExecDone=false; 64 asyncExec(exec,param); 65 while(bSyncExecDone==false) th.yield; 66 } 67 } 68 69 // Place this call after GetMessage()/PeekMessage() in main loop 70 void execute() 71 { 72 if(Thread.getThis !is mThread) throw new Exception("Calling SyncExec.execute from a wrong thread!"); 73 synchronized(mGuard) 74 { 75 SyncJob* next; 76 while((next = pop()) !is null) 77 { 78 next.exec(next.param); // do it 79 delete next; 80 } 81 bSyncExecDone=true; 82 } 83 } 84 85 protected: 86 SyncJob* pop() 250 SYNCEXEC pop() 87 251 { 88 252 //synchronized(guard) 89 253 { 90 254 if(mHead is null) return null; 91 S yncJob*t = mHead;255 SYNCEXEC t = mHead; 92 256 mHead = mHead.next; 93 257 if(mHead is null) mTail = null; … … 96 260 } 97 261 98 struct SyncJob 99 { 262 class SYNCEXEC 263 { 264 this(Object o=null) {param=o;} 265 void exec(){} 266 267 SYNCEXEC next; 100 268 Object param; 101 void delegate(Object) exec; 102 SyncJob* next; 103 } 104 105 SyncJob* mHead; 106 SyncJob* mTail; 269 } 270 271 class SYNCEXEC_1 : THIS_TYPE.SYNCEXEC 272 { 273 this(void delegate(Object) dg,Object o) {this.dg=dg; super(o);} 274 void exec(){dg(param);} 275 276 void delegate(Object) dg; 277 } 278 279 class SYNCEXEC_2 : THIS_TYPE.SYNCEXEC 280 { 281 this(void delegate() dg) {this.dg=dg;} 282 void exec(){dg();} 283 284 void delegate() dg; 285 } 286 287 SYNCEXEC mHead; 288 SYNCEXEC mTail; 107 289 Mutex mGuard; 290 //Mutex mGuard2; 108 291 Thread mThread; 109 292 static bool[Thread] mGuiThreads; 110 bool bSyncExecDone;293 //bool bSyncExecDone=true,bASyncExecDone=true; 111 294 } trunk/import/htmlayout/behaviors/translatable.d
r17 r18 21 21 } 22 22 23 void reset() 24 { 25 if(elements) 26 { 27 elements.each(delegate(ref Translatable t){t.element.release;}); 28 elements.empty; 29 delete elements; 30 elements=null; 31 } 32 if(strings) 33 { 34 delete strings; 35 strings=null; 36 } 37 elements=new GrowStack!(Translatable); 38 } 39 23 40 bool onInit(HInit p) 24 41 { … … 35 52 { 36 53 elements.remove(delegate(Translatable t){ 37 return t.element==p.element; 54 if(t.element==p.element) 55 { 56 t.element.release; 57 return true; 58 } 59 else return false; 38 60 }); 39 61 return true; … … 61 83 } 62 84 63 char[] opCall(char[] id )85 char[] opCall(char[] id,char[][] params=null) 64 86 { 65 return strings.getv(tango.text.Util.replace(id,'.','/') );87 return strings.getv(tango.text.Util.replace(id,'.','/'),null,params); 66 88 } 67 89 trunk/import/htmlayout/capi.d
r17 r18 437 437 { 438 438 ExpandoRelease finalizer; // can be either NULL or valid pointer to function 439 }; 440 439 } 441 440 442 441 alias HLDOM_RESULT function( HELEMENT he, HTMLayoutElementExpando* pExpando ) HTMLayoutElementSetExpando_t; … … 913 912 { 914 913 METHOD_PARAMS methodparams; 915 LPCSTR method_name;916 UINT argc;914 LPCSTR method_name; 915 UINT argc; 917 916 JSON_VALUE *argv; 918 917 JSON_VALUE retval; … … 1127 1126 struct DATA_ARRIVED_PARAMS 1128 1127 { 1129 HELEMENT initiator; // element intiator of HTMLayoutRequestElementData request, 1130 LPCBYTE data; // data buffer 1131 UINT dataSize; // size of data 1132 UINT dataType; // data type passed "as is" from HTMLayoutRequestElementData 1128 HELEMENT initiator; // element intiator of HTMLayoutRequestElementData request, 1129 LPCBYTE data; // data buffer 1130 UINT dataSize; // size of data 1131 UINT dataType; // data type passed "as is" from HTMLayoutRequestElementData 1132 UINT status; // status = 0 (dataSize == 0) - unknown error. 1133 // status = 100..505 - http response status, Note: 200 - OK! 1134 // status > 12000 - wininet error code, see ERROR_INTERNET_*** in wininet.h 1135 LPCWSTR uri; // requested url 1133 1136 }; 1134 1137 … … 1183 1186 ////////////////////////////////////////////////////////////////////////////// json 1184 1187 1188 class HJson 1189 { 1190 ~this(){mValue.release;} 1191 1192 JSON_VALUE* handle(){return mValue;} 1193 JSON_VALUE* opCast(){return mValue;} 1194 1195 extern(D) char[] toString(){return mValue.toString;} //todo: remove this extern(D) 1196 //JSON_VALUE[] toArray(){return mValue.toArray;} 1197 HJson[] toArray() 1198 { 1199 auto a=mValue.toArray; 1200 HJson[] ret; 1201 ret.length=a.length; 1202 foreach(i,v;a) ret[i]=HJson(&a[i]); 1203 return ret; 1204 } 1205 double toFloat(){return mValue.toFloat;} 1206 long toInt(){return mValue.toInt;} 1207 bool toBool(){return mValue.toBool;} 1208 char[] typename(){return mValue.typename;} 1209 int type(){return mValue.v_type;} 1210 1211 static HJson parse(char[] text,uint mode=0){return HJson(JSON_VALUE.parse(text,mode));} 1212 static HJson opCall(){return HJson(JSON_VALUE());} 1213 static HJson opCall(ubyte[] v){return HJson(JSON_VALUE(v));} 1214 static HJson opCall(char[] v){return HJson(JSON_VALUE(v));} 1215 //static HJson opCall(JSON_VALUE[] v){return HJson(JSON_VALUE(v));} 1216 static HJson opCall(HJson[] v) 1217 { 1218 JSON_VALUE[] vals; 1219 vals.length=v.length; 1220 foreach(i,vv;v) vals[i]=*vv.handle; 1221 return HJson(JSON_VALUE(vals)); 1222 } 1223 static HJson opCall(bool v){return HJson(JSON_VALUE(v));} 1224 static HJson opCall(double v){return HJson(JSON_VALUE(v));} 1225 static HJson opCall(__int64 v){return HJson(JSON_VALUE(v));} 1226 static HJson fromAA(K,V)(V[K] v){return HJson(JSON_VALUE.fromAA(v));} 1227 static HJson opCall(JSON_VALUE* value){if(value is null) return null; else return new HJson(value);} 1228 1229 protected: 1230 this(JSON_VALUE* value){if(value is null) throw new Exception("Invalid JSON_VALUE!"); mValue=value;} 1231 1232 JSON_VALUE* mValue; 1233 } 1234 1185 1235 enum VALUETYPE 1186 1236 { 1187 1237 V_UNDEFINED = 0, ///< empty 1188 V_BOOL = 1, ///< bool 1189 V_INT = 2, ///< int 1190 V_REAL = 3, ///< double 1191 V_STRING = 4, ///< string of wchar_t 1192 V_ARRAY = 5, ///< array of value elements 1193 V_MAP = 6 ///< map of name/value pairs - simple map 1238 V_BOOL = 1, ///< bool 1239 V_INT = 2, ///< int 1240 V_REAL = 3, ///< double 1241 V_STRING = 4, ///< string of wchar_t 1242 V_ARRAY = 5, ///< array of value elements 1243 V_MAP = 6, ///< map of name/value pairs - simple map 1244 V_BYTES = 7 ///< vector of bytes, a.k.a. blob 1194 1245 }; 1195 1246 … … 1201 1252 alias VALUETYPE.V_ARRAY V_ARRAY; 1202 1253 alias VALUETYPE.V_MAP V_MAP; 1254 alias VALUETYPE.V_BYTES V_BYTES; 1203 1255 1204 1256 private extern(C) alias void function(void*) wiper_t; … … 1207 1259 { 1208 1260 int refcount; 1209 size_t length;1210 wiper_t wipe;1261 size_t length; 1262 wiper_t wipe; 1211 1263 } 1212 1264 … … 1214 1266 { 1215 1267 int refcount; 1216 size_t length;1217 wiper_t wipe;1268 size_t length; 1269 wiper_t wipe; 1218 1270 } 1219 1271 … … 1221 1273 { 1222 1274 JSON_VALUE key; 1223 JSON_VALUE val; 1224 HJsonMap* next; 1225 wiper_t wipe; 1226 int refcount; 1227 } 1228 1229 alias JSON_VALUE HJson; 1275 JSON_VALUE val; 1276 HJsonMap* next; 1277 wiper_t wipe; 1278 int refcount; 1279 } 1280 1281 align(4) struct HJsonBytes 1282 { 1283 int refcount; 1284 ubyte* data; 1285 size_t length; // number of elements used in the buffer 1286 wiper_t wipe; 1287 } 1230 1288 1231 1289 align(4) struct JSON_VALUE 1232 1290 { 1233 VALUETYPE v_type;1291 VALUETYPE v_type; 1234 1292 union data_slot 1235 1293 { 1236 int i_val; 1237 double r_val; 1238 __int64 l_val; 1239 HJsonString* s_val; 1240 HJsonArray* a_val; // array data 1241 HJsonMap* m_val; // simple map of name/value pairs. 1294 int i_val; 1295 double r_val; 1296 __int64 l_val; 1297 HJsonString* s_val; 1298 HJsonArray* a_val; // array data 1299 HJsonMap* m_val; // simple map of name/value pairs. 1300 HJsonBytes* b_val; // bytes data 1242 1301 } 1243 1302 data_slot data; … … 1245 1304 char[] toString() 1246 1305 { 1247 if(v_type==V_STRING) return .toString((cast(wchar_t*)(data.s_val+1))[0..data.s_val.length]); 1306 if(v_type==V_STRING) 1307 { 1308 auto str=cast(wchar_t*)(data.s_val+1); 1309 //todo: is this right??? 1310 if(data.s_val.length && str[data.s_val.length-1]==0) return .toString(str[0..data.s_val.length-1]); 1311 return .toString(str[0..data.s_val.length]); 1312 } 1313 else if(v_type==V_BYTES) return (cast(char*)(data.b_val+1))[0..data.b_val.length]; 1248 1314 else if(v_type==V_UNDEFINED) 1249 1315 { … … 1254 1320 else if(v_type==V_BOOL) return data.i_val?"true":"false"; 1255 1321 else if(v_type==V_REAL) return Float.toString(data.r_val); 1256 else throw new Exception("Don't know how to convert "~typename~" to string");1322 else throw new Exception("Don't know how to convert "~typename~" to string"); 1257 1323 } 1258 1324 … … 1260 1326 { 1261 1327 if(v_type==V_ARRAY) return ((cast(JSON_VALUE*)(data.a_val+1))[0..data.a_val.length]); 1262 else throw new Exception("Don't know how to convert "~typename~" to string");1328 else throw new Exception("Don't know how to convert "~typename~" to string"); 1263 1329 } 1264 1330 … … 1269 1335 else if(v_type==V_INT || v_type==V_BOOL) return data.i_val; 1270 1336 else if(v_type==V_STRING) return Float.toFloat(toString); 1271 else return double.nan;//throw new Exception("Don't know how to convert "~typename~" to float");1337 else return double.nan;//throw new Exception("Don't know how to convert "~typename~" to float"); 1272 1338 } 1273 1339 … … 1278 1344 else if(v_type==V_REAL) return cast(long)data.r_val; 1279 1345 else if(v_type==V_STRING) return Int.toLong(toString); 1280 else throw new Exception("Don't know how to convert "~typename~" to integer");1346 else throw new Exception("Don't know how to convert "~typename~" to integer"); 1281 1347 } 1282 1348 … … 1290 1356 else if(v_type==V_INT || v_type==V_BOOL) return cast(bool)data.i_val; 1291 1357 else if(v_type==V_REAL) return cast(bool)data.r_val; 1292 else if(v_type==V_STRING) return cast(bool)toString.length; 1293 else throw new Exception("Don't know how to convert "~typename~"to boolean"); 1358 else if(v_type==V_STRING) return data.s_val.length>0; 1359 else if(v_type==V_BYTES) return data.b_val.length>0; 1360 else throw new Exception("Don't know how to convert "~typename~" to boolean"); 1294 1361 } 1295 1362 … … 1307 1374 else if(v_type==V_ARRAY) return "array"; 1308 1375 else if(v_type==V_MAP) return "map"; 1376 else if(v_type==V_BYTES) return "bytes"; 1309 1377 else return null; 1310 1378 } … … 1327 1395 value.v_type=V_UNDEFINED; 1328 1396 value.data.l_val=0; 1397 return value; 1398 } 1399 1400 static JSON_VALUE* opCall(ubyte[] v) 1401 { 1402 auto value=new JSON_VALUE; 1403 HJsonBytes* r = cast(HJsonBytes*)malloc(HJsonBytes.sizeof + v.length); 1404 r.refcount = 1; 1405 r.length = v.length; 1406 r.wipe = &free; 1407 r.data = cast(ubyte*)(r+1); 1408 value.v_type=V_BYTES; 1409 value.data.b_val=r; 1329 1410 return value; 1330 1411 } … … 1406 1487 { 1407 1488 if(--data.s_val.refcount == 0) data.s_val.wipe(data.s_val); 1489 } 1490 else if(v_type==V_BYTES) 1491 { 1492 if(--data.b_val.refcount == 0) data.b_val.wipe(data.b_val); 1408 1493 } 1409 1494 else if(v_type==V_ARRAY) … … 1444 1529 union data 1445 1530 { 1446 int i_val; 1447 double r_val; 1448 __int64 l_val; 1449 void* s_val; 1450 void* a_val; // array data 1451 void* m_val; // simple map of name/value pairs. 1531 int i_val; 1532 double r_val; 1533 __int64 l_val; 1534 void* s_val; 1535 void* a_val; // array data 1536 void* m_val; // simple map of name/value pairs. 1537 void* b_val; // bytes_data. 1452 1538 } 1453 1539 }*/ … … 1725 1811 alias BOOL function( LPVOID p, HELEMENT he, int pos, int postype, WCHAR code ) HTMLayoutEnumerationCallback; 1726 1812 1813 alias HLDOM_RESULT function (HELEMENT he, LPRECT p_location, UINT areas /*ELEMENT_AREAS*/) HTMLayoutGetElementLocation_t; 1814 HTMLayoutGetElementLocation_t HTMLayoutGetElementLocation; 1727 1815 alias HLDOM_RESULT function (HELEMENT he) HTMLayout_UseElement_t; 1728 1816 HTMLayout_UseElement_t HTMLayout_UseElement; … … 2220 2308 ////////////////////////////////////////////////////////////////////////////// import symbols 2221 2309 2222 import tango.sys.SharedLib; 2223 2224 void loadHTMLayout(char[] name=null) 2225 { 2226 static SharedLib dll; 2227 dll=SharedLib.load(name?name:"htmlayout.dll"); 2228 HTMLayout_UseElement=cast(HTMLayout_UseElement_t)dll.getSymbol("HTMLayout_UseElement\0"); 2229 HTMLayout_UnuseElement=cast(HTMLayout_UnuseElement_t)dll.getSymbol("HTMLayout_UnuseElement\0"); 2230 HTMLayoutGetRootElement=cast(HTMLayoutGetRootElement_t)dll.getSymbol("HTMLayoutGetRootElement\0"); 2231 HTMLayoutGetFocusElement=cast(HTMLayoutGetFocusElement_t)dll.getSymbol("HTMLayoutGetFocusElement\0"); 2232 HTMLayoutFindElement=cast(HTMLayoutFindElement_t)dll.getSymbol("HTMLayoutFindElement\0"); 2233 HTMLayoutGetChildrenCount=cast(HTMLayoutGetChildrenCount_t)dll.getSymbol("HTMLayoutGetChildrenCount\0"); 2234 HTMLayoutGetNthChild=cast(HTMLayoutGetNthChild_t)dll.getSymbol("HTMLayoutGetNthChild\0"); 2235 HTMLayoutGetParentElement=cast(HTMLayoutGetParentElement_t)dll.getSymbol("HTMLayoutGetParentElement\0"); 2236 HTMLayoutGetElementText=cast(HTMLayoutGetElementText_t)dll.getSymbol("HTMLayoutGetElementText\0"); 2237 HTMLayoutGetElementHtml=cast(HTMLayoutGetElementHtml_t)dll.getSymbol("HTMLayoutGetElementHtml\0"); 2238 HTMLayoutGetElementInnerText=cast(HTMLayoutGetElementInnerText_t)dll.getSymbol("HTMLayoutGetElementInnerText\0"); 2239 HTMLayoutSetElementInnerText=cast(HTMLayoutSetElementInnerText_t)dll.getSymbol("HTMLayoutSetElementInnerText\0"); 2240 HTMLayoutGetElementInnerText16=cast(HTMLayoutGetElementInnerText16_t)dll.getSymbol("HTMLayoutGetElementInnerText16\0"); 2241 HTMLayoutSetElementInnerText16=cast(HTMLayoutSetElementInnerText16_t)dll.getSymbol("HTMLayoutSetElementInnerText16\0"); 2242 HTMLayoutGetAttributeCount=cast(HTMLayoutGetAttributeCount_t)dll.getSymbol("HTMLayoutGetAttributeCount\0"); 2243 HTMLayoutGetNthAttribute=cast(HTMLayoutGetNthAttribute_t)dll.getSymbol("HTMLayoutGetNthAttribute\0"); 2244 HTMLayoutGetAttributeByName=cast(HTMLayoutGetAttributeByName_t)dll.getSymbol("HTMLayoutGetAttributeByName\0"); 2245 HTMLayoutSetAttributeByName=cast(HTMLayoutSetAttributeByName_t)dll.getSymbol("HTMLayoutSetAttributeByName\0"); 2246 HTMLayoutClearAttributes=cast(HTMLayoutClearAttributes_t)dll.getSymbol("HTMLayoutClearAttributes\0"); 2247 HTMLayoutGetElementIndex=cast(HTMLayoutGetElementIndex_t)dll.getSymbol("HTMLayoutGetElementIndex\0"); 2248 HTMLayoutGetElementType=cast(HTMLayoutGetElementType_t)dll.getSymbol("HTMLayoutGetElementType\0"); 2249 HTMLayoutGetStyleAttribute=cast(HTMLayoutGetStyleAttribute_t)dll.getSymbol("HTMLayoutGetStyleAttribute\0"); 2250 HTMLayoutSetStyleAttribute=cast(HTMLayoutSetStyleAttribute_t)dll.getSymbol("HTMLayoutSetStyleAttribute\0"); 2251 HTMLayoutUpdateElement=cast(HTMLayoutUpdateElement_t)dll.getSymbol("HTMLayoutUpdateElement\0"); 2252 HTMLayoutUpdateElementEx=cast(HTMLayoutUpdateElementEx_t)dll.getSymbol("HTMLayoutUpdateElementEx\0"); 2253 HTMLayoutSetCapture=cast(HTMLayoutSetCapture_t)dll.getSymbol("HTMLayoutSetCapture\0"); 2254 HTMLayoutGetElementHwnd=cast(HTMLayoutGetElementHwnd_t)dll.getSymbol("HTMLayoutGetElementHwnd\0"); 2255 HTMLayoutCombineURL=cast(HTMLayoutCombineURL_t)dll.getSymbol("HTMLayoutCombineURL\0"); 2256 HTMLayoutVisitElements=cast(HTMLayoutVisitElements_t)dll.getSymbol("HTMLayoutVisitElements\0"); 2257 HTMLayoutSelectElements=cast(HTMLayoutSelectElements_t)dll.getSymbol("HTMLayoutSelectElements\0"); 2258 HTMLayoutSelectParent=cast(HTMLayoutSelectParent_t)dll.getSymbol("HTMLayoutSelectParent\0"); 2259 HTMLayoutSetElementHtml=cast(HTMLayoutSetElementHtml_t)dll.getSymbol("HTMLayoutSetElementHtml\0"); 2260 HTMLayoutDeleteElement=cast(HTMLayoutDeleteElement_t)dll.getSymbol("HTMLayoutDeleteElement\0"); 2261 HTMLayoutGetElementUID=cast(HTMLayoutGetElementUID_t)dll.getSymbol("HTMLayoutGetElementUID\0"); 2262 HTMLayoutGetElementByUID=cast(HTMLayoutGetElementByUID_t)dll.getSymbol("HTMLayoutGetElementByUID\0"); 2263 HTMLayoutShowPopup=cast(HTMLayoutShowPopup_t)dll.getSymbol("HTMLayoutShowPopup\0"); 2264 HTMLayoutShowPopupAt=cast(HTMLayoutShowPopupAt_t)dll.getSymbol("HTMLayoutShowPopupAt\0"); 2265 HTMLayoutHidePopup=cast(HTMLayoutHidePopup_t)dll.getSymbol("HTMLayoutHidePopup\0"); 2266 HTMLayoutGetElementState=cast(HTMLayoutGetElementState_t)dll.getSymbol("HTMLayoutGetElementState\0"); 2267 HTMLayoutCreateElement=cast(HTMLayoutCreateElement_t)dll.getSymbol("HTMLayoutCreateElement\0"); 2268 HTMLayoutCloneElement=cast(HTMLayoutCloneElement_t)dll.getSymbol("HTMLayoutCloneElement\0"); 2269 HTMLayoutInsertElement=cast(HTMLayoutInsertElement_t)dll.getSymbol("HTMLayoutInsertElement\0"); 2270 HTMLayoutDetachElement=cast(HTMLayoutDetachElement_t)dll.getSymbol("HTMLayoutDetachElement\0"); 2271 HTMLayoutSetTimer=cast(HTMLayoutSetTimer_t)dll.getSymbol("HTMLayoutSetTimer\0"); 2272 HTMLayoutAttachEventHandler=cast(HTMLayoutAttachEventHandler_t)dll.getSymbol("HTMLayoutAttachEventHandler\0"); 2273 HTMLayoutAttachEventHandlerEx=cast(HTMLayoutAttachEventHandlerEx_t)dll.getSymbol("HTMLayoutAttachEventHandlerEx\0"); 2274 HTMLayoutWindowAttachEventHandler=cast(HTMLayoutWindowAttachEventHandler_t)dll.getSymbol("HTMLayoutWindowAttachEventHandler\0"); 2275 HTMLayoutSendEvent=cast(HTMLayoutSendEvent_t)dll.getSymbol("HTMLayoutSendEvent\0"); 2276 HTMLayoutPostEvent=cast(HTMLayoutPostEvent_t)dll.getSymbol("HTMLayoutPostEvent\0"); 2277 HTMLayoutCallBehaviorMethod=cast(HTMLayoutCallBehaviorMethod_t)dll.getSymbol("HTMLayoutCallBehaviorMethod\0"); 2278 HTMLayoutRequestElementData=cast(HTMLayoutRequestElementData_t)dll.getSymbol("HTMLayoutRequestElementData\0"); 2279 HTMLayoutGetScrollInfo=cast(HTMLayoutGetScrollInfo_t)dll.getSymbol("HTMLayoutGetScrollInfo\0"); 2280 HTMLayoutSetScrollPos=cast(HTMLayoutSetScrollPos_t)dll.getSymbol("HTMLayoutSetScrollPos\0"); 2281 HTMLayoutIsElementVisible=cast(HTMLayoutIsElementVisible_t)dll.getSymbol("HTMLayoutIsElementVisible\0"); 2282 HTMLayoutIsElementEnabled=cast(HTMLayoutIsElementEnabled_t)dll.getSymbol("HTMLayoutIsElementEnabled\0"); 2283 HTMLayoutSortElements=cast(HTMLayoutSortElements_t)dll.getSymbol("HTMLayoutSortElements\0"); 2284 HTMLayoutSwapElements=cast(HTMLayoutSwapElements_t)dll.getSymbol("HTMLayoutSwapElements\0"); 2285 HTMLayoutTraverseUIEvent=cast(HTMLayoutTraverseUIEvent_t)dll.getSymbol("HTMLayoutTraverseUIEvent\0"); 2286 HTMLayoutControlGetType=cast(HTMLayoutControlGetType_t)dll.getSymbol("HTMLayoutControlGetType\0"); 2287 HTMLayoutControlGetValue=cast(HTMLayoutControlGetValue_t)dll.getSymbol("HTMLayoutControlGetValue\0"); 2288 HTMLayoutControlSetValue=cast(HTMLayoutControlSetValue_t)dll.getSymbol("HTMLayoutControlSetValue\0"); 2289 HTMLayoutEnumerate=cast(HTMLayoutEnumerate_t)dll.getSymbol("HTMLayoutEnumerate\0"); 2290 HTMLayoutGetCharacterRect=cast(HTMLayoutGetCharacterRect_t)dll.getSymbol("HTMLayoutGetCharacterRect\0"); 2291 HTMLayoutClassNameA=cast(HTMLayoutClassNameA_t)dll.getSymbol("HTMLayoutClassNameA\0"); 2292 HTMLayoutClassNameW=cast(HTMLayoutClassNameW_t)dll.getSymbol("HTMLayoutClassNameW\0"); 2293 HTMLayoutDataReady=cast(HTMLayoutDataReady_t)dll.getSymbol("HTMLayoutDataReady\0"); 2294 HTMLayoutDataReadyAsync=cast(HTMLayoutDataReadyAsync_t)dll.getSymbol("HTMLayoutDataReadyAsync\0"); 2295 HTMLayoutProc=cast(HTMLayoutProc_t)dll.getSymbol("HTMLayoutProc\0"); 2296 HTMLayoutProcND=cast(HTMLayoutProcND_t)dll.getSymbol("HTMLayoutProcND\0"); 2297 HTMLayoutGetMinWidth=cast(HTMLayoutGetMinWidth_t)dll.getSymbol("HTMLayoutGetMinWidth\0"); 2298 HTMLayoutGetMinHeight=cast(HTMLayoutGetMinHeight_t)dll.getSymbol("HTMLayoutGetMinHeight\0"); 2299 HTMLayoutLoadFile=cast(HTMLayoutLoadFile_t)dll.getSymbol("HTMLayoutLoadFile\0"); 2300 HTMLayoutLoadHtml=cast(HTMLayoutLoadHtml_t)dll.getSymbol("HTMLayoutLoadHtml\0"); 2301 HTMLayoutLoadHtmlEx=cast(HTMLayoutLoadHtmlEx_t)dll.getSymbol("HTMLayoutLoadHtmlEx\0"); 2302 HTMLayoutSetMode=cast(HTMLayoutSetMode_t)dll.getSymbol("HTMLayoutSetMode\0"); 2303 HTMLayoutSetCallback=cast(HTMLayoutSetCallback_t)dll.getSymbol("HTMLayoutSetCallback\0"); 2304 HTMLayoutSelectionExist=cast(HTMLayoutSelectionExist_t)dll.getSymbol("HTMLayoutSelectionExist\0"); 2305 HTMLayoutGetSelectedHTML=cast(HTMLayoutGetSelectedHTML_t)dll.getSymbol("HTMLayoutGetSelectedHTML\0"); 2306 HTMLayoutClipboardCopy=cast(HTMLayoutClipboardCopy_t)dll.getSymbol("HTMLayoutClipboardCopy\0"); 2307 HTMLayoutEnumResources=cast(HTMLayoutEnumResources_t)dll.getSymbol("HTMLayoutEnumResources\0"); 2308 HTMLayoutSetMasterCSS=cast(HTMLayoutSetMasterCSS_t)dll.getSymbol("HTMLayoutSetMasterCSS\0"); 2309 HTMLayoutSetCSS=cast(HTMLayoutSetCSS_t)dll.getSymbol("HTMLayoutSetCSS\0"); 2310 HTMLayoutSetMediaType=cast(HTMLayoutSetMediaType_t)dll.getSymbol("HTMLayoutSetMediaType\0"); 2311 HTMLayoutSetHttpHeaders=cast(HTMLayoutSetHttpHeaders_t)dll.getSymbol("HTMLayoutSetHttpHeaders\0"); 2312 HTMLayoutRender=cast(HTMLayoutRender_t)dll.getSymbol("HTMLayoutRender\0"); 2313 HTMLayoutDialog=cast(HTMLayoutDialog_t)dll.getSymbol("HTMLayoutDialog\0"); 2314 HTMLiteCreateInstance=cast(HTMLiteCreateInstance_t)dll.getSymbol("HTMLiteCreateInstance\0"); 2315 HTMLiteDestroyInstance=cast(HTMLiteDestroyInstance_t)dll.getSymbol("HTMLiteDestroyInstance\0"); 2316 HTMLiteSetTag=cast(HTMLiteSetTag_t)dll.getSymbol("HTMLiteSetTag\0"); 2317 HTMLiteGetTag=cast(HTMLiteGetTag_t)dll.getSymbol("HTMLiteGetTag\0"); 2318 HTMLiteLoadHtmlFromFile=cast(HTMLiteLoadHtmlFromFile_t)dll.getSymbol("HTMLiteLoadHtmlFromFile\0"); 2319 HTMLiteLoadHtmlFromMemory=cast(HTMLiteLoadHtmlFromMemory_t)dll.getSymbol("HTMLiteLoadHtmlFromMemory\0"); 2320 HTMLiteMeasure=cast(HTMLiteMeasure_t)dll.getSymbol("HTMLiteMeasure\0"); 2321 HTMLiteRender=cast(HTMLiteRender_t)dll.getSymbol("HTMLiteRender\0"); 2322 HTMLiteRenderOnBitmap=cast(HTMLiteRenderOnBitmap_t)dll.getSymbol("HTMLiteRenderOnBitmap\0"); 2323 HTMLiteSetDataReady=cast(HTMLiteSetDataReady_t)dll.getSymbol("HTMLiteSetDataReady\0"); 2324 HTMLiteGetDocumentMinWidth=cast(HTMLiteGetDocumentMinWidth_t)dll.getSymbol("HTMLiteGetDocumentMinWidth\0"); 2325 HTMLiteGetDocumentMinHeight=cast(HTMLiteGetDocumentMinHeight_t)dll.getSymbol("HTMLiteGetDocumentMinHeight\0"); 2326 HTMLiteSetMediaType=cast(HTMLiteSetMediaType_t)dll.getSymbol("HTMLiteSetMediaType\0"); 2327 HTMLiteGetRootElement=cast(HTMLiteGetRootElement_t)dll.getSymbol("HTMLiteGetRootElement\0"); 2328 HTMLiteFindElement=cast(HTMLiteFindElement_t)dll.getSymbol("HTMLiteFindElement\0"); 2329 HTMLiteSetCallback=cast(HTMLiteSetCallback_t)dll.getSymbol("HTMLiteSetCallback\0"); 2330 HTMLiteAdvanceFocus=cast(HTMLiteAdvanceFocus_t)dll.getSymbol("HTMLiteAdvanceFocus\0"); 2331 HTMLiteTraverseUIEvent=cast(HTMLiteTraverseUIEvent_t)dll.getSymbol("HTMLiteTraverseUIEvent\0"); 2332 HTMLayoutSetElementState=cast(HTMLayoutSetElementState_t)dll.getSymbol("HTMLayoutSetElementState\0"); 2333 HTMLayoutDetachEventHandler=cast(HTMLayoutDetachEventHandler_t)dll.getSymbol("HTMLayoutDetachEventHandler\0"); 2334 HTMLayoutWindowDetachEventHandler=cast(HTMLayoutWindowDetachEventHandler_t)dll.getSymbol("HTMLayoutWindowDetachEventHandler\0"); 2335 HTMLayoutRangeCreate=cast(HTMLayoutRangeCreate_t)dll.getSymbol("HTMLayoutRangeCreate\0"); 2336 HTMLayoutRangeFromSelection=cast(HTMLayoutRangeFromSelection_t)dll.getSymbol("HTMLayoutRangeFromSelection\0"); 2337 HTMLayoutRangeFromPositions=cast(HTMLayoutRangeFromPositions_t)dll.getSymbol("HTMLayoutRangeFromPositions\0"); 2338 HTMLayoutRangeRelease=cast(HTMLayoutRangeRelease_t)dll.getSymbol("HTMLayoutRangeRelease\0"); 2339 HTMLayoutRangeAdvancePos=cast(HTMLayoutRangeAdvancePos_t)dll.getSymbol("HTMLayoutRangeAdvancePos\0"); 2340 HTMLayoutRangeToHtml=cast(HTMLayoutRangeToHtml_t)dll.getSymbol("HTMLayoutRangeToHtml\0"); 2341 HTMLayoutRangeReplace=cast(HTMLayoutRangeReplace_t)dll.getSymbol("HTMLayoutRangeReplace\0"); 2342 HTMLayoutRangeInsertHtml=cast(HTMLayoutRangeInsertHtml_t)dll.getSymbol("HTMLayoutRangeInsertHtml\0"); 2343 HTMLayoutRangeIsEmpty=cast(HTMLayoutRangeIsEmpty_t)dll.getSymbol("HTMLayoutRangeIsEmpty\0"); 2344 HTMLayoutSetOption=cast(HTMLayoutSetOption_t)dll.getSymbol("HTMLayoutSetOption\0"); 2345 HTMLayoutDeclareElementType=cast(HTMLayoutDeclareElementType_t)dll.getSymbol("HTMLayoutDeclareElementType\0"); 2346 HTMLayoutAppendMasterCSS=cast(HTMLayoutAppendMasterCSS_t)dll.getSymbol("HTMLayoutAppendMasterCSS\0"); 2347 HTMLayoutScrollToView=cast(HTMLayoutScrollToView_t)dll.getSymbol("HTMLayoutScrollToView\0"); 2348 HTMLayoutElementSetExpando=cast(HTMLayoutElementSetExpando_t)dll.getSymbol("HTMLayoutElementSetExpando\0"); 2349 HTMLayoutElementGetExpando=cast(HTMLayoutElementGetExpando_t)dll.getSymbol("HTMLayoutElementGetExpando\0"); 2350 HTMLayoutParseValue=cast(HTMLayoutParseValue_t)dll.getSymbol("HTMLayoutParseValue\0"); 2351 HTMLayoutGetGraphin=cast(HTMLayoutGetGraphin_t)dll.getSymbol("HTMLayoutGetGraphin\0"); 2352 HTMLayoutRenderElement=cast(HTMLayoutRenderElement_t)dll.getSymbol("HTMLayoutRenderElement\0"); 2353 } 2310 import flowerd.sharedlib; 2311 2312 bool loadHTMLayout(char[] name=null,void[] data=null) 2313 { 2314 scope SharedLib dll; 2315 if(name is null) name="htmlayout.dll"; 2316 if(data is null) dll=SharedLib(name); 2317 else dll=SharedLib(name,data); 2318 if(dll is null) return false; 2319 2320 HTMLayout_UseElement=cast(HTMLayout_UseElement_t)dll.symbol("HTMLayout_UseElement\0"); 2321 HTMLayout_UnuseElement=cast(HTMLayout_UnuseElement_t)dll.symbol("HTMLayout_UnuseElement\0"); 2322 HTMLayoutGetRootElement=cast(HTMLayoutGetRootElement_t)dll.symbol("HTMLayoutGetRootElement\0"); 2323 HTMLayoutGetFocusElement=cast(HTMLayoutGetFocusElement_t)dll.symbol("HTMLayoutGetFocusElement\0"); 2324 HTMLayoutFindElement=cast(HTMLayoutFindElement_t)dll.symbol("HTMLayoutFindElement\0"); 2325 HTMLayoutGetChildrenCount=cast(HTMLayoutGetChildrenCount_t)dll.symbol("HTMLayoutGetChildrenCount\0"); 2326 HTMLayoutGetNthChild=cast(HTMLayoutGetNthChild_t)dll.symbol("HTMLayoutGetNthChild\0"); 2327 HTMLayoutGetParentElement=cast(HTMLayoutGetParentElement_t)dll.symbol("HTMLayoutGetParentElement\0"); 2328 HTMLayoutGetElementText=cast(HTMLayoutGetElementText_t)dll.symbol("HTMLayoutGetElementText\0"); 2329 HTMLayoutGetElementHtml=cast(HTMLayoutGetElementHtml_t)dll.symbol("HTMLayoutGetElementHtml\0"); 2330 HTMLayoutGetElementInnerText=cast(HTMLayoutGetElementInnerText_t)dll.symbol("HTMLayoutGetElementInnerText\0"); 2331 HTMLayoutSetElementInnerText=cast(HTMLayoutSetElementInnerText_t)dll.symbol("HTMLayoutSetElementInnerText\0"); 2332 HTMLayoutGetElementInnerText16=cast(HTMLayoutGetElementInnerText16_t)dll.symbol("HTMLayoutGetElementInnerText16\0"); 2333 HTMLayoutSetElementInnerText16=cast(HTMLayoutSetElementInnerText16_t)dll.symbol("HTMLayoutSetElementInnerText16\0"); 2334 HTMLayoutGetAttributeCount=cast(HTMLayoutGetAttributeCount_t)dll.symbol("HTMLayoutGetAttributeCount\0"); 2335 HTMLayoutGetNthAttribute=cast(HTMLayoutGetNthAttribute_t)dll.symbol("HTMLayoutGetNthAttribute\0"); 2336 HTMLayoutGetAttributeByName=cast(HTMLayoutGetAttributeByName_t)dll.symbol("HTMLayoutGetAttributeByName\0"); 2337 HTMLayoutSetAttributeByName=cast(HTMLayoutSetAttributeByName_t)dll.symbol("HTMLayoutSetAttributeByName\0"); 2338 HTMLayoutClearAttributes=cast(HTMLayoutClearAttributes_t)dll.symbol("HTMLayoutClearAttributes\0"); 2339 HTMLayoutGetElementIndex=cast(HTMLayoutGetElementIndex_t)dll.symbol("HTMLayoutGetElementIndex\0"); 2340 HTMLayoutGetElementType=cast(HTMLayoutGetElementType_t)dll.symbol("HTMLayoutGetElementType\0"); 2341 HTMLayoutGetStyleAttribute=cast(HTMLayoutGetStyleAttribute_t)dll.symbol("HTMLayoutGetStyleAttribute\0"); 2342 HTMLayoutSetStyleAttribute=cast(HTMLayoutSetStyleAttribute_t)dll.symbol("HTMLayoutSetStyleAttribute\0"); 2343 HTMLayoutUpdateElement=cast(HTMLayoutUpdateElement_t)dll.symbol("HTMLayoutUpdateElement\0"); 2344 HTMLayoutUpdateElementEx=cast(HTMLayoutUpdateElementEx_t)dll.symbol("HTMLayoutUpdateElementEx\0"); 2345 HTMLayoutSetCapture=cast(HTMLayoutSetCapture_t)dll.symbol("HTMLayoutSetCapture\0"); 2346 HTMLayoutGetElementHwnd=cast(HTMLayoutGetElementHwnd_t)dll.symbol("HTMLayoutGetElementHwnd\0"); 2347 HTMLayoutCombineURL=cast(HTMLayoutCombineURL_t)dll.symbol("HTMLayoutCombineURL\0"); 2348 HTMLayoutVisitElements=cast(HTMLayoutVisitElements_t)dll.symbol("HTMLayoutVisitElements\0"); 2349 HTMLayoutSelectElements=cast(HTMLayoutSelectElements_t)dll.symbol("HTMLayoutSelectElements\0"); 2350 HTMLayoutSelectParent=cast(HTMLayoutSelectParent_t)dll.symbol("HTMLayoutSelectParent\0"); 2351 HTMLayoutSetElementHtml=cast(HTMLayoutSetElementHtml_t)dll.symbol("HTMLayoutSetElementHtml\0"); 2352 HTMLayoutDeleteElement=cast(HTMLayoutDeleteElement_t)dll.symbol("HTMLayoutDeleteElement\0"); 2353 HTMLayoutGetElementUID=cast(HTMLayoutGetElementUID_t)dll.symbol("HTMLayoutGetElementUID\0"); 2354 HTMLayoutGetElementByUID=cast(HTMLayoutGetElementByUID_t)dll.symbol("HTMLayoutGetElementByUID\0"); 2355 HTMLayoutShowPopup=cast(HTMLayoutShowPopup_t)dll.symbol("HTMLayoutShowPopup\0"); 2356 HTMLayoutShowPopupAt=cast(HTMLayoutShowPopupAt_t)dll.symbol("HTMLayoutShowPopupAt\0"); 2357 HTMLayoutHidePopup=cast(HTMLayoutHidePopup_t)dll.symbol("HTMLayoutHidePopup\0"); 2358 HTMLayoutGetElementState=cast(HTMLayoutGetElementState_t)dll.symbol("HTMLayoutGetElementState\0"); 2359 HTMLayoutCreateElement=cast(HTMLayoutCreateElement_t)dll.symbol("HTMLayoutCreateElement\0"); 2360 HTMLayoutCloneElement=cast(HTMLayoutCloneElement_t)dll.symbol("HTMLayoutCloneElement\0"); 2361 HTMLayoutInsertElement=cast(HTMLayoutInsertElement_t)dll.symbol("HTMLayoutInsertElement\0"); 2362 HTMLayoutDetachElement=cast(HTMLayoutDetachElement_t)dll.symbol("HTMLayoutDetachElement\0"); 2363 HTMLayoutSetTimer=cast(HTMLayoutSetTimer_t)dll.symbol("HTMLayoutSetTimer\0"); 2364 HTMLayoutAttachEventHandler=cast(HTMLayoutAttachEventHandler_t)dll.symbol("HTMLayoutAttachEventHandler\0"); 2365 HTMLayoutAttachEventHandlerEx=cast(HTMLayoutAttachEventHandlerEx_t)dll.symbol("HTMLayoutAttachEventHandlerEx\0"); 2366 HTMLayoutWindowAttachEventHandler=cast(HTMLayoutWindowAttachEventHandler_t)dll.symbol("HTMLayoutWindowAttachEventHandler\0"); 2367 HTMLayoutSendEvent=cast(HTMLayoutSendEvent_t)dll.symbol("HTMLayoutSendEvent\0"); 2368 HTMLayoutPostEvent=cast(HTMLayoutPostEvent_t)dll.symbol("HTMLayoutPostEvent\0"); 2369 HTMLayoutCallBehaviorMethod=cast(HTMLayoutCallBehaviorMethod_t)dll.symbol("HTMLayoutCallBehaviorMethod\0"); 2370 HTMLayoutRequestElementData=cast(HTMLayoutRequestElementData_t)dll.symbol("HTMLayoutRequestElementData\0"); 2371 HTMLayoutGetScrollInfo=cast(HTMLayoutGetScrollInfo_t)dll.symbol("HTMLayoutGetScrollInfo\0"); 2372 HTMLayoutSetScrollPos=cast(HTMLayoutSetScrollPos_t)dll.symbol("HTMLayoutSetScrollPos\0"); 2373 HTMLayoutIsElementVisible=cast(HTMLayoutIsElementVisible_t)dll.symbol("HTMLayoutIsElementVisible\0"); 2374 HTMLayoutIsElementEnabled=cast(HTMLayoutIsElementEnabled_t)dll.symbol("HTMLayoutIsElementEnabled\0"); 2375 HTMLayoutSortElements=cast(HTMLayoutSortElements_t)dll.symbol("HTMLayoutSortElements\0"); 2376 HTMLayoutSwapElements=cast(HTMLayoutSwapElements_t)dll.symbol("HTMLayoutSwapElements\0"); 2377 HTMLayoutTraverseUIEvent=cast(HTMLayoutTraverseUIEvent_t)dll.symbol("HTMLayoutTraverseUIEvent\0"); 2378 HTMLayoutControlGetType=cast(HTMLayoutControlGetType_t)dll.symbol("HTMLayoutControlGetType\0"); 2379 HTMLayoutControlGetValue=cast(HTMLayoutControlGetValue_t)dll.symbol("HTMLayoutControlGetValue\0"); 2380 HTMLayoutControlSetValue=cast(HTMLayoutControlSetValue_t)dll.symbol("HTMLayoutControlSetValue\0"); 2381 HTMLayoutEnumerate=cast(HTMLayoutEnumerate_t)dll.symbol("HTMLayoutEnumerate\0"); 2382 HTMLayoutGetCharacterRect=cast(HTMLayoutGetCharacterRect_t)dll.symbol("HTMLayoutGetCharacterRect\0"); 2383 HTMLayoutClassNameA=cast(HTMLayoutClassNameA_t)dll.symbol("HTMLayoutClassNameA\0"); 2384 HTMLayoutClassNameW=cast(HTMLayoutClassNameW_t)dll.symbol("HTMLayoutClassNameW\0"); 2385 HTMLayoutDataReady=cast(HTMLayoutDataReady_t)dll.symbol("HTMLayoutDataReady\0"); 2386 HTMLayoutDataReadyAsync=cast(HTMLayoutDataReadyAsync_t)dll.symbol("HTMLayoutDataReadyAsync\0"); 2387 HTMLayoutProc=cast(HTMLayoutProc_t)dll.symbol("HTMLayoutProc\0"); 2388 HTMLayoutProcND=cast(HTMLayoutProcND_t)dll.symbol("HTMLayoutProcND\0"); 2389 HTMLayoutGetMinWidth=cast(HTMLayoutGetMinWidth_t)dll.symbol("HTMLayoutGetMinWidth\0"); 2390 HTMLayoutGetMinHeight=cast(HTMLayoutGetMinHeight_t)dll.symbol("HTMLayoutGetMinHeight\0"); 2391 HTMLayoutLoadFile=cast(HTMLayoutLoadFile_t)dll.symbol("HTMLayoutLoadFile\0"); 2392 HTMLayoutLoadHtml=cast(HTMLayoutLoadHtml_t)dll.symbol("HTMLayoutLoadHtml\0"); 2393 HTMLayoutLoadHtmlEx=cast(HTMLayoutLoadHtmlEx_t)dll.symbol("HTMLayoutLoadHtmlEx\0"); 2394 HTMLayoutSetMode=cast(HTMLayoutSetMode_t)dll.symbol("HTMLayoutSetMode\0"); 2395 HTMLayoutSetCallback=cast(HTMLayoutSetCallback_t)dll.symbol("HTMLayoutSetCallback\0"); 2396 HTMLayoutSelectionExist=cast(HTMLayoutSelectionExist_t)dll.symbol("HTMLayoutSelectionExist\0"); 2397 HTMLayoutGetSelectedHTML=cast(HTMLayoutGetSelectedHTML_t)dll.symbol("HTMLayoutGetSelectedHTML\0"); 2398 HTMLayoutClipboardCopy=cast(HTMLayoutClipboardCopy_t)dll.symbol("HTMLayoutClipboardCopy\0"); 2399 HTMLayoutEnumResources=cast(HTMLayoutEnumResources_t)dll.symbol("HTMLayoutEnumResources\0"); 2400 HTMLayoutSetMasterCSS=cast(HTMLayoutSetMasterCSS_t)dll.symbol("HTMLayoutSetMasterCSS\0"); 2401 HTMLayoutSetCSS=cast(HTMLayoutSetCSS_t)dll.symbol("HTMLayoutSetCSS\0"); 2402 HTMLayoutSetMediaType=cast(HTMLayoutSetMediaType_t)dll.symbol("HTMLayoutSetMediaType\0"); 2403 HTMLayoutSetHttpHeaders=cast(HTMLayoutSetHttpHeaders_t)dll.symbol("HTMLayoutSetHttpHeaders\0"); 2404 HTMLayoutRender=cast(HTMLayoutRender_t)dll.symbol("HTMLayoutRender\0"); 2405 HTMLayoutDialog=cast(HTMLayoutDialog_t)dll.symbol("HTMLayoutDialog\0"); 2406 HTMLiteCreateInstance=cast(HTMLiteCreateInstance_t)dll.symbol("HTMLiteCreateInstance\0"); 2407 HTMLiteDestroyInstance=cast(HTMLiteDestroyInstance_t)dll.symbol("HTMLiteDestroyInstance\0"); 2408 HTMLiteSetTag=cast(HTMLiteSetTag_t)dll.symbol("HTMLiteSetTag\0"); 2409 HTMLiteGetTag=cast(HTMLiteGetTag_t)dll.symbol("HTMLiteGetTag\0"); 2410 HTMLiteLoadHtmlFromFile=cast(HTMLiteLoadHtmlFromFile_t)dll.symbol("HTMLiteLoadHtmlFromFile\0"); 2411 HTMLiteLoadHtmlFromMemory=cast(HTMLiteLoadHtmlFromMemory_t)dll.symbol("HTMLiteLoadHtmlFromMemory\0"); 2412 HTMLiteMeasure=cast(HTMLiteMeasure_t)dll.symbol("HTMLiteMeasure\0"); 2413 HTMLiteRender=cast(HTMLiteRender_t)dll.symbol("HTMLiteRender\0"); 2414 HTMLiteRenderOnBitmap=cast(HTMLiteRenderOnBitmap_t)dll.symbol("HTMLiteRenderOnBitmap\0"); 2415 HTMLiteSetDataReady=cast(HTMLiteSetDataReady_t)dll.symbol("HTMLiteSetDataReady\0"); 2416 HTMLiteGetDocumentMinWidth=cast(HTMLiteGetDocumentMinWidth_t)dll.symbol("HTMLiteGetDocumentMinWidth\0"); 2417 HTMLiteGetDocumentMinHeight=cast(HTMLiteGetDocumentMinHeight_t)dll.symbol("HTMLiteGetDocumentMinHeight\0"); 2418 HTMLiteSetMediaType=cast(HTMLiteSetMediaType_t)dll.symbol("HTMLiteSetMediaType\0"); 2419 HTMLiteGetRootElement=cast(HTMLiteGetRootElement_t)dll.symbol("HTMLiteGetRootElement\0"); 2420 HTMLiteFindElement=cast(HTMLiteFindElement_t)dll.symbol("HTMLiteFindElement\0"); 2421 HTMLiteSetCallback=cast(HTMLiteSetCallback_t)dll.symbol("HTMLiteSetCallback\0"); 2422 HTMLiteAdvanceFocus=cast(HTMLiteAdvanceFocus_t)dll.symbol("HTMLiteAdvanceFocus\0"); 2423 HTMLiteTraverseUIEvent=cast(HTMLiteTraverseUIEvent_t)dll.symbol("HTMLiteTraverseUIEvent\0"); 2424 HTMLayoutSetElementState=cast(HTMLayoutSetElementState_t)dll.symbol("HTMLayoutSetElementState\0"); 2425 HTMLayoutDetachEventHandler=cast(HTMLayoutDetachEventHandler_t)dll.symbol("HTMLayoutDetachEventHandler\0"); 2426 HTMLayoutWindowDetachEventHandler=cast(HTMLayoutWindowDetachEventHandler_t)dll.symbol("HTMLayoutWindowDetachEventHandler\0"); 2427 HTMLayoutRangeCreate=cast(HTMLayoutRangeCreate_t)dll.symbol("HTMLayoutRangeCreate\0"); 2428 HTMLayoutRangeFromSelection=cast(HTMLayoutRangeFromSelection_t)dll.symbol("HTMLayoutRangeFromSelection\0"); 2429 HTMLayoutRangeFromPositions=cast(HTMLayoutRangeFromPositions_t)dll.symbol("HTMLayoutRangeFromPositions\0"); 2430 HTMLayoutRangeRelease=cast(HTMLayoutRangeRelease_t)dll.symbol("HTMLayoutRangeRelease\0"); 2431 HTMLayoutRangeAdvancePos=cast(HTMLayoutRangeAdvancePos_t)dll.symbol("HTMLayoutRangeAdvancePos\0"); 2432 HTMLayoutRangeToHtml=cast(HTMLayoutRangeToHtml_t)dll.symbol("HTMLayoutRangeToHtml\0"); 2433 HTMLayoutRangeReplace=cast(HTMLayoutRangeReplace_t)dll.symbol("HTMLayoutRangeReplace\0"); 2434 HTMLayoutRangeInsertHtml=cast(HTMLayoutRangeInsertHtml_t)dll.symbol("HTMLayoutRangeInsertHtml\0"); 2435 HTMLayoutRangeIsEmpty=cast(HTMLayoutRangeIsEmpty_t)dll.symbol("HTMLayoutRangeIsEmpty\0"); 2436 HTMLayoutSetOption=cast(HTMLayoutSetOption_t)dll.symbol("HTMLayoutSetOption\0"); 2437 HTMLayoutDeclareElementType=cast(HTMLayoutDeclareElementType_t)dll.symbol("HTMLayoutDeclareElementType\0"); 2438 HTMLayoutAppendMasterCSS=cast(HTMLayoutAppendMasterCSS_t)dll.symbol("HTMLayoutAppendMasterCSS\0"); 2439 HTMLayoutScrollToView=cast(HTMLayoutScrollToView_t)dll.symbol("HTMLayoutScrollToView\0"); 2440 HTMLayoutElementSetExpando=cast(HTMLayoutElementSetExpando_t)dll.symbol("HTMLayoutElementSetExpando\0"); 2441 HTMLayoutElementGetExpando=cast(HTMLayoutElementGetExpando_t)dll.symbol("HTMLayoutElementGetExpando\0"); 2442 HTMLayoutParseValue=cast(HTMLayoutParseValue_t)dll.symbol("HTMLayoutParseValue\0"); 2443 HTMLayoutGetGraphin=cast(HTMLayoutGetGraphin_t)dll.symbol("HTMLayoutGetGraphin\0"); 2444 HTMLayoutRenderElement=cast(HTMLayoutRenderElement_t)dll.symbol("HTMLayoutRenderElement\0"); 2445 HTMLayoutGetElementLocation=cast(HTMLayoutGetElementLocation_t)dll.symbol("HTMLayoutGetElementLocation\0"); 2446 2447 return true; 2448 } trunk/import/htmlayout/element.d
r17 r18 12 12 alias bool delegate(HElement e,UINT evtgm,LPVOID prms) HElement_event_callback_t; 13 13 alias bool delegate(HElement,PVOID param) HElement_callback_t; 14 alias bool delegate(HElement,LPVOID p,int pos, int postype, wchar code) HElement_enum_callback_t; 15 16 extern(Windows) BOOL ReleaseCapture(); 14 alias bool delegate(HElement,LPVOID p,int pos,int postype,wchar code) HElement_enum_callback_t; 15 16 extern(Windows) 17 { 18 BOOL ReleaseCapture(); 19 BOOL PtInRect(RECT *lprc,POINT pt); 20 } 17 21 18 22 template EVENT_HANDLER_STRING2(char[] NAME,char[] EVENT) … … 69 73 } 70 74 71 bool opCall(char[] name, char[] value) //setter75 bool opCall(char[] name,char[] value) //setter 72 76 {return (lastResult=HTMLayoutSetStyleAttribute(mHandle,toStringz(name),toString16z(toString16(value))))==HLDOM_OK;} 73 77 } … … 210 214 } 211 215 212 bool attribute(UINT n, ref char[] name,ref char[] value) //getter216 bool attribute(UINT n,ref char[] name,ref char[] value) //getter 213 217 { 214 218 LPCSTR p_name; … … 287 291 } 288 292 289 HElement[] wildcard(char[] tagName, char[] attributeName=null, char[] attributeValue=null, DWORD depth=0,uint max=0)293 HElement[] wildcard(char[] tagName,char[] attributeName=null,char[] attributeValue=null,DWORD depth=0,uint max=0) 290 294 { 291 295 auto ret=new GrowStack!(HElement)(max>0?max:15); … … 300 304 } 301 305 302 bool wildcard(char[] tagName, char[] attributeName, char[] attributeValue, HElement_callback_t callback, LPVOID param=null,DWORD depth=0)306 bool wildcard(char[] tagName,char[] attributeName,char[] attributeValue,HElement_callback_t callback,LPVOID param=null,DWORD depth=0) 303 307 {synchronized{ 304 308 … … 379 383 } 380 384 381 bool select(char[] CSS_selectors, HElement_callback_t callback,LPVOID param=null)385 bool select(char[] CSS_selectors,HElement_callback_t callback,LPVOID param=null) 382 386 {synchronized{ 383 387 … … 387 391 }} 388 392 389 HElement selectParent(char[] selector, UINT depth=0)393 HElement selectParent(char[] selector,UINT depth=0) 390 394 { 391 395 HELEMENT heFound; … … 411 415 } 412 416 413 bool showAsPopup(HElement anchor,UINT placement=2) {return anchor.showPopup(this,placement);}414 bool showPopup(HElement hePopup, UINT placement=2){return (lastResult=HTMLayoutShowPopup(hePopup.mHandle,mHandle,placement))==HLDOM_OK;}415 bool showPopupAt(HElement hePopup, int x,int y,bool animate){return (lastResult=HTMLayoutShowPopupAt(hePopup.mHandle,POINT(x,y),animate))==HLDOM_OK;}416 bool showAsPopupAt(int x,int y, bool animate){return showPopupAt(this,x,y,animate);}417 bool showAsPopup(HElement anchor,UINT placement=2){return anchor.showPopup(this,placement);} 418 bool showPopup(HElement hePopup,UINT placement=2){return (lastResult=HTMLayoutShowPopup(hePopup.mHandle,mHandle,placement))==HLDOM_OK;} 419 bool showPopupAt(HElement hePopup,int x,int y,bool animate){return (lastResult=HTMLayoutShowPopupAt(hePopup.mHandle,POINT(x,y),animate))==HLDOM_OK;} 420 bool showAsPopupAt(int x,int y,bool animate){return showPopupAt(this,x,y,animate);} 417 421 bool hidePopup(HElement hePopup=null){return (lastResult=HTMLayoutHidePopup(hePopup?hePopup.mHandle:mHandle))==HLDOM_OK;} 418 422 … … 424 428 } 425 429 426 bool state(UINT stateBitsToSet, UINT stateBitsToClear,bool updateView) //setter430 bool state(UINT stateBitsToSet,UINT stateBitsToClear,bool updateView) //setter 427 431 {return (lastResult=HTMLayoutSetElementState(mHandle,stateBitsToSet,stateBitsToClear,updateView))==HLDOM_OK;} 428 432 433 bool link(){return (state&STATE_LINK)!=0;} 434 bool hovered(){return (state&STATE_HOVER)!=0;} 435 bool active(){return (state&STATE_ACTIVE)!=0;} 436 bool visited(){return (state&STATE_VISITED)!=0;} 437 bool current(){return (state&STATE_CURRENT)!=0;} 438 bool readOnly(){return (state&STATE_READONLY)!=0;} 439 bool readOnly(bool v){return state(v?STATE_READONLY:0,v?0:STATE_READONLY,true);} 440 bool expanded(){return (state&STATE_EXPANDED)!=0;} 441 bool collapsed(){return (state&STATE_COLLAPSED)!=0;} 442 bool incomplete(){return (state&STATE_INCOMPLETE)!=0;} 443 bool animating(){return (state&STATE_ANIMATING)!=0;} 444 bool synthetic(){return (state&STATE_SYNTHETIC)!=0;} 445 bool ownsPopup(){return (state&STATE_OWNS_POPUP)!=0;} 446 bool tabFocus(){return (state&STATE_TABFOCUS)!=0;} 447 bool empty(){return (state&STATE_EMPTY)!=0;} 448 bool busy(){return (state&STATE_BUSY)!=0;} 449 bool dragOver(){return (state&STATE_DRAG_OVER)!=0;} 450 bool dropTarget(){return (state&STATE_DROP_TARGET)!=0;} 451 bool moving(){return (state&STATE_MOVING)!=0;} 452 bool copying(){return (state&STATE_COPYING)!=0;} 453 bool dragSource(){return (state&STATE_DRAG_SOURCE)!=0;} 454 bool popup(){return (state&STATE_POPUP)!=0;} 455 bool pressed(){return (state&STATE_PRESSED)!=0;} 456 bool hasChildren(){return (state&STATE_HAS_CHILDREN)!=0;} 457 bool hasChild(){return (state&STATE_HAS_CHILD)!=0;} 429 458 bool focus(){return state(STATE_FOCUS,0,true);} 430 459 bool focused(){return (state&STATE_FOCUS)!=0;} … … 439 468 { 440 469 HELEMENT phe; 441 if((lastResult=HTMLayoutCloneElement(mHandle,&phe))==HLDOM_OK) return new HElement(phe,false); 470 if((lastResult=HTMLayoutCloneElement(mHandle,&phe))==HLDOM_OK) 471 { 472 auto r=new HElement(phe,false); 473 r.mUsed=true; 474 return r; 475 } 442 476 return null; 443 477 } 444 478 445 bool insert(HElement hparent, UINT index=0){return (lastResult=HTMLayoutInsertElement(mHandle,hparent.mHandle,index))==HLDOM_OK;}446 bool adopt(HElement child, UINT index=0){return child.insert(this,index);}479 bool insert(HElement hparent,UINT index=0){return (lastResult=HTMLayoutInsertElement(mHandle,hparent.mHandle,index))==HLDOM_OK;} 480 bool adopt(HElement child,UINT index=0){return child.insert(this,index);} 447 481 bool detach(){return (lastResult=HTMLayoutDetachElement(mHandle))==HLDOM_OK;} 448 482 bool timer(UINT milliseconds){return (lastResult=HTMLayoutSetTimer(mHandle,milliseconds))==HLDOM_OK;} 449 483 450 bool sendEvent(UINT appEventCode, HElement heSource, UINT reason,out bool handled)484 bool sendEvent(UINT appEventCode,HElement heSource,UINT reason,out bool handled) 451 485 { 452 486 BOOL mHandled; … … 459 493 } 460 494 461 bool postEvent(UINT appEventCode, HElement heSource,UINT reason){return (lastResult=HTMLayoutPostEvent(mHandle,appEventCode,heSource?heSource.mHandle:null,reason))==HLDOM_OK;}495 bool postEvent(UINT appEventCode,HElement heSource,UINT reason){return (lastResult=HTMLayoutPostEvent(mHandle,appEventCode,heSource?heSource.mHandle:null,reason))==HLDOM_OK;} 462 496 463 497 protected bool callMethod(HMethodParams* params){return (lastResult=HTMLayoutCallBehaviorMethod(mHandle,params))==HLDOM_OK;} 464 498 465 499 bool click(){return callMethod(&HMethodParams(DO_CLICK));} 466 bool xcall(char[] name,HJson[] values=null){return callMethod(HXcall(name,values).opCast);} 467 bool xcall(char[] name,HJson *value){return callMethod(HXcall(name,value).opCast);} 468 469 bool requestData(char[] url, UINT dataType, HElement initiator){return (lastResult=HTMLayoutRequestElementData(mHandle,toString16z(toString16(url)),dataType,initiator?initiator.mHandle:null))==HLDOM_OK;} 470 bool scrollInfo(ref POINT scrollPos, ref RECT viewRect,ref SIZE contentSize) //getter 500 bool xcall(char[] name,HJson[] values=null) 501 { 502 JSON_VALUE[] vals; 503 vals.length=values.length; 504 foreach(i,v;values) vals[i]=*v.handle; 505 return callMethod(HXcall(name,vals).opCast); 506 } 507 bool xcall(char[] name,HJson value){return callMethod(HXcall(name,value.handle).opCast);} 508 509 bool requestData(char[] url,UINT dataType,HElement initiator){return (lastResult=HTMLayoutRequestElementData(mHandle,toString16z(toString16(url)),dataType,initiator?initiator.mHandle:null))==HLDOM_OK;} 510 bool scrollInfo(ref POINT scrollPos,ref RECT viewRect,ref SIZE contentSize) //getter 471 511 {return (lastResult=HTMLayoutGetScrollInfo(mHandle,&scrollPos,&viewRect,&contentSize))==HLDOM_OK;} 472 512 POINT scrollPos() … … 494 534 } 495 535 bool scrollPos(POINT p,bool smooth=false) {return scrollPos(p.x,p.y,smooth);} 496 bool scrollPos(int x,int y, bool smooth=false) //setter536 bool scrollPos(int x,int y,bool smooth=false) //setter 497 537 {return (lastResult=HTMLayoutSetScrollPos(mHandle,POINT(x,y),smooth))==HLDOM_OK;} 498 538 … … 509 549 } 510 550 511 bool sort(UINT firstIndex, UINT lastIndex, ELEMENT_COMPARATOR cmpFunc,LPVOID cmpFuncParam){return (lastResult=HTMLayoutSortElements(mHandle,firstIndex,lastIndex,cmpFunc,cmpFuncParam))==HLDOM_OK;}551 bool sort(UINT firstIndex,UINT lastIndex,ELEMENT_COMPARATOR cmpFunc,LPVOID cmpFuncParam){return (lastResult=HTMLayoutSortElements(mHandle,firstIndex,lastIndex,cmpFunc,cmpFuncParam))==HLDOM_OK;} 512 552 513 553 bool swap(HElement he2){return (lastResult=HTMLayoutSwapElements(mHandle,he2.mHandle))==HLDOM_OK;} … … 519 559 else return -1; 520 560 } 521 HJson *value()522 { 523 auto r=new HJson;524 if((lastResult=HTMLayoutControlGetValue(mHandle,r))==HLDOM_OK) return r;525 else return null; 526 } 527 bool value(HJson *pVal){return (lastResult=HTMLayoutControlSetValue(mHandle,pVal))==HLDOM_OK;}528 529 bool enumerate(HElement_enum_callback_t callback, LPVOID p,bool forward)561 HJson value() 562 { 563 auto r=new JSON_VALUE; 564 if((lastResult=HTMLayoutControlGetValue(mHandle,r))==HLDOM_OK) return HJson(r); 565 else return null; 566 } 567 bool value(HJson pVal){return (lastResult=HTMLayoutControlSetValue(mHandle,pVal.handle))==HLDOM_OK;} 568 569 bool enumerate(HElement_enum_callback_t callback,LPVOID p,bool forward) 530 570 { 531 571 if(!callback) return false; … … 541 581 } 542 582 583 RECT* location(UINT areas /*ELEMENT_AREAS*/) 584 { 585 auto outRect=new RECT; 586 if((lastResult=HTMLayoutGetElementLocation(mHandle,outRect,areas))==HLDOM_OK) return outRect; 587 else return null; 588 } 589 590 bool isInside(POINT client_pt) 591 { 592 auto rc = location(ROOT_RELATIVE | BORDER_BOX); 593 if(rc) return PtInRect(rc,client_pt) != FALSE; 594 else return false; 595 } 596 543 597 HWND hwnd(BOOL rootWindow) 544 598 { … … 551 605 { 552 606 HRANGE pRange; 553 if((lastResult=HTMLayoutRangeCreate(mHandle,&pRange, outer ))==HLDOM_OK) return new HRange(pRange);607 if((lastResult=HTMLayoutRangeCreate(mHandle,&pRange,outer ))==HLDOM_OK) return new HRange(pRange); 554 608 else return null; 555 609 } … … 558 612 { 559 613 HRANGE pRange; 560 if((lastResult=HTMLayoutRangeFromSelection(mHandle, &pRange ))==HLDOM_OK) return new HRange(pRange);614 if((lastResult=HTMLayoutRangeFromSelection(mHandle,&pRange ))==HLDOM_OK) return new HRange(pRange); 561 615 else return null; 562 616 } … … 565 619 { 566 620 HRANGE pRange; 567 if((lastResult=HTMLayoutRangeFromPositions(mHandle, &pStart,&pEnd ))==HLDOM_OK) return new HRange(pRange);621 if((lastResult=HTMLayoutRangeFromPositions(mHandle,&pStart,&pEnd ))==HLDOM_OK) return new HRange(pRange); 568 622 else return null; 569 623 } … … 627 681 else if(lastResult==HLDOM_INVALID_HANDLE) return "return HLDOM_INVALID_HANDLE - invalid HELEMENT"; 628 682 else if(lastResult==HLDOM_PASSIVE_HANDLE) return "return HLDOM_PASSIVE_HANDLE - attempt to use HELEMENT which is not marked by HTMLayout_UseElement()"; 629 else if(lastResult==HLDOM_INVALID_PARAMETER) return "return HLDOM_INVALID_PARAMETER - parameter is invalid, e.g. pointer is null";683 else if(lastResult==HLDOM_INVALID_PARAMETER) return "return HLDOM_INVALID_PARAMETER - parameter is invalid,e.g. pointer is null"; 630 684 else if(lastResult==HLDOM_OPERATION_FAILED) return "return HLDOM_OPERATION_FAILED"; 631 685 else return null; … … 635 689 636 690 static HElement_enum_callback_t mEnumCallback; 637 extern(Windows) static BOOL mEnumerationCallback( LPVOID p, HELEMENT he, int pos, int postype,WCHAR code )691 extern(Windows) static BOOL mEnumerationCallback( LPVOID p,HELEMENT he,int pos,int postype,WCHAR code ) 638 692 { 639 693 return mEnumCallback(new HElement(he),p,pos,postype,code); … … 646 700 } 647 701 648 extern(Windows) static BOOL mStaticHandler(LPVOID tag, HELEMENT target, UINT event,LPVOID params )702 extern(Windows) static BOOL mStaticHandler(LPVOID tag,HELEMENT target,UINT event,LPVOID params ) 649 703 { 650 704 if(event==HANDLE_INITIALIZATION){return dgsInit(target).call(HInitialization(target,cast(INITIALIZATION_PARAMS*)params));} … … 741 795 742 796 bool release(){if((lastResult=HTMLayoutRangeRelease(mHandle))==HLDOM_OK) {mHandle=null;return true;} return false;} 743 bool advance(UINT cmd, ref INT c, ref HPOSITION pPos ){return (lastResult=HTMLayoutRangeAdvancePos( mHandle, cmd, &c,&pPos ))==HLDOM_OK;}797 bool advance(UINT cmd,ref INT c,ref HPOSITION pPos ){return (lastResult=HTMLayoutRangeAdvancePos( mHandle,cmd,&c,&pPos ))==HLDOM_OK;} 744 798 char[] html() 745 799 { 746 800 LPCBYTE ret; 747 801 uint len; 748 if((lastResult=HTMLayoutRangeToHtml( mHandle, &ret,&len))==HLDOM_OK) return (cast(char*)ret)[0..len].dup;749 else return null; 750 } 751 bool replace(char[] html){return (lastResult=HTMLayoutRangeReplace( mHandle, cast(LPCBYTE)html.ptr,html.length))==HLDOM_OK;}752 bool insert(HPOSITION pPos,char[] html){return (lastResult=HTMLayoutRangeInsertHtml( &pPos, cast(LPBYTE) html.ptr,html.length ))==HLDOM_OK;}802 if((lastResult=HTMLayoutRangeToHtml( mHandle,&ret,&len))==HLDOM_OK) return (cast(char*)ret)[0..len].dup; 803 else return null; 804 } 805 bool replace(char[] html){return (lastResult=HTMLayoutRangeReplace( mHandle,cast(LPCBYTE)html.ptr,html.length))==HLDOM_OK;} 806 bool insert(HPOSITION pPos,char[] html){return (lastResult=HTMLayoutRangeInsertHtml( &pPos,cast(LPBYTE) html.ptr,html.length ))==HLDOM_OK;} 753 807 bool isEmpty() 754 808 { 755 809 BOOL pResult; 756 lastResult=HTMLayoutRangeIsEmpty( mHandle, &pResult );810 lastResult=HTMLayoutRangeIsEmpty( mHandle,&pResult ); 757 811 return cast(bool)pResult; 758 812 } … … 765 819 else if(lastResult==HLDOM_INVALID_HANDLE) return "HLDOM_INVALID_HANDLE - invalid HELEMENT"; 766 820 else if(lastResult==HLDOM_PASSIVE_HANDLE) return "HLDOM_PASSIVE_HANDLE - attempt to use HELEMENT which is not marked by HTMLayout_UseElement()"; 767 else if(lastResult==HLDOM_INVALID_PARAMETER) return "HLDOM_INVALID_PARAMETER - parameter is invalid, e.g. pointer is null";821 else if(lastResult==HLDOM_INVALID_PARAMETER) return "HLDOM_INVALID_PARAMETER - parameter is invalid,e.g. pointer is null"; 768 822 else if(lastResult==HLDOM_OPERATION_FAILED) return "HLDOM_OPERATION_FAILED"; 769 823 else return null; trunk/import/htmlayout/events.d
r17 r18 291 291 } 292 292 293 void reset(){} 294 295 static void resetAll() {foreach(b;mBehaviors) b.reset();} 296 293 297 final static HBehavior find(char[] name) 294 298 { … … 565 569 UINT dataSize(){return event.dataSize;} 566 570 UINT dataType(){return event.dataType;} 571 UINT status(){return event.status;} 572 LPCWSTR uri(){return event.uri;} 567 573 } 568 574 trunk/import/htmlayout/htmlayout.d
r17 r18 1 //wrapper for Andrew Fedoniouk's excellent HTMLayout (3.2.2. 8) - http://www.terrainformatica.com/1 //wrapper for Andrew Fedoniouk's excellent HTMLayout (3.2.2.13) - http://www.terrainformatica.com/ 2 2 3 3 //todo: make the event struct wrappers (i.e. HMouse, HKey, etc) return HElement everywhere, not HELEMENT … … 6 6 //todo: wrap HRange propperly 7 7 //todo: handleEvent(size) followed by handleEvent(draw) makes draw to not work, but vice versa works 8 //todo: port Andrew's hpp behaviors 8 //todo: port Andrew's hpp behaviors (or get some ideas from them) 9 //todo: flowerd.skin: msgBox, SkinnedWindow.icon, dropped files (and other dropped stuff) handler, HSkinLite 10 //todo: add scripting support 11 //todo: add mootools style animator class 9 12 10 13 /* 11 14 12 15 changelog: 16 17 0.7 18 JSON_VALUE.toString is not including the terminating null character for strings anymore 19 added shortcuts for all HElement states (most of which are only getters; i.e. readOnly, disabled, checked, etc.) 20 made HJson a separate class instead of alias of JSON_VALUE 21 upadated to HTMLayout 3.2.2.13 (new HDataArrived members) 22 added HJson.V_BYTES 23 renamed HLayout.elementByUID to HLayout.getUID 24 added HElement.location 25 added HElement.isInside 26 added flowerd.sharedlib, which can now load HTMLayout from memory 27 added HBehavior.reset and HBehavior.resetAll . This is intended to be used if HTMLayout is unloaded and loaded again in the lifetime of the application 13 28 14 29 0.6 … … 343 358 } 344 359 345 HElement elementByUID(UINT uid)360 HElement getUID(UINT uid) 346 361 { 347 362 HELEMENT hret;
