本文整理汇总了C++中wxDateTime::SetSecond方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDateTime::SetSecond方法的具体用法?C++ wxDateTime::SetSecond怎么用?C++ wxDateTime::SetSecond使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDateTime
的用法示例。
在下文中一共展示了wxDateTime::SetSecond方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: switch
// Decrement or increment the value of the current field (wrapping if
// necessary).
void ChangeCurrentFieldBy1(Direction dir)
{
switch ( m_currentField )
{
case Field_Hour:
m_time.SetHour((m_time.GetHour() + 24 + dir) % 24);
break;
case Field_Min:
m_time.SetMinute((m_time.GetMinute() + 60 + dir) % 60);
break;
case Field_Sec:
m_time.SetSecond((m_time.GetSecond() + 60 + dir) % 60);
break;
case Field_AMPM:
m_time.SetHour((m_time.GetHour() + 12) % 24);
break;
case Field_Max:
wxFAIL_MSG( "Invalid field" );
return;
}
UpdateText();
}
示例3: ResetCurrentField
// Set the current field to its minimal or maximal value.
void ResetCurrentField(Direction dir)
{
switch ( m_currentField )
{
case Field_Hour:
case Field_AMPM:
// In 12-hour mode setting the hour to the minimal value
// also changes the suffix to AM and, correspondingly,
// setting it to the maximal one changes the suffix to PM.
// And, for consistency with the native MSW behaviour, we
// also do the same thing when changing AM/PM field itself,
// so change hours in any case.
m_time.SetHour(dir == Dir_Down ? 0 : 23);
break;
case Field_Min:
m_time.SetMinute(dir == Dir_Down ? 0 : 59);
break;
case Field_Sec:
m_time.SetSecond(dir == Dir_Down ? 0 : 59);
break;
case Field_Max:
wxFAIL_MSG( "Invalid field" );
return;
}
UpdateText();
}
示例4: GetDate
bool DateChooserWidget::GetDate(wxDateTime &date)
{
int ret = wxID_OK;
date_control->SetDate(date);
hour_control->SetValue(date.GetHour());
minute_control->SetValue(date.GetMinute());
current_minute = date.GetMinute();
current_second = date.GetSecond();
while( (ret = ShowModal()) == wxID_OK){
date = date_control->GetDate();
// ustawiamy godzine
date.SetHour(hour_control->GetValue());
date.SetMinute(minute_control->GetValue());
if (second_control)
date.SetSecond(second_control->GetValue());
wxDateTime tmin(time_t(0));
wxDateTime tmax(MAX_TIME_T_FOR_WX_DATE_TIME);
if (date <= tmin || date >= tmax) {
wxMessageBox(_("Invalid (too large/small) date"), _("Error!"), wxOK);
return false;
}
if (min_date == -1 && max_date == -1)
return true;
if(date.GetTicks() >= min_date && date.GetTicks() <= max_date)
return true;
else {
wxString buf;
buf = _("Please choose the date from between: ");
buf += wxDateTime(min_date).Format(_T("%Y-%m-%d %H:%M "));
buf += _("and");
buf += wxDateTime(max_date).Format(_T(" %Y-%m-%d %H:%M\n"));
wxMessageDialog *mesg = new wxMessageDialog(this, buf, _("Incorrect date range"), wxOK);
mesg->ShowModal();
delete mesg;
}
}
return false;
}
示例5: AppendDigitToCurrentField
// Append the given digit (from 0 to 9) to the current value of the current
// field.
void AppendDigitToCurrentField(int n)
{
bool moveToNextField = false;
if ( !m_isFirstDigit )
{
// The first digit simply replaces the existing field contents,
// but the second one should be combined with the previous one,
// otherwise entering 2-digit numbers would be impossible.
int currentValue = 0,
maxValue = 0;
switch ( m_currentField )
{
case Field_Hour:
currentValue = m_time.GetHour();
maxValue = 23;
break;
case Field_Min:
currentValue = m_time.GetMinute();
maxValue = 59;
break;
case Field_Sec:
currentValue = m_time.GetSecond();
maxValue = 59;
break;
case Field_AMPM:
case Field_Max:
wxFAIL_MSG( "Invalid field" );
return;
}
// Check if the new value is acceptable. If not, we just handle
// this digit as if it were the first one.
int newValue = currentValue*10 + n;
if ( newValue < maxValue )
{
n = newValue;
// If we're not on the seconds field, advance to the next one.
// This makes it more convenient to enter times as you can just
// press all digits one after one without touching the cursor
// arrow keys at all.
//
// Notice that MSW native control doesn't do this but it seems
// so useful that we intentionally diverge from it here.
moveToNextField = true;
// We entered both digits so the next one will be "first" again.
m_isFirstDigit = true;
}
}
else // First digit entered.
{
// The next one won't be first any more.
m_isFirstDigit = false;
}
switch ( m_currentField )
{
case Field_Hour:
m_time.SetHour(n);
break;
case Field_Min:
m_time.SetMinute(n);
break;
case Field_Sec:
m_time.SetSecond(n);
break;
case Field_AMPM:
case Field_Max:
wxFAIL_MSG( "Invalid field" );
return;
}
if ( moveToNextField && m_currentField < Field_Sec )
CycleCurrentField(Dir_Up);
UpdateText();
}