Bearsampp
2026.7.11
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-2024 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
22
private
$wbWindow
;
23
private
$wbImage
;
24
private
$wbTextLoading
;
25
private
$wbProgressBar
;
26
27
private
$currentImg
;
28
34
public
function
__construct
()
35
{
36
Log::initClass
($this);
37
$this->currentImg =
null
;
38
}
39
47
public
function
init
($title, $gauge, $text)
48
{
49
global
$bearsamppCore
, $bearsamppWinbinder;
50
51
$bearsamppWinbinder->reset();
52
53
$screenArea = explode(
' '
, $bearsamppWinbinder->getSystemInfo(
WinBinder::SYSINFO_WORKAREA
));
54
$screenWidth = intval($screenArea[2]);
55
$screenHeight = intval($screenArea[3]);
56
$xPos = $screenWidth - self::WINDOW_WIDTH;
57
$yPos = $screenHeight - self::WINDOW_HEIGHT - 5;
58
59
$this->wbWindow = $bearsamppWinbinder->createWindow(
null
, ToolDialog, $title, $xPos, $yPos, self::WINDOW_WIDTH, self::WINDOW_HEIGHT, WBC_TOP | WBC_READONLY,
null
);
60
61
// Check if window was created successfully
62
if
($this->wbWindow ===
false
|| $this->wbWindow ===
null
) {
63
Log::error
(
'Failed to create splash window'
);
64
return
;
65
}
66
67
// CRITICAL: wb_set_visible() must be called AFTER window creation in PHP 8.4
68
// The WS_VISIBLE flag during creation doesn't work
69
wb_set_visible($this->wbWindow,
true
);
70
71
$this->wbImage = $bearsamppWinbinder->drawImage($this->wbWindow,
Path::getImagesPath
() .
'/bearsampp.bmp'
);
72
$this->wbProgressBar = $bearsamppWinbinder->createProgressBar($this->wbWindow, $gauge + 1, 42, 24, 390, 15);
73
74
$this->
setTextLoading
($text);
75
$this->
incrProgressBar
();
76
}
77
83
public
function
setTextLoading
($caption)
84
{
85
global $bearsamppWinbinder;
86
87
$bearsamppWinbinder->drawRect($this->wbWindow, 42, 0, self::WINDOW_WIDTH - 42, self::WINDOW_HEIGHT);
88
$this->wbTextLoading = $bearsamppWinbinder->drawText($this->wbWindow, $caption, 42, 0, self::WINDOW_WIDTH - 44, 25);
89
}
90
96
public
function
incrProgressBar
($nb = 1)
97
{
98
global
$bearsamppCore
, $bearsamppWinbinder;
99
100
for
($i = 0; $i < $nb; $i++) {
101
$bearsamppWinbinder->drawImage($this->wbWindow,
Path::getImagesPath
() .
'/bearsampp.bmp'
, 4, 4, 32, 32);
102
$bearsamppWinbinder->incrProgressBar($this->wbProgressBar);
103
}
104
105
$bearsamppWinbinder->wait();
106
$bearsamppWinbinder->wait($this->wbWindow);
107
}
108
114
public
function
getWbWindow
()
115
{
116
return
$this->wbWindow
;
117
}
118
}
$bearsamppCore
global $bearsamppCore
Definition
ajax.latestversion.php:24
Log\error
static error($data, $file=null)
Definition
class.log.php:650
Log\initClass
static initClass($classInstance)
Definition
class.log.php:660
Path\getImagesPath
static getImagesPath($aetrayPath=false)
Definition
class.path.php:527
Splash
Definition
class.splash.php:17
Splash\__construct
__construct()
Definition
class.splash.php:34
Splash\$wbWindow
$wbWindow
Definition
class.splash.php:22
Splash\$wbTextLoading
$wbTextLoading
Definition
class.splash.php:24
Splash\setTextLoading
setTextLoading($caption)
Definition
class.splash.php:83
Splash\WINDOW_HEIGHT
const WINDOW_HEIGHT
Definition
class.splash.php:20
Splash\$wbImage
$wbImage
Definition
class.splash.php:23
Splash\init
init($title, $gauge, $text)
Definition
class.splash.php:47
Splash\WINDOW_WIDTH
const WINDOW_WIDTH
Definition
class.splash.php:19
Splash\getWbWindow
getWbWindow()
Definition
class.splash.php:114
Splash\$wbProgressBar
$wbProgressBar
Definition
class.splash.php:25
Splash\incrProgressBar
incrProgressBar($nb=1)
Definition
class.splash.php:96
Splash\$currentImg
$currentImg
Definition
class.splash.php:27
WinBinder\SYSINFO_WORKAREA
const SYSINFO_WORKAREA
Definition
class.winbinder.php:57
sandbox
core
classes
class.splash.php
Generated by
1.17.0