From 5e0ef1616e618faeff6d5adc65689900f5354b11 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 3 Aug 2024 05:39:55 +0300 Subject: [PATCH] draft content area --- src/Entity/Browser/Container/Page/Auth.php | 59 +++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/src/Entity/Browser/Container/Page/Auth.php b/src/Entity/Browser/Container/Page/Auth.php index 39d4c7bb..991a8d7c 100644 --- a/src/Entity/Browser/Container/Page/Auth.php +++ b/src/Entity/Browser/Container/Page/Auth.php @@ -8,6 +8,7 @@ use \GtkButtonsType; use \GtkDialogFlags; use \GtkMessageDialog; use \GtkMessageType; +use \GtkRadioButton; use \GtkResponseType; use \Yggverse\Yoda\Entity\Browser\Container\Page; @@ -21,8 +22,12 @@ class Auth public Page $page; // Defaults - public const DIALOG_MESSAGE_FORMAT = 'Authorization'; public const DIALOG_DEFAULT_RESPONSE = GtkResponseType::CANCEL; + public const DIALOG_FORMAT_SECONDARY_TEXT = 'Select identity'; + public const DIALOG_MESSAGE_FORMAT = 'Authorization'; + public const DIALOG_CONTENT_OPTION_LABEL_CREATE = 'Create new for this resource'; + public const DIALOG_CONTENT_OPTION_MARGIN = 8; + public const DIALOG_CONTENT_SPACING = 8; public function __construct( Page $page, @@ -33,6 +38,7 @@ class Auth public function dialog(): bool { + // Init dialog $this->gtk = new GtkMessageDialog( $this->page->container->browser->gtk, GtkDialogFlags::MODAL, @@ -41,10 +47,31 @@ class Auth _($this::DIALOG_MESSAGE_FORMAT) ); + $this->gtk->format_secondary_text( + _($this::DIALOG_FORMAT_SECONDARY_TEXT) + ); + $this->gtk->set_default_response( $this::DIALOG_DEFAULT_RESPONSE ); + // Init content + $content = $this->gtk->get_content_area(); + + $content->set_spacing( + $this::DIALOG_CONTENT_SPACING + ); + + $content->add( + $this->_option( + _($this::DIALOG_CONTENT_OPTION_LABEL_CREATE) + ) + ); + + // Render + $this->gtk->show_all(); + + // Listen for chose if (GtkResponseType::OK == $this->gtk->run()) { // @TODO @@ -58,4 +85,34 @@ class Auth return false; } + + private function _option( + string $label, + int $margin = self::DIALOG_CONTENT_OPTION_MARGIN + ): GtkRadioButton + { + $option = GtkRadioButton::new_with_label( + $label + ); + + $option->set_margin_start( + $margin + ); + + $option->set_margin_start( + $margin + ); + + $option->set_margin_end( + $margin + ); + + $option->set_margin_bottom( + $margin + ); + + // @TODO connect signals? + + return $option; + } } \ No newline at end of file