Initialize element.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(element_object), | intent(inout) | :: | self | element. |
||
| class(*), | intent(in), | optional | :: | string | Element string. |
|
| character(len=*), | intent(in), | optional | :: | color_fg | Foreground color. |
|
| character(len=*), | intent(in), | optional | :: | color_bg | Background color. |
|
| character(len=*), | intent(in), | optional | :: | style | Style. |
pure subroutine initialize(self, string, color_fg, color_bg, style)
!< Initialize element.
class(element_object), intent(inout) :: self !< element.
class(*), intent(in), optional :: string !< Element string.
character(len=*), intent(in), optional :: color_fg !< Foreground color.
character(len=*), intent(in), optional :: color_bg !< Background color.
character(len=*), intent(in), optional :: style !< Style.
call self%destroy
self%string = UCS4_''
if (present(string)) then
select type(string)
#if defined ASCII_SUPPORTED && defined ASCII_NEQ_DEFAULT
type is(character(len=*, kind=ASCII))
self%string = string
#endif
#ifdef UCS4_SUPPORTED
type is(character(len=*, kind=UCS4))
self%string = string
#endif
type is(character(len=*))
self%string = string
endselect
endif
self%color_fg = '' ; if (present(color_fg)) self%color_fg = color_fg
self%color_bg = '' ; if (present(color_bg)) self%color_bg = color_bg
self%style = '' ; if (present(style)) self%style = style
endsubroutine initialize