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.
font_box.h
Go to the documentation of this file.
1 #pragma once
5 #include <xtd/static.h>
6 #include "font_dialog.h"
7 #include "font_box_options.h"
8 
10 namespace xtd {
12  namespace forms {
22  class font_box final static_ {
23  public:
25 
31  static dialog_result show(xtd::drawing::font& font) { return show_font_box(font); }
32 
38  static dialog_result show(xtd::drawing::font& font, const font_box_options options) { return show_font_box(font, nullptr, nullptr, options); }
39 
45  static dialog_result show(xtd::drawing::font& font, const iwin32_window& owner) { return show_font_box(font, nullptr, &owner); }
46 
53  static dialog_result show(xtd::drawing::font& font, const iwin32_window& owner, const font_box_options options) { return show_font_box(font, nullptr, &owner, options); }
54 
60  static dialog_result show(xtd::drawing::font& font, xtd::drawing::color& color) { return show_font_box(font, &color); }
61 
68  static dialog_result show(xtd::drawing::font& font, xtd::drawing::color& color, const font_box_options options) { return show_font_box(font, &color, nullptr, options); }
69 
76  static dialog_result show(xtd::drawing::font& font, xtd::drawing::color& color, const iwin32_window& owner) { return show_font_box(font, &color, &owner); }
77 
85  static dialog_result show(xtd::drawing::font& font, xtd::drawing::color& color, const iwin32_window& owner, const font_box_options options) { return show_font_box(font, &color, &owner, options); }
87 
88  private:
89  static dialog_result show_font_box(xtd::drawing::font& font, xtd::drawing::color* color = nullptr, const iwin32_window* owner = nullptr, font_box_options options = font_box_options::none) {
90  font_dialog dialog{};
91  if (color) {
93  dialog.color(*color);
94  }
95  dialog.allow_simulation(options & font_box_options::allow_simulations)
96  .allow_vector_fonts(options & font_box_options::allow_vector_fonts)
97  .allow_vertical_fonts(options & font_box_options::allow_vertical_fonts)
98  .allow_script_change(options & font_box_options::allow_script_change)
99  .fixed_pitch_only(options & font_box_options::fixed_pitch_only)
100  .font(font)
101  .script_only(options & font_box_options::scripts_only)
102  .show_apply(options & font_box_options::show_apply)
103  .show_color(options & font_box_options::show_color)
104  .show_effect(options & font_box_options::show_effects)
105  .show_help(options & font_box_options::show_help);
106  auto res = owner ? dialog.show_sheet_dialog(*owner) : dialog.show_dialog();
107  if (res == dialog_result::ok) {
108  font = dialog.font();
109  if (color) *color = dialog.color();
110  }
111  return res;
112  }
113  };
114  }
115 }
Contains xtd::static_object class.
font(const font &prototype, float em_size)
IInitializes a new Font that uses the specified existing xtd::drawing::font and size.
Whether the dialog box allows vector font selections.
Defines a particular format for text, including font face, size, and style attributes. This class cannot be inherited.
Definition: font.h:39
dialog_result
Specifies identifiers to indicate the return value of a dialog box.
Definition: dialog_result.h:39
Contains xtd::forms::font_box_options control.
#define static_
This keyword is use to represent a static object. A static object can&#39;t be instantiated (constructors...
Definition: static.h:38
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.
Definition: font_box.h:53
Contains xtd::forms::font_dialog dialog.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
font_box_options
Specifies options on a xtd::forms::font_box.
Definition: font_box_options.h:18
Whether the dialog box allows selection of fonts for all non-OEM and Symbol character sets...
Represents a common dialog box that displays a dialog to the user to choose a font from among those i...
Definition: font_box.h:22
static dialog_result show(xtd::drawing::font &font, xtd::drawing::color &color)
Displays a font dialog box.
Definition: font_box.h:60
Whether the dialog box allows graphics device interface (GDI) font simulations.
Provides an interface to expose Win32 HWND handles.
Definition: iwin32_window.h:19
static dialog_result show(xtd::drawing::font &font, const font_box_options options)
Displays a font dialog box.
Definition: font_box.h:38
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:39
Prompts the user to choose a font from among those installed on the local computer.
Definition: font_dialog.h:27
Whether the dialog box contains controls that allow the user to specify strikethrough, underline, and text color options.
Whether the dialog box displays a Help button.
Whether the dialog box contains an Apply button.
Whether the dialog box allows only the selection of fixed-pitch fonts.
Whether the dialog box displays the color choice.
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.
Definition: font_box.h:76
Whether the user can change the character set specified in the Script combo box to display a characte...
static dialog_result show(xtd::drawing::font &font)
Displays a font dialog box.
Definition: font_box.h:31
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
Whether the dialog box displays both vertical and horizontal fonts or only horizontal fonts...
The dialog box return value is OK (usually sent from a button labeled OK).
static dialog_result show(xtd::drawing::font &font, xtd::drawing::color &color, const font_box_options options)
Displays a font dialog box.
Definition: font_box.h:68
static dialog_result show(xtd::drawing::font &font, const iwin32_window &owner)
Displays a font dialog box in front of a specified window.
Definition: font_box.h:45
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.
Definition: font_box.h:85