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

Represent a emoticon with name and codepoints. More...

#include <emoticon.h>

Public Member Functions

 emoticon (const std::string &name, std::initializer_list< char32_t > codepoints)
 Initialize a new instance of emoticon class with specified name and codepoints. More...
 
 emoticon (const std::string &name, const std::vector< char32_t > &codepoints)
 Initialize a new instance of emoticon class with specified name and codepoints. More...
 
 emoticon (const std::string &name, char32_t codepoint)
 Initialize a new instance of emoticon class with specified name and codepoint. More...
 
 emoticon (std::initializer_list< char32_t > codepoints)
 Initialize a new instance of emoticon class with specified codepoints. More...
 
 emoticon (const std::vector< char32_t > &codepoints)
 Initialize a new instance of emoticon class with specified codepoints. More...
 
 emoticon (char32_t codepoint)
 Initialize a new instance of emoticon class with specified codepoint. More...
 
const std::vector< char32_t > & codepoints () const
 Gets codepoints of emoticon. More...
 
const std::string & name () const
 Gets name of emoticon. More...
 
std::string to_string () const
 Returns a string containing the codepoints of the emoticons. More...
 

Static Public Member Functions

static const emoticon empty ()
 Represents an empty emoticon. More...
 

Detailed Description

Represent a emoticon with name and codepoints.

Library
xtd.forms
Examples
The following code example demonstrate the use of emoticon class.
#include <xtd/xtd>
using namespace std;
using namespace xtd;
using namespace xtd::forms;
int main() {
auto main_form = control::create<form>("Emoticons example");
main_form->client_size({500, 400}).padding(10);
auto emoticon_label = control::create<label>(*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 = control::create<list_box>(*main_form);
emoticons_list_box->dock(dock_style::left).width(200);
for (const auto& emoticon : emoticons::get_emoticons())
emoticons_list_box->items().push_back({strings::format("{} {}", emoticon, emoticon.name()), emoticon});
emoticons_list_box->selected_value_changed += [&] {
emoticon_label->text(any_cast<emoticon>(emoticons_list_box->selected_item().tag()).to_string());
};
emoticons_list_box->selected_index(0);
application::run(*main_form);
}
Windows
emoticons_w.png

emoticons_wd.png
macOS
emoticons_m.png

emoticons_md.png
Gnome
emoticons_g.png

emoticons_gd.png
Examples:
countries.cpp, and emoticons.cpp.

Constructor & Destructor Documentation

◆ emoticon() [1/6]

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

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_t that represent the emoticon.

◆ emoticon() [2/6]

xtd::forms::emoticon::emoticon ( const std::string &  name,
const std::vector< char32_t > &  codepoints 
)
inline

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_t that represent the emoticon.

◆ emoticon() [3/6]

xtd::forms::emoticon::emoticon ( const std::string &  name,
char32_t  codepoint 
)
inline

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

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

◆ emoticon() [4/6]

xtd::forms::emoticon::emoticon ( std::initializer_list< char32_t >  codepoints)
inline

Initialize a new instance of emoticon class with specified codepoints.

Parameters
codepointsAn initializer list of char32_t that represent the emoticon.

◆ emoticon() [5/6]

xtd::forms::emoticon::emoticon ( const std::vector< char32_t > &  codepoints)
inline

Initialize a new instance of emoticon class with specified codepoints.

Parameters
codepointsAn array of char32_t that represent the emoticon.

◆ emoticon() [6/6]

xtd::forms::emoticon::emoticon ( char32_t  codepoint)
inline

Initialize a new instance of emoticon class with specified codepoint.

Parameters
codepointsA char32_t that represent the emoticon.

Member Function Documentation

◆ codepoints()

const std::vector<char32_t>& xtd::forms::emoticon::codepoints ( ) const
inline

Gets codepoints of emoticon.

Returns
An array of char32_t that represent the emoticon.

◆ empty()

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

Represents an empty emoticon.

◆ name()

const std::string& xtd::forms::emoticon::name ( ) const
inline

Gets name of emoticon.

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

◆ to_string()

std::string xtd::forms::emoticon::to_string ( ) const
inline

Returns a string containing the codepoints of the emoticons.

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

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