94 $this->countCtrls = 1000;
95 $this->callback = array();
107 private function callWinBinder($function, $params = array(), $removeErrorHandler =
false)
110 if ( function_exists( $function ) ) {
111 if ( $removeErrorHandler ) {
112 $result = @call_user_func_array( $function, $params );
115 $result = call_user_func_array( $function, $params );
137 public function createWindow($parent, $wclass, $caption, $xPos, $yPos, $width, $height, $style =
null, $params =
null)
141 $caption = empty( $caption ) ? $this->defaultTitle : $this->defaultTitle .
' - ' . $caption;
142 $window = $this->
callWinBinder(
'wb_create_window', array($parent, $wclass, $caption, $xPos, $yPos, $width, $height, $style, $params) );
165 public function createControl($parent, $ctlClass, $caption, $xPos, $yPos, $width, $height, $style =
null, $params =
null)
170 self::CTRL_ID => $this->countCtrls,
171 self::CTRL_OBJ => $this->
callWinBinder(
'wb_create_control', array(
172 $parent, $ctlClass, $caption, $xPos, $yPos, $width, $height, $this->countCtrls, $style, $params
188 public function createAppWindow($caption, $width, $height, $style =
null, $params =
null)
190 return $this->
createWindow(
null, AppWindow, $caption, WBC_CENTER, WBC_CENTER, $width, $height, $style, $params );
206 $window = $this->
createWindow(
null, NakedWindow, $caption, WBC_CENTER, WBC_CENTER, $width, $height, $style, $params );
207 $this->
setArea( $window, $width, $height );
219 $this->
callWinBinder(
'wb_destroy_window', array($window),
true );
242 return $this->
callWinBinder(
'wb_refresh', array($wbobject,
true) );
254 return $this->
callWinBinder(
'wb_get_system_info', array($info) );
269 public function drawImage($wbobject, $path, $xPos = 0, $yPos = 0, $width = 0, $height = 0)
271 $image = $this->
callWinBinder(
'wb_load_image', array($path) );
273 return $this->
callWinBinder(
'wb_draw_image', array($wbobject, $image, $xPos, $yPos, $width, $height) );
289 public function drawText($parent, $caption, $xPos, $yPos, $width =
null, $height =
null, $font =
null)
291 $caption = str_replace( self::NEW_LINE, PHP_EOL, $caption );
292 $width = $width ==
null ? 120 : $width;
293 $height = $height ==
null ? 25 : $height;
295 return $this->
callWinBinder(
'wb_draw_text', array($parent, $caption, $xPos, $yPos, $width, $height, $font) );
311 public function drawRect($parent, $xPos, $yPos, $width, $height, $color = 15790320, $filled =
true)
313 return $this->
callWinBinder(
'wb_draw_rect', array($parent, $xPos, $yPos, $width, $height, $color, $filled) );
329 public function drawLine($wbobject, $xStartPos, $yStartPos, $xEndPos, $yEndPos, $color, $height = 1)
331 return $this->
callWinBinder(
'wb_draw_line', array($wbobject, $xStartPos, $yStartPos, $xEndPos, $yEndPos, $color, $height) );
344 public function createFont($fontName, $size =
null, $color =
null, $style =
null)
346 return $this->
callWinBinder(
'wb_create_font', array($fontName, $size, $color, $style) );
356 public function wait($wbobject =
null)
358 return $this->
callWinBinder(
'wb_wait', array($wbobject),
true );
374 self::CTRL_ID => $this->countCtrls,
375 self::CTRL_OBJ => $this->
callWinBinder(
'wb_create_timer', array($wbobject, $this->countCtrls, $wait) )
389 return $this->
callWinBinder(
'wb_destroy_timer', array($wbobject, $timerobject) );
401 public function exec($cmd, $params =
null, $silent =
false)
407 $cmd =
'wscript.exe';
408 $params = !empty( $params ) ? $silent .
' "' . $params .
'"' : $silent;
411 $this->
writeLog(
'exec: ' . $cmd .
' ' . $params );
413 return $this->
callWinBinder(
'wb_exec', array($cmd, $params) );
441 public function setHandler($wbobject, $classCallback, $methodCallback, $launchTimer =
null)
443 if ( $launchTimer !=
null ) {
444 $launchTimer = $this->
createTimer( $wbobject, $launchTimer );
447 $this->callback[$wbobject] = array($classCallback, $methodCallback, $launchTimer);
449 return $this->
callWinBinder(
'wb_set_handler', array($wbobject,
'__winbinderEventHandler') );
462 return $this->
callWinBinder(
'wb_set_image', array($wbobject, $path) );
475 return $this->
callWinBinder(
'wb_send_message', array($wbobject, 0x00c5, $length, 0) );
487 public function setArea($wbobject, $width, $height)
489 return $this->
callWinBinder(
'wb_set_area', array($wbobject, WBC_TITLE, 0, 0, $width, $height) );
501 return $this->
callWinBinder(
'wb_get_text', array($wbobject) );
514 $content = str_replace( self::NEW_LINE, PHP_EOL, $content );
516 return $this->
callWinBinder(
'wb_set_text', array($wbobject, $content) );
528 return $this->
callWinBinder(
'wb_get_value', array($wbobject) );
541 return $this->
callWinBinder(
'wb_set_value', array($wbobject, $content) );
563 return $this->
callWinBinder(
'wb_set_focus', array($wbobject) );
574 public function setCursor($wbobject, $type = self::CURSOR_ARROW)
576 return $this->
callWinBinder(
'wb_set_cursor', array($wbobject, $type) );
588 return $this->
callWinBinder(
'wb_get_enabled', array($wbobject) );
601 return $this->
callWinBinder(
'wb_set_enabled', array($wbobject, $enabled) );
626 return $this->
callWinBinder(
'wb_set_style', array($wbobject, $style) );
640 return $this->
callWinBinder(
'wb_set_range', array($wbobject, $min, $max) );
654 return $this->
callWinBinder(
'wb_sys_dlg_path', array($parent, $title, $path) );
667 public function sysDlgOpen($parent, $title, $filter =
null, $path =
null)
669 return $this->
callWinBinder(
'wb_sys_dlg_open', array($parent, $title, $filter, $path) );
686 public function createLabel($parent, $caption, $xPos, $yPos, $width =
null, $height =
null, $style =
null, $params =
null)
688 $caption = str_replace( self::NEW_LINE, PHP_EOL, $caption );
689 $width = $width ==
null ? 120 : $width;
690 $height = $height ==
null ? 25 : $height;
692 return $this->
createControl( $parent, Label, $caption, $xPos, $yPos, $width, $height, $style, $params );
710 public function createInputText($parent, $value, $xPos, $yPos, $width =
null, $height =
null, $maxLength =
null, $style =
null, $params =
null)
712 $value = str_replace( self::NEW_LINE, PHP_EOL, $value );
713 $width = $width ==
null ? 120 : $width;
714 $height = $height ==
null ? 25 : $height;
715 $inputText = $this->
createControl( $parent, EditBox, (
string) $value, $xPos, $yPos, $width, $height, $style, $params );
716 if ( is_numeric( $maxLength ) && $maxLength > 0 ) {
717 $this->
setMaxLength( $inputText[self::CTRL_OBJ], $maxLength );
737 public function createEditBox($parent, $value, $xPos, $yPos, $width =
null, $height =
null, $style =
null, $params =
null)
739 $value = str_replace( self::NEW_LINE, PHP_EOL, $value );
740 $width = $width ==
null ? 540 : $width;
741 $height = $height ==
null ? 340 : $height;
742 $editBox = $this->
createControl( $parent, RTFEditBox, (
string) $value, $xPos, $yPos, $width, $height, $style, $params );
761 public function createHyperLink($parent, $caption, $xPos, $yPos, $width =
null, $height =
null, $style =
null, $params =
null)
763 $caption = str_replace( self::NEW_LINE, PHP_EOL, $caption );
764 $width = $width ==
null ? 120 : $width;
765 $height = $height ==
null ? 15 : $height;
766 $hyperLink = $this->
createControl( $parent, HyperLink, (
string) $caption, $xPos, $yPos, $width, $height, $style, $params );
767 $this->
setCursor( $hyperLink[self::CTRL_OBJ], self::CURSOR_FINGER );
786 public function createRadioButton($parent, $caption, $checked, $xPos, $yPos, $width =
null, $height =
null, $startGroup =
false)
788 $caption = str_replace( self::NEW_LINE, PHP_EOL, $caption );
789 $width = $width ==
null ? 120 : $width;
790 $height = $height ==
null ? 25 : $height;
792 return $this->
createControl( $parent, RadioButton, (
string) $caption, $xPos, $yPos, $width, $height, $startGroup ? WBC_GROUP :
null, $checked ? 1 : 0 );
809 public function createButton($parent, $caption, $xPos, $yPos, $width =
null, $height =
null, $style =
null, $params =
null)
811 $width = $width ==
null ? 80 : $width;
812 $height = $height ==
null ? 25 : $height;
814 return $this->
createControl( $parent, PushButton, $caption, $xPos, $yPos, $width, $height, $style, $params );
831 public function createProgressBar($parent, $max, $xPos, $yPos, $width =
null, $height =
null, $style =
null, $params =
null)
835 $width = $width ==
null ? 200 : $width;
836 $height = $height ==
null ? 15 : $height;
839 $this->
setRange( $progressBar[self::CTRL_OBJ], 0, $max );
873 if ( $progressBar !=
null && isset( $progressBar[self::CTRL_OBJ] ) && isset( $this->gauge[$progressBar[self::CTRL_OBJ]] ) ) {
874 if ( strval( $value ) == self::INCR_PROGRESS_BAR ) {
877 if ( is_numeric( $value ) ) {
879 $this->
setValue( $progressBar[self::CTRL_OBJ], $value );
892 $this->
setRange( $progressBar[self::CTRL_OBJ], 0, $max );
908 $message = str_replace( self::NEW_LINE, PHP_EOL, $message );
910 null, strlen( $message ) < 64 ? str_pad( $message, 64 ) : $message,
911 $title ==
null ? $this->defaultTitle : $this->defaultTitle .
' - ' . $title, $type
931 return $this->
messageBox( $message, self::BOX_INFO, $title );
944 return $this->
messageBox( $message, self::BOX_OK, $title );
957 return $this->
messageBox( $message, self::BOX_OKCANCEL, $title );
970 return $this->
messageBox( $message, self::BOX_QUESTION, $title );
983 return $this->
messageBox( $message, self::BOX_ERROR, $title );
996 return $this->
messageBox( $message, self::BOX_WARNING, $title );
1009 return $this->
messageBox( $message, self::BOX_YESNO, $title );
1022 return $this->
messageBox( $message, self::BOX_YESNOCANCEL, $title );
1042 global $bearsamppWinbinder;
1044 if ( $bearsamppWinbinder->callback[$window][2] !=
null ) {
1045 $bearsamppWinbinder->destroyTimer( $window, $bearsamppWinbinder->callback[$window][2][0] );
1048 call_user_func_array(
1049 array($bearsamppWinbinder->callback[$window][0], $bearsamppWinbinder->callback[$window][1]),
1050 array($window, $id, $ctrl, $param1, $param2)
static logDebug($data, $file=null)
static logInitClass($classInstance)
exec($cmd, $params=null, $silent=false)
sysDlgOpen($parent, $title, $filter=null, $path=null)
setHandler($wbobject, $classCallback, $methodCallback, $launchTimer=null)
createNakedWindow($caption, $width, $height, $style=null, $params=null)
messageBoxYesNoCancel($message, $title=null)
createAppWindow($caption, $width, $height, $style=null, $params=null)
callWinBinder($function, $params=array(), $removeErrorHandler=false)
createEditBox($parent, $value, $xPos, $yPos, $width=null, $height=null, $style=null, $params=null)
incrProgressBar($progressBar)
messageBoxQuestion($message, $title=null)
createRadioButton($parent, $caption, $checked, $xPos, $yPos, $width=null, $height=null, $startGroup=false)
drawLine($wbobject, $xStartPos, $yStartPos, $xEndPos, $yEndPos, $color, $height=1)
setStyle($wbobject, $style)
sysDlgPath($parent, $title, $path=null)
messageBox($message, $type, $title=null)
setMaxLength($wbobject, $length)
createLabel($parent, $caption, $xPos, $yPos, $width=null, $height=null, $style=null, $params=null)
createControl($parent, $ctlClass, $caption, $xPos, $yPos, $width, $height, $style=null, $params=null)
createButton($parent, $caption, $xPos, $yPos, $width=null, $height=null, $style=null, $params=null)
setText($wbobject, $content)
createTimer($wbobject, $wait=1000)
messageBoxInfo($message, $title=null)
createHyperLink($parent, $caption, $xPos, $yPos, $width=null, $height=null, $style=null, $params=null)
messageBoxOkCancel($message, $title=null)
createFont($fontName, $size=null, $color=null, $style=null)
setEnabled($wbobject, $enabled=true)
resetProgressBar($progressBar)
setProgressBarValue($progressBar, $value)
drawImage($wbobject, $path, $xPos=0, $yPos=0, $width=0, $height=0)
setArea($wbobject, $width, $height)
drawText($parent, $caption, $xPos, $yPos, $width=null, $height=null, $font=null)
setImage($wbobject, $path)
createProgressBar($parent, $max, $xPos, $yPos, $width=null, $height=null, $style=null, $params=null)
setValue($wbobject, $content)
setRange($wbobject, $min, $max)
messageBoxOk($message, $title=null)
setCursor($wbobject, $type=self::CURSOR_ARROW)
createWindow($parent, $wclass, $caption, $xPos, $yPos, $width, $height, $style=null, $params=null)
messageBoxYesNo($message, $title=null)
setProgressBarMax($progressBar, $max)
destroyTimer($wbobject, $timerobject)
messageBoxError($message, $title=null)
drawRect($parent, $xPos, $yPos, $width, $height, $color=15790320, $filled=true)
messageBoxWarning($message, $title=null)
createInputText($parent, $value, $xPos, $yPos, $width=null, $height=null, $maxLength=null, $style=null, $params=null)
__winbinderEventHandler($window, $id, $ctrl, $param1, $param2)