2024.8.23
Loading...
Searching...
No Matches
WinBinder Class Reference

Public Member Functions

 __construct ()
 
 createAppWindow ($caption, $width, $height, $style=null, $params=null)
 
 createButton ($parent, $caption, $xPos, $yPos, $width=null, $height=null, $style=null, $params=null)
 
 createControl ($parent, $ctlClass, $caption, $xPos, $yPos, $width, $height, $style=null, $params=null)
 
 createEditBox ($parent, $value, $xPos, $yPos, $width=null, $height=null, $style=null, $params=null)
 
 createFont ($fontName, $size=null, $color=null, $style=null)
 
 createHyperLink ($parent, $caption, $xPos, $yPos, $width=null, $height=null, $style=null, $params=null)
 
 createInputText ($parent, $value, $xPos, $yPos, $width=null, $height=null, $maxLength=null, $style=null, $params=null)
 
 createLabel ($parent, $caption, $xPos, $yPos, $width=null, $height=null, $style=null, $params=null)
 
 createNakedWindow ($caption, $width, $height, $style=null, $params=null)
 
 createProgressBar ($parent, $max, $xPos, $yPos, $width=null, $height=null, $style=null, $params=null)
 
 createRadioButton ($parent, $caption, $checked, $xPos, $yPos, $width=null, $height=null, $startGroup=false)
 
 createTimer ($wbobject, $wait=1000)
 
 createWindow ($parent, $wclass, $caption, $xPos, $yPos, $width, $height, $style=null, $params=null)
 
 destroyTimer ($wbobject, $timerobject)
 
 destroyWindow ($window)
 
 drawImage ($wbobject, $path, $xPos=0, $yPos=0, $width=0, $height=0)
 
 drawLine ($wbobject, $xStartPos, $yStartPos, $xEndPos, $yEndPos, $color, $height=1)
 
 drawRect ($parent, $xPos, $yPos, $width, $height, $color=15790320, $filled=true)
 
 drawText ($parent, $caption, $xPos, $yPos, $width=null, $height=null, $font=null)
 
 exec ($cmd, $params=null, $silent=false)
 
 findFile ($filename)
 
 getFocus ()
 
 getSystemInfo ($info)
 
 getText ($wbobject)
 
 getValue ($wbobject)
 
 incrProgressBar ($progressBar)
 
 isEnabled ($wbobject)
 
 mainLoop ()
 
 messageBox ($message, $type, $title=null)
 
 messageBoxError ($message, $title=null)
 
 messageBoxInfo ($message, $title=null)
 
 messageBoxOk ($message, $title=null)
 
 messageBoxOkCancel ($message, $title=null)
 
 messageBoxQuestion ($message, $title=null)
 
 messageBoxWarning ($message, $title=null)
 
 messageBoxYesNo ($message, $title=null)
 
 messageBoxYesNoCancel ($message, $title=null)
 
 refresh ($wbobject)
 
 reset ()
 
 resetProgressBar ($progressBar)
 
 setArea ($wbobject, $width, $height)
 
 setCursor ($wbobject, $type=self::CURSOR_ARROW)
 
 setDisabled ($wbobject)
 
 setEnabled ($wbobject, $enabled=true)
 
 setFocus ($wbobject)
 
 setHandler ($wbobject, $classCallback, $methodCallback, $launchTimer=null)
 
 setImage ($wbobject, $path)
 
 setMaxLength ($wbobject, $length)
 
 setProgressBarMax ($progressBar, $max)
 
 setProgressBarValue ($progressBar, $value)
 
 setRange ($wbobject, $min, $max)
 
 setStyle ($wbobject, $style)
 
 setText ($wbobject, $content)
 
 setValue ($wbobject, $content)
 
 sysDlgOpen ($parent, $title, $filter=null, $path=null)
 
 sysDlgPath ($parent, $title, $path=null)
 
 wait ($wbobject=null)
 

Data Fields

 $callback
 
 $gauge
 
const BOX_ERROR = WBC_STOP
 
const BOX_INFO = WBC_INFO
 
const BOX_OK = WBC_OK
 
const BOX_OKCANCEL = WBC_OKCANCEL
 
const BOX_QUESTION = WBC_QUESTION
 
const BOX_WARNING = WBC_WARNING
 
const BOX_YESNO = WBC_YESNO
 
const BOX_YESNOCANCEL = WBC_YESNOCANCEL
 
const CTRL_ID = 0
 
const CTRL_OBJ = 1
 
const CURSOR_ARROW = 'arrow'
 
const CURSOR_CROSS = 'cross'
 
const CURSOR_FINGER = 'finger'
 
const CURSOR_FORBIDDEN = 'forbidden'
 
const CURSOR_HELP = 'help'
 
const CURSOR_IBEAM = 'ibeam'
 
const CURSOR_NONE = null
 
const CURSOR_SIZEALL = 'sizeall'
 
const CURSOR_SIZENESW = 'sizenesw'
 
const CURSOR_SIZENS = 'sizens'
 
const CURSOR_SIZENWSE = 'sizenwse'
 
const CURSOR_SIZEWE = 'sizewe'
 
const CURSOR_UPARROW = 'uparrow'
 
const CURSOR_WAIT = 'wait'
 
const CURSOR_WAITARROW = 'waitarrow'
 
const INCR_PROGRESS_BAR = '++'
 
const NEW_LINE = '@nl@'
 
const SYSINFO_SCREENAREA = 'screenarea'
 
const SYSINFO_WORKAREA = 'workarea'
 

Private Member Functions

 callWinBinder ($function, $params=array(), $removeErrorHandler=false)
 

Static Private Member Functions

static writeLog ($log)
 

Private Attributes

 $countCtrls
 
 $defaultTitle
 

Detailed Description

Class WinBinder

This class provides an interface to the WinBinder library, allowing for the creation and management of Windows GUI elements in PHP. It includes methods for creating windows, controls, handling events, and executing system commands.

Definition at line 17 of file class.winbinder.php.

Constructor & Destructor Documentation

◆ __construct()

WinBinder::__construct ( )

WinBinder constructor.

Initializes the WinBinder class, sets the default window title, and resets control counters.

Definition at line 69 of file class.winbinder.php.

70 {
71 global $bearsamppCore;
72 Util::logInitClass( $this );
73
74 $this->defaultTitle = APP_TITLE . ' ' . $bearsamppCore->getAppVersion();
75 $this->reset();
76 }
global $bearsamppCore
static logInitClass($classInstance)
const APP_TITLE
Definition root.php:12

References $bearsamppCore, APP_TITLE, Util\logInitClass(), and reset().

Member Function Documentation

◆ callWinBinder()

WinBinder::callWinBinder ( $function,
$params = array(),
$removeErrorHandler = false )
private

Calls a WinBinder function with the specified parameters.

Parameters
string$functionThe name of the WinBinder function to call.
array$paramsThe parameters to pass to the function.
bool$removeErrorHandlerWhether to remove the error handler during the call.
Returns
mixed The result of the function call.

Definition at line 107 of file class.winbinder.php.

108 {
109 $result = false;
110 if ( function_exists( $function ) ) {
111 if ( $removeErrorHandler ) {
112 $result = @call_user_func_array( $function, $params );
113 }
114 else {
115 $result = call_user_func_array( $function, $params );
116 }
117 }
118
119 return $result;
120 }
$result

References $result.

Referenced by createControl(), createFont(), createTimer(), createWindow(), destroyTimer(), destroyWindow(), drawImage(), drawLine(), drawRect(), drawText(), exec(), findFile(), getFocus(), getSystemInfo(), getText(), getValue(), isEnabled(), mainLoop(), messageBox(), refresh(), setArea(), setCursor(), setEnabled(), setFocus(), setHandler(), setImage(), setMaxLength(), setRange(), setStyle(), setText(), setValue(), sysDlgOpen(), sysDlgPath(), and wait().

+ Here is the caller graph for this function:

◆ createAppWindow()

WinBinder::createAppWindow ( $caption,
$width,
$height,
$style = null,
$params = null )

Creates a new application window.

Parameters
string$captionThe window caption.
int$widthThe width of the window.
int$heightThe height of the window.
mixed$styleThe window style.
mixed$paramsAdditional parameters for the window.
Returns
mixed The created window object.

Definition at line 188 of file class.winbinder.php.

189 {
190 return $this->createWindow( null, AppWindow, $caption, WBC_CENTER, WBC_CENTER, $width, $height, $style, $params );
191 }
createWindow($parent, $wclass, $caption, $xPos, $yPos, $width, $height, $style=null, $params=null)

References createWindow().

◆ createButton()

WinBinder::createButton ( $parent,
$caption,
$xPos,
$yPos,
$width = null,
$height = null,
$style = null,
$params = null )

Creates a button control.

Parameters
mixed$parentThe parent window or control.
string$captionThe caption for the button.
int$xPosThe x-coordinate of the button.
int$yPosThe y-coordinate of the button.
int | null$widthThe width of the button.
int | null$heightThe height of the button.
mixed$styleThe style for the button.
mixed$paramsAdditional parameters for the button.
Returns
array An array containing the control ID and object.

Definition at line 809 of file class.winbinder.php.

810 {
811 $width = $width == null ? 80 : $width;
812 $height = $height == null ? 25 : $height;
813
814 return $this->createControl( $parent, PushButton, $caption, $xPos, $yPos, $width, $height, $style, $params );
815 }
createControl($parent, $ctlClass, $caption, $xPos, $yPos, $width, $height, $style=null, $params=null)

References createControl().

◆ createControl()

WinBinder::createControl ( $parent,
$ctlClass,
$caption,
$xPos,
$yPos,
$width,
$height,
$style = null,
$params = null )

Creates a new control.

Parameters
mixed$parentThe parent window or control.
string$ctlClassThe control class.
string$captionThe control caption.
int$xPosThe x-coordinate of the control.
int$yPosThe y-coordinate of the control.
int$widthThe width of the control.
int$heightThe height of the control.
mixed$styleThe control style.
mixed$paramsAdditional parameters for the control.
Returns
array An array containing the control ID and object.

Definition at line 165 of file class.winbinder.php.

166 {
167 $this->countCtrls++;
168
169 return array(
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
173 ) ),
174 );
175 }
callWinBinder($function, $params=array(), $removeErrorHandler=false)

References callWinBinder().

Referenced by createButton(), createEditBox(), createHyperLink(), createInputText(), createLabel(), createProgressBar(), and createRadioButton().

+ Here is the caller graph for this function:

◆ createEditBox()

WinBinder::createEditBox ( $parent,
$value,
$xPos,
$yPos,
$width = null,
$height = null,
$style = null,
$params = null )

Creates an edit box control.

Parameters
mixed$parentThe parent window or control.
string$valueThe initial value for the edit box.
int$xPosThe x-coordinate of the edit box.
int$yPosThe y-coordinate of the edit box.
int | null$widthThe width of the edit box.
int | null$heightThe height of the edit box.
mixed$styleThe style for the edit box.
mixed$paramsAdditional parameters for the edit box.
Returns
array An array containing the control ID and object.

Definition at line 737 of file class.winbinder.php.

738 {
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 );
743
744 return $editBox;
745 }

References createControl().

◆ createFont()

WinBinder::createFont ( $fontName,
$size = null,
$color = null,
$style = null )

Creates a font for use in WinBinder controls.

Parameters
string$fontNameThe name of the font.
int | null$sizeThe size of the font.
int | null$colorThe color of the font.
mixed$styleThe style of the font.
Returns
mixed The created font object.

Definition at line 344 of file class.winbinder.php.

