xtd 0.2.0
Loading...
Searching...
No Matches
link_label.h
Go to the documentation of this file.
1
4#pragma once
5#include "cursors.h"
6#include "label.h"
7#include "link.h"
8#include "link_area.h"
9#include "link_behavior.h"
11#include <xtd/drawing/system_colors>
12#include <xtd/any>
13#include <tuple>
14
16namespace xtd {
18 namespace forms {
41 class link_label : public label {
42 struct data;
43
44 public:
46
54
56 class link_collection : public xtd::forms::layout::arranged_element_collection<xtd::forms::link_label::link> {
57 public:
59
64
66
71 explicit link_collection(const allocator_type& allocator = allocator_type());
73
75 explicit link_collection(const base& collection);
76 link_collection(const link_collection& collection);
77 link_collection& operator =(const link_collection& collection);
80
82
84 using base::operator [];
96 };
97
99
104
106 link_label(link_label&& rhs);
107 link_label(const link_label&) = default;
108 link_label& operator =(const link_label&) = default;
110
112
128 link_label& active_link_color(const xtd::drawing::color& color);
129
135 xtd::drawing::color disabled_link_color() const noexcept;
142 link_label& disabled_link_color(const xtd::drawing::color& color);
143
150 xtd::forms::link_area link_area() const noexcept;
159
169
176 xtd::drawing::color link_color() const noexcept;
184 link_label& link_color(const xtd::drawing::color& color);
185
191 const link_collection& links() const noexcept;
205
208 xtd::forms::cursor override_cursor() const noexcept;
213
220 xtd::drawing::color visited_link_color() const noexcept;
228 link_label& visited_link_color(const xtd::drawing::color& color);
230
232
240 static link_label create(const drawing::point& location);
245 static link_label create(const drawing::point& location, const drawing::size& size);
251 static link_label create(const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
260 static link_label create(const xtd::ustring& text, const drawing::point& location);
266 static link_label create(const xtd::ustring& text, const drawing::point& location, const drawing::size& size);
273 static link_label create(const xtd::ustring& text, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
284 static link_label create(const xtd::ustring& text, const link_collection& links, const drawing::point& location);
291 static link_label create(const xtd::ustring& text, const link_collection& links, const drawing::point& location, const drawing::size& size);
299 static link_label create(const xtd::ustring& text, const link_collection& links, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
308 static link_label create(const control& parent, const drawing::point& location);
314 static link_label create(const control& parent, const drawing::point& location, const drawing::size& size);
321 static link_label create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
326 static link_label create(const control& parent, const xtd::ustring& text);
332 static link_label create(const control& parent, const xtd::ustring& text, const drawing::point& location);
339 static link_label create(const control& parent, const xtd::ustring& text, const drawing::point& location, const drawing::size& size);
347 static link_label create(const control& parent, const xtd::ustring& text, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
359 static link_label create(const control& parent, const xtd::ustring& text, const link_collection& links, const drawing::point& location);
367 static link_label create(const control& parent, const xtd::ustring& text, const link_collection& links, const drawing::point& location, const drawing::size& size);
376 static link_label create(const control& parent, const xtd::ustring& text, const link_collection& links, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
378
380
387
388 protected:
390
396 std::unique_ptr<xtd::object> clone() const override;
397
398 xtd::drawing::size measure_control() const noexcept override;
399 void on_cursor_changed(const xtd::event_args& e) override;
400 void on_mouse_click(const xtd::forms::mouse_event_args& e) override;
401 void on_mouse_down(const xtd::forms::mouse_event_args& e) override;
402 void on_mouse_up(const xtd::forms::mouse_event_args& e) override;
403 void on_mouse_move(const xtd::forms::mouse_event_args& e) override;
405 void on_text_align_changed(const xtd::event_args& e) override;
406 void on_text_changed(const xtd::event_args& e) override;
407
410 link_label::link& point_in_link(const xtd::drawing::point& point);
412
413 private:
414 xtd::drawing::point get_text_location(size_t line) const noexcept;
415 std::vector<std::tuple<xtd::drawing::rectangle, bool>> generate_text_rects() const noexcept;
416 xtd::drawing::font link_font() const noexcept;
417 void on_links_link_added(size_t pos, const link& link);
418 void on_links_link_removed(size_t pos, const link& link);
419 void on_links_link_updated(size_t pos, const link& link);
420
421 std::shared_ptr<data> data_;
422 };
423 }
424}
425
Represents an ARGB (alpha, red, green, blue) color.
Definition color.h:49
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
Represents an event.
Definition event.h:21
Defines the base class for controls, which are components with visual representation.
Definition control.h:79
virtual const xtd::ustring & text() const noexcept
Gets the text associated with this control.
virtual drawing::point location() const noexcept
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
virtual drawing::font font() const noexcept
Gets the font of the text displayed by the control.
virtual const xtd::ustring & name() const noexcept
Gets the name of the control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
Represents the image used to paint the mouse pointer.
Definition cursor.h:38
Represents a standard Windows label.
Definition label.h:36
Represents a collection of objects.
Definition arranged_element_collection.h:32
value_type & reference
Represents the value type reference of the collection.
Definition arranged_element_collection.h:75
std::allocator< value_type > allocator_type
Represents the allocator type of the collection.
Definition arranged_element_collection.h:69
const value_type & const_reference
Represents the value type const reference the collection.
Definition arranged_element_collection.h:77
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down,...
Definition mouse_event_args.h:32
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.h:28
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
Contains xtd::forms::cursors factory.
delegate< void(object &sender, link_label_clicked_event_args &e)> link_label_clicked_event_handler
Represents the method that will handle the xtd::forms::link_label::link_clicked event of a xtd::forms...
Definition link_label_clicked_event_handler.h:22
size_t size
Represents a size of any object in bytes.
Definition types.h:197
link_behavior
Specifies the behaviors of a link in a xtd::forms::link_label.
Definition link_behavior.h:20
@ e
The E key.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::forms::style_sheets::label class.