xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
emoticons.cpp

The following code example demonstrate the use of emoticon and emoticons classes.

Windows

macOS

Gnome

#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({ustring::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);
}
Represent a emoticon with name and codepoints.
Definition emoticon.h:25
const xtd::ustring & name() const
Gets name of emoticon.
Definition emoticon.h:100
Represents a display device or multiple display devices on a single system.
Definition padding.h:20
@ middle_center
Content is vertically aligned at the middle, and horizontally aligned at the center.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17