345 {
346 return $this->callWinBinder( 'wb_create_font', array($fontName, $size, $color, $style) );
347 }

References callWinBinder().

◆ createHyperLink()

WinBinder::createHyperLink ( $parent,
$caption,
$xPos,
$yPos,
$width = null,
$height = null,
$style = null,
$params = null )

Creates a hyperlink control.

Parameters
mixed$parentThe parent window or control.
string$captionThe caption for the hyperlink.
int$xPosThe x-coordinate of the hyperlink.
int$yPosThe y-coordinate of the hyperlink.
int | null$widthThe width of the hyperlink.
int | null$heightThe height of the hyperlink.
mixed$styleThe style for the hyperlink.
mixed$paramsAdditional parameters for the hyperlink.
Returns
array An array containing the control ID and object.

Definition at line 761 of file class.winbinder.php.

762 {
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 );
768
769 return $hyperLink;
770 }
setCursor($wbobject, $type=self::CURSOR_ARROW)

References createControl(), and setCursor().

◆ createInputText()

WinBinder::createInputText ( $parent,
$value,
$xPos,
$yPos,
$width = null,
$height = null,
$maxLength = null,
$style = null,
$params = null )

Creates an input text control.

Parameters
mixed$parentThe parent window or control.
string$valueThe initial value for the input text.
int$xPosThe x-coordinate of the input text.
int$yPosThe y-coordinate of the input text.
int | null$widthThe width of the input text.
int | null$heightThe height of the input text.
int | null$maxLengthThe maximum length of the input text.
mixed$styleThe style for the input text.
mixed$paramsAdditional parameters for the input text.
Returns
array An array containing the control ID and object.

Definition at line 710 of file class.winbinder.php.

711 {
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 );
718 }
719
720 return $inputText;
721 }
setMaxLength($wbobject, $length)

References createControl(), and setMaxLength().

◆ createLabel()

WinBinder::createLabel ( $parent,
$caption,
$xPos,
$yPos,
$width = null,
$height = null,
$style = null,
$params = null )

Creates a label control.

Parameters
mixed$parentThe parent window or control.
string$captionThe caption for the label.
int$xPosThe x-coordinate of the label.
int$yPosThe y-coordinate of the label.
int | null$widthThe width of the label.
int | null$heightThe height of the label.
mixed$styleThe style for the label.
mixed$paramsAdditional parameters for the label.
Returns
array An array containing the control ID and object.

Definition at line 686 of file class.winbinder.php.

687 {
688 $caption = str_replace( self::NEW_LINE, PHP_EOL, $caption );
689 $width = $width == null ? 120 : $width;
690 $height = $height == null ? 25 : $height;
691
692 return $this->createControl( $parent, Label, $caption, $xPos, $yPos, $width, $height, $style, $params );
693 }

References createControl().

◆ createNakedWindow()

WinBinder::createNakedWindow ( $caption,
$width,
$height,
$style = null,
$params = null )

Creates a new naked window.

Parameters
string$captionThe window caption.
int$widthThe width of the window.
int$heightThe height of the window.
mixed$styleThe window style.
mixed$paramsAdditional parameters for the window.
Returns
mixed The created window object.

Definition at line 204 of file class.winbinder.php.

205 {
206 $window = $this->createWindow( null, NakedWindow, $caption, WBC_CENTER, WBC_CENTER, $width, $height, $style, $params );
207 $this->setArea( $window, $width, $height );
208
209 return $window;
210 }
setArea($wbobject, $width, $height)

References createWindow(), and setArea().

◆ createProgressBar()

WinBinder::createProgressBar ( $parent,
$max,
$xPos,
$yPos,
$width = null,
$height = null,
$style = null,
$params = null )

Creates a progress bar control.

Parameters
mixed$parentThe parent window or control.
int$maxThe maximum value for the progress bar.
int$xPosThe x-coordinate of the progress bar.
int$yPosThe y-coordinate of the progress bar.
int | null$widthThe width of the progress bar.
int | null$heightThe height of the progress bar.
mixed$styleThe style for the progress bar.
mixed$paramsAdditional parameters for the progress bar.
Returns
array An array containing the control ID and object.

Definition at line 831 of file class.winbinder.php.

832 {
833 global $bearsamppLang;
834
835 $width = $width == null ? 200 : $width;
836 $height = $height == null ? 15 : $height;
837 $progressBar = $this->createControl( $parent, Gauge, $bearsamppLang->getValue( Lang::LOADING ), $xPos, $yPos, $width, $height, $style, $params );
838
839 $this->setRange( $progressBar[self::CTRL_OBJ], 0, $max );
840 $this->gauge[$progressBar[self::CTRL_OBJ]] = 0;
841
842 return $progressBar;
843 }
global $bearsamppLang
const LOADING
setRange($wbobject, $min, $max)

References $bearsamppLang, createControl(), CTRL_OBJ, Lang\LOADING, and setRange().

◆ createRadioButton()

WinBinder::createRadioButton ( $parent,
$caption,
$checked,
$xPos,
$yPos,
$width = null,
$height = null,
$startGroup = false )

Creates a radio button control.

Parameters
mixed$parentThe parent window or control.
string$captionThe caption for the radio button.
bool$checkedWhether the radio button is checked.
int$xPosThe x-coordinate of the radio button.
int$yPosThe y-coordinate of the radio button.
int | null$widthThe width of the radio button.
int | null$heightThe height of the radio button.
bool$startGroupWhether this radio button starts a new group.
Returns
array An array containing the control ID and object.

Definition at line 786 of file class.winbinder.php.

787 {
788 $caption = str_replace( self::NEW_LINE, PHP_EOL, $caption );
789 $width = $width == null ? 120 : $width;
790 $height = $height == null ? 25 : $height;
791
792 return $this->createControl( $parent, RadioButton, (string) $caption, $xPos, $yPos, $width, $height, $startGroup ? WBC_GROUP : null, $checked ? 1 : 0 );
793 }

References createControl().

◆ createTimer()

WinBinder::createTimer ( $wbobject,
$wait = 1000 )

Creates a timer for a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to create the timer for.
int$waitThe wait time in milliseconds.
Returns
array An array containing the timer ID and object.

Definition at line 369 of file class.winbinder.php.

370 {
371 $this->countCtrls++;
372
373 return array(
374 self::CTRL_ID => $this->countCtrls,
375 self::CTRL_OBJ => $this->callWinBinder( 'wb_create_timer', array($wbobject, $this->countCtrls, $wait) )
376 );
377 }

References callWinBinder().

Referenced by setHandler().

+ Here is the caller graph for this function:

◆ createWindow()

WinBinder::createWindow ( $parent,
$wclass,
$caption,
$xPos,
$yPos,
$width,
$height,
$style = null,
$params = null )

Creates a new window.

Parameters
mixed$parentThe parent window or null for a top-level window.
string$wclassThe window class.
string$captionThe window caption.
int$xPosThe x-coordinate of the window.
int$yPosThe y-coordinate of the window.
int$widthThe width of the window.
int$heightThe height of the window.
mixed$styleThe window style.
mixed$paramsAdditional parameters for the window.
Returns
mixed The created window object.

Definition at line 137 of file class.winbinder.php.

138 {
139 global $bearsamppCore;
140
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) );
143
144 // Set tiny window icon
145 $this->setImage( $window, $bearsamppCore->getResourcesPath() . '/homepage/img/icons/app.ico' );
146
147 return $window;
148 }
setImage($wbobject, $path)

References $bearsamppCore, callWinBinder(), and setImage().

Referenced by createAppWindow(), and createNakedWindow().

+ Here is the caller graph for this function:

◆ destroyTimer()

WinBinder::destroyTimer ( $wbobject,
$timerobject )

Destroys a timer for a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to destroy the timer for.
mixed$timerobjectThe timer object to destroy.
Returns
mixed The result of the destroy operation.

Definition at line 387 of file class.winbinder.php.

388 {
389 return $this->callWinBinder( 'wb_destroy_timer', array($wbobject, $timerobject) );
390 }

References callWinBinder().

◆ destroyWindow()

WinBinder::destroyWindow ( $window)

Destroys a window.

Parameters
mixed$windowThe window object to destroy.

Definition at line 217 of file class.winbinder.php.

218 {
219 $this->callWinBinder( 'wb_destroy_window', array($window), true );
220 exit();
221 }

References callWinBinder().

◆ drawImage()

WinBinder::drawImage ( $wbobject,
$path,
$xPos = 0,
$yPos = 0,
$width = 0,
$height = 0 )

Draws an image on a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to draw on.
string$pathThe path to the image file.
int$xPosThe x-coordinate of the image.
int$yPosThe y-coordinate of the image.
int$widthThe width of the image.
int$heightThe height of the image.
Returns
mixed The result of the draw operation.

Definition at line 269 of file class.winbinder.php.

270 {
271 $image = $this->callWinBinder( 'wb_load_image', array($path) );
272
273 return $this->callWinBinder( 'wb_draw_image', array($wbobject, $image, $xPos, $yPos, $width, $height) );
274 }

References callWinBinder().

◆ drawLine()

WinBinder::drawLine ( $wbobject,
$xStartPos,
$yStartPos,
$xEndPos,
$yEndPos,
$color,
$height = 1 )

Draws a line on a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to draw on.
int$xStartPosThe starting x-coordinate of the line.
int$yStartPosThe starting y-coordinate of the line.
int$xEndPosThe ending x-coordinate of the line.
int$yEndPosThe ending y-coordinate of the line.
int$colorThe color of the line.
int$heightThe height of the line.
Returns
mixed The result of the draw operation.

Definition at line 329 of file class.winbinder.php.

330 {
331 return $this->callWinBinder( 'wb_draw_line', array($wbobject, $xStartPos, $yStartPos, $xEndPos, $yEndPos, $color, $height) );
332 }

References callWinBinder().

◆ drawRect()

WinBinder::drawRect ( $parent,
$xPos,
$yPos,
$width,
$height,
$color = 15790320,
$filled = true )

Draws a rectangle on a WinBinder object.

Parameters
mixed$parentThe parent WinBinder object.
int$xPosThe x-coordinate of the rectangle.
int$yPosThe y-coordinate of the rectangle.
int$widthThe width of the rectangle.
int$heightThe height of the rectangle.
int$colorThe color of the rectangle.
bool$filledWhether the rectangle should be filled.
Returns
mixed The result of the draw operation.

Definition at line 311 of file class.winbinder.php.

312 {
313 return $this->callWinBinder( 'wb_draw_rect', array($parent, $xPos, $yPos, $width, $height, $color, $filled) );
314 }

References callWinBinder().

◆ drawText()

WinBinder::drawText ( $parent,
$caption,
$xPos,
$yPos,
$width = null,
$height = null,
$font = null )

Draws text on a WinBinder object.

Parameters
mixed$parentThe parent WinBinder object.
string$captionThe text to draw.
int$xPosThe x-coordinate of the text.
int$yPosThe y-coordinate of the text.
int | null$widthThe width of the text area.
int | null$heightThe height of the text area.
mixed$fontThe font to use for the text.
Returns
mixed The result of the draw operation.

Definition at line 289 of file class.winbinder.php.

290 {
291 $caption = str_replace( self::NEW_LINE, PHP_EOL, $caption );
292 $width = $width == null ? 120 : $width;
293 $height = $height == null ? 25 : $height;
294
295 return $this->callWinBinder( 'wb_draw_text', array($parent, $caption, $xPos, $yPos, $width, $height, $font) );
296 }

References callWinBinder().

◆ exec()

WinBinder::exec ( $cmd,
$params = null,
$silent = false )

Executes a system command.

Parameters
string$cmdThe command to execute.
string | null$paramsThe parameters to pass to the command.
bool$silentWhether to execute the command silently.
Returns
mixed The result of the command execution.

Definition at line 401 of file class.winbinder.php.

402 {
403 global $bearsamppCore;
404
405 if ( $silent ) {
406 $silent = '"' . $bearsamppCore->getScript( Core::SCRIPT_EXEC_SILENT ) . '" "' . $cmd . '"';
407 $cmd = 'wscript.exe';
408 $params = !empty( $params ) ? $silent . ' "' . $params . '"' : $silent;
409 }
410
411 $this->writeLog( 'exec: ' . $cmd . ' ' . $params );
412
413 return $this->callWinBinder( 'wb_exec', array($cmd, $params) );
414 }
const SCRIPT_EXEC_SILENT
static writeLog($log)

References $bearsamppCore, callWinBinder(), Core\SCRIPT_EXEC_SILENT, and writeLog().

◆ findFile()

WinBinder::findFile ( $filename)

Finds a file using WinBinder.

Parameters
string$filenameThe name of the file to find.
Returns
mixed The result of the find operation.

Definition at line 423 of file class.winbinder.php.

424 {
425 $result = $this->callWinBinder( 'wb_find_file', array($filename) );
426 $this->writeLog( 'findFile ' . $filename . ': ' . $result );
427
428 return $result != $filename ? $result : false;
429 }

References $result, callWinBinder(), and writeLog().

◆ getFocus()

WinBinder::getFocus ( )

Retrieves the focus from a WinBinder object.

Returns
mixed The WinBinder object that has the focus.

Definition at line 549 of file class.winbinder.php.

550 {
551 return $this->callWinBinder( 'wb_get_focus' );
552 }

References callWinBinder().

◆ getSystemInfo()

WinBinder::getSystemInfo ( $info)

Retrieves system information.

Parameters
string$infoThe type of system information to retrieve.
Returns
mixed The retrieved system information.

Definition at line 252 of file class.winbinder.php.

253 {
254 return $this->callWinBinder( 'wb_get_system_info', array($info) );
255 }

References callWinBinder().

◆ getText()

WinBinder::getText ( $wbobject)

Retrieves the text from a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to get the text from.
Returns
mixed The retrieved text.

Definition at line 499 of file class.winbinder.php.

500 {
501 return $this->callWinBinder( 'wb_get_text', array($wbobject) );
502 }

References callWinBinder().

◆ getValue()

WinBinder::getValue ( $wbobject)

Retrieves the value from a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to get the value from.
Returns
mixed The retrieved value.

Definition at line 526 of file class.winbinder.php.

527 {
528 return $this->callWinBinder( 'wb_get_value', array($wbobject) );
529 }

References callWinBinder().

◆ incrProgressBar()

WinBinder::incrProgressBar ( $progressBar)

Increments the value of a progress bar.

Parameters
array$progressBarThe progress bar control.

Definition at line 850 of file class.winbinder.php.

851 {
852 $this->setProgressBarValue( $progressBar, self::INCR_PROGRESS_BAR );
853 }
setProgressBarValue($progressBar, $value)

References setProgressBarValue().

◆ isEnabled()

WinBinder::isEnabled ( $wbobject)

Checks if a WinBinder object is enabled.

Parameters
mixed$wbobjectThe WinBinder object to check.
Returns
mixed True if the object is enabled, false otherwise.

Definition at line 586 of file class.winbinder.php.

587 {
588 return $this->callWinBinder( 'wb_get_enabled', array($wbobject) );
589 }

References callWinBinder().

◆ mainLoop()

WinBinder::mainLoop ( )

Starts the main event loop.

Returns
mixed The result of the main loop.

Definition at line 228 of file class.winbinder.php.

229 {
230 return $this->callWinBinder( 'wb_main_loop' );
231 }

References callWinBinder().

◆ messageBox()

WinBinder::messageBox ( $message,
$type,
$title = null )

Displays a message box.

Parameters
string$messageThe message to display.
int$typeThe type of message box.
string | null$titleThe title of the message box.
Returns
mixed The result of the message box operation.

Definition at line 904 of file class.winbinder.php.

905 {
906 global $bearsamppCore;
907
908 $message = str_replace( self::NEW_LINE, PHP_EOL, $message );
909 $messageBox = $this->callWinBinder( 'wb_message_box', array(
910 null, strlen( $message ) < 64 ? str_pad( $message, 64 ) : $message, // Pad message to display entire title
911 $title == null ? $this->defaultTitle : $this->defaultTitle . ' - ' . $title, $type
912 ) );
913
914 // TODO why does this create an error sometimes.
915 // Set tiny window icon
916 $this->setImage( $messageBox, $bearsamppCore->getResourcesPath() . '/homepage/img/icons/app.ico' );
917
918 return $messageBox;
919 }

References $bearsamppCore, callWinBinder(), and setImage().

Referenced by messageBoxError(), messageBoxInfo(), messageBoxOk(), messageBoxOkCancel(), messageBoxQuestion(), messageBoxWarning(), messageBoxYesNo(), and messageBoxYesNoCancel().

+ Here is the caller graph for this function:

◆ messageBoxError()

WinBinder::messageBoxError ( $message,
$title = null )

Displays an error message box.

Parameters
string$messageThe message to display.
string | null$titleThe title of the message box. If null, the default title will be used.
Returns
mixed The result of the message box operation.

Definition at line 981 of file class.winbinder.php.

982 {
983 return $this->messageBox( $message, self::BOX_ERROR, $title );
984 }
messageBox($message, $type, $title=null)

References messageBox().

◆ messageBoxInfo()

WinBinder::messageBoxInfo ( $message,
$title = null )

Displays an informational message box.

Parameters
string$messageThe message to display.
string | null$titleThe title of the message box.
Returns
mixed The result of the message box operation.

