xtd 1.0.0
Loading...
Searching...
No Matches
month_calendar.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "application.hpp"
6#include "control.hpp"
8#include "day.hpp"
9#include "menu.hpp"
10#include "selection_range.hpp"
11#include <xtd/chrono>
12
14namespace xtd {
16 namespace forms {
41 struct data;
42
43 public:
46
49 enum class hit_area {
51 nowhere,
53 title_background,
55 title_month,
57 title_year,
59 next_month_button,
61 prev_month_button,
63 calendar_background,
65 date,
67 next_month_date,
69 prev_month_date,
73 week_numbers,
75 today_link
76 };
77
81 class hit_test_info final : public xtd::object {
82 public:
85
88 [[nodiscard]] auto hit_area() const noexcept -> xtd::forms::month_calendar::hit_area;
89
92 [[nodiscard]] auto point() const noexcept -> const xtd::drawing::point&;
93
97 [[nodiscard]] auto time() const noexcept -> const xtd::date_time&;
99
100 private:
101 friend class xtd::forms::month_calendar;
102 hit_test_info(xtd::forms::month_calendar::hit_area hit_area, const xtd::drawing::point& point, const xtd::date_time& time);
103
104 xtd::forms::month_calendar::hit_area hit_area_ = xtd::forms::month_calendar::hit_area::nowhere;
105 xtd::drawing::point point_;
106 xtd::date_time time_;
107 };
108
109
112
120
123
127 [[nodiscard]] auto annually_bolded_dates() const noexcept -> xtd::array<xtd::date_time>;
133
137 [[nodiscard]] auto bolded_dates() const noexcept -> xtd::array<xtd::date_time>;
143
147 [[nodiscard]] auto calendar_dimensions() const noexcept -> const xtd::drawing::size&;
153
156 [[nodiscard]] auto first_day_of_week() const noexcept -> xtd::forms::day;
161
164 [[nodiscard]] auto max_date() const noexcept -> xtd::date_time;
169
175 [[nodiscard]] auto max_selection_count() const noexcept -> xtd::uint32;
183
186 [[nodiscard]] auto min_date() const noexcept -> xtd::date_time;
191
195 [[nodiscard]] auto monthly_bolded_dates() const noexcept -> xtd::array<xtd::date_time>;
201
208 [[nodiscard]] auto selection_end() const noexcept -> xtd::date_time;
217
222 [[nodiscard]] auto selection_range() const noexcept -> xtd::forms::selection_range;
229
236 [[nodiscard]] auto selection_start() const noexcept -> xtd::date_time;
245
249 [[nodiscard]] auto show_today() const noexcept -> bool;
254 auto show_today(bool value) -> month_calendar&;
255
259 [[nodiscard]] auto show_today_circle() const noexcept -> bool;
264 auto show_today_circle(bool value) -> month_calendar&;
265
268 [[nodiscard]] auto show_week_numbers() const noexcept -> bool;
272 auto show_week_numbers(bool value) -> month_calendar&;
273
277 [[nodiscard]] auto single_month_size() const noexcept -> xtd::drawing::size;
278
282 [[nodiscard]] auto title_back_color() const noexcept -> xtd::drawing::color;
287 auto title_back_color(const xtd::drawing::color& value) -> month_calendar&;
288
291 [[nodiscard]] auto title_fore_color() const noexcept -> xtd::drawing::color;
295 auto title_fore_color(const xtd::drawing::color& value) -> month_calendar&;
296
300 [[nodiscard]] auto today_date() const noexcept -> const xtd::date_time&;
305 auto today_date(const xtd::date_time& value) -> month_calendar&;
306
309 [[nodiscard]] auto today_date_set() const noexcept -> bool;
310
314 [[nodiscard]] auto trailing_fore_color() const noexcept -> xtd::drawing::color;
319 auto trailing_fore_color(const xtd::drawing::color& value) -> month_calendar&;
321
323
329
335
337
343 auto add_annually_bolded_date(const xtd::date_time& date) -> void;
344
349 auto add_bolded_date(const xtd::date_time& date) -> void;
350
355 auto add_monthly_bolded_date(const xtd::date_time& date) -> void;
356
361 [[nodiscard]] auto hit_test(xtd::int32 x, xtd::int32 y) const -> hit_test_info;
365 [[nodiscard]] auto hit_test(const xtd::drawing::point& point) const -> hit_test_info;
366
371
376
381
385 auto remove_annually_bolded_dates(const xtd::date_time& date) -> void;
386
390 auto remove_bolded_dates(const xtd::date_time& date) -> void;
391
395 auto remove_monthly_bolded_dates(const xtd::date_time& date) -> void;
396
402
406 auto set_date(const xtd::date_time& date) -> void;
407
413 auto set_selection_range(const xtd::date_time& date1, const xtd::date_time& date2) -> void;
414
415 [[nodiscard]] auto to_string() const noexcept -> xtd::string override;
416
419 auto update_bolded_dates() -> void;
421
423
427 [[nodiscard]] static auto create() -> month_calendar;
431 [[nodiscard]] static auto create(const xtd::drawing::point& location) -> month_calendar;
436 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size) -> month_calendar;
442 [[nodiscard]] static auto create(const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> month_calendar;
446 [[nodiscard]] static auto create(const forms::selection_range& selection_range) -> month_calendar;
451 [[nodiscard]] static auto create(const forms::selection_range& selection_range, const xtd::drawing::point& location) -> month_calendar;
457 [[nodiscard]] static auto create(const forms::selection_range& selection_range, const xtd::drawing::point& location, const xtd::drawing::size& size) -> month_calendar;
464 [[nodiscard]] static auto create(const forms::selection_range& selection_range, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> month_calendar;
469 [[nodiscard]] static auto create(const forms::selection_range& selection_range, const xtd::date_time& max_date) -> month_calendar;
475 [[nodiscard]] static auto create(const forms::selection_range& selection_range, const xtd::date_time& max_date, const xtd::drawing::point& location) -> month_calendar;
482 [[nodiscard]] static auto create(const forms::selection_range& selection_range, const xtd::date_time& max_date, const xtd::drawing::point& location, const xtd::drawing::size& size) -> month_calendar;
490 [[nodiscard]] static auto create(const forms::selection_range& selection_range, const xtd::date_time& max_date, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> month_calendar;
496 [[nodiscard]] static auto create(const forms::selection_range& selection_range, const xtd::date_time& min_date, const xtd::date_time& max_date) -> month_calendar;
503 [[nodiscard]] static auto create(const forms::selection_range& selection_range, const xtd::date_time& min_date, const xtd::date_time& max_date, const xtd::drawing::point& location) -> month_calendar;
511 [[nodiscard]] static auto create(const forms::selection_range& selection_range, const xtd::date_time& min_date, const xtd::date_time& max_date, const xtd::drawing::point& location, const xtd::drawing::size& size) -> month_calendar;
520 [[nodiscard]] static auto create(const forms::selection_range& selection_range, const xtd::date_time& min_date, const xtd::date_time& max_date, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> month_calendar;
530 [[nodiscard]] static auto create(const xtd::forms::control& parent) -> month_calendar;
537 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location) -> month_calendar;
544 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size) -> month_calendar;
551 [[nodiscard]] static auto create(const xtd::forms::control& parent, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> month_calendar;
556 [[nodiscard]] static auto create(const xtd::forms::control& parent, const forms::selection_range& selection_range) -> month_calendar;
564 [[nodiscard]] static auto create(const xtd::forms::control& parent, const forms::selection_range& selection_range, const xtd::drawing::point& location) -> month_calendar;
572 [[nodiscard]] static auto create(const xtd::forms::control& parent, const forms::selection_range& selection_range, const xtd::drawing::point& location, const xtd::drawing::size& size) -> month_calendar;
580 [[nodiscard]] static auto create(const xtd::forms::control& parent, const forms::selection_range& selection_range, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> month_calendar;
586 [[nodiscard]] static auto create(const xtd::forms::control& parent, const forms::selection_range& selection_range, const xtd::date_time& max_date) -> month_calendar;
595 [[nodiscard]] static auto create(const xtd::forms::control& parent, const forms::selection_range& selection_range, const xtd::date_time& max_date, const xtd::drawing::point& location) -> month_calendar;
604 [[nodiscard]] static auto create(const xtd::forms::control& parent, const forms::selection_range& selection_range, const xtd::date_time& max_date, const xtd::drawing::point& location, const xtd::drawing::size& size) -> month_calendar;
613 [[nodiscard]] static auto create(const xtd::forms::control& parent, const forms::selection_range& selection_range, const xtd::date_time& max_date, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> month_calendar;
620 [[nodiscard]] static auto create(const xtd::forms::control& parent, const forms::selection_range& selection_range, const xtd::date_time& min_date, const xtd::date_time& max_date) -> month_calendar;
630 [[nodiscard]] static auto create(const xtd::forms::control& parent, const forms::selection_range& selection_range, const xtd::date_time& min_date, const xtd::date_time& max_date, const xtd::drawing::point& location) -> month_calendar;
640 [[nodiscard]] static auto create(const xtd::forms::control& parent, const forms::selection_range& selection_range, const xtd::date_time& min_date, const xtd::date_time& max_date, const xtd::drawing::point& location, const xtd::drawing::size& size) -> month_calendar;
650 [[nodiscard]] static auto create(const xtd::forms::control& parent, const forms::selection_range& selection_range, const xtd::date_time& min_date, const xtd::date_time& max_date, const xtd::drawing::point& location, const xtd::drawing::size& size, const xtd::string& name) -> month_calendar;
652
653 protected:
655
657 auto create_params() const noexcept -> xtd::forms::create_params override;
658 auto default_back_color() const noexcept -> xtd::drawing::color override;
659 auto default_fore_color() const noexcept -> xtd::drawing::color override;
661
663
671 virtual auto on_date_changed(const xtd::forms::date_range_event_args& e) -> void;
672
679 virtual auto on_date_selected(const xtd::forms::date_range_event_args& e) -> void;
680
681 auto on_handle_created(const xtd::event_args& e) -> void override;
682 auto wnd_proc(xtd::forms::message& message) -> void override;
684
685 private:
686 auto wm_notify_control(xtd::forms::message& message) -> void;
687 auto wm_date_selected(xtd::forms::message& message) -> void;
688 auto wm_date_changed(xtd::forms::message& message) -> void;
689 auto wm_view_changed(xtd::forms::message& message) -> void;
690
691 xtd::sptr<data> data_;
692 };
693 }
694}
695
697template<> struct xtd::enum_register<xtd::forms::month_calendar::hit_area> {
699};
Contains xtd::forms::application class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
Represents an instant in time, typically expressed as a date and time of day.
Definition date_time.hpp:83
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents an event.
Definition event.hpp:23
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
virtual auto size() const noexcept -> xtd::drawing::size
Gets the height and width of the control.
virtual auto parent() const noexcept -> std::optional< xtd::forms::control_ref >
Gets the parent container of the control.
virtual auto name() const noexcept -> const xtd::string &
Gets the name of the control.
control()
Initializes a new instance of the xtd::forms::control class with default settings.
virtual auto location() const noexcept -> xtd::drawing::point
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
Provides data for the xtd::forms::month_calendar::date_changed or xtd::forms::month_calendar::date_se...
Definition date_range_event_args.hpp:30
Contains information about an area of a xtd::forms::month_calendar control. This class cannot be inhe...
Definition month_calendar.hpp:81
auto point() const noexcept -> const xtd::drawing::point &
Gets the point that was hit-tested.
auto hit_area() const noexcept -> xtd::forms::month_calendar::hit_area
Gets the xtd::forms::month_calendar::hit_area that represents the area of the calendar evaluated by t...
auto time() const noexcept -> const xtd::date_time &
Gets the time information specific to the location that was hit-tested.
auto max_selection_count() const noexcept -> xtd::uint32
Gets the maximum number of days that can be selected in a month calendar control.
auto title_fore_color() const noexcept -> xtd::drawing::color
Gets a value indicating the foreground color of the title area of the calendar.
auto annually_bolded_dates() const noexcept -> xtd::array< xtd::date_time >
Gets the array of xtd::date_time objects that determines which annual days are displayed in bold.
auto set_date(const xtd::date_time &date) -> void
Sets a date as the currently selected date.
auto single_month_size() const noexcept -> xtd::drawing::size
Gets the minimum size to display one month of the calendar.
auto selection_range() const noexcept -> xtd::forms::selection_range
Gets the selected range of dates for a month calendar control.
auto remove_bolded_dates(const xtd::date_time &date) -> void
Removes the specified date from the list of the nonrecurring bold dates.
auto today_date() const noexcept -> const xtd::date_time &
Gets the value that is used by xtd::forms::month_calendar as today's date.
auto update_bolded_dates() -> void
Repaints the bold dates to reflect the dates set in the lists of bold dates.
auto remove_all_bolded_dates() -> void
Removes all the nonrecurring bold dates.
auto default_back_color() const noexcept -> xtd::drawing::color override
Gets the default background color of the control.
auto set_calendar_dimensions(xtd::int32 x, xtd::int32 y) -> void
Sets the number of columns and rows of months to display.
auto create_params() const noexcept -> xtd::forms::create_params override
Gets the required creation parameters when the control handle is created.
auto to_string() const noexcept -> xtd::string override
Returns a string containing the name of the control, if any.
virtual auto on_date_selected(const xtd::forms::date_range_event_args &e) -> void
Raises the xtd::forms::month_calendar::date_selected event.
auto on_handle_created(const xtd::event_args &e) -> void override
Raises the xtd::forms::control::handle_created event.
auto remove_all_annually_bolded_dates() -> void
Removes all the annually bold dates.
auto title_back_color() const noexcept -> xtd::drawing::color
Gets a value indicating the background color of the title area of the calendar.
xtd::event< month_calendar, xtd::forms::date_range_event_handler > date_selected
Occurs when the user makes an explicit date selection using the mouse.
Definition month_calendar.hpp:333
auto show_today_circle() const noexcept -> bool
Gets a value indicating whether today's date is identified with a circle or a square.
auto show_week_numbers() const noexcept -> bool
Gets a value indicating whether the month calendar control displays week numbers (1-52) to the left o...
auto add_bolded_date(const xtd::date_time &date) -> void
Adds a day to be displayed in bold in the month calendar.
auto remove_all_monthly_bolded_dates() -> void
Removes all the monthly bold dates.
month_calendar()
Initializes a new instance of the month_calendar class.
auto wnd_proc(xtd::forms::message &message) -> void override
Processes Windows messages.
auto bolded_dates() const noexcept -> xtd::array< xtd::date_time >
Gets the array of xtd::date_time bjects that determines which nonrecurring dates are displayed in bol...
auto default_fore_color() const noexcept -> xtd::drawing::color override
Gets the default foreground color of the control.
auto add_monthly_bolded_date(const xtd::date_time &date) -> void
Adds a day that is displayed in bold on a monthly basis in the month calendar.
auto today_date_set() const noexcept -> bool
Gets a value indicating whether the xtd::forms::month_calendar::today_date property has been explicit...
auto selection_start() const noexcept -> xtd::date_time
Gets the start date of the selected range of dates.
auto calendar_dimensions() const noexcept -> const xtd::drawing::size &
Gets the number of columns and rows of months displayed.
auto add_annually_bolded_date(const xtd::date_time &date) -> void
Adds a day that is displayed in bold on an annual basis in the month calendar.
static auto create() -> month_calendar
A factory to create an xtd::forms::month_calendar.
auto first_day_of_week() const noexcept -> xtd::forms::day
Gets the first day of the week as displayed in the month calendar.
virtual auto on_date_changed(const xtd::forms::date_range_event_args &e) -> void
Raises the xtd::forms::month_calendar::date_changed event.
auto max_date() const noexcept -> xtd::date_time
Gets the maximum date that can be selected in the control.
xtd::event< month_calendar, xtd::forms::date_range_event_handler > date_changed
Occurs when the date selected in the xtd::forms::month_calendar changes.
Definition month_calendar.hpp:328
auto set_selection_range(const xtd::date_time &date1, const xtd::date_time &date2) -> void
Sets the selected dates in a month calendar control to the specified date range.
auto remove_annually_bolded_dates(const xtd::date_time &date) -> void
Removes the specified date from the list of annually bold dates.
auto remove_monthly_bolded_dates(const xtd::date_time &date) -> void
Removes the specified date from the list of monthly bold dates.
auto trailing_fore_color() const noexcept -> xtd::drawing::color
Gets a value indicating the color of days in months that are not fully displayed in the control.
auto hit_test(xtd::int32 x, xtd::int32 y) const -> hit_test_info
Returns a xtd::forms::month_calendar::hit_test_info with information on which portion of a month cale...
auto show_today() const noexcept -> bool
Gets a value indicating whether the date represented by the xtd::today_date property is displayed at ...
auto min_date() const noexcept -> xtd::date_time
Gets the minimum date that can be selected in the control.
hit_area
Defines constants that represent areas in a xtd::forms::month_calendar control.
Definition month_calendar.hpp:49
@ nowhere
The specified point is either not on the month calendar control, or it is in an inactive portion of t...
Definition month_calendar.hpp:51
@ calendar_background
The specified point is part of the calendar's background.
Definition month_calendar.hpp:63
@ prev_month_date
The specified point is over a date from the previous month (partially displayed at the top of the cur...
Definition month_calendar.hpp:69
@ date
The specified point is on a date within the calendar. The System.Windows.Forms.xtd::forms::month_cale...
Definition month_calendar.hpp:65
@ title_year
The specified point is in a month's title bar, over the year value.
Definition month_calendar.hpp:57
@ day_of_week
The specified point is over a day abbreviation ("Fri", for example). The System.Windows....
Definition month_calendar.hpp:71
@ week_numbers
The specified point is over a week number. This occurs only if the xtd::forms::month_calendar::show_w...
Definition month_calendar.hpp:73
@ title_month
The specified point is in a month's title bar, over a month name.
Definition month_calendar.hpp:55
@ next_month_button
The specified point is over the button at the upper-right corner of the control. If the user clicks h...
Definition month_calendar.hpp:59
@ title_background
The specified point is over the background of a month's title.
Definition month_calendar.hpp:53
@ prev_month_button
The specified point is over the button at the upper-left corner of the control. If the user clicks he...
Definition month_calendar.hpp:61
@ next_month_date
The specified point is over a date from the next month (partially displayed at the top of the current...
Definition month_calendar.hpp:67
@ today_link
The specified point is on the today link at the bottom of the month calendar control.
Definition month_calendar.hpp:75
auto selection_end() const noexcept -> xtd::date_time
Gets the end date of the selected range of dates.
auto monthly_bolded_dates() const noexcept -> xtd::array< xtd::date_time >
Gets the array of xtd::date_time objects that determine which monthly days to bold.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
Contains xtd::forms::control control.
Contains xtd::forms::date_range_event_handler event handler.
Contains xtd::forms::day enum class.
xtd::delegate< void(xtd::object &sender, const xtd::forms::date_range_event_args &e)> date_range_event_handler
Represents the method that will handle the xtd::forms::month_calendar::date_changed and xtd::forms::m...
Definition date_range_event_handler.hpp:28
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
std::uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
std::vector< std::pair< enum_t, xtd::string > > enum_collection
Represents a pair of an enum_t value and a string of an enum of type enum_t.
Definition enum_collection.hpp:24
day_of_week
Specifies the day of the week.
Definition day_of_week.hpp:25
day
Specifies the day of the week.
Definition day.hpp:21
Contains xtd::forms::menu menu.
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr auto data() const noexcept -> const_pointer
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:197
Contains xtd::forms::selection_range control.
Provides the registration struct for enumerations.
Definition enum_register.hpp:38
Implements a Windows message.
Definition message.hpp:33