2024.8.23
Loading...
Searching...
No Matches
class.action.about.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
10/**
11 * Class ActionAbout
12 * Handles the creation and management of the "About" window in the Bearsampp application.
13 */
15{
16 private $wbWindow;
17 private $wbImage;
21 private $wbBtnOk;
22
23 const GAUGE_SAVE = 2;
24
25 /**
26 * ActionAbout constructor.
27 * Initializes the "About" window and its components.
28 *
29 * @param array $args Arguments passed to the constructor.
30 */
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), 500, 250, WBC_NOTIFY, WBC_KEYDOWN | WBC_KEYUP);
37
38 $aboutText = sprintf($bearsamppLang->getValue(Lang::ABOUT_TEXT), APP_TITLE . ' ' . $bearsamppCore->getAppVersion(), date('Y'), APP_AUTHOR_NAME);
39 $bearsamppWinbinder->createLabel($this->wbWindow, $aboutText, 80, 20, 470, 120);
40
41 $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::WEBSITE) . ' :', 80, 105, 470, 15);
42 $this->wbLinkHomepage = $bearsamppWinbinder->createHyperLink($this->wbWindow, Util::getWebsiteUrlNoUtm(), 180, 105, 300, 15, WBC_LINES);
43
44 $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::DONATE) . ' :', 80, 125, 470, 15);
45 $this->wbLinkDonate = $bearsamppWinbinder->createHyperLink($this->wbWindow, Util::getWebsiteUrlNoUtm('donate'), 180, 125, 300, 15, WBC_LINES | WBC_RIGHT);
46
47 $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::GITHUB) . ' :', 80, 145, 470, 15);
48 $this->wbLinkGithub = $bearsamppWinbinder->createHyperLink($this->wbWindow, Util::getGithubUserUrl(), 180, 145, 300, 15, WBC_LINES | WBC_RIGHT);
49
50 $this->wbBtnOk = $bearsamppWinbinder->createButton($this->wbWindow, $bearsamppLang->getValue(Lang::BUTTON_OK), 390, 180);
51
52 $this->wbImage = $bearsamppWinbinder->drawImage($this->wbWindow, $bearsamppCore->getResourcesPath() . '/homepage/img/about.bmp');
53
54 $bearsamppWinbinder->setHandler($this->wbWindow, $this, 'processWindow');
55 $bearsamppWinbinder->mainLoop();
56 $bearsamppWinbinder->reset();
57 }
58
59 /**
60 * Processes window events and handles user interactions.
61 *
62 * @param int $window The window identifier.
63 * @param int $id The control identifier.
64 * @param int $ctrl The control object.
65 * @param mixed $param1 Additional parameter 1.
66 * @param mixed $param2 Additional parameter 2.
67 */
68 public function processWindow($window, $id, $ctrl, $param1, $param2)
69 {
70 global $bearsamppConfig, $bearsamppWinbinder;
71
72 switch ($id) {
73 case $this->wbLinkHomepage[WinBinder::CTRL_ID]:
74 $bearsamppWinbinder->exec($bearsamppConfig->getBrowser(), Util::getWebsiteUrl());
75 break;
76 case $this->wbLinkDonate[WinBinder::CTRL_ID]:
77 $bearsamppWinbinder->exec($bearsamppConfig->getBrowser(), Util::getWebsiteUrl('donate'));
78 break;
79 case $this->wbLinkGithub[WinBinder::CTRL_ID]:
80 $bearsamppWinbinder->exec($bearsamppConfig->getBrowser(), Util::getGithubUserUrl());
81 break;
82 case IDCLOSE:
83 case $this->wbBtnOk[WinBinder::CTRL_ID]:
84 $bearsamppWinbinder->destroyWindow($window);
85 break;
86 }
87 }
88}
global $bearsamppLang
global $bearsamppCore
processWindow($window, $id, $ctrl, $param1, $param2)
const BUTTON_OK
const WEBSITE
const GITHUB
const DONATE
const ABOUT_TEXT
const ABOUT_TITLE
static getGithubUserUrl($part=null)
static getWebsiteUrlNoUtm($path='', $fragment='')
static getWebsiteUrl($path='', $fragment='', $utmSource=true)
global $bearsamppConfig
Definition homepage.php:26
const APP_AUTHOR_NAME
Definition root.php:11
const APP_TITLE
Definition root.php:12