-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a5fd251
Showing
57 changed files
with
5,559 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
SimpleGUI | ||
=================== | ||
|
||
__The GUI SDK based on php-gui for SimpleFramework(CLI)__ | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
Introduction | ||
------------- | ||
With this SDK, you can create a visual window quickly and easily. | ||
|
||
Get SimpleGUI | ||
------------- | ||
__[Releases](https://github.com/PeratX/SimpleGUI/releases)__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "SimpleGUI", | ||
"version": "1.0.0", | ||
"api": 2, | ||
"description": "The GUI SDK based on php-gui for SimpleFramework.", | ||
"author": "PeratX", | ||
"main": "SimpleGUI\\Main", | ||
"order": 0, | ||
"website": "https://github.com/PeratX/SimpleGUI" | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Evenement. | ||
* | ||
* (c) Igor Wiedler <igor@wiedler.ch> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Evenement; | ||
|
||
class EventEmitter implements EventEmitterInterface | ||
{ | ||
use EventEmitterTrait; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Evenement. | ||
* | ||
* (c) Igor Wiedler <igor@wiedler.ch> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Evenement; | ||
|
||
interface EventEmitterInterface | ||
{ | ||
public function on($event, callable $listener); | ||
public function once($event, callable $listener); | ||
public function removeListener($event, callable $listener); | ||
public function removeAllListeners($event = null); | ||
public function listeners($event); | ||
public function emit($event, array $arguments = []); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Evenement. | ||
* | ||
* (c) Igor Wiedler <igor@wiedler.ch> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Evenement; | ||
|
||
trait EventEmitterTrait | ||
{ | ||
protected $listeners = []; | ||
|
||
public function on($event, callable $listener) | ||
{ | ||
if (!isset($this->listeners[$event])) { | ||
$this->listeners[$event] = []; | ||
} | ||
|
||
$this->listeners[$event][] = $listener; | ||
} | ||
|
||
public function once($event, callable $listener) | ||
{ | ||
$onceListener = function () use (&$onceListener, $event, $listener) { | ||
$this->removeListener($event, $onceListener); | ||
|
||
call_user_func_array($listener, func_get_args()); | ||
}; | ||
|
||
$this->on($event, $onceListener); | ||
} | ||
|
||
public function removeListener($event, callable $listener) | ||
{ | ||
if (isset($this->listeners[$event])) { | ||
$index = array_search($listener, $this->listeners[$event], true); | ||
if (false !== $index) { | ||
unset($this->listeners[$event][$index]); | ||
} | ||
} | ||
} | ||
|
||
public function removeAllListeners($event = null) | ||
{ | ||
if ($event !== null) { | ||
unset($this->listeners[$event]); | ||
} else { | ||
$this->listeners = []; | ||
} | ||
} | ||
|
||
public function listeners($event) | ||
{ | ||
return isset($this->listeners[$event]) ? $this->listeners[$event] : []; | ||
} | ||
|
||
public function emit($event, array $arguments = []) | ||
{ | ||
foreach ($this->listeners($event) as $listener) { | ||
call_user_func_array($listener, $arguments); | ||
} | ||
} | ||
} |
Oops, something went wrong.