xtd 1.0.0
Loading...
Searching...
No Matches
xtd::forms::font_box Class Referencefinal
Inheritance diagram for xtd::forms::font_box:
xtd::static_object

Definition

Represents a common dialog box that displays a dialog to the user to choose a font from among those installed on the local computer.

Header
#include <xtd/forms/font_box>
Namespace
xtd::forms
Library
xtd.forms
Appearance
Windows macOS Gnome
Light
Dark
Examples
The following code example demonstrates the use of xtd::forms::font_box dialog.
#include <xtd/xtd>
class form1 : public form {
public:
form1() {
text("Font box example");
client_size({220, 160});
controls().add_range({button_font, button_font_and_color});
button_font.parent(*this)
.location({10, 10})
.text("Select a font")
.size({200, 45})
.click += delegate_ {
auto font = system_fonts::default_font();
auto res = font_box::show(font, *this);
if (res == dialog_result::ok)
message_box::show(string::format("Selected font is: {}", font));
};
button_font_and_color.parent(*this)
.location({10, 60})
.text("Select a font and a font color")
.size({200, 45})
.click += delegate_ {
drawing::font font(drawing::font_family::generic_sans_serif(), 16);
drawing::color color = drawing::color::blue;
auto res = font_box::show(font, color, font_box_options::show_color);
if (res == dialog_result::ok)
message_box::show(string::format("Selected font is: {}\ncolor: {}", font, color));
};
}
private:
button button_font;
button button_font_and_color;
};
auto main() -> int {
application::run(form1 {});
}
virtual auto font() const noexcept -> xtd::drawing::font
Gets the font of the text displayed by the control.
virtual auto text() const noexcept -> const xtd::string &
Gets the text associated with this control.
virtual auto client_size() const noexcept -> const xtd::drawing::size &
Gets the height and width of the client area of the control.
virtual auto controls() noexcept -> control_collection &
Gets the collection of controls contained within the control.
static auto show(xtd::drawing::font &font) -> xtd::forms::dialog_result
Displays a font dialog box.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
static auto show() -> xtd::forms::dialog_result
Displays a message box.
#define delegate_
The declaration of a delegate type is similar to a method signature. It has a return value and any nu...
Definition delegate.hpp:1018
xtd::forms::style_sheets::control button
The buttton data allows you to specify the box of a button control.
Definition button.hpp:25

Public Static Methods

static auto show (xtd::drawing::font &font) -> xtd::forms::dialog_result
 Displays a font dialog box.
static auto show (xtd::drawing::font &font, const font_box_options options) -> xtd::forms::dialog_result
 Displays a font dialog box.
static auto show (xtd::drawing::font &font, const iwin32_window &owner) -> xtd::forms::dialog_result
 Displays a font dialog box in front of a specified window.
static auto show (xtd::drawing::font &font, const iwin32_window &owner, const font_box_options options) -> xtd::forms::dialog_result
 Displays a font dialog box in front of a specified window.
static auto show (xtd::drawing::font &font, xtd::drawing::color &color) -> xtd::forms::dialog_result
 Displays a font dialog box.
static auto show (xtd::drawing::font &font, xtd::drawing::color &color, const font_box_options options) -> xtd::forms::dialog_result
 Displays a font dialog box.
static auto show (xtd::drawing::font &font, xtd::drawing::color &color, const iwin32_window &owner) -> xtd::forms::dialog_result
 Displays a font dialog box in front of a specified window.
static auto show (xtd::drawing::font &font, xtd::drawing::color &color, const iwin32_window &owner, const font_box_options options) -> xtd::forms::dialog_result
 Displays a font dialog box in front of a specified window.

Member Function Documentation

◆ show() [1/8]

auto xtd::forms::font_box::show ( xtd::drawing::font & font) -> xtd::forms::dialog_result
staticnodiscard

Displays a font dialog box.

