forked from gabrielrcouto/php-gui
-
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.
New components by everton3x (gabrielrcouto#117)
* TDirectoryEdit implemented as DirectoryField. DirectoryField provides a one-button text field for directory selection. * TDirectoryEdit implemented as DirectoryField. DirectoryField provides a one-button text field for directory selection. Fixed bug with windows directories firing JSON Syntax exception * Code settings for Travis-CI * Line breaks to Unix * Line breaks to Unix, aff * Line breaks to Unix, aff, aff, Travis, you make me crazy. * DirectoryField::getBaseDir(): return the dialog title - bug fixed * Code format to DirectoryField a.k.a Travis * Implementation of TFileNameEdit * PSR2 refactor, and letting pascal return a list of files * Implementation of TFileNameEdit * DirectoryField renamed for compatibility with project naming (a.k.a InputText) * FileField renamed for compatibility with project naming (a.k.a InputText) * Implementation of @reisraff suggestions: OptionMgr and OpenOptions inserted in InputFile; Improved PSR2 formatting. * InputPassor Implementation. * InputNumber Implementation. Minor adjusts in examples. * InputDate Implementation. Minor adjusts in examples. * InputTime Implementation. Minor adjusts and code format. * Calendar Implementation. Minor adjusts and code format. * Gallery sample * Travis-CI: Line exceeds 120 characters; contains 136 characters - fixed * Travis-CI: Line exceeds 120 characters; contains 136 characters - fixed * Travis-CI: Line exceeds 120 characters; contains 136 characters - fixed * Travis-CI: Line exceeds 120 characters; contains 136 characters - fixed * Notes reviewed gabrielrcouto#113 * Adding duplicated code to a trait
- Loading branch information
Showing
23 changed files
with
921 additions
and
40 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ bin/* | |
!bin/generatedoc | ||
phpunit.xml | ||
doc/ | ||
/nbproject |
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
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
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,43 @@ | ||
<?php | ||
/* | ||
* Password Input Example | ||
*/ | ||
require __DIR__ . '/../../vendor/autoload.php'; | ||
|
||
use Gui\Application; | ||
use Gui\Components\Label; | ||
use Gui\Components\Button; | ||
use Gui\Components\InputPassword; | ||
|
||
$application = new Application(); | ||
|
||
$application->on('start', function() use ($application) { | ||
$label = (new Label()) | ||
->setFontSize(12) | ||
->setLeft(10) | ||
->setText('Password:') | ||
->setTop(20); | ||
|
||
$field = (new InputPassword()) | ||
->setLeft(90) | ||
->setTop(16) | ||
->setWidth(200) | ||
; | ||
|
||
$button = (new Button()) | ||
->setCounter(1) | ||
->setLeft(10) | ||
->setTop(50) | ||
->setValue('Click me, or Return/Enter in the above field') | ||
->setWidth(300); | ||
|
||
$func = function() use ($application, $field) { | ||
$application->alert('Password: ' . $field->getValue(), 'Password'); | ||
}; | ||
|
||
$button->on('click', $func); | ||
|
||
$field->on('EditingDone', $func); | ||
}); | ||
|
||
$application->run(); |
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,47 @@ | ||
<?php | ||
/* | ||
* Number Input Example | ||
*/ | ||
require __DIR__ . '/../../vendor/autoload.php'; | ||
|
||
use Gui\Application; | ||
use Gui\Components\Label; | ||
use Gui\Components\InputNumber; | ||
|
||
$application = new Application(); | ||
|
||
$application->on('start', function() use ($application) { | ||
$label1 = (new Label()) | ||
->setFontSize(12) | ||
->setLeft(10) | ||
->setText('Integer') | ||
->setTop(80); | ||
|
||
$field1 = (new InputNumber()) | ||
->setLeft(100) | ||
->setTop(80) | ||
->setWidth(200) | ||
->setIncrement(2) | ||
->setMax(10) | ||
->setMin(-10) | ||
->setValue(-4) | ||
; | ||
|
||
$label2 = (new Label()) | ||
->setFontSize(12) | ||
->setLeft(10) | ||
->setText('Float') | ||
->setTop(120); | ||
|
||
$field2 = (new InputNumber(true)) | ||
->setLeft(100) | ||
->setTop(120) | ||
->setWidth(200) | ||
->setIncrement(0.25) | ||
->setValue(1.25) | ||
->setDecimals(4) | ||
; | ||
|
||
}); | ||
|
||
$application->run(); |
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,31 @@ | ||
<?php | ||
/* | ||
* Date Input Example | ||
*/ | ||
require __DIR__ . '/../../vendor/autoload.php'; | ||
|
||
use Gui\Application; | ||
use Gui\Components\Label; | ||
use Gui\Components\InputDate; | ||
|
||
$application = new Application(); | ||
|
||
$application->on('start', function() use ($application) { | ||
$label = (new Label()) | ||
->setFontSize(12) | ||
->setLeft(10) | ||
->setText('Date') | ||
->setTop(20); | ||
|
||
$field = (new InputDate()) | ||
->setLeft(90) | ||
->setTop(16) | ||
->setWidth(200) | ||
; | ||
|
||
$field->on('change', function() use ($application, $field) { | ||
$application->alert('Date selected: ' . $field->getValue(), 'Date selected'); | ||
}); | ||
}); | ||
|
||
$application->run(); |
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,33 @@ | ||
<?php | ||
/* | ||
* Date Input Example | ||
*/ | ||
require __DIR__ . '/../../vendor/autoload.php'; | ||
|
||
use Gui\Application; | ||
use Gui\Components\Label; | ||
use Gui\Components\InputTime; | ||
|
||
$application = new Application(); | ||
|
||
$application->on('start', function() use ($application) { | ||
$label = (new Label()) | ||
->setFontSize(12) | ||
->setLeft(10) | ||
->setText('Time') | ||
->setTop(20); | ||
|
||
$field = (new InputTime()) | ||
->setLeft(100) | ||
->setTop(16) | ||
->setWidth(200) | ||
->setAcceptInput(false) | ||
->setButtonOnlyWhenFocused(true) | ||
; | ||
|
||
$field->on('change', function() use ($application, $field) { | ||
$application->alert('Time selected: ' . $field->getValue(), 'Time selected'); | ||
}); | ||
}); | ||
|
||
$application->run(); |
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 @@ | ||
<?php | ||
/* | ||
* Calendar Example | ||
*/ | ||
require __DIR__ . '/../../vendor/autoload.php'; | ||
|
||
use Gui\Application; | ||
use Gui\Components\Calendar; | ||
|
||
$application = new Application(); | ||
|
||
$application->on('start', function() use ($application) { | ||
$field = (new Calendar()) | ||
->setLeft(20) | ||
->setTop(20) | ||
->setValue('01/02/2017') | ||
; | ||
|
||
// {on}change events is also fired with the getValue() and then causes a infinite loop | ||
$field->on('mouseUp', function() use ($application, $field) { | ||
$application->alert('Date selected: ' . $field->getValue(), 'Date selected'); | ||
}); | ||
}); | ||
|
||
$application->run(); |
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,113 @@ | ||
<?php | ||
|
||
/* | ||
* Components Gallery | ||
*/ | ||
require __DIR__ . '/../../vendor/autoload.php'; | ||
|
||
use Gui\Application; | ||
use Gui\Components\Button; | ||
use Gui\Components\Calendar; | ||
use Gui\Components\Checkbox; | ||
use Gui\Components\InputDate; | ||
use Gui\Components\InputDirectory; | ||
use Gui\Components\InputFile; | ||
use Gui\Components\InputNumber; | ||
use Gui\Components\InputPassword; | ||
use Gui\Components\InputText; | ||
use Gui\Components\InputTime; | ||
use Gui\Components\Label; | ||
use Gui\Components\Option; | ||
use Gui\Components\ProgressBar; | ||
use Gui\Components\Radio; | ||
use Gui\Components\Select; | ||
use Gui\Components\TextArea; | ||
|
||
$application = new Application(); | ||
|
||
$application->on('start', function() use ($application) { | ||
$application->getWindow()->setTitle('PHP-GUI Components Gallery'); | ||
$application->getWindow()->setWindowState('maximized'); | ||
|
||
$button = (new Button()) | ||
->setValue('Click') | ||
->setTop(10) | ||
->setLeft(10); | ||
|
||
$calendar = (new Calendar()) | ||
->setTop(50) | ||
->setLeft(10); | ||
|
||
$checkbox = (new Checkbox()) | ||
->setTop(10) | ||
->setLeft(300); | ||
|
||
$label = (new Label()) | ||
->setText('Checkbox') | ||
->setTop(11) | ||
->setLeft(320); | ||
|
||
$radio = (new Radio()) | ||
->setTop(30) | ||
->setLeft(300) | ||
->setOptions([ | ||
new Option('Radio 1', 1), | ||
new Option('Radio 2', 2), | ||
new Option('Radio 3', 3) | ||
]); | ||
|
||
$date = (new InputDate()) | ||
->setTop(250) | ||
->setLeft(10); | ||
|
||
$directory = (new InputDirectory()) | ||
->setTop(300) | ||
->setLeft(10); | ||
|
||
$file = (new InputFile()) | ||
->setTop(350) | ||
->setLeft(10); | ||
|
||
$integer= (new InputNumber()) | ||
->setTop(400) | ||
->setLeft(10); | ||
|
||
$float= (new InputNumber(true)) | ||
->setTop(450) | ||
->setLeft(10); | ||
|
||
$password = (new InputPassword()) | ||
->setTop(250) | ||
->setLeft(250); | ||
|
||
$text = (new InputText()) | ||
->setTop(300) | ||
->setLeft(250); | ||
|
||
$time = (new InputTime()) | ||
->setTop(350) | ||
->setLeft(250); | ||
|
||
$progress = (new ProgressBar()) | ||
->setTop(500) | ||
->setLeft(10) | ||
->setMin(0) | ||
->setMax(100) | ||
->setPosition(75); | ||
|
||
$select = (new Select()) | ||
->setTop(10) | ||
->setLeft(190) | ||
->setOptions([ | ||
new Option('Option 1', 1), | ||
new Option('Option 2', 2), | ||
new Option('Option 3', 3) | ||
]); | ||
|
||
$textarea = (new TextArea()) | ||
->setTop(500) | ||
->setLeft(500) | ||
->setValue('Text area sample'); | ||
}); | ||
|
||
$application->run(); |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Oops, something went wrong.