212 $winvar =
'$mainwin',
219 $height = WBC_CENTER,
224 global $_winclass, $_usergeom, $path_res;
228 $_usergeom = array($x, $y, $width, $height);
229 $path_res = $respath;
233 $rc = preg_replace(
"/^\s*;.*$/m",
"", $rc);
234 $rc = preg_replace(
"/^\s*(.*)$/m",
"\\1", $rc);
239 $def = preg_replace(
'/^((?!#define).)*$/m',
"\\2", $rc);
243 $def = preg_replace(
"/\n+/m",
"\n", $def);
247 $def = preg_replace(
"/#define\s+(\w+)\s+\"(.*)\"/",
"if(!defined(\"\\1\")) define(\"\\1\", \"\\2\");", $def);
251 $def = preg_replace(
"/#define\s+(\w+)\s+'(.+)'/",
"if(!defined(\"\\1\")) define(\"\\1\", \"\\2\");", $def);
255 $def = preg_replace(
"/#define\s+(\w+)\s+(\S+)/",
"if(!defined(\"\\1\")) define(\"\\1\", \\2);", $def);
256 $def =
"// Control identifiers\n\n" . preg_replace(
"/(\r\n|\r|\n)+/sm",
"\n", $def);
260 $rc = preg_replace(
"/^\s*#define(.*)$/m",
"", $rc);
266 $tok =
"\s*((?:[\"'][\S \t]*[\"'])|(?:[\S^,'\"]+))\s*";
267 $rc =
"// Create window\n\n" . preg_replace_callback(
"/^$tok\s+DIALOGEX$tok,$tok,$tok,$tok\s+CAPTION$tok\s+FONT$tok,$tok\s+STYLE$tok\s+EXSTYLE$tok/m",
"_scale_dialog", $rc);
271 $rc = preg_replace_callback(
"/^\s*CONTROL\s+$tok,$tok,$tok,$tok,$tok,$tok,$tok,$tok,$tok/m",
"_scale_controls", $rc);
275 $rc = preg_replace(
"/^\s*BEGIN/m",
"\n// Insert controls\n", $rc);
276 $rc = preg_replace(
"/^\s*END/m",
"\n// End controls", $rc);
280 $rc = str_replace(
"%WINVAR%", $winvar, $rc);
281 $rc = str_replace(
"%PARENT%", $parent ? $parent :
"0", $rc);
282 $rc = str_replace(
"%STYLE%", $style, $rc);
283 $rc = str_replace(
"%LPARAM%", $lparam, $rc);
292 global $_winclass, $_usergeom, $_tabN;
294 if ($_winclass ==
"TabControl") {
296 $code =
"wb_create_item(%PARENT%, " . $c[6] .
");\n";
299 $_addy = 4 + 42 + 17 + 4;
301 switch (is_string($_winclass) ? strtolower($_winclass) : $_winclass) {
303 $_winclass = AppWindow;
305 $_addy = 3 + 18 + 22 + 18 + 3;
307 case "resizablewindow":
308 $_winclass = ResizableWindow;
310 $_addy = 4 + 42 + 17 + 4;
313 $_winclass = ModalDialog;
315 $_addy = 4 + 42 + 17 + 4;
317 case "modelessdialog":
318 $_winclass = ModelessDialog;
321 $_winclass = ToolDialog;
325 if (!(($_usergeom[0] == WBC_CENTER && $_usergeom[1] == WBC_CENTER &&
326 $_usergeom[2] == WBC_CENTER && $_usergeom[3] == WBC_CENTER))) {
327 $code =
"%WINVAR% = wb_create_window(" .
331 $_usergeom[0] .
", " .
332 $_usergeom[1] .
", " .
333 $_usergeom[2] .
", " .
334 $_usergeom[3] .
", " .
339 if (is_array($_usergeom)) {
340 if (count($_usergeom) == 2) {
341 $_usergeom[2] = $_usergeom[0];
342 $_usergeom[3] = $_usergeom[1];
343 $_usergeom[0] = WBC_CENTER;
344 $_usergeom[1] = WBC_CENTER;
346 } elseif (is_null($_usergeom)) {
347 $_usergeom[0] = WBC_DEFAULTPOS;
348 $_usergeom[1] = WBC_DEFAULTPOS;
349 $_usergeom[2] = WBC_DEFAULTPOS;
350 $_usergeom[3] = WBC_DEFAULTPOS;
353 $code =
"%WINVAR% = wb_create_window(" .
361 (int)($c[4] * WB_KX_SCREEN) .
", " .
362 (int)($c[5] * WB_KY_SCREEN) .
", " .
375 global $_tabN, $path_res;
378 $winstyle = hexdec($c[4]);
379 $winexstyle = hexdec($c[9]);
382 $style =
"WBC_VISIBLE";
384 $style =
"WBC_INVISIBLE";
388 $style .=
" | WBC_DISABLED";
390 $style .=
" | WBC_ENABLED";
393 if (
_bit_test($winexstyle, WS_EX_STATICEDGE)) {
394 $style .=
" | WBC_BORDER";
399 switch (strtolower($winclass)) {
402 switch ($winstyle & 0x0F) {
403 case BS_AUTORADIOBUTTON:
405 $class =
"RadioButton";
407 $style .=
" | WBC_GROUP";
410 case BS_AUTOCHECKBOX:
419 $class =
"PushButton";
426 switch ($winstyle & 0x1F) {
429 $style .=
" | WBC_IMAGE | WBC_CENTER";
438 if (
_bit_test($winstyle, SS_WORDELLIPSIS)) {
439 $style .=
" | WBC_ELLIPSIS";
441 $style .=
" | WBC_CENTER";
445 if (
_bit_test($winstyle, SS_WORDELLIPSIS)) {
446 $style .=
" | WBC_ELLIPSIS";
448 $style .=
" | WBC_RIGHT";
453 if (!
_bit_test($winstyle, SS_LEFTNOWORDWRAP)) {
454 $style .=
" | WBC_MULTILINE";
456 if (
_bit_test($winstyle, SS_WORDELLIPSIS)) {
457 $style .=
" | WBC_ELLIPSIS";
466 if (
_bit_test($winstyle, ES_MULTILINE)) {
467 $style .=
" | WBC_MULTILINE";
469 switch ($winstyle & 0x03) {
471 $style .=
" | WBC_CENTER";
474 $style .=
" | WBC_RIGHT";
482 $style .=
" | WBC_READONLY";
485 $style .=
" | WBC_MASKED";
488 $style .=
" | WBC_NUMBER";
492 case '"richedit20a"':
494 $style .=
" | WBC_READONLY";
496 $class =
"RTFEditBox";
497 switch ($winstyle & 0x03) {
499 $style .=
" | WBC_CENTER";
502 $style .=
" | WBC_RIGHT";
513 $style .=
" | WBC_SORT";
515 if (
_bit_test($winstyle, CBS_DROPDOWNLIST)) {
516 $style .=
" | WBC_READONLY";
523 $style .=
" | WBC_SORT";
528 $class =
"ScrollBar";
531 case '"syslistview32"':
533 if (!
_bit_test($winstyle, LVS_NOSORTHEADER)) {
534 $style .=
" | WBC_SORT";
536 if (
_bit_test($winstyle, LVS_GRIDLINES)) {
537 $style .=
" | WBC_LINES";
539 if (
_bit_test($winstyle, LVS_CHECKBOXES)) {
540 $style .=
" | WBC_CHECKBOXES";
542 if (!
_bit_test($winstyle, LVS_SINGLESEL)) {
543 $style .=
" | WBC_SINGLE";
547 case '"systabcontrol32"':
548 $class =
"TabControl";
551 case '"systreeview32"':
555 case '"toolbarwindow32"':
559 case '"msctls_progress32"':
563 case '"msctls_statusbar32"':
564 $class =
"StatusBar";
567 case '"sysmonthcal32"':
571 case '"msctls_trackbar32"':
573 if (
_bit_test($winstyle, TBS_AUTOTICKS)) {
574 $style .=
" | WBC_LINES";
578 case '"msctls_updown32"':
581 $style .=
" | WBC_GROUP";
588 $str =
"wb_create_control(" .
592 (int)($c[5] * WB_KX_SCREEN) .
", " .
593 (int)($c[6] * WB_KY_SCREEN) .
", " .
594 (int)($c[7] * WB_KX_SCREEN) .
", " .
595 (int)($c[8] * WB_KY_SCREEN) .
", " .
599 ($_tabN ?
", " . ($_tabN - 1) .
");\n" :
");\n");
606 if (strstr($style,
"WBC_IMAGE")) {
607 if (($winstyle & (SS_BITMAP | SS_ICON)) && ($c[1] !==
'""')) {
609 if (preg_match(
"/\.(bmp|ico)$/", $image)) {
610 $str =
"\$_tmp_ctrl_ = " . $str .
"wb_set_image(\$_tmp_ctrl_, '$image', GREEN);" .
" unset(\$_tmp_ctrl_);\n";
618 if (($winstyle & (BS_BITMAP | BS_ICON)) && ($c[1] !==
'""')) {
621 if (preg_match(
"/\.(bmp|ico)$/", $image)) {
622 $str =
"\$_tmp_ctrl_ = " . $str .
"wb_set_image(\$_tmp_ctrl_, '$image', GREEN);" .
" unset(\$_tmp_ctrl_);\n";
if(!defined("WB_KX_SCREEN")) if(!defined("WB_KY_SCREEN")) if(!defined("WS_VISIBLE")) if(!defined("WS_DISABLED")) if(!defined("WS_GROUP")) if(!defined("WS_EX_STATICEDGE")) if(!defined('BM_SETCHECK')) if(!defined( 'LVM_FIRST')) if(!defined('LVM_DELETEALLITEMS')) if(!defined( 'LVM_GETITEMCOUNT')) if(!defined('LVM_GETITEMSTATE')) if(!defined( 'LVM_GETSELECTEDCOUNT')) if(!defined('LVIS_SELECTED')) if(!defined( 'TCM_GETCURSEL')) if(!defined('CB_FINDSTRINGEXACT')) if(!defined( 'CB_SETCURSEL')) if(!defined('LB_FINDSTRINGEXACT')) if(!defined( 'LB_SETCURSEL')) if(!defined('TCM_SETCURSEL')) if(!defined( 'WM_SETTEXT')) if(!defined("BS_PUSHBUTTON")) if(!defined("BS_CHECKBOX")) if(!defined("BS_AUTOCHECKBOX")) if(!defined("BS_RADIOBUTTON")) if(!defined("BS_GROUPBOX")) if(!defined("BS_AUTORADIOBUTTON")) if(!defined("BS_ICON")) if(!defined("BS_BITMAP")) if(!defined("ES_NUMBER")) if(!defined("ES_PASSWORD")) if(!defined("ES_READONLY")) if(!defined("ES_UPPERCASE")) if(!defined("ES_LEFT")) if(!defined("ES_CENTER")) if(!defined("ES_RIGHT")) if(!defined("ES_MULTILINE")) if(!defined("SS_LEFT")) if(!defined("SS_CENTER")) if(!defined("SS_RIGHT")) if(!defined("SS_ETCHEDHORZ")) if(!defined("SS_ETCHEDVERT")) if(!defined("SS_ETCHEDFRAME")) if(!defined("SS_ICON")) if(!defined("SS_BITMAP")) if(!defined("SS_LEFTNOWORDWRAP")) if(!defined("SS_WORDELLIPSIS")) if(!defined("CBS_SORT")) if(!defined("CBS_DROPDOWNLIST")) if(!defined("LBS_SORT")) if(!defined("LVS_NOSORTHEADER")) if(!defined("LVS_GRIDLINES")) if(!defined("LVS_CHECKBOXES")) if(!defined("LVS_SINGLESEL")) if(!defined("TBS_AUTOTICKS")) parse_rc( $rc, $winvar=' $mainwin', $parent=0, $type="AppWindow", $caption="", $x=WBC_CENTER, $y=WBC_CENTER, $width=WBC_CENTER, $height=WBC_CENTER, $style=0, $lparam=0, $respath=PATH_RES)