Bearsampp 2025.8.29
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
16class 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;
26
27 private $currentImg;
28
34 public function __construct()
35 {
36 Util::logInitClass($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 $this->wbImage = $bearsamppWinbinder->drawImage($this->wbWindow, $bearsamppCore->getImagesPath() . '/bearsampp.bmp');
61 $this->wbProgressBar = $bearsamppWinbinder->createProgressBar($this->wbWindow, $gauge + 1, 42, 24, 390, 15);
62
63 $this->setTextLoading($text);
64 $this->incrProgressBar();
65 }
66
72 public function setTextLoading($caption)
73 {
74 global $bearsamppWinbinder;
75
76 $bearsamppWinbinder->drawRect($this->wbWindow, 42, 0, self::WINDOW_WIDTH - 42, self::WINDOW_HEIGHT);
77 $this->wbTextLoading = $bearsamppWinbinder->drawText($this->wbWindow, $caption, 42, 0, self::WINDOW_WIDTH - 44, 25);
78 }
79
85 public function incrProgressBar($nb = 1)
86 {
87 global $bearsamppCore, $bearsamppWinbinder;
88
89 for ($i = 0; $i < $nb; $i++) {
90 $bearsamppWinbinder->drawImage($this->wbWindow, $bearsamppCore->getImagesPath() . '/bearsampp.bmp', 4, 4, 32, 32);
91 $bearsamppWinbinder->incrProgressBar($this->wbProgressBar);
92 }
93
94 $bearsamppWinbinder->wait();
95 $bearsamppWinbinder->wait($this->wbWindow);
96 }
97
103 public function getWbWindow()
104 {
105 return $this->wbWindow;
106 }
107}
global $bearsamppCore
setTextLoading($caption)
const WINDOW_HEIGHT
init($title, $gauge, $text)
const WINDOW_WIDTH
incrProgressBar($nb=1)
static logInitClass($classInstance)
const SYSINFO_WORKAREA