xtd 0.2.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 enum class hit_area {
48 nowhere,
50 title_background,
52 title_month,
54 title_year,
56 next_month_button,
58 prev_month_button,
60 calendar_background,
62 date,
64 next_month_date,
66 prev_month_date,
70 week_numbers,
72 today_link
73 };
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
124 std::vector<xtd::date_time> annually_bolded_dates() const noexcept;
129 month_calendar& annually_bolded_dates(const std::vector<xtd::date_time>& value);
130
134 std::vector<xtd::date_time> bolded_dates() const noexcept;
139 month_calendar& bolded_dates(const std::vector<xtd::date_time>& value);
140
144 const xtd::drawing::size& calendar_dimensions() const noexcept;
149 month_calendar& calendar_dimensions(const xtd::drawing::size& value);
150
153 xtd::forms::day first_day_of_week() const noexcept;
157 month_calendar& first_day_of_week(xtd::forms::day value);
158
161 xtd::date_time max_date() const noexcept;
165 month_calendar& max_date(xtd::date_time value);
166
172 uint32 max_selection_count() const noexcept;
179 month_calendar& max_selection_count(uint32 value);
180
183 xtd::date_time min_date() const noexcept;
187 month_calendar& min_date(xtd::date_time value);
188
192 std::vector<xtd::date_time> monthly_bolded_dates() const noexcept;
197 month_calendar& monthly_bolded_dates(const std::vector<xtd::date_time>& value);
198
205 xtd::date_time selection_end() const noexcept;
213 month_calendar& selection_end(xtd::date_time value);
214
226
233 xtd::date_time selection_start() const noexcept;
241 month_calendar& selection_start(xtd::date_time value);
242
246 bool show_today() const noexcept;
251 month_calendar& show_today(bool value);
252
256 bool show_today_circle() const noexcept;
261 month_calendar& show_today_circle(bool value);
262
265 bool show_week_numbers() const noexcept;
269 month_calendar& show_week_numbers(bool value);
270
274 xtd::drawing::size single_month_size() const noexcept;
275
279 xtd::drawing::color title_back_color() const noexcept;
284 month_calendar& title_back_color(const xtd::drawing::color& value);
285
288 xtd::drawing::color title_fore_color() const noexcept;
292 month_calendar& title_fore_color(const xtd::drawing::color& value);
293
297 const xtd::date_time& today_date() const noexcept;
302 month_calendar& today_date(const xtd::date_time& value);
303
306 bool today_date_set() const noexcept;
307
311 xtd::drawing::color trailing_fore_color() const noexcept;
316 month_calendar& trailing_fore_color(const xtd::drawing::color& value);
318
320
326
332
334
340 void add_annually_bolded_date(const xtd::date_time& date);
341
346 void add_bolded_date(const xtd::date_time& date);
347
352 void add_monthly_bolded_date(const xtd::date_time& date);
353
362 xtd::forms::month_calendar::hit_test_info hit_test(const xtd::drawing::point& point) const;
363
367 void remove_all_annually_bolded_dates();
368
372 void remove_all_bolded_dates();
373
377 void remove_all_monthly_bolded_dates();
378
382 void remove_annually_bolded_dates(const xtd::date_time& date);
383
387 void remove_bolded_dates(const xtd::date_time& date);
388
392 void remove_monthly_bolded_dates(const xtd::date_time& date);
393
398 void set_calendar_dimensions(int32 x, int32 y);
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
416 void update_bolded_dates();
418
420
424 static month_calendar create();
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);
448 static month_calendar create(const forms::selection_range& selection_range, const drawing::point& location);
454 static month_calendar create(const forms::selection_range& selection_range, const drawing::point& location, const drawing::size& size);
461 static month_calendar create(const forms::selection_range& selection_range, const drawing::point& location, const drawing::size& size, const xtd::string& name);
466 static month_calendar create(const forms::selection_range& selection_range, const xtd::date_time& max_date);
472 static month_calendar create(const forms::selection_range& selection_range, const xtd::date_time& max_date, const drawing::point& location);
479 static month_calendar create(const forms::selection_range& selection_range, const xtd::date_time& max_date, const drawing::point& location, const drawing::size& size);
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);
493 static month_calendar create(const forms::selection_range& selection_range, const xtd::date_time& min_date, const xtd::date_time& max_date);
500 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);
508 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);
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);
527 static month_calendar create(const control& parent);
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);
553 static month_calendar create(const control& parent, const forms::selection_range& selection_range);
561 static month_calendar create(const control& parent, const forms::selection_range& selection_range, const drawing::point& location);
569 static month_calendar create(const control& parent, const forms::selection_range& selection_range, const drawing::point& location, const drawing::size& size);
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);
583 static month_calendar create(const control& parent, const forms::selection_range& selection_range, const xtd::date_time& max_date);
592 static month_calendar create(const control& parent, const forms::selection_range& selection_range, const xtd::date_time& max_date, const drawing::point& location);
601 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);
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);
617 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);
627 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);
637 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);
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
674 virtual void on_date_changed(const xtd::forms::date_range_event_args& e);
675
682 virtual void on_date_selected(const xtd::forms::date_range_event_args& e);
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.
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
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
Encapsulates the information needed when creating a control.
Definition create_params.hpp:29
Provides data for the xtd::forms::month_calendar::date_changed or xtd::forms::month_calendar::date_se...
Definition date_range_event_args.hpp:30
Implements a Windows message.
Definition message.hpp:28
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...
Represents a control that displays a month calendar.
Definition month_calendar.hpp:40
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...
@ 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.hpp:38
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:42
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.hpp:25
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
std::vector< xtd::collections::generic::key_value_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:22
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::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::forms::selection_range control.
Provides the registration struct for enumerations.
Definition enum_register.hpp:38
Contains xtd::forms::style_sheets::control class.