Bearsampp 2025.8.29
Loading...
Searching...
No Matches
class.action.about.php
Go to the documentation of this file.
1<?php
2/*
3 *
4 * * Copyright (c) 2022-2025 Bearsampp
5 * * License: GNU General Public License version 3 or later; see LICENSE.txt
6 * * Website: https://bearsampp.com
7 * * Github: https://github.com/Bearsampp
8 *
9 */
10
16{
17 const GAUGE_SAVE = 2;
18 private $wbWindow;
19 private $wbImage;
23 private $wbBtnOk;
24
31 public function __construct($args)
32 {
33 global $bearsamppCore, $bearsamppLang, $bearsamppWinbinder;
34
35 $bearsamppWinbinder->reset();
36 $this->wbWindow = $bearsamppWinbinder->createAppWindow($bearsamppLang->getValue(Lang::ABOUT_TITLE), 520, 250, WBC_NOTIFY, WBC_KEYDOWN | WBC_KEYUP);
37
38 // Get the about text
39 $aboutText = sprintf($bearsamppLang->getValue(Lang::ABOUT_TEXT), APP_TITLE . ' ' . $bearsamppCore->getAppVersion(), date('Y'), APP_AUTHOR_NAME);
40
41 // Split the text using the custom newline marker "@nl@"
42 $textLines = explode('@nl@', $aboutText);
43
44 // Display each line at a specific position
45 $yPos = 20;
46 $lineHeight = 20;
47 foreach ($textLines as $line) {
48 $bearsamppWinbinder->createLabel($this->wbWindow, trim($line), 80, $yPos, 470, $lineHeight);
49 $yPos += $lineHeight;
50 }
51
52 // Add exactly one line of blank space
53 $yPos = 125;
54
55 // Add hyperlinks
56 $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::WEBSITE) . ' :', 80, $yPos, 100, 15);
57 $this->wbLinkHomepage = $bearsamppWinbinder->createHyperLink($this->wbWindow, Util::getWebsiteUrlNoUtm(), 180, $yPos, 300, 15, WBC_LINES);
58 $yPos += 20;
59
60 $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::DONATE) . ' :', 80, $yPos, 100, 15);
61 $this->wbLinkDonate = $bearsamppWinbinder->createHyperLink($this->wbWindow, Util::getWebsiteUrlNoUtm('donate'), 180, $yPos, 300, 15, WBC_LINES);
62 $yPos += 20;
63
64 $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::GITHUB) . ' :', 80, $yPos, 100, 15);
65 $this->wbLinkGithub = $bearsamppWinbinder->createHyperLink($this->wbWindow, Util::getGithubUserUrl(), 180, $yPos, 300, 15, WBC_LINES);
66 $yPos += 10;
67
68 $this->wbBtnOk = $bearsamppWinbinder->createButton($this->wbWindow, $bearsamppLang->getValue(Lang::BUTTON_OK), 390, 180);
69
70 $this->wbImage = $bearsamppWinbinder->drawImage($this->wbWindow, $bearsamppCore->getImagesPath() . '/about.bmp');
71
72 $bearsamppWinbinder->setHandler($this->wbWindow, $this, 'processWindow');
73 $bearsamppWinbinder->mainLoop();
74 $bearsamppWinbinder->reset();
75 }
76
86 public function processWindow($window, $id, $ctrl, $param1, $param2)
87 {
88 global $bearsamppConfig, $bearsamppWinbinder;
89
90 switch ($id) {
91 case $this->wbLinkHomepage[WinBinder::CTRL_ID]:
92 $bearsamppWinbinder->exec($bearsamppConfig->getBrowser(), Util::getWebsiteUrl());
93 break;
94 case $this->wbLinkDonate[WinBinder::CTRL_ID]:
95 $bearsamppWinbinder->exec($bearsamppConfig->getBrowser(), Util::getWebsiteUrl('donate'));
96 break;
97 case $this->wbLinkGithub[WinBinder::CTRL_ID]:
98 $bearsamppWinbinder->exec($bearsamppConfig->getBrowser(), Util::getGithubUserUrl());
99 break;
100 case IDCLOSE:
101 case $this->wbBtnOk[WinBinder::CTRL_ID]:
102 $bearsamppWinbinder->destroyWindow($window);
103 break;
104 }
105 }
106}
global $bearsamppLang
global $bearsamppCore
processWindow($window, $id, $ctrl, $param1, $param2)
const BUTTON_OK
const DONATE
const GITHUB
const ABOUT_TEXT
const ABOUT_TITLE
const WEBSITE
static getWebsiteUrlNoUtm($path='', $fragment='')
static getGithubUserUrl($part=null)
static getWebsiteUrl($path='', $fragment='', $utmSource=true)
global $bearsamppConfig
Definition homepage.php:27
const APP_AUTHOR_NAME
Definition root.php:12
const APP_TITLE
Definition root.php:13