/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
This class allows for the selection of a date. The displayed date range is the one specified by the Date class. We display as many months as we have space in the control. The user can switch between months using a ContextMenu (clicking on the month's name) or via two ScrollButtons in-between the months.
We set and get the selected date by SetCurDate()/GetCurDate(). If the user selects a date Select() is called. If the user double clicks DoubleClick() is called.
SetSaturdayColor() and SetSundayColor() set a special color for Saturdays and Sundays. AddDateInfo() marks special days. With that we can set e.g. public holidays to another color or encircle them (for e.g. appointments). If we do not supply a year in the date, the day is used in EVERY year.
AddDateInfo() can also add text for every date, which is displayed if the BalloonHelp is enabled. In order to not have to supply all years with the relevant data, we call the RequestDateInfo() handler if a new year is displayed. We can then query the year in the handler with GetRequestYear().
In order to display a ContextMenu for a date, we need to override the Command handler. GetDate() can infer the date from the mouse's position. If we use the keyboard, the current date should be use.
If a ContextMenu is displayed, the baseclass' handler must not be called.
SetNoSelection() deselects everything. SetCurDate() does not select the current date, but only defines the focus rectangle. GetSelectDateCount()/GetSelectDate() query the selected range. IsDateSelected() queries for the status of a date.
The SelectionChanging() handler is being called while a user selects a date. In it, we can change the selected range. E.g. if we want to limit or extend the selected range. The selected range is realised via SelectDate() and SelectDateRange() and queried with GetSelectDateCount()/GetSelectDate().
IsSelectLeft() returns the direction of the selection: sal_True is a selection to the left or up sal_False is a selection to the right or down
If the DateRange area changes and we want to take over the selection, we should only do this is if IsScrollDateRangeChanged() returns sal_True. This method returns sal_True if the area change was triggered by using the ScrollButtons and sal_False if it was triggered by Resize(), other method calls or by ending a selection.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.