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

Public Member Functions

 __construct ($args)
 
 incrProgressBar ($nb=1)
 
 processLoading ($window, $id, $ctrl, $param1, $param2)
 

Data Fields

const GAUGE = 20
 
const WINDOW_HEIGHT = 90
 
const WINDOW_WIDTH = 360
 

Private Attributes

 $wbProgressBar
 
 $wbWindow
 

Detailed Description

Class ActionLoading

This class handles the loading action, including the creation and management of a progress bar window.

Definition at line 15 of file class.action.loading.php.

Constructor & Destructor Documentation

◆ __construct()

ActionLoading::__construct ( $args)

ActionLoading constructor.

Initializes the loading action, creates the progress bar window, and starts the main loop.

Parameters
array$argsThe arguments passed to the constructor.

Definition at line 39 of file class.action.loading.php.

40 {
41 global $bearsamppCore, $bearsamppLang, $bearsamppWinbinder;
42
43 $bearsamppWinbinder->reset();
44 $bearsamppCore->addLoadingPid(Win32Ps::getCurrentPid());
45
46 // Screen information
47 $screenArea = explode(' ', $bearsamppWinbinder->getSystemInfo(WinBinder::SYSINFO_WORKAREA));
48 $screenWidth = intval($screenArea[2]);
49 $screenHeight = intval($screenArea[3]);
50 $xPos = $screenWidth - self::WINDOW_WIDTH;
51 $yPos = $screenHeight - self::WINDOW_HEIGHT - 5;
52
53 // Create the window and progress bar
54 $this->wbWindow = $bearsamppWinbinder->createWindow(null, ToolDialog, null, $xPos, $yPos, self::WINDOW_WIDTH, self::WINDOW_HEIGHT, WBC_TOP, null);
55 $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::LOADING), 42, 2, 295, null, WBC_LEFT);
56 $this->wbProgressBar = $bearsamppWinbinder->createProgressBar($this->wbWindow, self::GAUGE, 42, 20, 290, 15);
57
58 // Set the handler and start the main loop
59 $bearsamppWinbinder->setHandler($this->wbWindow, $this, 'processLoading', 10);
60 $bearsamppWinbinder->mainLoop();
61 }
global $bearsamppLang
global $bearsamppCore
const LOADING
static getCurrentPid()
const SYSINFO_WORKAREA

References $bearsamppCore, $bearsamppLang, Win32Ps\getCurrentPid(), Lang\LOADING, WinBinder\SYSINFO_WORKAREA, and WINDOW_WIDTH.

Member Function Documentation

◆ incrProgressBar()

ActionLoading::incrProgressBar ( $nb = 1)

Increments the progress bar by a specified number of steps.

Parameters
int$nbThe number of steps to increment the progress bar by. Default is 1.

Definition at line 68 of file class.action.loading.php.

69 {
70 global $bearsamppCore, $bearsamppWinbinder;
71
72 for ($i = 0; $i < $nb; $i++) {
73 $bearsamppWinbinder->incrProgressBar($this->wbProgressBar);
74 $bearsamppWinbinder->drawImage($this->wbWindow, $bearsamppCore->getResourcesPath() . '/homepage/img/bearsampp.bmp', 4, 2, 32, 32);
75 }
76
77 $bearsamppWinbinder->wait();
78 $bearsamppWinbinder->wait($this->wbWindow);
79 }

References $bearsamppCore.

Referenced by processLoading().

+ Here is the caller graph for this function:

◆ processLoading()

ActionLoading::processLoading ( $window,
$id,
$ctrl,
$param1,
$param2 )

Processes the loading action, including handling window events and updating the progress bar.

Parameters
mixed$windowThe window object.
int$idThe ID of the event.
mixed$ctrlThe control object.
mixed$param1The first parameter of the event.
mixed$param2The second parameter of the event.

Definition at line 90 of file class.action.loading.php.

91 {
92 global $bearsamppRoot, $bearsamppWinbinder;
93
94 switch ($id) {
95 case IDCLOSE:
97 break;
98 }
99
100 while (true) {
101 $bearsamppRoot->removeErrorHandling();
102 $bearsamppWinbinder->resetProgressBar($this->wbProgressBar);
103 usleep(100000);
104 for ($i = 0; $i < self::GAUGE; $i++) {
105 $this->incrProgressBar();
106 usleep(100000);
107 }
108 }
109 }
global $bearsamppRoot
static kill($pid)

References $bearsamppRoot, GAUGE, Win32Ps\getCurrentPid(), incrProgressBar(), and Win32Ps\kill().

Field Documentation

◆ $wbProgressBar

ActionLoading::$wbProgressBar
private

Definition at line 30 of file class.action.loading.php.

◆ $wbWindow

ActionLoading::$wbWindow
private

Definition at line 27 of file class.action.loading.php.

◆ GAUGE

const ActionLoading::GAUGE = 20

Definition at line 24 of file class.action.loading.php.

Referenced by processLoading().

◆ WINDOW_HEIGHT

const ActionLoading::WINDOW_HEIGHT = 90

Definition at line 21 of file class.action.loading.php.

◆ WINDOW_WIDTH

const ActionLoading::WINDOW_WIDTH = 360

Definition at line 18 of file class.action.loading.php.

Referenced by __construct().


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