xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Static Public Member Functions | List of all members
xtd::forms::font_box Class Referencefinal

#include <font_box.h>

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.

Namespace
xtd::forms
Library
xtd.forms
Examples
The following code example demonstrate the use of xtd::forms::font_box dialog.
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Font box example");
client_size({ 220, 160 });
controls().push_back_range({ button_font, button_font_and_color });
button_font.parent(*this)
.location({ 10, 10 })
.text("Select a font")
.size({ 200, 45 })
.click += [this] {
auto res = font_box::show(font, *this);
if (res == dialog_result::ok) {
message_box::show(ustring::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 += [] {
auto res = font_box::show(font, color, font_box_options::show_color);
if (res == dialog_result::ok) {
message_box::show(ustring::format("Selected font is: {}\ncolor: {}", font, color));
}
};
}
private:
button button_font;
button button_font_and_color;
};
int main() {
application::run(form1());
}

Static Public Member Functions

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

Member Function Documentation

◆ show() [1/8]

static dialog_result xtd::forms::font_box::show ( xtd::drawing::font font)
inlinestatic

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]

static dialog_result xtd::forms::font_box::show ( xtd::drawing::font font,
const font_box_options  options 
)
inlinestatic

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]

static dialog_result xtd::forms::font_box::show ( xtd::drawing::font font,
const iwin32_window owner 
)
inlinestatic

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]

static dialog_result xtd::forms::font_box::show ( xtd::drawing::font font,
const iwin32_window owner,
const font_box_options  options 
)
inlinestatic

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]

static dialog_result xtd::forms::font_box::show ( xtd::drawing::font font,
xtd::drawing::color color 
)
inlinestatic

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]

static dialog_result xtd::forms::font_box::show ( xtd::drawing::font font,
xtd::drawing::color color,
const font_box_options  options 
)
inlinestatic

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]

static dialog_result xtd::forms::font_box::show ( xtd::drawing::font font,
xtd::drawing::color color,
const iwin32_window owner 
)
inlinestatic

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]

static dialog_result xtd::forms::font_box::show ( xtd::drawing::font font,
xtd::drawing::color color,
const iwin32_window owner,
const font_box_options  options 
)
inlinestatic

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: