当前位置: 首页>>代码示例>>C++>>正文


C++ wxDateTime::IsValid方法代码示例

本文整理汇总了C++中wxDateTime::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDateTime::IsValid方法的具体用法?C++ wxDateTime::IsValid怎么用?C++ wxDateTime::IsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxDateTime的用法示例。


在下文中一共展示了wxDateTime::IsValid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetRange

void wxDatePickerCtrl::SetRange(const wxDateTime& dt1, const wxDateTime& dt2)
{
    SYSTEMTIME st[2];

    DWORD flags = 0;
    if ( dt1.IsValid() )
    {
        dt1.GetAsMSWSysTime(st + 0);
        flags |= GDTR_MIN;
    }

    if ( dt2.IsValid() )
    {
        dt2.GetAsMSWSysTime(st + 1);
        flags |= GDTR_MAX;
    }

    if ( !DateTime_SetRange(GetHwnd(), flags, st) )
    {
        wxLogDebug(wxT("DateTime_SetRange() failed"));
        return;
    }

    // Setting the range could have changed the current control value if the
    // old one wasn't inside the new range, so update it.
    m_date = MSWGetControlValue();
}
开发者ID:nE0sIghT,项目名称:wxWidgets,代码行数:27,代码来源:datectrl.cpp

示例2:

bool
wxGtkCalendarCtrl::SetDateRange(const wxDateTime& lowerdate,
                                const wxDateTime& upperdate)
{
    if ( lowerdate.IsValid() && upperdate.IsValid() && lowerdate >= upperdate )
        return false;

    m_validStart = lowerdate;
    m_validEnd = upperdate;

    return true;
}
开发者ID:iokto,项目名称:newton-dynamics,代码行数:12,代码来源:calctrl.cpp

示例3: GetValue

wxDateTime wxDatePickerCtrl::GetValue() const
{
#if wxDEBUG_LEVEL
    const wxDateTime dt = MSWGetControlValue();

    wxASSERT_MSG( m_date.IsValid() == dt.IsValid() &&
                    (!dt.IsValid() || dt == m_date),
                  wxT("bug in wxDateTimePickerCtrl: m_date not in sync") );
#endif // wxDEBUG_LEVEL

    return wxDateTimePickerCtrl::GetValue();
}
开发者ID:nE0sIghT,项目名称:wxWidgets,代码行数:12,代码来源:datectrl.cpp

示例4: setBegin

void CJournalEntry::setBegin(const wxDateTime& dt)
{
  // Avoid silly wxDateTime assertions ... (doh!)
  if (m_dtBegin.IsValid() && !dt.IsValid()) {
    m_bDirty = true;
  } else if (!m_dtBegin.IsValid() && dt.IsValid()) {
    m_bDirty = true;
  } else {
    if (m_dtBegin.IsValid() && dt.IsValid()) {
      m_bDirty = m_bDirty || (m_dtBegin != dt);
    }
  }
  m_dtBegin = dt;
}
开发者ID:Sonderstorch,项目名称:c-mon,代码行数:14,代码来源:journalentry.cpp

示例5: SetValue

void wxDatePickerCtrl::SetValue(const wxDateTime& dt)
{
    wxCHECK_RET( dt.IsValid() || HasFlag(wxDP_ALLOWNONE),
                    _T("this control requires a valid date") );

    SYSTEMTIME st;
    if ( dt.IsValid() )
        wxToSystemTime(&st, dt);
    if ( !DateTime_SetSystemtime(GetHwnd(),
                                 dt.IsValid() ? GDT_VALID : GDT_NONE,
                                 &st) )
    {
        wxLogDebug(_T("DateTime_SetSystemtime() failed"));
    }
}
开发者ID:Duion,项目名称:Torsion,代码行数:15,代码来源:datectrl.cpp

示例6: SetUtcTime

void DashboardInstrument_Moon::SetUtcTime( wxDateTime data )
{
    if (data.IsValid())
    {
        m_phase = moon_phase(data.GetYear(), data.GetMonth() + 1, data.GetDay());
    }
}
开发者ID:mookiejones,项目名称:OpenCPN,代码行数:7,代码来源:clock.cpp

示例7: SetValue

bool
wxDatePickerCtrl::Create(wxWindow *parent,
                         wxWindowID id,
                         const wxDateTime& dt,
                         const wxPoint& pos,
                         const wxSize& size,
                         long style,
                         const wxValidator& validator,
                         const wxString& name)
{
    if ( !wxMSWDateControls::CheckInitialization() )
        return false;

    // use wxDP_SPIN if wxDP_DEFAULT (0) was given as style
    if ( !(style & wxDP_DROPDOWN) )
        style |= wxDP_SPIN;

    // initialize the base class
    if ( !CreateControl(parent, id, pos, size, style, validator, name) )
        return false;

    // create the native control
    if ( !MSWCreateControl(DATETIMEPICK_CLASS, wxEmptyString, pos, size) )
        return false;

    if ( dt.IsValid() || (style & wxDP_ALLOWNONE) )
        SetValue(dt);
    else
        SetValue(wxDateTime::Today());

    return true;
}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:32,代码来源:datectrl.cpp

示例8: eDocumentPath_shouldUpdateCygwin

//
// Returns true if this Cygwin installation should be updated (or installed for the first time.)
// Returns false if we are up-to-date.
//
bool eDocumentPath_shouldUpdateCygwin(wxDateTime &stampTime, const wxFileName &supportFile){
	// E's support folder comes with a network installer for Cygwin.
	// Newer versions of E may come with newer Cygwin versions.
	// If the user already has Cygwin installed, we still check the
	// bundled installer to see if it is newer; if so, then we need to
	// re-install Cygwin at the newer version.

	if (!stampTime.IsValid())
		return true; // First time, so we need to update.

	wxDateTime updateTime = supportFile.GetModificationTime();

	// Windows doesn't store milliseconds; we clear out this part of the time.
	updateTime.SetMillisecond(0);
	updateTime.SetSecond(0);

	stampTime.SetMillisecond(0);
	stampTime.SetSecond(0);

	// If the times are the same, no update needed.
	if (updateTime == stampTime)
		return false;

	// ...else the dates differ and we need to update.
	wxLogDebug(wxT("InitCygwin: Diff dates"));
	wxLogDebug(wxT("  e-postinstall: %s"), updateTime.FormatTime());
	wxLogDebug(wxT("  last-e-update: %s"), stampTime.FormatTime());
	return true;
}
开发者ID:joeri,项目名称:e,代码行数:33,代码来源:eDocumentPath.cpp

示例9: wxQtConvertDate

QDate wxQtConvertDate(const wxDateTime& date)
{
    if ( date.IsValid() )
        return QDate(date.GetYear(), date.GetMonth() + 1, date.GetDay());
    else
        return QDate();
}
开发者ID:EEmmanuel7,项目名称:wxWidgets,代码行数:7,代码来源:converter.cpp

示例10: SetValue

void wxDatePickerCtrl::SetValue(const wxDateTime& dt)
{
    if ( dt.IsValid() )
    {
        // Don't try setting the date if it's out of range: calendar control
        // under XP (and presumably all the other pre-Vista Windows versions)
        // doesn't return false from DateTime_SetSystemtime() in this case but
        // doesn't actually change the date, so we can't update our m_date
        // unconditionally and would need to check whether it was changed
        // before doing it. It looks simpler to just check whether it's in
        // range here instead.
        //
        // If we ever drop support for XP we could rely on the return value of
        // DateTime_SetSystemtime() but this probably won't happen in near
        // future.
        wxDateTime dtStart, dtEnd;
        GetRange(&dtStart, &dtEnd);
        if ( (dtStart.IsValid() && dt < dtStart) ||
                (dtEnd.IsValid() && dt > dtEnd) )
        {
            // Fail silently, some existing code relies on SetValue() with an
            // out of range value simply doing nothing -- so don't.
            return;
        }
    }

    wxDateTimePickerCtrl::SetValue(dt);

    // we need to keep only the date part, times don't make sense for this
    // control (in particular, comparisons with other dates would fail)
    if ( m_date.IsValid() )
        m_date.ResetTime();
}
开发者ID:nE0sIghT,项目名称:wxWidgets,代码行数:33,代码来源:datectrl.cpp

示例11: SetValue

bool
wxDateTimePickerCtrl::MSWCreateDateTimePicker(wxWindow *parent,
                                              wxWindowID id,
                                              const wxDateTime& dt,
                                              const wxPoint& pos,
                                              const wxSize& size,
                                              long style,
                                              const wxValidator& validator,
                                              const wxString& name)
{
    if ( !wxMSWDateControls::CheckInitialization() )
        return false;

    // initialize the base class
    if ( !CreateControl(parent, id, pos, size, style, validator, name) )
        return false;

    // create the native control
    if ( !MSWCreateControl(DATETIMEPICK_CLASS, wxString(), pos, size) )
        return false;

    if ( dt.IsValid() || MSWAllowsNone() )
        SetValue(dt);
    else
        SetValue(wxDateTime::Now());

    return true;
}
开发者ID:chromylei,项目名称:third_party,代码行数:28,代码来源:datetimectrl.cpp

示例12: DateToStr

wxString DateToStr(const wxDateTime &datetime)
{
	if (!datetime.IsValid())
		return wxEmptyString;

	return datetime.FormatDate() + wxT(" ") + datetime.FormatTime();
}
开发者ID:swflb,项目名称:pgadmin3,代码行数:7,代码来源:misc.cpp

示例13: wxT

bool
wxCalendarCtrl::Create(wxWindow *parent,
                       wxWindowID id,
                       const wxDateTime& dt,
                       const wxPoint& pos,
                       const wxSize& size,
                       long style,
                       const wxString& name)
{
    if ( !wxMSWDateControls::CheckInitialization() )
        return false;

    // we need the arrows for the navigation
    style |= wxWANTS_CHARS;

    // initialize the base class
    if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) )
        return false;

    // create the native control: this is a bit tricky as we want to receive
    // double click events but the MONTHCAL_CLASS doesn't use CS_DBLCLKS style
    // and so we create our own copy of it which does
    static ClassRegistrar s_clsMonthCal;
    if ( !s_clsMonthCal.IsInitialized() )
    {
        // get a copy of standard class and modify it
        WNDCLASS wc;
        if ( ::GetClassInfo(NULL, MONTHCAL_CLASS, &wc) )
        {
            wc.lpszClassName = wxT("_wx_SysMonthCtl32");
            wc.style |= CS_DBLCLKS;
            s_clsMonthCal.Register(wc);
        }
        else
        {
            wxLogLastError(wxT("GetClassInfoEx(SysMonthCal32)"));
        }
    }

    const wxChar * const clsname = s_clsMonthCal.IsRegistered()
        ? static_cast<const wxChar*>(s_clsMonthCal.GetName().t_str())
        : MONTHCAL_CLASS;

    if ( !MSWCreateControl(clsname, wxEmptyString, pos, size) )
        return false;

    // initialize the control
    UpdateFirstDayOfWeek();

    SetDate(dt.IsValid() ? dt : wxDateTime::Today());

    SetHolidayAttrs();
    UpdateMarks();

    Bind(wxEVT_LEFT_DOWN, &wxCalendarCtrl::MSWOnClick, this);
    Bind(wxEVT_LEFT_DCLICK, &wxCalendarCtrl::MSWOnDoubleClick, this);

    return true;
}
开发者ID:CodeSmithyIDE,项目名称:wxWidgets,代码行数:59,代码来源:calctrl.cpp

示例14: SetCreateTime

void TrackPoint::SetCreateTime( wxDateTime dt )
{
    wxString ts;
    if(dt.IsValid())
        ts = dt.FormatISODate().Append(_T("T")).Append(dt.FormatISOTime()).Append(_T("Z"));

    SetCreateTime(ts);
}
开发者ID:SamsonovAnton,项目名称:OpenCPN,代码行数:8,代码来源:Track.cpp

示例15: Create

bool wxGtkCalendarCtrl::Create(wxWindow *parent,
                               wxWindowID id,
                               const wxDateTime& date,
                               const wxPoint& pos,
                               const wxSize& size,
                               long style,
                               const wxString& name)
{
    if (!PreCreation(parent, pos, size) ||
          !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name))
    {
        wxFAIL_MSG(wxT("wxGtkCalendarCtrl creation failed"));
        return false;
    }

    m_widget = gtk_calendar_new();
    g_object_ref(m_widget);
    SetDate(date.IsValid() ? date : wxDateTime::Today());

    if (style & wxCAL_NO_MONTH_CHANGE)
        g_object_set (G_OBJECT (m_widget), "no-month-change", true, NULL);
    if (style & wxCAL_SHOW_WEEK_NUMBERS)
        g_object_set (G_OBJECT (m_widget), "show-week-numbers", true, NULL);

    g_signal_connect_after(m_widget, "day-selected",
                           G_CALLBACK (gtk_day_selected_callback),
                           this);
    g_signal_connect_after(m_widget, "day-selected-double-click",
                           G_CALLBACK (gtk_day_selected_double_click_callback),
                           this);
    g_signal_connect_after(m_widget, "month-changed",
                           G_CALLBACK (gtk_month_changed_callback),
                           this);

    // connect callbacks that send deprecated events
    g_signal_connect_after(m_widget, "prev-month",
                           G_CALLBACK (gtk_prev_month_callback),
                           this);
    g_signal_connect_after(m_widget, "next-month",
                           G_CALLBACK (gtk_prev_month_callback),
                           this);
    g_signal_connect_after(m_widget, "prev-year",
                           G_CALLBACK (gtk_prev_year_callback),
                           this);
    g_signal_connect_after(m_widget, "next-year",
                           G_CALLBACK (gtk_prev_year_callback),
                           this);

    m_parent->DoAddChild(this);

    PostCreation(size);

    return true;
}
开发者ID:iokto,项目名称:newton-dynamics,代码行数:54,代码来源:calctrl.cpp


注:本文中的wxDateTime::IsValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。