Definition at line 929 of file class.winbinder.php.

930 {
931 return $this->messageBox( $message, self::BOX_INFO, $title );
932 }

References messageBox().

◆ messageBoxOk()

WinBinder::messageBoxOk ( $message,
$title = null )

Displays an OK message box.

Parameters
string$messageThe message to display.
string | null$titleThe title of the message box.
Returns
mixed The result of the message box operation.

Definition at line 942 of file class.winbinder.php.

943 {
944 return $this->messageBox( $message, self::BOX_OK, $title );
945 }

References messageBox().

◆ messageBoxOkCancel()

WinBinder::messageBoxOkCancel ( $message,
$title = null )

Displays an OK/Cancel message box.

Parameters
string$messageThe message to display.
string | null$titleThe title of the message box.
Returns
mixed The result of the message box operation.

Definition at line 955 of file class.winbinder.php.

956 {
957 return $this->messageBox( $message, self::BOX_OKCANCEL, $title );
958 }

References messageBox().

◆ messageBoxQuestion()

WinBinder::messageBoxQuestion ( $message,
$title = null )

Displays a question message box.

Parameters
string$messageThe message to display.
string | null$titleThe title of the message box. If null, the default title will be used.
Returns
mixed The result of the message box operation.

Definition at line 968 of file class.winbinder.php.

969 {
970 return $this->messageBox( $message, self::BOX_QUESTION, $title );
971 }

References messageBox().

◆ messageBoxWarning()

WinBinder::messageBoxWarning ( $message,
$title = null )

Displays a warning message box.

Parameters
string$messageThe message to display.
string | null$titleThe title of the message box. If null, the default title will be used.
Returns
mixed The result of the message box operation.

Definition at line 994 of file class.winbinder.php.

995 {
996 return $this->messageBox( $message, self::BOX_WARNING, $title );
997 }

References messageBox().

◆ messageBoxYesNo()

WinBinder::messageBoxYesNo ( $message,
$title = null )

Displays a Yes/No message box.

Parameters
string$messageThe message to display.
string | null$titleThe title of the message box. If null, the default title will be used.
Returns
mixed The result of the message box operation.

Definition at line 1007 of file class.winbinder.php.

1008 {
1009 return $this->messageBox( $message, self::BOX_YESNO, $title );
1010 }

References messageBox().

◆ messageBoxYesNoCancel()

WinBinder::messageBoxYesNoCancel ( $message,
$title = null )

Displays a Yes/No/Cancel message box.

Parameters
string$messageThe message to display.
string | null$titleThe title of the message box. If null, the default title will be used.
Returns
mixed The result of the message box operation.

Definition at line 1020 of file class.winbinder.php.

1021 {
1022 return $this->messageBox( $message, self::BOX_YESNOCANCEL, $title );
1023 }

References messageBox().

◆ refresh()

WinBinder::refresh ( $wbobject)

Refreshes a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to refresh.
Returns
mixed The result of the refresh operation.

Definition at line 240 of file class.winbinder.php.

241 {
242 return $this->callWinBinder( 'wb_refresh', array($wbobject, true) );
243 }

References callWinBinder().

◆ reset()

WinBinder::reset ( )

Resets the control counter and callback array.

Definition at line 92 of file class.winbinder.php.

