LibreOffice Module vcl (master) 1
include/vcl/toolkit/calendar.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
23#error "don't use this in new code"
24#endif
25
26#include <config_options.h>
27#include <vcl/dllapi.h>
28
29#include <vcl/toolkit/field.hxx>
30#include <vcl/weld.hxx>
31
32class FloatingWindow;
34
35/*************************************************************************
36
37Description
38============
39
40class CalendarField
41
42This class is a DateField with which one can select a date via a DropDownButton
43and the CalendarControl.
44
45--------------------------------------------------------------------------
46
47WinBits
48
49See DateField
50
51The preferences for the CalendarControl can be set via SetCalendarStyle().
52
53--------------------------------------------------------------------------
54
55With EnableToday()/EnableNone() we can enable a TodayButton and a NoneButton.
56
57--------------------------------------------------------------------------
58
59Because we only take over the start date into the field, we should query
60with GetCalendar() in the SelectHandler and with GetSelectDateCount()/GetSelectDate()
61the selected range. We then can e.g. take over that value to another field.
62
63--------------------------------------------------------------------------
64
65If a derived Calendar should be used, we can override the CreateCalendar()
66method in CalendarField and create an own calendar there ourselves.
67
68*************************************************************************/
69
70
72{
73private:
77 bool mbToday;
78 bool mbNone;
79
80 DECL_DLLPRIVATE_LINK( ImplSelectHdl, weld::Calendar&, void );
81 DECL_DLLPRIVATE_LINK( ImplClickHdl, weld::Button&, void );
82 DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl, FloatingWindow*, void );
83
84public:
85 CalendarField( vcl::Window* pParent, WinBits nWinStyle );
86 virtual ~CalendarField() override;
87 virtual void dispose() override;
88
89 virtual bool ShowDropDown( bool bShow ) override;
90
91 void EnableToday() { mbToday = true; }
92 void EnableNone() { mbNone = true; }
93
94private:
95 virtual void StateChanged( StateChangedType nStateChange ) override;
96 virtual bool FocusWindowBelongsToControl(const vcl::Window* pFocusWin) const override;
97};
98
99/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
VclPtr< ImplCFieldFloatWin > mpFloatWin
DECL_DLLPRIVATE_LINK(ImplPopupModeEndHdl, FloatingWindow *, void)
DECL_DLLPRIVATE_LINK(ImplSelectHdl, weld::Calendar &, void)
DECL_DLLPRIVATE_LINK(ImplClickHdl, weld::Button &, void)
virtual bool FocusWindowBelongsToControl(const vcl::Window *pFocusWin) const
Definition: ctrl.cxx:220
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: field2.cxx:2020
virtual void StateChanged(StateChangedType nType) override
Definition: spinfld.cxx:777
virtual bool ShowDropDown(bool bShow)
Definition: spinfld.cxx:905
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109