Parameters
fontAn output xtd::drawing::font that will store the selected font.
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output font parameter will contain the selected font, otherwise it will be ignored.

◆ show() [2/8]

auto xtd::forms::font_box::show ( xtd::drawing::font & font,
const font_box_options options ) -> xtd::forms::dialog_result
staticnodiscard

Displays a font dialog box.

Parameters
fontAn output xtd::drawing::font that will store the selected font.
optionsA bitwise combination of enum xtd::forms::font_box_options to specify additional options to the font dialog box.
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output font parameter will contain the selected font, otherwise it will be ignored.

◆ show() [3/8]

auto xtd::forms::font_box::show ( xtd::drawing::font & font,
const iwin32_window & owner ) -> xtd::forms::dialog_result
staticnodiscard

Displays a font dialog box in front of a specified window.

Parameters
fontAn output xtd::drawing::font that will store the selected font.
ownerAn xtd::forms::iwin32_window that represents the owner window of the font dialog box.
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output font parameter will contain the selected font, otherwise it will be ignored.

◆ show() [4/8]

auto xtd::forms::font_box::show ( xtd::drawing::font & font,
const iwin32_window & owner,
const font_box_options options ) -> xtd::forms::dialog_result
staticnodiscard

Displays a font dialog box in front of a specified window.

Parameters
fontAn output xtd::drawing::font that will store the selected font.
ownerAn xtd::forms::iwin32_window that represents the owner window of the font dialog box.
optionsA bitwise combination of enum xtd::forms::font_box_options to specify additional options to the font dialog box.
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is ok, the output font parameter will contain the selected font, otherwise it will be ignored.

◆ show() [5/8]

auto xtd::forms::font_box::show ( xtd::drawing::font & font,
xtd::drawing::color & color ) -> xtd::forms::dialog_result
staticnodiscard

Displays a font dialog box.

Parameters
fontAn output xtd::drawing::font that will store the selected font.
colorAn output xtd::drawing::color that will store the selected font color.
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output parameters font and color will contain the selected font and color, otherwise they will be ignored.

◆ show() [6/8]

auto xtd::forms::font_box::show ( xtd::drawing::font & font,
xtd::drawing::color & color,
const font_box_options options ) -> xtd::forms::dialog_result
staticnodiscard

Displays a font dialog box.

Parameters
fontAn output xtd::drawing::font that will store the selected font.
colorAn output xtd::drawing::color that will store the selected font color.
optionsA bitwise combination of enum xtd::forms::font_box_options to specify additional options to the font dialog box.
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output parameters font and color will contain the selected font and color, otherwise they will be ignored.

◆ show() [7/8]

auto xtd::forms::font_box::show ( xtd::drawing::font & font,
xtd::drawing::color & color,
const iwin32_window & owner ) -> xtd::forms::dialog_result
staticnodiscard

Displays a font dialog box in front of a specified window.

Parameters
fontAn output xtd::drawing::font that will store the selected font.
colorAn output xtd::drawing::color that will store the selected font color.
ownerAn xtd::forms::iwin32_window that represents the owner window of the font dialog box.
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output parameters font and color will contain the selected font and color, otherwise they will be ignored.

◆ show() [8/8]

auto xtd::forms::font_box::show ( xtd::drawing::font & font,
xtd::drawing::color & color,
const iwin32_window & owner,
const font_box_options options ) -> xtd::forms::dialog_result
staticnodiscard

Displays a font dialog box in front of a specified window.

Parameters
fontAn output xtd::drawing::font that will store the selected font.
colorAn output xtd::drawing::color that will store the selected font color.
ownerAn xtd::forms::iwin32_window that represents the owner window of the font dialog box.
optionsA bitwise combination of enum xtd::forms::font_box_options to specify additional options to the font dialog box.
Returns
xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
Remarks
If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output parameters font and color will contain the selected font and color, otherwise they will be ignored.

The documentation for this class was generated from the following file: