xtd 1.0.0
Loading...
Searching...
No Matches
xtd::forms::country Class Reference
Inheritance diagram for xtd::forms::country:
xtd::object xtd::icomparable< country > xtd::iequatable< country > xtd::interface xtd::extensions::comparison_operators< country, icomparable< country > > xtd::interface xtd::extensions::equality_operators< country, iequatable< country > >

Definition

Represent a country with name, alpha codes, numeric code, emoticon and flag.

Header
#include <xtd/forms/country>
Namespace
xtd::forms
Library
xtd.forms
Examples
The following code example demonstrates the use of country component.
#include <xtd/xtd>
namespace countries_example {
class main_form : public form {
public:
static auto main() {
//locale::global(locale {"fr_FR.utf-8"});
application::run(main_form());
}
main_form() {
text("Countries example");
client_size({600, 500});
countries_list_box.parent(*this);
countries_list_box.location({10, 10});
countries_list_box.size({200, 480});
countries_list_box.anchor(anchor_styles::left | anchor_styles::top | anchor_styles::bottom);
for (auto country : countries::get_countries())
countries_list_box.items().add({country.name(), country});
countries_list_box.sorted(true);
countries_list_box.selected_value_changed += delegate_ {
country_flag_picture_box.image(bitmap(as<forms::country>(countries_list_box.selected_item().tag()).flag(), {256, 192}));
country_flag_squared_picture_box.image(bitmap(as<forms::country>(countries_list_box.selected_item().tag()).flag_squared(), {128, 128}));
country_emoticon_label.text(as<forms::country>(countries_list_box.selected_item().tag()).emoticon());
country_code_label.text(string::format("Codes : {} ({}) / {}", as<forms::country>(countries_list_box.selected_item().tag()).alpha_3_code(), as<forms::country>(countries_list_box.selected_item().tag()).alpha_2_code(), as<forms::country>(countries_list_box.selected_item().tag()).numeric_code()));
};
countries_list_box.selected_item(countries::belgium().name());
country_panel.parent(*this);
country_panel.location({220, 10});
country_panel.size({370, 480});
country_panel.anchor(anchor_styles::left | anchor_styles::top | anchor_styles::right | anchor_styles::bottom);
country_panel.border_style(forms::border_style::fixed_3d);
country_panel.back_color(system_colors::window());
country_panel.auto_scroll(true);
country_flag_picture_box.parent(country_panel);
country_flag_picture_box.location({10, 10});
country_flag_picture_box.size({256, 192});
country_flag_squared_picture_box.parent(country_panel);
country_flag_squared_picture_box.location({10, 212});
country_flag_squared_picture_box.size({128, 128});
country_emoticon_label.flat_style(xtd::forms::flat_style::system);
country_emoticon_label.parent(country_panel);
country_emoticon_label.font({country_emoticon_label.font(), 64});
country_emoticon_label.location({10, 350});
country_emoticon_label.auto_size(true);
country_code_label.parent(country_panel);
country_code_label.location({10, 445});
country_code_label.auto_size(true);
}
private:
list_box countries_list_box;
panel country_panel;
picture_box country_flag_picture_box;
picture_box country_flag_squared_picture_box;
label country_emoticon_label;
label country_code_label;
};
}
startup_(countries_example::main_form::main);
static auto run() -> void
Begins running a standard application message loop on the current thread, without a form.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
#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
#define startup_(...)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:284
xtd::forms::style_sheets::control label
The label data allows you to specify the box of a label control.
Definition label.hpp:25
xtd::forms::style_sheets::control panel
The panel data allows you to specify the box of a panel control.
Definition panel.hpp:25
auto name() noexcept -> xtd::string
Gets the thread name of the current thread.
@ system
The appearance of the control is determined by the user's operating system.
Definition flat_style.hpp:32
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:13

Public Fields

static auto empty () -> country
 Gets an empty country.

Public Static Methods

static auto from_alpha_2_code (const xtd::string &alpha_2_code) -> country
 Gets a country from alpha 2 code.
static auto from_alpha_3_code (const xtd::string &alpha_3_code) -> country
 Gets a country from alpha 3 code.
static auto from_name (const xtd::string &name) -> country
 Gets a country from name.
static auto from_numeric_code (xtd::int32 numeric_code) -> country
 Gets a country from numeric code.

Public Properties

virtual auto alpha_2_code () const noexcept -> xtd::string
 Gets the country alpha 2 code.
virtual auto alpha_3_code () const noexcept -> xtd::string
 Gets the country alpha 3 code.
virtual auto emoticon () const noexcept -> xtd::string
 Gets the country emoticon.
virtual auto flag () const noexcept -> xtd::drawing::image
 Gets the country flag.
virtual auto flag_squared () const noexcept -> xtd::drawing::image
 Gets the country flag.
virtual auto name () const noexcept -> xtd::string
 Gets the country name.
virtual auto numeric_code () const noexcept -> xtd::int32
 Gets the country numeric code.

Public Methods

auto compare_to (const country &obj) const noexcept -> xtd::int32 override
 Compares the current instance with another object of the same type.
auto equals (const xtd::object &obj) const noexcept -> bool override
 Determines whether the specified object is equal to the current object.
auto equals (const country &other) const noexcept -> bool override
 Determines whether the specified object is equal to the current object.
auto get_hash_code () const noexcept -> xtd::usize override
 Serves as a hash function for a particular type.
virtual auto to_string () const noexcept -> xtd::string override
 Returns a string containing the name, alpha codes and numeric code of the country.

Additional Inherited Members

 object ()=default
 Create a new instance of the ultimate base class object.
virtual auto get_type () const noexcept -> type_object
 Gets the type of the current instance.
template<typename object_t>
auto memberwise_clone () const -> xtd::unique_ptr_object< object_t >
 Creates a shallow copy of the current object.
virtual auto compare_to (const country &obj) const noexcept -> xtd::int32=0
 Compares the current instance with another object of the same type.
virtual auto equals (const country &) const noexcept -> bool=0
 Indicates whether the current object is equal to another object of the same type.
template<typename object_a_t, typename object_b_t>
static auto equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are considered equal.
template<typename object_a_t, typename object_b_t>
static auto reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are the same instance.

Member Function Documentation

◆ empty()

auto xtd::forms::country::empty ( ) -> country
staticnodiscard

Gets an empty country.

Returns
An empty country

◆ alpha_2_code()

virtual auto xtd::forms::country::alpha_2_code ( ) const -> xtd::string
nodiscardvirtualnoexcept

Gets the country alpha 2 code.

Returns
A string that represent the alpha 2 code.

◆ alpha_3_code()

virtual auto xtd::forms::country::alpha_3_code ( ) const -> xtd::string
nodiscardvirtualnoexcept

Gets the country alpha 3 code.

Returns
A string that represent the alpha 3 code.

◆ emoticon()

virtual auto xtd::forms::country::emoticon ( ) const -> xtd::string
nodiscardvirtualnoexcept

Gets the country emoticon.

Returns
A string that represent the emoticon.

◆ flag()

virtual auto xtd::forms::country::flag ( ) const -> xtd::drawing::image
nodiscardvirtualnoexcept

Gets the country flag.

Returns
A xtd::drawing::image that represent the flag of 1024 x 768 pixels.

◆ flag_squared()

virtual auto xtd::forms::country::flag_squared ( ) const -> xtd::drawing::image
nodiscardvirtualnoexcept

Gets the country flag.

Returns
A xtd::drawing::image that represent the flag of 1024 x 1024 pixels.

◆ name()

virtual auto xtd::forms::country::name ( ) const -> xtd::string
nodiscardvirtualnoexcept

Gets the country name.

Returns
A string that represent the country.

◆ numeric_code()

virtual auto xtd::forms::country::numeric_code ( ) const -> xtd::int32
nodiscardvirtualnoexcept

Gets the country numeric code.

Returns
A signed-integer that represent the numeric code.

◆ compare_to()

auto xtd::forms::country::compare_to ( const country & obj) const -> xtd::int32
nodiscardoverridenoexcept

Compares the current instance with another object of the same type.

Parameters
objAn object to compare with this instance.
Returns
A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings:
Value Condition
Less than zero This instance is less than obj.
Zero This instance is equal to obj.
Greater than zero This instance is greater than obj.

◆ equals() [1/2]

auto xtd::forms::country::equals ( const xtd::object & obj) const -> bool
nodiscardoverridevirtualnoexcept

Determines whether the specified object is equal to the current object.

Parameters
objThe object to compare with the current object.
Returns
true if the specified object is equal to the current object. otherwise, false.

Reimplemented from xtd::object.

◆ equals() [2/2]

auto xtd::forms::country::equals ( const country & other) const -> bool
nodiscardoverridenoexcept

Determines whether the specified object is equal to the current object.

Parameters
otherThe object to compare with the current object.
Returns
true if the specified object is equal to the current object. otherwise, false.

◆ get_hash_code()

auto xtd::forms::country::get_hash_code ( ) const -> xtd::usize
nodiscardoverridevirtualnoexcept

Serves as a hash function for a particular type.

Returns
A hash code for the current object.

Reimplemented from xtd::object.

◆ to_string()

virtual auto xtd::forms::country::to_string ( ) const -> xtd::string
nodiscardoverridevirtualnoexcept

Returns a string containing the name, alpha codes and numeric code of the country.

Returns
A string containing the name, alpha codes and numeric code of the country.

Reimplemented from xtd::object.

◆ from_alpha_2_code()

auto xtd::forms::country::from_alpha_2_code ( const xtd::string & alpha_2_code) -> country
staticnodiscard

Gets a country from alpha 2 code.

Returns
If exist a xtd::forms::country that represent alpha 2 coded; otherwise xtd::forms::country::empty.

◆ from_alpha_3_code()

auto xtd::forms::country::from_alpha_3_code ( const xtd::string & alpha_3_code) -> country
staticnodiscard

Gets a country from alpha 3 code.

Returns
If exist a xtd::forms::country that represent alpha 3 coded; otherwise xtd::forms::country::empty.

◆ from_name()

auto xtd::forms::country::from_name ( const xtd::string & name) -> country
staticnodiscard

Gets a country from name.

Returns
If exist a xtd::forms::country that represent name; otherwise xtd::forms::country::empty.

◆ from_numeric_code()

auto xtd::forms::country::from_numeric_code ( xtd::int32 numeric_code) -> country
staticnodiscard

Gets a country from numeric code.

Returns
If exist a xtd::forms::country that represent numeric coded; otherwise xtd::forms::country::empty.

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