xtd 0.2.0
Loading...
Searching...
No Matches
month_calendar.h
Go to the documentation of this file.
1
4#pragma once
5#include "application.h"
6#include "control.h"
8#include "day.h"
9#include "menu.h"
10#include "selection_range.h"
11#include <xtd/chrono>
12
14namespace xtd {
16 namespace forms {
39 struct data;
40
41 public:
44 enum class hit_area {
46 nowhere,
48 title_background,
50 title_month,
52 title_year,
54 next_month_button,
56 prev_month_button,
58 calendar_background,
60 date,
62 next_month_date,
64 prev_month_date,
68 week_numbers,
70 today_link
71 };
72
76 class hit_test_info final : public xtd::object {
77 public:
79 hit_test_info(const hit_test_info&) = default;
80 hit_test_info& operator =(const hit_test_info&) = default;
82
86
89 const xtd::drawing::point& point() const noexcept;
90
94 const xtd::date_time& time() const noexcept;
95
96 private:
97 friend class xtd::forms::month_calendar;
98 hit_test_info(xtd::forms::month_calendar::hit_area hit_area, const xtd::drawing::point& point, const xtd::date_time& time);
99
100 xtd::forms::month_calendar::hit_area hit_area_ = xtd::forms::month_calendar::hit_area::nowhere;
101 xtd::drawing::point point_;
102 xtd::date_time time_;
103 };
104
107
115
118
122 std::vector<xtd::date_time> annually_bolded_dates() const noexcept;
127 month_calendar& annually_bolded_dates(const std::vector<xtd::date_time>& value);
128
132 std::vector<xtd::date_time> bolded_dates() const noexcept;
137 month_calendar& bolded_dates(const std::vector<xtd::date_time>& value);
138
142 const xtd::drawing::size& calendar_dimensions() const noexcept;
147 month_calendar& calendar_dimensions(const xtd::drawing::size& value);
148
151 xtd::forms::day first_day_of_week() const noexcept;
155 month_calendar& first_day_of_week(xtd::forms::day value);
156
159 xtd::date_time max_date() const noexcept;
163 month_calendar& max_date(xtd::date_time value);
164
170 uint32 max_selection_count() const noexcept;
177 month_calendar& max_selection_count(uint32 value);
178
181 xtd::date_time min_date() const noexcept;
185 month_calendar& min_date(xtd::date_time value);
186
190 std::vector<xtd::date_time> monthly_bolded_dates() const noexcept;
195 month_calendar& monthly_bolded_dates(const std::vector<xtd::date_time>& value);
196
203 xtd::date_time selection_end() const noexcept;
211 month_calendar& selection_end(xtd::date_time value);
212
224
231 xtd::date_time selection_start() const noexcept;
239 month_calendar& selection_start(xtd::date_time value);
240
244 bool show_today() const noexcept;
249 month_calendar& show_today(bool value);
250
254 bool show_today_circle() const noexcept;
259 month_calendar& show_today_circle(bool value);
260
263 bool show_week_numbers() const noexcept;
267 month_calendar& show_week_numbers(bool value);
268
272 xtd::drawing::size single_month_size() const noexcept;
273
277 xtd::drawing::color title_back_color() const noexcept;
282 month_calendar& title_back_color(const xtd::drawing::color& value);
283
286 xtd::drawing::color title_fore_color() const noexcept;
290 month_calendar& title_fore_color(const xtd::drawing::color& value);
291
295 const xtd::date_time& today_date() const noexcept;
300 month_calendar& today_date(const xtd::date_time& value);
301
304 bool today_date_set() const noexcept;
305
309 xtd::drawing::color trailing_fore_color() const noexcept;
314 month_calendar& trailing_fore_color(const xtd::drawing::color& value);
316
318
324
330
332
338 void add_annually_bolded_date(const xtd::date_time& date);
339
344 void add_bolded_date(const xtd::date_time& date);
345
350 void add_monthly_bolded_date(const xtd::date_time& date);
351
360 xtd::forms::month_calendar::hit_test_info hit_test(const xtd::drawing::point& point) const;
361
365 void remove_all_annually_bolded_dates();
366
370 void remove_all_bolded_dates();
371
375 void remove_all_monthly_bolded_dates();
376
380 void remove_annually_bolded_dates(const xtd::date_time& date);
381
385 void remove_bolded_dates(const xtd::date_time& date);
386
390 void remove_monthly_bolded_dates(const xtd::date_time& date);
391
396 void set_calendar_dimensions(int32 x, int32 y);
397
401 void set_date(const xtd::date_time& date);
402
408 void set_selection_range(const xtd::date_time& date1, const xtd::date_time& date2);
409
410 xtd::ustring to_string() const noexcept override;
411
414 void update_bolded_dates();
416
418
422 static month_calendar create();
426 static month_calendar create(const drawing::point& location);
431 static month_calendar create(const drawing::point& location, const drawing::size& size);
437 static month_calendar create(const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
446 static month_calendar create(const forms::selection_range& selection_range, const drawing::point& location);
452 static month_calendar create(const forms::selection_range& selection_range, const drawing::point& location, const drawing::size& size);
459 static month_calendar create(const forms::selection_range& selection_range, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
464 static month_calendar create(const forms::selection_range& selection_range, const xtd::date_time& max_date);
470 static month_calendar create(const forms::selection_range& selection_range, const xtd::date_time& max_date, const drawing::point& location);
477 static month_calendar create(const forms::selection_range& selection_range, const xtd::date_time& max_date, const drawing::point& location, const drawing::size& size);
485 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::ustring& name);
491 static month_calendar create(const forms::selection_range& selection_range, const xtd::date_time& min_date, const xtd::date_time& max_date);
498 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);
506 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);
515 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::ustring& name);
525 static month_calendar create(const control& parent);
532 static month_calendar create(const control& parent, const drawing::point& location);
539 static month_calendar create(const control& parent, const drawing::point& location, const drawing::size& size);
546 static month_calendar create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
551 static month_calendar create(const control& parent, const forms::selection_range& selection_range);
559 static month_calendar create(const control& parent, const forms::selection_range& selection_range, const drawing::point& location);
567 static month_calendar create(const control& parent, const forms::selection_range& selection_range, const drawing::point& location, const drawing::size& size);
575 static month_calendar create(const control& parent, const forms::selection_range& selection_range, const drawing::point& location, const drawing::size& size, const xtd::ustring& name);
581 static month_calendar create(const control& parent, const forms::selection_range& selection_range, const xtd::date_time& max_date);
590 static month_calendar create(const control& parent, const forms::selection_range& selection_range, const xtd::date_time& max_date, const drawing::point& location);
599 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);
608 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::ustring& name);
615 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);
625 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);
635 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);
645 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::ustring& name);
647
648 protected:
650
652 xtd::forms::create_params create_params() const noexcept override;
653 xtd::drawing::color default_back_color() const noexcept override;
654 xtd::drawing::color default_fore_color() const noexcept override;
656
658
664 std::unique_ptr<xtd::object> clone() const override;
665
672 virtual void on_date_changed(const xtd::forms::date_range_event_args& e);
673
680 virtual void on_date_selected(const xtd::forms::date_range_event_args& e);
681
682 void on_handle_created(const xtd::event_args& e) override;
683 void wnd_proc(xtd::forms::message& message) override;
685
686 private:
687 void wm_notify_control(xtd::forms::message& message);
688 void wm_date_selected(xtd::forms::message& message);
689 void wm_date_changed(xtd::forms::message& message);
690 void wm_view_changed(xtd::forms::message& message);
691
692 std::shared_ptr<data> data_;
693 };
694 }
695}
696
698template<> struct xtd::enum_register<xtd::forms::month_calendar::hit_area> {
700};
Contains xtd::forms::application class.
Represents an instant in time, typically expressed as a date and time of day.
Definition date_time.h:79
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
Encapsulates the information needed when creating a control.
Definition create_params.h:27
Provides data for the xtd::forms::month_calendar::date_changed or xtd::forms::month_calendar::date_se...
Definition date_range_event_args.h:28
Implements a Windows message.
Definition message.h:26
Contains information about an area of a xtd::forms::month_calendar control. This class cannot be inhe...
Definition month_calendar.h:76
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...
Represents a control that displays a month calendar.
Definition month_calendar.h:38
hit_area
Defines constants that represent areas in a xtd::forms::month_calendar control.
Definition month_calendar.h:44
@ nowhere
The specified point is either not on the month calendar control, or it is in an inactive portion of t...
@ calendar_background
The specified point is part of the calendar's background.
@ prev_month_date
The specified point is over a date from the previous month (partially displayed at the top of the cur...
@ date
The specified point is on a date within the calendar. The System.Windows.Forms.xtd::forms::month_cale...
@ title_year
The specified point is in a month's title bar, over the year value.
@ day_of_week
The specified point is over a day abbreviation ("Fri", for example). The System.Windows....
@ week_numbers
The specified point is over a week number. This occurs only if the xtd::forms::month_calendar::show_w...
@ title_month
The specified point is in a month's title bar, over a month name.
@ next_month_button
The specified point is over the button at the upper-right corner of the control. If the user clicks h...
@ title_background
The specified point is over the background of a month's title.
@ prev_month_button
The specified point is over the button at the upper-left corner of the control. If the user clicks he...
@ next_month_date
The specified point is over a date from the next month (partially displayed at the top of the current...
@ today_link
The specified point is on the today link at the bottom of the month calendar control.
Represents a date selection range in a month calendar control.
Definition selection_range.h:36
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:32
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
Contains xtd::forms::date_range_event_handler event handler.
Contains xtd::forms::day enum class.
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.h:23
#define forms_export_
Define shared library export.
Definition forms_export.h:13
int_least32_t int32
Represents a 32-bit signed integer.
Definition types.h:131
size_t size
Represents a size of any object in bytes.
Definition types.h:197
uint_least32_t uint32
Represents a 32-bit unsigned integer.
Definition types.h:241
std::vector< std::pair< enum_t, xtd::ustring > > enum_collection
Represents a pair of an enum_t value and a string of an enum of type enum_t.
Definition enum_collection.h:19
day_of_week
Specifies the day of the week.
Definition day_of_week.h:23
day
Specifies the day of the week.
Definition day.h:19
Contains xtd::forms::menu menu.
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::selection_range control.
Provides the registration struct for enumerations.
Definition enum_register.h:36
Contains xtd::forms::style_sheets::control class.