diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-02-14 21:26:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-02-15 15:11:58 +0100 |
commit | 03b4d8f486d9ecdfe21a05d6bf65c396a35772f6 (patch) | |
tree | e12a35585430f1cfcac56a202382a30d3d1917f9 /svtools | |
parent | 8fdbda18b593e7014e44a0fd590bbf98d83258b7 (diff) |
weld ScDPDateGroupDlg
adding a weld::Calendar and a pretty menubutton to access it, sidestepping the
difficulty of abusing a spinbutton to select a date. The prettiness is wasted
on this hard to find obscure dialog
Change-Id: I51d461fe0220f947c106d96965e6422b4b26575b
Reviewed-on: https://gerrit.libreoffice.org/67863
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/UIConfig_svt.mk | 1 | ||||
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 33 | ||||
-rw-r--r-- | svtools/uiconfig/ui/datewindow.ui | 32 |
3 files changed, 66 insertions, 0 deletions
diff --git a/svtools/UIConfig_svt.mk b/svtools/UIConfig_svt.mk index 5887d1645165..8ebefde11310 100644 --- a/svtools/UIConfig_svt.mk +++ b/svtools/UIConfig_svt.mk @@ -11,6 +11,7 @@ $(eval $(call gb_UIConfig_UIConfig,svt)) $(eval $(call gb_UIConfig_add_uifiles,svt,\ svtools/uiconfig/ui/addresstemplatedialog \ + svtools/uiconfig/ui/datewindow \ svtools/uiconfig/ui/fileviewmenu \ svtools/uiconfig/ui/graphicexport \ svtools/uiconfig/ui/inputbox \ diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 0fba463c4ff6..d45547e22b8b 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -2056,4 +2056,37 @@ void SvtLineListBox::UpdatePreview() } } +SvtCalendarBox::SvtCalendarBox(std::unique_ptr<weld::MenuButton> pControl) + : m_xControl(std::move(pControl)) + , m_xBuilder(Application::CreateBuilder(m_xControl.get(), "svt/ui/datewindow.ui")) + , m_xTopLevel(m_xBuilder->weld_widget("date_popup_window")) + , m_xCalendar(m_xBuilder->weld_calendar("date")) +{ + m_xControl->set_popover(m_xTopLevel.get()); + m_xCalendar->connect_selected(LINK(this, SvtCalendarBox, SelectHdl)); + m_xCalendar->connect_activated(LINK(this, SvtCalendarBox, ActivateHdl)); +} + +void SvtCalendarBox::set_date(const Date& rDate) +{ + m_xCalendar->set_date(rDate); + SelectHdl(*m_xCalendar); +} + +IMPL_LINK(SvtCalendarBox, SelectHdl, weld::Calendar&, rCalendar, void) +{ + const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetLocaleDataWrapper(); + m_xControl->set_label(rLocaleData.getDate(rCalendar.get_date())); +} + +IMPL_LINK_NOARG(SvtCalendarBox, ActivateHdl, weld::Calendar&, void) +{ + if (m_xControl->get_active()) + m_xControl->set_active(false); +} + +SvtCalendarBox::~SvtCalendarBox() +{ +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/uiconfig/ui/datewindow.ui b/svtools/uiconfig/ui/datewindow.ui new file mode 100644 index 000000000000..84d7ebf4931c --- /dev/null +++ b/svtools/uiconfig/ui/datewindow.ui @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface domain="svx"> + <requires lib="gtk+" version="3.18"/> + <object class="GtkPopover" id="date_popup_window"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="border_width">4</property> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkCalendar" id="date"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="year">2019</property> + <property name="month">1</property> + <property name="day">14</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + </object> +</interface> |