8a64b6acea
This class must not derive from the native wxDatePickerCtrl, as it doesn't make much sense and resulted in the need for an ugly hack with either overriding unused and inapplicable pure virtual methods in this class itself, as was originally done in569c7d8ccb
(Add wxTimePickerCtrl class., 2011-09-29) when it was introduced, or not making these methods pure virtual in the first place, as was done ind0da5061ce
(Dirty hack to allow generic wxDatePickerCtrl to compile under MSW., 2011-10-20), but didn't really fix the problem. Do fix it now by using different hierarchies for the native and generic classes. The main disadvantage of doing it is that there is no common base class for wxTimePickerCtrl and wxTimePickerCtrlGeneric providing SetTime() and GetTime() methods any more, but this seems like a relatively small price to pay because real applications won't be using these two classes simultaneously, as the calendar sample does, anyhow.
72 lines
2.6 KiB
C++
72 lines
2.6 KiB
C++
///////////////////////////////////////////////////////////////////////////////
|
|
// Name: wx/generic/timectrl.h
|
|
// Purpose: Generic implementation of wxTimePickerCtrl.
|
|
// Author: Paul Breen, Vadim Zeitlin
|
|
// Created: 2011-09-22
|
|
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
|
|
// Licence: wxWindows licence
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef _WX_GENERIC_TIMECTRL_H_
|
|
#define _WX_GENERIC_TIMECTRL_H_
|
|
|
|
#include "wx/containr.h"
|
|
#include "wx/compositewin.h"
|
|
|
|
typedef wxTimePickerCtrlCommonBase<wxDateTimePickerCtrlBase> wxTimePickerCtrlGenericBase;
|
|
|
|
class WXDLLIMPEXP_ADV wxTimePickerCtrlGeneric
|
|
: public wxCompositeWindow< wxNavigationEnabled<wxTimePickerCtrlGenericBase> >
|
|
{
|
|
public:
|
|
typedef wxCompositeWindow< wxNavigationEnabled<wxTimePickerCtrlGenericBase> > Base;
|
|
|
|
// Creating the control.
|
|
wxTimePickerCtrlGeneric() { Init(); }
|
|
virtual ~wxTimePickerCtrlGeneric();
|
|
wxTimePickerCtrlGeneric(wxWindow *parent,
|
|
wxWindowID id,
|
|
const wxDateTime& date = wxDefaultDateTime,
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
const wxSize& size = wxDefaultSize,
|
|
long style = wxTP_DEFAULT,
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
const wxString& name = wxTimePickerCtrlNameStr)
|
|
{
|
|
Init();
|
|
|
|
(void)Create(parent, id, date, pos, size, style, validator, name);
|
|
}
|
|
|
|
bool Create(wxWindow *parent,
|
|
wxWindowID id,
|
|
const wxDateTime& date = wxDefaultDateTime,
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
const wxSize& size = wxDefaultSize,
|
|
long style = wxTP_DEFAULT,
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
const wxString& name = wxTimePickerCtrlNameStr);
|
|
|
|
// Implement pure virtual wxTimePickerCtrlBase methods.
|
|
virtual void SetValue(const wxDateTime& date) wxOVERRIDE;
|
|
virtual wxDateTime GetValue() const wxOVERRIDE;
|
|
|
|
protected:
|
|
virtual wxSize DoGetBestSize() const wxOVERRIDE;
|
|
|
|
virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE;
|
|
|
|
private:
|
|
void Init();
|
|
|
|
// Return the list of the windows composing this one.
|
|
virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE;
|
|
|
|
// Implementation data.
|
|
class wxTimePickerGenericImpl* m_impl;
|
|
|
|
wxDECLARE_NO_COPY_CLASS(wxTimePickerCtrlGeneric);
|
|
};
|
|
|
|
#endif // _WX_GENERIC_TIMECTRL_H_
|