Bearsampp
2026.9.23
Toggle main menu visibility
Loading...
Searching...
No Matches
class.splash.php
Go to the documentation of this file.
1
<?php
2
/*
3
* Copyright (c) 2021-2026 Bearsampp
4
* License: GNU General Public License version 3 or later; see LICENSE.txt
5
* Author: Bear
6
* Website: https://bearsampp.com
7
* Github: https://github.com/Bearsampp
8
*/
9
16
class
Splash
17
{
18
/* Set progress bar "loading" modal size. */
19
const
WINDOW_WIDTH
= 460;
20
const
WINDOW_HEIGHT
= 90;
21
23
private
$wbWindow
;
25
private
$wbImage
;
27
private
$wbTextLoading
;
29
private
$wbProgressBar
;
30
32
private
$currentImg
;
33
39
public
function
__construct
()
40
{
41
Log::initClass
($this);
42
$this->currentImg =
null
;
43
}
44
52
public
function
init
($title, $gauge, $text)
53
{
54
global
$bearsamppCore
, $bearsamppWinbinder;
55
56
$bearsamppWinbinder->reset();
57
58
$screenArea = explode(
' '
, $bearsamppWinbinder->getSystemInfo(
WinBinder::SYSINFO_WORKAREA
));
59
$screenWidth = intval($screenArea[2]);
60
$screenHeight = intval($screenArea[3]);
61
$xPos = $screenWidth - self::WINDOW_WIDTH;
62
$yPos = $screenHeight - self::WINDOW_HEIGHT - 5;
63
64
$this->wbWindow = $bearsamppWinbinder->createWindow(
null
, ToolDialog, $title, $xPos, $yPos, self::WINDOW_WIDTH, self::WINDOW_HEIGHT, WBC_TOP | WBC_READONLY,
null
);
65
66
// Check if window was created successfully
67
if
($this->wbWindow ===
false
|| $this->wbWindow ===
null
) {
68
Log::error
(
'Failed to create splash window'
);
69
70
return
;
71
}
72
73
// CRITICAL: wb_set_visible() must be called AFTER window creation in PHP 8.4
74
// The WS_VISIBLE flag during creation doesn't work
75
wb_set_visible($this->wbWindow,
true
);
76
77
$this->wbImage = $bearsamppWinbinder->drawImage($this->wbWindow,
Path::getImagesPath
() .
'/bearsampp.bmp'
);
78
$this->wbProgressBar = $bearsamppWinbinder->createProgressBar($this->wbWindow, $gauge + 1, 42, 24, 390, 15);
79
80
$this->
setTextLoading
($text);
81
$this->
incrProgressBar
();
82
}
83
89
public
function
setTextLoading
($caption)
90
{
91
global $bearsamppWinbinder;
92
93
$bearsamppWinbinder->drawRect($this->wbWindow, 42, 0, self::WINDOW_WIDTH - 42, self::WINDOW_HEIGHT);
94
$this->wbTextLoading = $bearsamppWinbinder->drawText($this->wbWindow, $caption, 42, 0, self::WINDOW_WIDTH - 44, 25);
95
}
96
102
public
function
incrProgressBar
($nb = 1)
103
{
104
global
$bearsamppCore
, $bearsamppWinbinder;
105
106
for
($i = 0; $i < $nb; $i++) {
107
$bearsamppWinbinder->drawImage($this->wbWindow,
Path::getImagesPath
() .
'/bearsampp.bmp'
, 4, 4, 32, 32);
108
$bearsamppWinbinder->incrProgressBar($this->wbProgressBar);
109
}
110
111
$bearsamppWinbinder->wait();
112
$bearsamppWinbinder->wait($this->wbWindow);
113
}
114
120
public
function
getWbWindow
()
121
{
122
return
$this->wbWindow
;
123
}
124
}
$bearsamppCore
global $bearsamppCore
Definition
ajax.latestversion.php:24
Log\error
static error($data, $file=null)
Definition
class.log.php:760
Log\initClass
static initClass($classInstance)
Definition
class.log.php:784
Path\getImagesPath
static getImagesPath($aetrayPath=false)
Definition
class.path.php:559
Splash
Definition
class.splash.php:17
Splash\__construct
__construct()
Definition
class.splash.php:39
Splash\$wbWindow
$wbWindow
Definition
class.splash.php:23
Splash\$wbTextLoading
$wbTextLoading
Definition
class.splash.php:27
Splash\setTextLoading
setTextLoading($caption)
Definition
class.splash.php:89
Splash\WINDOW_HEIGHT
const WINDOW_HEIGHT
Definition
class.splash.php:20
Splash\$wbImage
$wbImage
Definition
class.splash.php:25
Splash\init
init($title, $gauge, $text)
Definition
class.splash.php:52
Splash\WINDOW_WIDTH
const WINDOW_WIDTH
Definition
class.splash.php:19
Splash\getWbWindow
getWbWindow()
Definition
class.splash.php:120
Splash\$wbProgressBar
$wbProgressBar
Definition
class.splash.php:29
Splash\incrProgressBar
incrProgressBar($nb=1)
Definition
class.splash.php:102
Splash\$currentImg
$currentImg
Definition
class.splash.php:32
WinBinder\SYSINFO_WORKAREA
const SYSINFO_WORKAREA
Definition
class.winbinder.php:57
sandbox
core
classes
class.splash.php
Generated by
1.17.0