mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 08:57:35 +00:00
LibGUI+Calendar: Make Calendar a common widget in LibGUI
Refactors the Calendar widget into LibGUI and updates the Calendar app interface. Calendar widget lets layout engine manage most of its geometry now and has a few new features like tile click navigation, hover highlighting and a togglable year/month mode.
This commit is contained in:
parent
918f2c592d
commit
ab3fff4211
11 changed files with 631 additions and 485 deletions
|
@ -39,14 +39,19 @@
|
|||
#include <LibGfx/Color.h>
|
||||
#include <LibGfx/Font.h>
|
||||
|
||||
AddEventDialog::AddEventDialog(RefPtr<Calendar> calendar, Core::DateTime date_time, Window* parent_window)
|
||||
static const char* short_month_names[] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
};
|
||||
|
||||
AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window)
|
||||
: Dialog(parent_window)
|
||||
, m_calendar(calendar)
|
||||
, m_date_time(date_time)
|
||||
{
|
||||
resize(158, 100);
|
||||
set_title("Add Event");
|
||||
set_resizable(false);
|
||||
set_icon(parent_window->icon());
|
||||
|
||||
auto& widget = set_main_widget<GUI::Widget>();
|
||||
widget.set_fill_with_background_color(true);
|
||||
|
@ -148,7 +153,7 @@ String AddEventDialog::MonthListModel::column_name(int column) const
|
|||
|
||||
GUI::Variant AddEventDialog::MonthListModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
|
||||
{
|
||||
auto& month = Calendar::name_of_month(index.row() + 1);
|
||||
auto& month = short_month_names[index.row()];
|
||||
if (role == GUI::ModelRole::Display) {
|
||||
switch (index.column()) {
|
||||
case Column::Month:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue