compilation fixes; pruned API
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31496 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
cad3d9c14c
commit
4b134bb2ce
@ -19,13 +19,15 @@ class WXDLLIMPEXP_ADV wxCalendarEvent;
|
|||||||
class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlBase
|
class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// creating the control
|
||||||
wxDatePickerCtrl() { Init(); }
|
wxDatePickerCtrl() { Init(); }
|
||||||
wxDatePickerCtrl(wxWindow *parent,
|
wxDatePickerCtrl(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxDateTime& date = wxDefaultDateTime,
|
const wxDateTime& date = wxDefaultDateTime,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxCAL_SHOW_HOLIDAYS | wxWANTS_CHARS, const wxString& name=wxDatePickerCtrlNameStr);
|
long style = 0,
|
||||||
|
const wxString& name = wxDatePickerCtrlNameStr);
|
||||||
|
|
||||||
bool Create(wxWindow *parent,
|
bool Create(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
@ -35,30 +37,31 @@ public:
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name=wxDatePickerCtrlNameStr);
|
const wxString& name=wxDatePickerCtrlNameStr);
|
||||||
|
|
||||||
|
// wxDatePickerCtrl methods
|
||||||
void SetValue(const wxDateTime& date);
|
void SetValue(const wxDateTime& date);
|
||||||
wxDateTime GetValue() const;
|
wxDateTime GetValue() const;
|
||||||
|
|
||||||
bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const;
|
bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const;
|
||||||
void SetRange(const wxDateTime &dt1, const wxDateTime &dt2);
|
void SetRange(const wxDateTime &dt1, const wxDateTime &dt2);
|
||||||
|
|
||||||
bool Destroy();
|
bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime,
|
||||||
|
const wxDateTime& upperdate = wxDefaultDateTime);
|
||||||
|
|
||||||
bool SetLowerDateLimit(const wxDateTime& date = wxDefaultDateTime) { return m_cal->SetLowerDateLimit(date); }
|
// extra methods available only in this (generic) implementation
|
||||||
const wxDateTime& GetLowerDateLimit() const { return m_cal->GetLowerDateLimit(); }
|
|
||||||
bool SetUpperDateLimit(const wxDateTime& date = wxDefaultDateTime) { return m_cal->SetUpperDateLimit(date); }
|
|
||||||
const wxDateTime& GetUpperDateLimit() const { return m_cal->GetUpperDateLimit(); }
|
|
||||||
|
|
||||||
bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, const wxDateTime& upperdate = wxDefaultDateTime)
|
|
||||||
{ return m_cal->SetDateRange(lowerdate, upperdate); }
|
|
||||||
|
|
||||||
wxCalendarDateAttr *GetAttr(size_t day) const { return m_cal->GetAttr(day); }
|
|
||||||
void SetAttr(size_t day, wxCalendarDateAttr *attr) { m_cal->SetAttr(day, attr); }
|
|
||||||
void SetHoliday(size_t day) { m_cal->SetHoliday(day); }
|
|
||||||
void ResetAttr(size_t day) { m_cal->ResetAttr(day); }
|
|
||||||
bool SetFormat(const wxChar *fmt);
|
bool SetFormat(const wxChar *fmt);
|
||||||
|
wxCalendarCtrl *GetCalendar() const { return m_cal; }
|
||||||
|
|
||||||
|
|
||||||
|
// implementation only from now on
|
||||||
|
// -------------------------------
|
||||||
|
|
||||||
|
// overridden base class methods
|
||||||
|
virtual bool Destroy();
|
||||||
|
|
||||||
virtual bool Enable(bool enable = TRUE);
|
virtual bool Enable(bool enable = TRUE);
|
||||||
virtual bool Show(bool show = TRUE);
|
virtual bool Show(bool show = TRUE);
|
||||||
|
|
||||||
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/datectrl.h"
|
#include "wx/datectrl.h"
|
||||||
|
#include "wx/calctrl.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
@ -32,8 +33,8 @@
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CTRLID_TXT = 101,
|
CTRLID_TXT = 101,
|
||||||
CTRLID_CAL
|
CTRLID_CAL,
|
||||||
CTRLID_BTN
|
CTRLID_BTN,
|
||||||
CTRLID_PAN
|
CTRLID_PAN
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -110,27 +111,50 @@ bool wxDatePickerCtrl::Create(wxWindow *parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_txt=new wxTextCtrl(this, CTRLID_TXT, txt);
|
m_txt=new wxTextCtrl(this, CTRLID_TXT, txt);
|
||||||
m_txt->Connect(wxID_ANY, wxID_ANY, wxEVT_KEY_DOWN, (wxObjectEventFunction)&wxDatePickerCtrl::OnEditKey, 0, this);
|
m_txt->Connect(wxID_ANY, wxID_ANY, wxEVT_KEY_DOWN,
|
||||||
m_txt->Connect(wxID_ANY, wxID_ANY, wxEVT_KILL_FOCUS, (wxObjectEventFunction)&wxDatePickerCtrl::OnKillFocus, 0, this);
|
(wxObjectEventFunction)&wxDatePickerCtrl::OnEditKey,
|
||||||
|
0, this);
|
||||||
|
m_txt->Connect(wxID_ANY, wxID_ANY, wxEVT_KILL_FOCUS,
|
||||||
|
(wxObjectEventFunction)&wxDatePickerCtrl::OnKillFocus,
|
||||||
|
0, this);
|
||||||
SetFormat(wxT("%x"));
|
SetFormat(wxT("%x"));
|
||||||
|
|
||||||
m_btn = new wxBitmapButton(this, CTRLID_BTN, bmp);
|
m_btn = new wxBitmapButton(this, CTRLID_BTN, bmp);
|
||||||
|
|
||||||
m_dlg = new wxDialog(this, CTRLID_CAL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER);
|
m_dlg = new wxDialog(this, CTRLID_CAL, wxEmptyString,
|
||||||
|
wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxSIMPLE_BORDER);
|
||||||
m_dlg->SetFont(GetFont());
|
m_dlg->SetFont(GetFont());
|
||||||
|
|
||||||
wxPanel *panel=new wxPanel(m_dlg, CTRLID_PAN, wxPoint(0, 0), wxDefaultSize, wxSUNKEN_BORDER|wxCLIP_CHILDREN);
|
wxPanel *panel=new wxPanel(m_dlg, CTRLID_PAN,
|
||||||
m_cal = new wxCalendarCtrl(panel, CTRLID_CAL, wxDefaultDateTime, wxPoint(0,0), wxDefaultSize, wxSUNKEN_BORDER);
|
wxPoint(0, 0), wxDefaultSize,
|
||||||
m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_SEL_CHANGED, (wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange, 0, this);
|
wxSUNKEN_BORDER);
|
||||||
m_cal->Connect(wxID_ANY, wxID_ANY, wxEVT_KEY_DOWN, (wxObjectEventFunction)&wxDatePickerCtrl::OnCalKey, 0, this);
|
m_cal = new wxCalendarCtrl(panel, CTRLID_CAL, wxDefaultDateTime,
|
||||||
m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_DOUBLECLICKED, (wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange, 0, this);
|
wxPoint(0,0), wxDefaultSize,
|
||||||
m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_DAY_CHANGED, (wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange, 0, this);
|
wxCAL_SHOW_HOLIDAYS | wxSUNKEN_BORDER);
|
||||||
m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_MONTH_CHANGED, (wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange, 0, this);
|
m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_SEL_CHANGED,
|
||||||
m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_YEAR_CHANGED, (wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange, 0, this);
|
(wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange,
|
||||||
|
0, this);
|
||||||
|
m_cal->Connect(wxID_ANY, wxID_ANY, wxEVT_KEY_DOWN,
|
||||||
|
(wxObjectEventFunction)&wxDatePickerCtrl::OnCalKey,
|
||||||
|
0, this);
|
||||||
|
m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_DOUBLECLICKED,
|
||||||
|
(wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange,
|
||||||
|
0, this);
|
||||||
|
m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_DAY_CHANGED,
|
||||||
|
(wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange,
|
||||||
|
0, this);
|
||||||
|
m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_MONTH_CHANGED,
|
||||||
|
(wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange,
|
||||||
|
0, this);
|
||||||
|
m_cal->Connect(CTRLID_CAL, CTRLID_CAL, wxEVT_CALENDAR_YEAR_CHANGED,
|
||||||
|
(wxObjectEventFunction)&wxDatePickerCtrl::OnSelChange,
|
||||||
|
0, this);
|
||||||
|
|
||||||
wxWindow *yearControl = m_cal->GetYearControl();
|
wxWindow *yearControl = m_cal->GetYearControl();
|
||||||
|
|
||||||
Connect(wxID_ANY, wxID_ANY, wxEVT_SET_FOCUS, (wxObjectEventFunction)&wxDatePickerCtrl::OnSetFocus);
|
Connect(wxID_ANY, wxID_ANY, wxEVT_SET_FOCUS,
|
||||||
|
(wxObjectEventFunction)&wxDatePickerCtrl::OnSetFocus);
|
||||||
|
|
||||||
wxClientDC dc(yearControl);
|
wxClientDC dc(yearControl);
|
||||||
dc.SetFont(m_font);
|
dc.SetFont(m_font);
|
||||||
@ -161,7 +185,8 @@ bool wxDatePickerCtrl::Create(wxWindow *parent,
|
|||||||
width += 2;
|
width += 2;
|
||||||
}
|
}
|
||||||
m_cal->SetSize(calPos, 0, calSize.x, calSize.y);
|
m_cal->SetSize(calPos, 0, calSize.x, calSize.y);
|
||||||
yearControl->SetSize(width-yearSize.x-CALBORDER/2, yearPosition.y, yearSize.x, yearSize.y);
|
yearControl->SetSize(width-yearSize.x-CALBORDER/2, yearPosition.y,
|
||||||
|
yearSize.x, yearSize.y);
|
||||||
m_cal->GetMonthControl()->Move(0, 0);
|
m_cal->GetMonthControl()->Move(0, 0);
|
||||||
|
|
||||||
|
|
||||||
@ -270,6 +295,13 @@ bool wxDatePickerCtrl::Enable(bool enable)
|
|||||||
// wxDatePickerCtrl API
|
// wxDatePickerCtrl API
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool
|
||||||
|
wxDatePickerCtrl::SetDateRange(const wxDateTime& lowerdate,
|
||||||
|
const wxDateTime& upperdate)
|
||||||
|
{
|
||||||
|
return m_cal->SetDateRange(lowerdate, upperdate);
|
||||||
|
}
|
||||||
|
|
||||||
bool wxDatePickerCtrl::SetFormat(const wxChar *fmt)
|
bool wxDatePickerCtrl::SetFormat(const wxChar *fmt)
|
||||||
{
|
{
|
||||||
wxDateTime dt;
|
wxDateTime dt;
|
||||||
@ -351,17 +383,16 @@ void wxDatePickerCtrl::SetValue(const wxDateTime& date)
|
|||||||
bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) const
|
bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) const
|
||||||
{
|
{
|
||||||
if (dt1)
|
if (dt1)
|
||||||
*dt1 = GetLowerDateLimit();
|
*dt1 = m_cal->GetLowerDateLimit();
|
||||||
if (dt1)
|
if (dt1)
|
||||||
*dt2 = GetUpperDateLimit();
|
*dt2 = m_cal->GetUpperDateLimit();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxDatePickerCtrl::SetRange(const wxDateTime &dt1, const wxDateTime &dt2)
|
void wxDatePickerCtrl::SetRange(const wxDateTime &dt1, const wxDateTime &dt2)
|
||||||
{
|
{
|
||||||
SetLowerDateLimit(dt1);
|
m_cal->SetDateRange(dt1, dt2);
|
||||||
SetUpperDateLimit(dt2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user