Beispiel #1
0
    // Update the text value to correspond to the current time. By default also
    // generate an event but this can be avoided by calling the "WithoutEvent"
    // variant.
    void UpdateText()
    {
        UpdateTextWithoutEvent();

        wxWindow* const ctrl = m_text->GetParent();

        wxDateEvent event(ctrl, m_time, wxEVT_TIME_CHANGED);
        ctrl->HandleWindowEvent(event);
    }
Beispiel #2
0
    // Set the new value.
    void SetValue(const wxDateTime& time)
    {
        m_time = time.IsValid() ? time : wxDateTime::Now();

        // Ensure that the date part doesn't correspond to a DST change date as
        // time is discontinuous then resulting in many problems, e.g. it's
        // impossible to even enter 2:00:00 at the beginning of summer time
        // date as this time doesn't exist. By using Jan 1, on which nobody
        // changes DST, we avoid all such problems.
        wxDateTime::Tm tm = m_time.GetTm();
        tm.mday =
        tm.yday = 1;
        tm.mon = wxDateTime::Jan;
        m_time.Set(tm);

        UpdateTextWithoutEvent();
    }
Beispiel #3
0
    // Set the new value.
    void SetValue(const wxDateTime& time)
    {
        m_time = time.IsValid() ? time : wxDateTime::Now();

        UpdateTextWithoutEvent();
    }