2005-01-19 08:55:48 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: generic/datectrl.h
|
|
|
|
// Purpose: generic wxDatePickerCtrl implementation
|
|
|
|
// Author: Andreas Pflug
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2005-01-19
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 2005 Andreas Pflug <pgadmin@pse-consulting.de>
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_GENERIC_DATECTRL_H_
|
|
|
|
#define _WX_GENERIC_DATECTRL_H_
|
|
|
|
|
2005-02-13 07:44:14 -05:00
|
|
|
class WXDLLIMPEXP_ADV wxButton;
|
2005-01-19 08:55:48 -05:00
|
|
|
class WXDLLIMPEXP_ADV wxCalendarDateAttr;
|
|
|
|
class WXDLLIMPEXP_ADV wxCalendarCtrl;
|
|
|
|
class WXDLLIMPEXP_ADV wxCalendarEvent;
|
2005-02-13 07:44:14 -05:00
|
|
|
class WXDLLIMPEXP_ADV wxDatePopup;
|
|
|
|
class WXDLLIMPEXP_ADV wxTextCtrl;
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_ADV wxDatePopupInternal;
|
2005-01-20 21:00:07 -05:00
|
|
|
|
2005-01-21 08:44:01 -05:00
|
|
|
class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric : public wxDatePickerCtrlBase
|
2005-01-19 08:55:48 -05:00
|
|
|
{
|
|
|
|
public:
|
2005-01-19 10:57:30 -05:00
|
|
|
// creating the control
|
2005-01-21 08:44:01 -05:00
|
|
|
wxDatePickerCtrlGeneric() { Init(); }
|
|
|
|
wxDatePickerCtrlGeneric(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxDateTime& date = wxDefaultDateTime,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
|
2005-02-07 13:37:43 -05:00
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2005-01-21 08:44:01 -05:00
|
|
|
const wxString& name = wxDatePickerCtrlNameStr)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
|
2005-02-07 13:37:43 -05:00
|
|
|
(void)Create(parent, id, date, pos, size, style, validator, name);
|
2005-01-21 08:44:01 -05:00
|
|
|
}
|
2005-01-19 08:55:48 -05:00
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
2005-01-20 11:22:48 -05:00
|
|
|
wxWindowID id,
|
|
|
|
const wxDateTime& date = wxDefaultDateTime,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
|
2005-02-07 13:37:43 -05:00
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2005-01-20 11:22:48 -05:00
|
|
|
const wxString& name = wxDatePickerCtrlNameStr);
|
2005-01-19 08:55:48 -05:00
|
|
|
|
2005-01-19 10:57:30 -05:00
|
|
|
// wxDatePickerCtrl methods
|
2005-01-19 08:55:48 -05:00
|
|
|
void SetValue(const wxDateTime& date);
|
|
|
|
wxDateTime GetValue() const;
|
2005-01-19 10:57:30 -05:00
|
|
|
|
2005-01-19 08:55:48 -05:00
|
|
|
bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const;
|
|
|
|
void SetRange(const wxDateTime &dt1, const wxDateTime &dt2);
|
|
|
|
|
2005-01-19 10:57:30 -05:00
|
|
|
bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime,
|
|
|
|
const wxDateTime& upperdate = wxDefaultDateTime);
|
|
|
|
|
|
|
|
// extra methods available only in this (generic) implementation
|
|
|
|
bool SetFormat(const wxChar *fmt);
|
|
|
|
wxCalendarCtrl *GetCalendar() const { return m_cal; }
|
2005-01-19 08:55:48 -05:00
|
|
|
|
|
|
|
|
2005-01-19 10:57:30 -05:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
2005-01-19 08:55:48 -05:00
|
|
|
|
2005-01-19 10:57:30 -05:00
|
|
|
// overridden base class methods
|
|
|
|
virtual bool Destroy();
|
2005-01-19 08:55:48 -05:00
|
|
|
|
2005-02-13 07:44:14 -05:00
|
|
|
virtual bool Enable(bool enable = true);
|
|
|
|
virtual bool Show(bool show = true);
|
2005-01-19 08:55:48 -05:00
|
|
|
|
2005-01-19 10:57:30 -05:00
|
|
|
protected:
|
2005-01-19 08:55:48 -05:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void Init();
|
2005-01-21 12:54:08 -05:00
|
|
|
void DropDown(bool down = true);
|
2005-01-19 08:55:48 -05:00
|
|
|
|
2005-02-13 07:44:14 -05:00
|
|
|
void OnText(wxCommandEvent &event);
|
2005-01-19 08:55:48 -05:00
|
|
|
void OnEditKey(wxKeyEvent & event);
|
|
|
|
void OnCalKey(wxKeyEvent & event);
|
2005-02-13 07:44:14 -05:00
|
|
|
void OnClick(wxCommandEvent &event);
|
|
|
|
void OnSelChange(wxCalendarEvent &event);
|
|
|
|
void OnSetFocus(wxFocusEvent &event);
|
|
|
|
void OnKillFocus(wxFocusEvent &event);
|
|
|
|
void OnChildSetFocus(wxChildFocusEvent &event);
|
2005-01-19 08:55:48 -05:00
|
|
|
|
2005-01-21 12:54:08 -05:00
|
|
|
|
2005-02-13 07:44:14 -05:00
|
|
|
wxDatePopupInternal *m_popup;
|
2005-01-21 12:54:08 -05:00
|
|
|
wxTextCtrl *m_txt;
|
|
|
|
wxCalendarCtrl *m_cal;
|
|
|
|
wxButton *m_btn;
|
|
|
|
wxString m_format;
|
2005-02-13 07:44:14 -05:00
|
|
|
wxDateTime m_currentDate;
|
2005-01-21 12:54:08 -05:00
|
|
|
|
|
|
|
bool m_dropped,
|
|
|
|
m_ignoreDrop;
|
|
|
|
|
|
|
|
|
2005-01-19 08:55:48 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
2005-01-21 08:44:01 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(wxDatePickerCtrlGeneric)
|
2005-01-19 08:55:48 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _WX_GENERIC_DATECTRL_H_
|
|
|
|
|