Bearsampp 2025.8.29
Loading...
Searching...
No Matches
ActionAbout Class Reference

Public Member Functions

 __construct ($args)
 processWindow ($window, $id, $ctrl, $param1, $param2)

Data Fields

const GAUGE_SAVE = 2

Private Attributes

 $wbBtnOk
 $wbImage
 $wbLinkDonate
 $wbLinkGithub
 $wbLinkHomepage
 $wbWindow

Detailed Description

Class ActionAbout Handles the creation and management of the "About" window in the Bearsampp application.

Definition at line 15 of file class.action.about.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( $args)

ActionAbout constructor. Initializes the "About" window and its components.

Parameters
array$argsArguments passed to the constructor.

Definition at line 31 of file class.action.about.php.

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 }
global $bearsamppLang
global $bearsamppCore
const BUTTON_OK
const DONATE
const GITHUB
const ABOUT_TEXT
const ABOUT_TITLE
const WEBSITE
static getWebsiteUrlNoUtm($path='', $fragment='')
static getGithubUserUrl($part=null)
const APP_AUTHOR_NAME
Definition root.php:12
const APP_TITLE
Definition root.php:13

References $bearsamppCore, $bearsamppLang, Lang\ABOUT_TEXT, Lang\ABOUT_TITLE, APP_AUTHOR_NAME, APP_TITLE, Lang\BUTTON_OK, Lang\DONATE, Util\getGithubUserUrl(), Util\getWebsiteUrlNoUtm(), Lang\GITHUB, and Lang\WEBSITE.

Member Function Documentation

◆ processWindow()

processWindow ( $window,
$id,
$ctrl,
$param1,
$param2 )

Processes window events and handles user interactions.

Parameters
int$windowThe window identifier.
int$idThe control identifier.
int$ctrlThe control object.
mixed$param1Additional parameter 1.
mixed$param2Additional parameter 2.

Definition at line 86 of file class.action.about.php.

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 }
static getWebsiteUrl($path='', $fragment='', $utmSource=true)
global $bearsamppConfig
Definition homepage.php:27

References $bearsamppConfig, WinBinder\CTRL_ID, Util\getGithubUserUrl(), and Util\getWebsiteUrl().

Field Documentation

◆ $wbBtnOk

$wbBtnOk
private

Definition at line 23 of file class.action.about.php.

◆ $wbImage

$wbImage
private

Definition at line 19 of file class.action.about.php.

◆ $wbLinkDonate

$wbLinkDonate
private

Definition at line 21 of file class.action.about.php.

◆ $wbLinkGithub

$wbLinkGithub
private

Definition at line 22 of file class.action.about.php.

◆ $wbLinkHomepage

$wbLinkHomepage
private

Definition at line 20 of file class.action.about.php.

◆ $wbWindow

$wbWindow
private

Definition at line 18 of file class.action.about.php.

◆ GAUGE_SAVE

const GAUGE_SAVE = 2

Definition at line 17 of file class.action.about.php.


The documentation for this class was generated from the following file: