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 .
22 #if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
23 #error "don't use this in new code"
26 #include <config_options.h>
27 #include <vcl/dllapi.h>
29 #include <vcl/toolkit/field.hxx>
30 #include <vcl/weld.hxx>
33 struct ImplCFieldFloatWin
;
35 /*************************************************************************
42 This class is a DateField with which one can select a date via a DropDownButton
43 and the CalendarControl.
45 --------------------------------------------------------------------------
51 The preferences for the CalendarControl can be set via SetCalendarStyle().
53 --------------------------------------------------------------------------
55 With EnableToday()/EnableNone() we can enable a TodayButton and a NoneButton.
57 --------------------------------------------------------------------------
59 Because we only take over the start date into the field, we should query
60 with GetCalendar() in the SelectHandler and with GetSelectDateCount()/GetSelectDate()
61 the selected range. We then can e.g. take over that value to another field.
63 --------------------------------------------------------------------------
65 If a derived Calendar should be used, we can override the CreateCalendar()
66 method in CalendarField and create an own calendar there ourselves.
68 *************************************************************************/
71 class VCL_DLLPUBLIC CalendarField final
: public DateField
74 VclPtr
<ImplCFieldFloatWin
> mpFloatWin
;
75 weld::Button
* mpTodayBtn
;
76 weld::Button
* mpNoneBtn
;
80 DECL_DLLPRIVATE_LINK( ImplSelectHdl
, weld::Calendar
&, void );
81 DECL_DLLPRIVATE_LINK( ImplClickHdl
, weld::Button
&, void );
82 DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl
, FloatingWindow
*, void );
85 CalendarField( vcl::Window
* pParent
, WinBits nWinStyle
);
86 virtual ~CalendarField() override
;
87 virtual void dispose() override
;
89 virtual bool ShowDropDown( bool bShow
) override
;
91 void EnableToday() { mbToday
= true; }
92 void EnableNone() { mbNone
= true; }
95 virtual void StateChanged( StateChangedType nStateChange
) override
;
96 virtual bool FocusWindowBelongsToControl(const vcl::Window
* pFocusWin
) const override
;
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */