xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
link_label.h
Go to the documentation of this file.
1 #pragma once
5 #include <any>
6 #include <tuple>
8 #include "cursors.h"
9 #include "label.h"
10 #include "link.h"
12 
14 namespace xtd {
16  namespace forms {
32  class link_label : public label {
33  public:
39 
41  class link_collection : public xtd::forms::layout::arranged_element_collection<xtd::forms::link_label::link> {
42  public:
45 
49  explicit link_collection(const allocator_type& allocator = allocator_type());
51  link_collection(const base& collection);
52  link_collection(const link_collection& collection);
53  link_collection& operator=(const link_collection& collection);
54  link_collection(link_collection&&) = default;
56 
57  using base::operator[];
68 
69  private:
70  inline static value_type empty_;
71  };
72 
75 
88 
89  const xtd::drawing::color& disabled_link_color() const;
90  link_label& disabled_link_color(const xtd::drawing::color& color);
91 
92  const xtd::drawing::color& link_color() const;
93  link_label& link_color(const xtd::drawing::color& color);
94 
95  const link_collection& links() const;
96  link_collection& links();
97 
98  const xtd::drawing::color& visited_link_color() const;
99  link_label& visited_link_color(const xtd::drawing::color& color);
100 
102 
103  protected:
105 
106  void on_cursor_changed(const xtd::event_args& e) override;
109  void on_mouse_up(const xtd::forms::mouse_event_args& e) override;
112  void on_text_align_changed(const xtd::event_args& e) override;
113  void on_text_changed(const xtd::event_args& e) override;
114 
115  link_label::link& point_in_link(const xtd::drawing::point& point);
116 
117  private:
118  xtd::drawing::point get_text_location(size_t line) const;
119  std::vector<std::tuple<xtd::drawing::rectangle, bool>> generate_text_rects() const;
120  xtd::drawing::font link_font() const;
121  bool mouse_hover_ = false;
122  xtd::drawing::color active_link_color_;
123  xtd::drawing::color disabled_link_color_;
124  xtd::drawing::color link_color_;
125  link_collection links_;
126  xtd::forms::cursor original_cursor_;
127  xtd::forms::cursor override_cursor_;
128  xtd::drawing::color visited_link_color_;
129  inline static link link_empty_;
130  };
131  }
132 }
133 
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:39
Defines a particular format for text, including font face, size, and style attributes....
Definition: font.h:39
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:48
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:25
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
virtual const xtd::ustring & name() const
Gets the name of the control.
Definition: control.h:573
Represents the image used to paint the mouse pointer.
Definition: cursor.h:35
Represents a standard Windows label.
Definition: label.h:26
Represents a collection of objects.
Definition: arranged_element_collection.h:28
value_type & reference
Represents the value type reference of the collection.
Definition: arranged_element_collection.h:68
std::allocator< value_type > allocator_type
Represents the allocator type of the collection.
Definition: arranged_element_collection.h:62
const value_type & const_reference
Represents the value type const reference the collection.
Definition: arranged_element_collection.h:70
Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down,...
Definition: mouse_event_args.h:29
Provides data for the paint event.
Definition: paint_event_args.h:26
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Contains xtd::forms::cursors factory.
Contains xtd::forms::label control.
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
Contains xtd::drawing::system_colors factory.