xtd 0.2.0
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:
74
78 class hit_test_info final : public xtd::object {
79 public:
81 hit_test_info(const hit_test_info&) = default;
82 hit_test_info& operator =(const hit_test_info&) = default;
84
88
91 const xtd::drawing::point& point() const noexcept;
92
96 const xtd::date_time& time() const noexcept;
97
98 private:
99 friend class xtd::forms::month_calendar;
100 hit_test_info(xtd::forms::month_calendar::hit_area hit_area, const xtd::drawing::point& point, const xtd::date_time& time);
101
102 xtd::forms::month_calendar::hit_area hit_area_ = xtd::forms::month_calendar::hit_area::nowhere;
103 xtd::drawing::point point_;
104 xtd::date_time time_;
105 };
106
109
117
120
130
134 xtd::array<xtd::date_time> bolded_dates() const noexcept;
140
144 const xtd::drawing::size& calendar_dimensions() const noexcept;
150
153 xtd::forms::day first_day_of_week() const noexcept;
158
161 xtd::date_time max_date() const noexcept;
166
172 uint32 max_selection_count() const noexcept;
180
183 xtd::date_time min_date() const noexcept;
188
198
205 xtd::date_time selection_end() const noexcept;
214
226
233 xtd::date_time selection_start() const noexcept;
242
246 bool show_today() const noexcept;
252
256 bool show_today_circle() const noexcept;
262
265 bool show_week_numbers() const noexcept;
270
274 xtd::drawing::size single_month_size() const noexcept;
275
279 xtd::drawing::color title_back_color() const noexcept;
285
288 xtd::drawing::color title_fore_color() const noexcept;
293
297 const xtd::date_time& today_date() const noexcept;
303
306 bool today_date_set() const noexcept;
307
311 xtd::drawing::color trailing_fore_color() const noexcept;
318
320
326
332
334
341
347
353
362 xtd::forms::month_calendar::hit_test_info hit_test(const xtd::drawing::point& point) const;
363
368
373
378
383
388
393
399
403 void set_date(const xtd::date_time& date);
404
410 void set_selection_range(const xtd::date_time& date1, const xtd::date_time& date2);
411
412 xtd::string to_string() const noexcept override;
413
418
420
428 static month_calendar create(const drawing::point& location);
433 static month_calendar create(const drawing::point& location, const drawing::size& size);
439 static month_calendar create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
461 static month_calendar create(const forms::selection_range& selection_range, const drawing::point& location, const drawing::size& size, const xtd::string& name);
487 static month_calendar create(const forms::selection_range& selection_range, const xtd::date_time& max_date, const drawing::point& location, const drawing::size& size, const xtd::string& name);
517 static month_calendar create(const forms::selection_range& selection_range, const xtd::date_time& min_date, const xtd::date_time& max_date, const drawing::point& location, const drawing::size& size, const xtd::string& name);
534 static month_calendar create(const control& parent, const drawing::point& location);
541 static month_calendar create(const control& parent, const drawing::point& location, const drawing::size& size);
548 static month_calendar create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
577 static month_calendar create(const control& parent, const forms::selection_range& selection_range, const drawing::point& location, const drawing::size& size, const xtd::string& name);
610 static month_calendar create(const control& parent, const forms::selection_range& selection_range, const xtd::date_time& max_date, const drawing::point& location, const drawing::size& size, const xtd::string& name);
647 static month_calendar create(const control& parent, const forms::selection_range& selection_range, const xtd::date_time& min_date, const xtd::date_time& max_date, const drawing::point& location, const drawing::size& size, const xtd::string& name);
649
650 protected:
652
654 xtd::forms::create_params create_params() const noexcept override;
655 xtd::drawing::color default_back_color() const noexcept override;
656 xtd::drawing::color default_fore_color() const noexcept override;
658
660
666 xtd::uptr<xtd::object> clone() const override;
667
675
683
684 void on_handle_created(const xtd::event_args& e) override;
685 void wnd_proc(xtd::forms::message& message) override;
687
688 private:
689 void wm_notify_control(xtd::forms::message& message);
690 void wm_date_selected(xtd::forms::message& message);
691 void wm_date_changed(xtd::forms::message& message);
692 void wm_view_changed(xtd::forms::message& message);
693
694 xtd::sptr<data> data_;
695 };
696 }
697}
698
700template<> struct xtd::enum_register<xtd::forms::month_calendar::hit_area> {
702};
Contains xtd::forms::application class.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:61
Represents an instant in time, typically expressed as a date and time of day.
Definition date_time.hpp:85
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:21
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 const xtd::string & name() const noexcept
Gets the name of the control.
control()
Initializes a new instance of the xtd::forms::control class with default settings.
virtual drawing::size size() const noexcept
Gets the height and width of the control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
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:78
xtd::forms::month_calendar::hit_area hit_area() const noexcept
Gets the xtd::forms::month_calendar::hit_area that represents the area of the calendar evaluated by t...
const xtd::date_time & time() const noexcept
Gets the time information specific to the location that was hit-tested.
const xtd::drawing::point & point() const noexcept
Gets the point that was hit-tested.
xtd::forms::create_params create_params() const noexcept override
Gets the required creation parameters when the control handle is created.
xtd::forms::selection_range selection_range() const noexcept
Gets the selected range of dates for a month calendar control.
xtd::drawing::color title_fore_color() const noexcept
Gets a value indicating the foreground color of the title area of the calendar.
void remove_annually_bolded_dates(const xtd::date_time &date)
Removes the specified date from the list of annually bold dates.
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:330
void remove_monthly_bolded_dates(const xtd::date_time &date)
Removes the specified date from the list of monthly bold dates.
xtd::date_time selection_start() const noexcept
Gets the start date of the selected range of dates.
xtd::array< xtd::date_time > annually_bolded_dates() const noexcept
Gets the array of xtd::date_time objects that determines which annual days are displayed in bold.
xtd::drawing::color default_back_color() const noexcept override
Gets the default background color of the control.
void on_handle_created(const xtd::event_args &e) override
Raises the xtd::forms::control::handle_created event.
void wnd_proc(xtd::forms::message &message) override
Processes Windows messages.
xtd::drawing::color title_back_color() const noexcept
Gets a value indicating the background color of the title area of the calendar.
void add_monthly_bolded_date(const xtd::date_time &date)
Adds a day that is displayed in bold on a monthly basis in the month calendar.
void add_annually_bolded_date(const xtd::date_time &date)
Adds a day that is displayed in bold on an annual basis in the month calendar.
void remove_all_monthly_bolded_dates()
Removes all the monthly bold dates.
void set_calendar_dimensions(int32 x, int32 y)
Sets the number of columns and rows of months to display.
void set_date(const xtd::date_time &date)
Sets a date as the currently selected date.
const xtd::drawing::size & calendar_dimensions() const noexcept
Gets the number of columns and rows of months displayed.
month_calendar()
Initializes a new instance of the month_calendar class.
xtd::drawing::size single_month_size() const noexcept
Gets the minimum size to display one month of the calendar.
xtd::array< xtd::date_time > bolded_dates() const noexcept
Gets the array of xtd::date_time bjects that determines which nonrecurring dates are displayed in bol...
void update_bolded_dates()
Repaints the bold dates to reflect the dates set in the lists of bold dates.
const xtd::date_time & today_date() const noexcept
Gets the value that is used by xtd::forms::month_calendar as today's date.
bool show_today() const noexcept
Gets a value indicating whether the date represented by the xtd::today_date property is displayed at ...
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
static month_calendar create()
A factory to create an xtd::forms::month_calendar.
void add_bolded_date(const xtd::date_time &date)
Adds a day to be displayed in bold in the month calendar.
xtd::date_time max_date() const noexcept
Gets the maximum date that can be selected in the control.
xtd::string to_string() const noexcept override
Returns a string containing the name of the control, if any.
bool show_week_numbers() const noexcept
Gets a value indicating whether the month calendar control displays week numbers (1-52) to the left o...
xtd::array< xtd::date_time > monthly_bolded_dates() const noexcept
Gets the array of xtd::date_time objects that determine which monthly days to bold.
virtual void on_date_selected(const xtd::forms::date_range_event_args &e)
Raises the xtd::forms::month_calendar::date_selected event.
xtd::date_time min_date() const noexcept
Gets the minimum date that can be selected in the control.
xtd::drawing::color trailing_fore_color() const noexcept
Gets a value indicating the color of days in months that are not fully displayed in the control.
void set_selection_range(const xtd::date_time &date1, const xtd::date_time &date2)
Sets the selected dates in a month calendar control to the specified date range.
xtd::date_time selection_end() const noexcept
Gets the end date of the selected range of dates.
void remove_bolded_dates(const xtd::date_time &date)
Removes the specified date from the list of the nonrecurring bold dates.
bool show_today_circle() const noexcept
Gets a value indicating whether today's date is identified with a circle or a square.
xtd::forms::month_calendar::hit_test_info hit_test(int32 x, int32 y) const
Returns a xtd::forms::month_calendar::hit_test_info with information on which portion of a month cale...
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:325
hit_area
Defines constants that represent areas in a xtd::forms::month_calendar control.
Definition month_calendar.hpp:46
@ 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:48
@ calendar_background
The specified point is part of the calendar's background.
Definition month_calendar.hpp:60
@ 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:66
@ date
The specified point is on a date within the calendar. The System.Windows.Forms.xtd::forms::month_cale...
Definition month_calendar.hpp:62
@ title_year
The specified point is in a month's title bar, over the year value.
Definition month_calendar.hpp:54
@ day_of_week
The specified point is over a day abbreviation ("Fri", for example). The System.Windows....
Definition month_calendar.hpp:68
@ 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:70
@ title_month
The specified point is in a month's title bar, over a month name.
Definition month_calendar.hpp:52
@ 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:56
@ title_background
The specified point is over the background of a month's title.
Definition month_calendar.hpp:50
@ 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:58
@ 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:64
@ today_link
The specified point is on the today link at the bottom of the month calendar control.
Definition month_calendar.hpp:72
bool today_date_set() const noexcept
Gets a value indicating whether the xtd::forms::month_calendar::today_date property has been explicit...
virtual void on_date_changed(const xtd::forms::date_range_event_args &e)
Raises the xtd::forms::month_calendar::date_changed event.
void remove_all_bolded_dates()
Removes all the nonrecurring bold dates.
uint32 max_selection_count() const noexcept
Gets the maximum number of days that can be selected in a month calendar control.
void remove_all_annually_bolded_dates()
Removes all the annually bold dates.
xtd::forms::day first_day_of_week() const noexcept
Gets the first day of the week as displayed in the month calendar.
xtd::drawing::color default_fore_color() const noexcept override
Gets the default foreground color of the control.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
Contains xtd::forms::control control.
Contains xtd::forms::date_range_event_handler event handler.
Contains xtd::forms::day enum class.
xtd::delegate< void(object &sender, const 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
xtd::shared_ptr_object< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
xtd::unique_ptr_object< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
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
Specifies the day of the week.
Definition day.hpp:21
@ e
The E key.
Definition keys.hpp:207
@ y
Specifies that the top edge of the control is defined.
Definition bounds_specified.hpp:28
@ x
Specifies that the left edge of the control is defined.
Definition bounds_specified.hpp:26
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 const_pointer data() const noexcept
Gets direct access to the underlying contiguous storage.
Definition read_only_span.hpp:201
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