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 {
43 class link_label : public label {
44 struct data;
45
46 public:
48
56
58 class link_collection : public xtd::forms::layout::arranged_element_collection<xtd::forms::link_label::link> {
59 public:
61
66
68
73 explicit link_collection(const allocator_type& allocator = allocator_type());
75
77 explicit link_collection(const base& collection);
78 link_collection(const link_collection& collection);
79 link_collection& operator =(const link_collection& collection);
82
84
86 using base::operator [];
98 };
99
101
106
108 link_label(link_label&& rhs);
109 link_label(const link_label&) = default;
110 link_label& operator =(const link_label&) = default;
112
114
130 link_label& active_link_color(const xtd::drawing::color& color);
131
137 xtd::drawing::color disabled_link_color() const noexcept;
144 link_label& disabled_link_color(const xtd::drawing::color& color);
145
152 xtd::forms::link_area link_area() const noexcept;
161
171
178 xtd::drawing::color link_color() const noexcept;
186 link_label& link_color(const xtd::drawing::color& color);
187
193 const link_collection& links() const noexcept;
207
210 xtd::forms::cursor override_cursor() const noexcept;
215
222 xtd::drawing::color visited_link_color() const noexcept;
230 link_label& visited_link_color(const xtd::drawing::color& color);
232
234
242 static link_label create(const drawing::point& location);
247 static link_label create(const drawing::point& location, const drawing::size& size);
253 static link_label create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
257 static link_label create(const xtd::string& text);
262 static link_label create(const xtd::string& text, const drawing::point& location);
268 static link_label create(const xtd::string& text, const drawing::point& location, const drawing::size& size);
275 static link_label create(const xtd::string& text, const drawing::point& location, const drawing::size& size, const xtd::string& name);
280 static link_label create(const xtd::string& text, const link_collection& links);
286 static link_label create(const xtd::string& text, const link_collection& links, const drawing::point& location);
293 static link_label create(const xtd::string& text, const link_collection& links, const drawing::point& location, const drawing::size& size);
301 static link_label create(const xtd::string& text, const link_collection& links, const drawing::point& location, const drawing::size& size, const xtd::string& name);
310 static link_label create(const control& parent, const drawing::point& location);
316 static link_label create(const control& parent, const drawing::point& location, const drawing::size& size);
323 static link_label create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
328 static link_label create(const control& parent, const xtd::string& text);
334 static link_label create(const control& parent, const xtd::string& text, const drawing::point& location);
341 static link_label create(const control& parent, const xtd::string& text, const drawing::point& location, const drawing::size& size);
349 static link_label create(const control& parent, const xtd::string& text, const drawing::point& location, const drawing::size& size, const xtd::string& name);
354 static link_label create(const control& parent, const xtd::string& text, const link_collection& links);
361 static link_label create(const control& parent, const xtd::string& text, const link_collection& links, const drawing::point& location);
369 static link_label create(const control& parent, const xtd::string& text, const link_collection& links, const drawing::point& location, const drawing::size& size);
378 static link_label create(const control& parent, const xtd::string& text, const link_collection& links, const drawing::point& location, const drawing::size& size, const xtd::string& name);
380
382
389
390 protected:
392
398 xtd::uptr<xtd::object> clone() const override;
399
400 xtd::drawing::size measure_control() const noexcept override;
401 void on_cursor_changed(const xtd::event_args& e) override;
402 void on_mouse_click(const xtd::forms::mouse_event_args& e) override;
403 void on_mouse_down(const xtd::forms::mouse_event_args& e) override;
404 void on_mouse_up(const xtd::forms::mouse_event_args& e) override;
405 void on_mouse_move(const xtd::forms::mouse_event_args& e) override;
407 void on_text_align_changed(const xtd::event_args& e) override;
408 void on_text_changed(const xtd::event_args& e) override;
409
412 link_label::link& point_in_link(const xtd::drawing::point& point);
414
415 private:
416 xtd::drawing::point get_text_location(size_t line) const noexcept;
417 std::vector<std::tuple<xtd::drawing::rectangle, bool>> generate_text_rects() const noexcept;
418 xtd::drawing::font link_font() const noexcept;
419 void on_links_link_added(size_t pos, const link& link);
420 void on_links_link_removed(size_t pos, const link& link);
421 void on_links_link_updated(size_t pos, const link& link);
422
423 xtd::sptr<data> data_;
424 };
425 }
426}
427
Represents text as a sequence of character units.
Definition basic_string.h:79
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:81
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::string & name() const noexcept
Gets the name of the control.
virtual const xtd::string & text() const noexcept
Gets the text associated with this 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:40
Represents a standard Windows label.
Definition label.h:38
Represents a collection of objects.
Definition arranged_element_collection.h:34
value_type & reference
Represents the value type reference of the collection.
Definition arranged_element_collection.h:77
std::allocator< value_type > allocator_type
Represents the allocator type of the collection.
Definition arranged_element_collection.h:71
const value_type & const_reference
Represents the value type const reference the collection.
Definition arranged_element_collection.h:79
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down,...
Definition mouse_event_args.h:34
Provides data for the xtd::forms::control::paint event.
Definition paint_event_args.h:30
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:24
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.h:25
size_t size
Represents a size of any object in bytes.
Definition size.h:23
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
link_behavior
Specifies the behaviors of a link in a xtd::forms::link_label.
Definition link_behavior.h:22
@ 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::cursors factory.
Contains xtd::forms::style_sheets::label class.