93 {
94 $this->countCtrls = 1000;
95 $this->callback = array();
96 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ resetProgressBar()

WinBinder::resetProgressBar ( $progressBar)

Resets the value of a progress bar to zero.

Parameters
array$progressBarThe progress bar control.

Definition at line 860 of file class.winbinder.php.

861 {
862 $this->setProgressBarValue( $progressBar, 0 );
863 }

References setProgressBarValue().

◆ setArea()

WinBinder::setArea ( $wbobject,
$width,
$height )

Sets the area of a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to set the area for.
int$widthThe width of the area.
int$heightThe height of the area.
Returns
mixed The result of the set area operation.

Definition at line 487 of file class.winbinder.php.

488 {
489 return $this->callWinBinder( 'wb_set_area', array($wbobject, WBC_TITLE, 0, 0, $width, $height) );
490 }

References callWinBinder().

Referenced by createNakedWindow().

+ Here is the caller graph for this function:

◆ setCursor()

WinBinder::setCursor ( $wbobject,
$type = self::CURSOR_ARROW )

Sets the cursor type for a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to set the cursor for.
string$typeThe cursor type to set.
Returns
mixed The result of the set cursor operation.

Definition at line 574 of file class.winbinder.php.

575 {
576 return $this->callWinBinder( 'wb_set_cursor', array($wbobject, $type) );
577 }

References callWinBinder().

Referenced by createHyperLink().

+ Here is the caller graph for this function:

◆ setDisabled()

WinBinder::setDisabled ( $wbobject)

Disables a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to disable.
Returns
mixed The result of the disable operation.

Definition at line 611 of file class.winbinder.php.

612 {
613 return $this->setEnabled( $wbobject, false );
614 }
setEnabled($wbobject, $enabled=true)

References setEnabled().

◆ setEnabled()

WinBinder::setEnabled ( $wbobject,
$enabled = true )

Sets the enabled state for a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to set the enabled state for.
bool$enabledTrue to enable the object, false to disable it.
Returns
mixed The result of the set enabled state operation.

Definition at line 599 of file class.winbinder.php.

600 {
601 return $this->callWinBinder( 'wb_set_enabled', array($wbobject, $enabled) );
602 }

References callWinBinder().

Referenced by setDisabled().

+ Here is the caller graph for this function:

◆ setFocus()

WinBinder::setFocus ( $wbobject)

Sets the focus to a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to set the focus to.
Returns
mixed The result of the set focus operation.

Definition at line 561 of file class.winbinder.php.

562 {
563 return $this->callWinBinder( 'wb_set_focus', array($wbobject) );
564 }

References callWinBinder().

◆ setHandler()

WinBinder::setHandler ( $wbobject,
$classCallback,
$methodCallback,
$launchTimer = null )

Sets an event handler for a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to set the handler for.
mixed$classCallbackThe class callback for the handler.
mixed$methodCallbackThe method callback for the handler.
mixed$launchTimerThe timer to launch for the handler.
Returns
mixed The result of the set handler operation.

Definition at line 441 of file class.winbinder.php.

442 {
443 if ( $launchTimer != null ) {
444 $launchTimer = $this->createTimer( $wbobject, $launchTimer );
445 }
446
447 $this->callback[$wbobject] = array($classCallback, $methodCallback, $launchTimer);
448
449 return $this->callWinBinder( 'wb_set_handler', array($wbobject, '__winbinderEventHandler') );
450 }
createTimer($wbobject, $wait=1000)

References callWinBinder(), and createTimer().

◆ setImage()

WinBinder::setImage ( $wbobject,
$path )

Sets an image for a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to set the image for.
string$pathThe path to the image file.
Returns
mixed The result of the set image operation.

Definition at line 460 of file class.winbinder.php.

461 {
462 return $this->callWinBinder( 'wb_set_image', array($wbobject, $path) );
463 }

References callWinBinder().

Referenced by createWindow(), and messageBox().

+ Here is the caller graph for this function:

◆ setMaxLength()

WinBinder::setMaxLength ( $wbobject,
$length )

Sets the maximum length for a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to set the maximum length for.
int$lengthThe maximum length to set.
Returns
mixed The result of the set maximum length operation.

Definition at line 473 of file class.winbinder.php.

474 {
475 return $this->callWinBinder( 'wb_send_message', array($wbobject, 0x00c5, $length, 0) );
476 }

References callWinBinder().

Referenced by createInputText().

+ Here is the caller graph for this function:

◆ setProgressBarMax()

WinBinder::setProgressBarMax ( $progressBar,
$max )

Sets the maximum value of a progress bar.

Parameters
array$progressBarThe progress bar control.
int$maxThe maximum value to set.

Definition at line 890 of file class.winbinder.php.

891 {
892 $this->setRange( $progressBar[self::CTRL_OBJ], 0, $max );
893 }

References setRange().

◆ setProgressBarValue()

WinBinder::setProgressBarValue ( $progressBar,
$value )

Sets the value of a progress bar.

Parameters
array$progressBarThe progress bar control.
mixed$valueThe value to set.

Definition at line 871 of file class.winbinder.php.

872 {
873 if ( $progressBar != null && isset( $progressBar[self::CTRL_OBJ] ) && isset( $this->gauge[$progressBar[self::CTRL_OBJ]] ) ) {
874 if ( strval( $value ) == self::INCR_PROGRESS_BAR ) {
875 $value = $this->gauge[$progressBar[self::CTRL_OBJ]] + 1;
876 }
877 if ( is_numeric( $value ) ) {
878 $this->gauge[$progressBar[self::CTRL_OBJ]] = $value;
879 $this->setValue( $progressBar[self::CTRL_OBJ], $value );
880 }
881 }
882 }
setValue($wbobject, $content)

References CTRL_OBJ, and setValue().

Referenced by incrProgressBar(), and resetProgressBar().

+ Here is the caller graph for this function:

◆ setRange()

WinBinder::setRange ( $wbobject,
$min,
$max )

Sets the range for a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to set the range for.
int$minThe minimum value of the range.
int$maxThe maximum value of the range.
Returns
mixed The result of the set range operation.

Definition at line 638 of file class.winbinder.php.

639 {
640 return $this->callWinBinder( 'wb_set_range', array($wbobject, $min, $max) );
641 }

References callWinBinder().

Referenced by createProgressBar(), and setProgressBarMax().

+ Here is the caller graph for this function:

◆ setStyle()

WinBinder::setStyle ( $wbobject,
$style )

Sets the style for a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to set the style for.
mixed$styleThe style to set.
Returns
mixed The result of the set style operation.

Definition at line 624 of file class.winbinder.php.

625 {
626 return $this->callWinBinder( 'wb_set_style', array($wbobject, $style) );
627 }

References callWinBinder().

◆ setText()

WinBinder::setText ( $wbobject,
$content )

Sets the text for a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to set the text for.
string$contentThe text content to set.
Returns
mixed The result of the set text operation.

Definition at line 512 of file class.winbinder.php.

513 {
514 $content = str_replace( self::NEW_LINE, PHP_EOL, $content );
515
516 return $this->callWinBinder( 'wb_set_text', array($wbobject, $content) );
517 }

References callWinBinder().

◆ setValue()

WinBinder::setValue ( $wbobject,
$content )

Sets the value for a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to set the value for.
mixed$contentThe value to set.
Returns
mixed The result of the set value operation.

Definition at line 539 of file class.winbinder.php.

540 {
541 return $this->callWinBinder( 'wb_set_value', array($wbobject, $content) );
542 }

References callWinBinder().

Referenced by setProgressBarValue().

+ Here is the caller graph for this function:

◆ sysDlgOpen()

WinBinder::sysDlgOpen ( $parent,
$title,
$filter = null,
$path = null )

Opens a system dialog to open a file.

Parameters
mixed$parentThe parent window for the dialog.
string$titleThe title of the dialog.
string | null$filterThe file filter for the dialog.
string | null$pathThe initial path for the dialog.
Returns
mixed The selected file path.

Definition at line 667 of file class.winbinder.php.

668 {
669 return $this->callWinBinder( 'wb_sys_dlg_open', array($parent, $title, $filter, $path) );
670 }

References callWinBinder().

◆ sysDlgPath()

WinBinder::sysDlgPath ( $parent,
$title,
$path = null )

Opens a system dialog to select a path.

Parameters
mixed$parentThe parent window for the dialog.
string$titleThe title of the dialog.
string | null$pathThe initial path for the dialog.
Returns
mixed The selected path.

Definition at line 652 of file class.winbinder.php.

653 {
654 return $this->callWinBinder( 'wb_sys_dlg_path', array($parent, $title, $path) );
655 }

References callWinBinder().

◆ wait()

WinBinder::wait ( $wbobject = null)

Waits for an event on a WinBinder object.

Parameters
mixed$wbobjectThe WinBinder object to wait on.
Returns
mixed The result of the wait operation.

Definition at line 356 of file class.winbinder.php.

357 {
358 return $this->callWinBinder( 'wb_wait', array($wbobject), true );
359 }

References callWinBinder().

◆ writeLog()

static WinBinder::writeLog ( $log)
staticprivate

Writes a log message to the WinBinder log file.

Parameters
string$logThe log message to write.

Definition at line 83 of file class.winbinder.php.

84 {
85 global $bearsamppRoot;
86 Util::logDebug( $log, $bearsamppRoot->getWinbinderLogFilePath() );
87 }
global $bearsamppRoot
static logDebug($data, $file=null)

References $bearsamppRoot, and Util\logDebug().

Referenced by exec(), and findFile().

+ Here is the caller graph for this function:

Field Documentation

◆ $callback

WinBinder::$callback

Definition at line 61 of file class.winbinder.php.

◆ $countCtrls

WinBinder::$countCtrls
private

Definition at line 59 of file class.winbinder.php.

◆ $defaultTitle

WinBinder::$defaultTitle
private

Definition at line 58 of file class.winbinder.php.

◆ $gauge

WinBinder::$gauge

Definition at line 62 of file class.winbinder.php.

◆ BOX_ERROR

const WinBinder::BOX_ERROR = WBC_STOP

Definition at line 32 of file class.winbinder.php.

◆ BOX_INFO

const WinBinder::BOX_INFO = WBC_INFO

Definition at line 28 of file class.winbinder.php.

◆ BOX_OK

const WinBinder::BOX_OK = WBC_OK

Definition at line 29 of file class.winbinder.php.

◆ BOX_OKCANCEL

const WinBinder::BOX_OKCANCEL = WBC_OKCANCEL

Definition at line 30 of file class.winbinder.php.

◆ BOX_QUESTION

const WinBinder::BOX_QUESTION = WBC_QUESTION

Definition at line 31 of file class.winbinder.php.

◆ BOX_WARNING

const WinBinder::BOX_WARNING = WBC_WARNING

Definition at line 33 of file class.winbinder.php.

◆ BOX_YESNO

const WinBinder::BOX_YESNO = WBC_YESNO

Definition at line 34 of file class.winbinder.php.

◆ BOX_YESNOCANCEL

const WinBinder::BOX_YESNOCANCEL = WBC_YESNOCANCEL

Definition at line 35 of file class.winbinder.php.

◆ CTRL_ID

◆ CTRL_OBJ

◆ CURSOR_ARROW

const WinBinder::CURSOR_ARROW = 'arrow'

Definition at line 38 of file class.winbinder.php.

◆ CURSOR_CROSS

const WinBinder::CURSOR_CROSS = 'cross'

Definition at line 39 of file class.winbinder.php.

◆ CURSOR_FINGER

const WinBinder::CURSOR_FINGER = 'finger'

Definition at line 40 of file class.winbinder.php.

◆ CURSOR_FORBIDDEN

const WinBinder::CURSOR_FORBIDDEN = 'forbidden'

Definition at line 41 of file class.winbinder.php.

◆ CURSOR_HELP

const WinBinder::CURSOR_HELP = 'help'

Definition at line 42 of file class.winbinder.php.

◆ CURSOR_IBEAM

const WinBinder::CURSOR_IBEAM = 'ibeam'

Definition at line 43 of file class.winbinder.php.

◆ CURSOR_NONE

const WinBinder::CURSOR_NONE = null

Definition at line 44 of file class.winbinder.php.

◆ CURSOR_SIZEALL

const WinBinder::CURSOR_SIZEALL = 'sizeall'

Definition at line 45 of file class.winbinder.php.

◆ CURSOR_SIZENESW

const WinBinder::CURSOR_SIZENESW = 'sizenesw'

Definition at line 46 of file class.winbinder.php.

◆ CURSOR_SIZENS

const WinBinder::CURSOR_SIZENS = 'sizens'

Definition at line 47 of file class.winbinder.php.

◆ CURSOR_SIZENWSE

const WinBinder::CURSOR_SIZENWSE = 'sizenwse'

Definition at line 48 of file class.winbinder.php.

◆ CURSOR_SIZEWE

const WinBinder::CURSOR_SIZEWE = 'sizewe'

Definition at line 49 of file class.winbinder.php.

◆ CURSOR_UPARROW

const WinBinder::CURSOR_UPARROW = 'uparrow'

Definition at line 50 of file class.winbinder.php.

◆ CURSOR_WAIT

const WinBinder::CURSOR_WAIT = 'wait'

Definition at line 51 of file class.winbinder.php.

◆ CURSOR_WAITARROW

const WinBinder::CURSOR_WAITARROW = 'waitarrow'

Definition at line 52 of file class.winbinder.php.

◆ INCR_PROGRESS_BAR

const WinBinder::INCR_PROGRESS_BAR = '++'

Definition at line 24 of file class.winbinder.php.

◆ NEW_LINE

const WinBinder::NEW_LINE = '@nl@'

Definition at line 25 of file class.winbinder.php.

◆ SYSINFO_SCREENAREA

const WinBinder::SYSINFO_SCREENAREA = 'screenarea'

Definition at line 55 of file class.winbinder.php.

◆ SYSINFO_WORKAREA

const WinBinder::SYSINFO_WORKAREA = 'workarea'

Definition at line 56 of file class.winbinder.php.

Referenced by ActionLoading\__construct(), and Splash\init().


The documentation for this class was generated from the following file: