xtd 0.2.0
xtd::forms::emoticon Class Reference
Inheritance diagram for xtd::forms::emoticon:
xtd::object xtd::iequatable< emoticon > xtd::icomparable< emoticon > xtd::interface xtd::extensions::equality_operators< emoticon, iequatable< emoticon > > xtd::interface xtd::extensions::comparison_operators< emoticon, icomparable< emoticon > >

Definition

Represent a emoticon with name and codepoints.

Header
#include <xtd/forms/emoticon>
Namespace
xtd::forms
Library
xtd.forms
Examples
The following code example demonstrates the use of emoticon class.
#include <xtd/forms/application>
#include <xtd/forms/emoticons>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/list_box>
using namespace xtd;
using namespace xtd::forms;
auto main() -> int {
auto main_form = form::create("Emoticons example");
main_form.client_size({500, 400}).padding(10);
auto emoticon_label = label::create(main_form, "");
emoticon_label.text_align(xtd::forms::content_alignment::middle_center).dock(dock_style::fill).font({main_form.font(), 192});
auto emoticons_list_box = list_box::create(main_form, list_box::object_collection {});
emoticons_list_box.dock(dock_style::left).width(200);
for (const auto& emoticon : emoticons::get_emoticons())
emoticons_list_box.items().push_back({string::format("{} {}", emoticon, emoticon.name()), emoticon});
emoticons_list_box.selected_value_changed += [&] {
emoticon_label.text(as<emoticon>(emoticons_list_box.selected_item().tag()).to_string());
};
emoticons_list_box.selected_index(0);
application::run(main_form);
}
static void run()
Begins running a standard application message loop on the current thread, without a form.
Represent a emoticon with name and codepoints.
Definition emoticon.hpp:32
const xtd::string & name() const noexcept
Gets name of emoticon.
static const xtd::array< xtd::forms::emoticon > & get_emoticons() noexcept
Gets emoticons collection.
static form create()
A factory to create an xtd::forms::form.
static label create()
A factory to create an xtd::forms::label.
static list_box create()
A factory to create an xtd::forms::list_box.
layout::arranged_element_collection< item, item::sorter > object_collection
Represents the collection of items in a list_control.
Definition list_control.hpp:135
Represents a display device or multiple display devices on a single system.
Definition padding.hpp:25
type_t as(any_object &o)
Casts a type into another type.
Definition __as_any_object.hpp:59
@ left
The control's left edge is docked to the left edge of its containing control.
Definition dock_style.hpp:31
@ fill
All the control's edges are docked to the all edges of its containing control and sized appropriately...
Definition dock_style.hpp:35
@ middle_center
Content is vertically aligned at the middle, and horizontally aligned at the center.
Definition content_alignment.hpp:31
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:217
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Examples
emoticons.cpp.

Public Fields

static const emoticon empty ()
 Represents an empty emoticon.
 

Public Constructors

 emoticon (const xtd::string &name, std::initializer_list< char32 > codepoints)
 Initialize a new instance of emoticon class with specified name and codepoints.
 
 emoticon (const xtd::string &name, const xtd::array< char32 > &codepoints)
 Initialize a new instance of emoticon class with specified name and codepoints.
 
 emoticon (const xtd::string &name, char32 codepoint)
 Initialize a new instance of emoticon class with specified name and codepoint.
 
 emoticon (std::initializer_list< char32 > codepoints)
 Initialize a new instance of emoticon class with specified codepoints.
 
 emoticon (const xtd::array< char32 > &codepoints)
 Initialize a new instance of emoticon class with specified codepoints.
 
 emoticon (char32 codepoint)
 Initialize a new instance of emoticon class with specified codepoint.
 

Public Properties

const xtd::stringname () const noexcept
 Gets name of emoticon.
 
xtd::array< char32codepoints () const noexcept
 Gets codepoints of emoticon.
 

Public Methods

int32 compare_to (const emoticon &obj) const noexcept override
 Compares the current instance with another object of the same type.
 
bool equals (const xtd::object &obj) const noexcept override
 Determines whether the specified object is equal to the current object.
 
bool equals (const emoticon &other) const noexcept override
 Determines whether the specified object is equal to the current object.
 
xtd::size get_hash_code () const noexcept override
 Serves as a hash function for a particular type.
 
xtd::string to_string () const noexcept override
 Returns a string containing the codepoints of the emoticons.
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ emoticon() [1/6]

xtd::forms::emoticon::emoticon ( const xtd::string & name,
std::initializer_list< char32 > codepoints )

Initialize a new instance of emoticon class with specified name and codepoints.

Parameters
nameA string that represent the name of emoticon
codepointsAn initializer list of char32 that represent the emoticon.

◆ emoticon() [2/6]

xtd::forms::emoticon::emoticon ( const xtd::string & name,
const xtd::array< char32 > & codepoints )

Initialize a new instance of emoticon class with specified name and codepoints.

Parameters
nameA string that represent the name of emoticon
codepointsAn array of char32 that represent the emoticon.

◆ emoticon() [3/6]

xtd::forms::emoticon::emoticon ( const xtd::string & name,
char32 codepoint )

Initialize a new instance of emoticon class with specified name and codepoint.

Parameters
nameA string that represent the name of emoticon
codepointA char32 that represent the emoticon.

◆ emoticon() [4/6]

xtd::forms::emoticon::emoticon ( std::initializer_list< char32 > codepoints)
explicit

Initialize a new instance of emoticon class with specified codepoints.

Parameters
codepointsAn initializer list of char32 that represent the emoticon.

◆ emoticon() [5/6]

xtd::forms::emoticon::emoticon ( const xtd::array< char32 > & codepoints)
explicit

Initialize a new instance of emoticon class with specified codepoints.

Parameters
codepointsAn array of char32 that represent the emoticon.

◆ emoticon() [6/6]

xtd::forms::emoticon::emoticon ( char32 codepoint)
explicit

Initialize a new instance of emoticon class with specified codepoint.

Parameters
codepointsA char32 that represent the emoticon.

Member Function Documentation

◆ empty()

static const emoticon xtd::forms::emoticon::empty ( )
static

Represents an empty emoticon.

◆ name()

const xtd::string & xtd::forms::emoticon::name ( ) const
noexcept

Gets name of emoticon.

Returns
A string that represent the name of emoticon.
Examples
emoticons.cpp.

◆ codepoints()

xtd::array< char32 > xtd::forms::emoticon::codepoints ( ) const
noexcept

Gets codepoints of emoticon.

Returns
An array of char32 that represent the emoticon.

◆ compare_to()

int32 xtd::forms::emoticon::compare_to ( const emoticon & obj) const
overridenoexcept

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]

bool xtd::forms::emoticon::equals ( const xtd::object & obj) const
overridevirtualnoexcept

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]

bool xtd::forms::emoticon::equals ( const emoticon & other) const
overridenoexcept

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()

xtd::size xtd::forms::emoticon::get_hash_code ( ) const
overridevirtualnoexcept

Serves as a hash function for a particular type.

Returns
A hash code for the current object.

Reimplemented from xtd::object.

◆ to_string()

xtd::string xtd::forms::emoticon::to_string ( ) const
overridevirtualnoexcept

Returns a string containing the codepoints of the emoticons.

Returns
A string containing the codepoints of the emoticon. Empty string ("") for none codepoints.

Reimplemented from xtd::object.


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