Bearsampp 2026.9.23
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{
18 const GAUGE_SAVE = 2;
20 private $wbWindow;
22 private $wbImage;
30 private $wbBtnOk;
31
38 public function __construct($args)
39 {
40 global $bearsamppCore, $bearsamppLang, $bearsamppWinbinder;
41
42 $bearsamppWinbinder->reset();
43 $this->wbWindow = $bearsamppWinbinder->createAppWindow($bearsamppLang->getValue(Lang::ABOUT_TITLE), 520, 250, WBC_NOTIFY, WBC_KEYDOWN | WBC_KEYUP);
44
45 // Get the about text
46 $aboutText = sprintf($bearsamppLang->getValue(Lang::ABOUT_TEXT), APP_TITLE . ' ' . $bearsamppCore->getAppVersion(), date('Y'), APP_AUTHOR_NAME);
47
48 // Split the text using the custom newline marker "@nl@"
49 $textLines = explode('@nl@', $aboutText);
50
51 // Display each line at a specific position
52 $yPos = 20;
53 $lineHeight = 20;
54 foreach ($textLines as $line) {
55 $bearsamppWinbinder->createLabel($this->wbWindow, trim($line), 80, $yPos, 470, $lineHeight);
56 $yPos += $lineHeight;
57 }
58
59 // Add exactly one line of blank space
60 $yPos = 125;
61
62 // Add hyperlinks
63 $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::WEBSITE) . ' :', 80, $yPos, 100, 15);
64 $this->wbLinkHomepage = $bearsamppWinbinder->createHyperLink($this->wbWindow, HttpClient::getWebsiteUrlNoUtm(), 180, $yPos, 300, 15, WBC_LINES);
65 $yPos += 20;
66
67 $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::DONATE) . ' :', 80, $yPos, 100, 15);
68 $this->wbLinkDonate = $bearsamppWinbinder->createHyperLink($this->wbWindow, HttpClient::getWebsiteUrlNoUtm('donate'), 180, $yPos, 300, 15, WBC_LINES);
69 $yPos += 20;
70
71 $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::GITHUB) . ' :', 80, $yPos, 100, 15);
72 $this->wbLinkGithub = $bearsamppWinbinder->createHyperLink($this->wbWindow, HttpClient::getGithubUserUrl(), 180, $yPos, 300, 15, WBC_LINES);
73 $yPos += 10;
74
75 $this->wbBtnOk = $bearsamppWinbinder->createButton($this->wbWindow, $bearsamppLang->getValue(Lang::BUTTON_OK), 390, 180);
76
77 $this->wbImage = $bearsamppWinbinder->drawImage($this->wbWindow, Path::getImagesPath() . '/about.bmp');
78
79 $bearsamppWinbinder->setHandler($this->wbWindow, $this, 'processWindow');
80 $bearsamppWinbinder->mainLoop();
81 $bearsamppWinbinder->reset();
82 }
83
93 public function processWindow($window, $id, $ctrl, $param1, $param2)
94 {
95 global $bearsamppConfig, $bearsamppWinbinder;
96
97 switch ($id) {
98 case $this->wbLinkHomepage[WinBinder::CTRL_ID]:
99 $bearsamppWinbinder->exec($bearsamppConfig->getBrowser(), HttpClient::getWebsiteUrl());
100 break;
101 case $this->wbLinkDonate[WinBinder::CTRL_ID]:
102 $bearsamppWinbinder->exec($bearsamppConfig->getBrowser(), HttpClient::getWebsiteUrl('donate'));
103 break;
104 case $this->wbLinkGithub[WinBinder::CTRL_ID]:
105 $bearsamppWinbinder->exec($bearsamppConfig->getBrowser(), HttpClient::getGithubUserUrl());
106 break;
107 case IDCLOSE:
108 case $this->wbBtnOk[WinBinder::CTRL_ID]:
109 $bearsamppWinbinder->destroyWindow($window);
110 break;
111 }
112 }
113}
114
global $bearsamppLang
global $bearsamppCore
processWindow($window, $id, $ctrl, $param1, $param2)
static getWebsiteUrlNoUtm($path='', $fragment='')
static getGithubUserUrl()
static getWebsiteUrl($path='', $fragment='', $utmSource=true)
const BUTTON_OK
const DONATE
const GITHUB
const ABOUT_TEXT
const ABOUT_TITLE
const WEBSITE
static getImagesPath($aetrayPath=false)
global $bearsamppConfig
Definition homepage.php:46
const APP_AUTHOR_NAME
Definition root.php:18
const APP_TITLE
Definition root.php:19