1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVTOOLS_CALENDAR_HXX
21 #define INCLUDED_SVTOOLS_CALENDAR_HXX
23 #include <svtools/svtdllapi.h>
24 #include <unotools/calendarwrapper.hxx>
26 #include <vcl/calendar.hxx>
27 #include <vcl/ctrl.hxx>
28 #include <vcl/field.hxx>
36 class DataChangedEvent
;
39 class ImplCFieldFloatWin
;
42 /*************************************************************************
49 This class is a DateField with which one can select a date via a DropDownButton
50 and the CalendarControl.
52 --------------------------------------------------------------------------
58 The preferences for the CalendarControl can be set via SetCalendarStyle().
60 --------------------------------------------------------------------------
62 With EnableToday()/EnableNone() we can enable a TodayButton and a NoneButton.
64 --------------------------------------------------------------------------
66 Because we only take over the start date into the field, we should query
67 with GetCalendar() in the SelectHandler and with GetSelectDateCount()/GetSelectDate()
68 the selected range. We then can e.g. take over that value to another field.
70 --------------------------------------------------------------------------
72 If a derived Calendar should be used, we can override the CreateCalendar()
73 method in CalendarField and create an own calendar there ourselves.
75 *************************************************************************/
78 class SVT_DLLPUBLIC CalendarField
: public DateField
81 VclPtr
<ImplCFieldFloatWin
> mpFloatWin
;
82 VclPtr
<Calendar
> mpCalendar
;
83 VclPtr
<PushButton
> mpTodayBtn
;
84 VclPtr
<PushButton
> mpNoneBtn
;
88 DECL_DLLPRIVATE_LINK( ImplSelectHdl
, Calendar
*, void );
89 DECL_DLLPRIVATE_LINK( ImplClickHdl
, Button
*, void );
90 DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl
, FloatingWindow
*, void );
93 CalendarField( vcl::Window
* pParent
, WinBits nWinStyle
);
94 virtual ~CalendarField() override
;
95 virtual void dispose() override
;
97 virtual bool ShowDropDown( bool bShow
) override
;
98 Calendar
* GetCalendar();
100 void EnableToday() { mbToday
= true; }
101 void EnableNone() { mbNone
= true; }
104 virtual void StateChanged( StateChangedType nStateChange
) override
;
107 #endif // INCLUDED_SVTOOLS_CALENDAR_HXX
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */