Skip to content

Commit

Permalink
Doc refinements
Browse files Browse the repository at this point in the history
  • Loading branch information
djowel committed Aug 4, 2024
1 parent 8deac36 commit 58e21fb
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 87 deletions.
4 changes: 3 additions & 1 deletion docs/modules/ROOT/pages/common.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@
:receiver: receiver
:font_descr: font_descr
:color: color
:text-align: text-align
:text-align: text-align
:text_writer_u8: text_writer_u8
:text_reader_u8: text_reader_u8
23 changes: 23 additions & 0 deletions docs/modules/ROOT/pages/elements/button_stylers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ The button stylers are separate from the button classes, which handle user
interactions. This separation of responsibilities allows for greater
flexibility in defining the button's appearance and behavior.

The `default_button_styler` class is the base class for button stylers. It
provides the default appearance for buttons. There are a couple of derived
classes that provide various properties that override the defaults. These
shall remain private to the library.

=== Declaration

[source,c++]
----
class default_button_styler;
----

=== Concepts

[source,c++]
----
namespace concepts
{
template <typename T>
concept ButtonStyler = std::is_base_of_v<default_button_styler, std::decay_t<T>>;
}
----

=== Notation

`label` :: An object of type std::string.
Expand Down
92 changes: 78 additions & 14 deletions docs/modules/ROOT/pages/elements/labels.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,30 @@ include::../common.adoc[]
Labels are used to display static text. They are typically used for various
tasks such as annotating other elements, such as input fields or buttons.
Label stylers allow for the customization of the label's appearance,
including the font, color, alignment, and size.
including the font, font color, font size, and text alignment.

The `default_label_styler` class is the base class for label stylers. It
provides the default appearance for labels. There are a couple of derived
classes that provide various properties that override the defaults. These
shall remain private to the library.

=== Declaration

[source,c++]
----
class default_label_styler;
----

=== Concepts

[source,c++]
----
namespace concepts
{
template <typename T>
concept ButtonStyler = std::is_base_of_v<default_label_styler, std::decay_t<T>>;
}
----

=== Notation

Expand Down Expand Up @@ -104,12 +127,45 @@ desired appearance.

[source,c++]
----
auto my_label = label("Hello, World!")
.font("Helvetica")
.font_size(18.0)
.font_color(colors::magenta)
.text_align(text_halign::left);
auto my_label = label("My Label")
.font(font_descr{"Open Sans"}.semi_bold())
.font_color(colors::antique_white)
.font_size(18)
;
----

== Enable/Disable

Labels can be either enabled or disabled. When a label is disabled, it will
appear grayed-out, indicating its disabled state.

=== Notation

`lst` :: A label styler instance.
`state` :: A boolean value indicating whether the label is enabled or disabled.

=== Expressions

[cols="2,3", options="header"]
|===
| Expression | Semantics

a|
[source,c++]
----
lst.enable(state)
----
a|
* Sets the label's enabled state. Pass `true` to the `state` argument to
enable the label, or `false` to disable it.
a|
[source,c++]
----
lst.is_enabled()
----
a|
* Returns `true` if the label is enabled, `false` otherwise.
|===

== Label Styler Defaults

Expand All @@ -119,11 +175,11 @@ The default label styler is created with the following defaults:
|===
| Property | Default

| font | {Global-theme} label_font
| font_size | {Global-theme} label_font.size
| font | {Global-theme} `label_font`
| font_size | {Global-theme} `label_font.size`
| relative_font_size | `1.0f`
| font_color | {Global-theme} label_font_color
| text_align | {Global-theme} label_text_align
| font_color | {Global-theme} `label_font_color`
| text_align | {Global-theme} `label_text_align`
|===

== Heading Styler Defaults
Expand All @@ -134,11 +190,11 @@ The default heading styler is created with the following defaults:
|===
| Property | Default

| font | {Global-theme} heading_font
| font_size | {Global-theme} heading_font.size
| font | {Global-theme} `heading_font`
| font_size | {Global-theme} `heading_font.size`
| relative_font_size | `1.0f`
| font_color | {Global-theme} heading_font_color
| text_align | {Global-theme} heading_text_align
| font_color | {Global-theme} `heading_font_color`
| text_align | {Global-theme} `heading_text_align`
|===

== Getters and Setters
Expand Down Expand Up @@ -206,6 +262,14 @@ a|
a|
[source,c++]
----
lst.get_default_font_size()
----
a|
* Get the default font size of the label.
* Returns `float`.
a|
[source,c++]
----
lst.set_font_size(size)
----
a|
Expand Down
Loading

0 comments on commit 58e21fb

Please sign in to comment.