Beispiel #1
0
void WCalendar::browseToPreviousYear()
{
  --currentYear_;

  emitCurrentPageChanged();
  renderMonth();
}
Beispiel #2
0
void WCalendar::setTop(const WDate& top)
{
  if (top_ != top) {
    top_ = top;
    renderMonth();
  }
}
Beispiel #3
0
void WCalendar::browseToNextYear()
{
  ++currentYear_;

  emitCurrentPageChanged();
  renderMonth();
}
Beispiel #4
0
void WCalendar::setBottom(const WDate& bottom)
{
  if (bottom_ != bottom) {
    bottom_ = bottom;
    renderMonth();
  }
}
Beispiel #5
0
void WCalendar::select(const WDate& date)
{
  selection_.clear();

  selection_.insert(date);
  renderMonth();
}
Beispiel #6
0
void WCalendar::setFirstDayOfWeek(int dayOfWeek)
{
  firstDayOfWeek_ = dayOfWeek;

  for (unsigned i = 0; i < 7; ++i) {
    int day = (i + firstDayOfWeek_ - 1) % 7 + 1;

    WString title = WDate::longDayName(day);
    impl_->bindString("t" + boost::lexical_cast<std::string>(i), 
		      title, 
		      XHTMLUnsafeText);

    WString abbr;
    switch (horizontalHeaderFormat_) {
    case SingleLetterDayNames:
      abbr = WString::fromUTF8(WDate::shortDayName(day).toUTF8().substr(0, 1));
      break;
    case ShortDayNames:
      abbr = WDate::shortDayName(day);
      break;
    case LongDayNames:
      abbr = WDate::longDayName(day);
      break;
    }
   
    impl_->bindString("d" + boost::lexical_cast<std::string>(i), 
		      abbr, 
		      XHTMLUnsafeText);
  }

  renderMonth();
}
Beispiel #7
0
void WCalendar::setSelectionMode(SelectionMode mode) 
{
  if (selectionMode_ != mode) {
    if (mode != ExtendedSelection && selection_.size() > 1) {
      selection_.clear();
      renderMonth();
    }
    selectionMode_ = mode;
  }
}
Beispiel #8
0
void WCalendar::browseToNextMonth()
{
  if (++currentMonth_ == 13) {
    currentMonth_ = 1;
    ++currentYear_;
  }

  emitCurrentPageChanged();
  renderMonth();
}
Beispiel #9
0
void WCalendar::browseToPreviousMonth()
{
  if (--currentMonth_ == 0) {
    currentMonth_ = 12;
    --currentYear_;
  }

  emitCurrentPageChanged();
  renderMonth();
}
Beispiel #10
0
void WCalendar::select(const std::set<WDate>& dates)
{
  if (selectionMode_ == ExtendedSelection) {
    selection_ = dates;
    renderMonth();
  } else if(selectionMode_ == SingleSelection) {
    if (dates.empty())
      clearSelection();
    else
      select(*dates.begin());
  }
}
Beispiel #11
0
void WCalendar::monthChanged(int newMonth)
{
  ++newMonth;

  if (currentMonth_ != newMonth
      && (newMonth >= 1 && newMonth <= 12)) {

    currentMonth_ = newMonth;

    emitCurrentPageChanged();
    renderMonth();
  }
}
Beispiel #12
0
void WCalendar::yearChanged(WString yearStr)
{
  try {
    int year = Utils::stoi(yearStr.toUTF8());

    if (currentYear_ != year &&
	(year >= 1900 && year <= 2200)) { // ??
      currentYear_ = year;

      emitCurrentPageChanged();
      renderMonth();
    }
  } catch (std::exception& e) {
  }
}
Beispiel #13
0
void WCalendar::yearChanged(WString yearStr)
{
  try {
    int year = boost::lexical_cast<int>(yearStr);

    if (currentYear_ != year &&
	(year >= 1900 && year <= 2200)) { // ??
      currentYear_ = year;

      emitCurrentPageChanged();
      renderMonth();
    }
  } catch (boost::bad_lexical_cast& e) {
  }
}
Beispiel #14
0
void WCalendar::selectInCurrentMonth(const WDate& d)
{
  if (d.month() == currentMonth_ && selectionMode_ != NoSelection) {
    if (selectionMode_ == ExtendedSelection) {
      if (isSelected(d))
	selection_.erase(d);
      else
	selection_.insert(d);
    } else {
      selection_.clear();
      selection_.insert(d);
    }

    renderMonth();
    selectionChanged().emit();
  }
}
Beispiel #15
0
void WCalendar::browseTo(const WDate& date)
{
  bool rerender = false;

  if (currentYear_ != date.year()) {
    currentYear_ = date.year();
    rerender = true;
  }

  if (currentMonth_ != date.month()) {
    currentMonth_ = date.month();
    rerender = true;
  }

  if (rerender) {
    emitCurrentPageChanged();
    renderMonth();
  }
}
Beispiel #16
0
void SettingsSetTimeScreen::render()
{
    uint16_t setcolor = color565(35,142,35);
    fillScreen(BLACK);
	makeRectangle(5,5, 230,310, setcolor, 3);
	drawPgmString(225,50 , PSTR("SET TIME"), setcolor, BLACK, 2);

	drawVerticalLine(0,160,235, setcolor,  3);

	makeRectangle(190, 30, 30,100, WHITE, 3);
	makeRectangle(190, 190, 30, 100, WHITE, 3);
	drawPgmString(195, 60, PSTR("DATE"), WHITE, BLACK, 2);
	drawPgmString(195, 220, PSTR("TIME"), WHITE , BLACK, 2);

	drawPgmString(175, 10, PSTR("MONTH"), WHITE, BLACK, 1);
	drawPgmString(175, 63, PSTR("DAY"), WHITE, BLACK, 1);
	drawPgmString(175, 107, PSTR("YEAR"), WHITE, BLACK, 1);
	drawPgmString(175, 165, PSTR("HOUR"), WHITE, BLACK, 1);
	drawPgmString(175, 213, PSTR("MINUTE"), WHITE, BLACK, 1);
	drawPgmString(175, 276, PSTR("AM/PM"), WHITE, BLACK, 1);

	makeRectangle(135, 10, 35, 33, BLUE, 3);
	makeRectangle(135, 63, 35, 34, BLUE, 3);
	makeRectangle(135, 117, 35, 33, BLUE, 3);
	makeRectangle(135, 170, 35, 33, BLUE, 3);
	makeRectangle(135, 223, 35, 34, BLUE, 3);
	makeRectangle(135, 277, 35, 33, BLUE, 3);

	drawChar(110, 45, '/', WHITE, BLACK, 2);
	drawChar(110, 95, '/', WHITE, BLACK, 2);
	drawChar(110, 205, ':', WHITE, BLACK, 2);

	drawHorizontalLine(105, 0, 319, WHITE, 3);
	drawHorizontalLine(125, 0, 319, WHITE, 3);
	makeRectangle(60, 10, 35, 33, RED, 3);
	makeRectangle(60, 63, 35, 34, RED, 3);
	makeRectangle(60, 117, 35, 33, RED, 3);
	makeRectangle(60, 170, 35, 33, RED, 3);
	makeRectangle(60, 223, 35, 34, RED, 3);
	makeRectangle(60, 277, 35, 33, RED, 3);

	drawChar(150, 20,  '+', BLUE, BLACK, 2);
	drawChar(150, 73,  '+', BLUE, BLACK, 2);
	drawChar(150, 127, '+', BLUE, BLACK, 2);
	drawChar(150, 180, '+', BLUE, BLACK, 2);
	drawChar(150, 233, '+', BLUE, BLACK, 2);
	drawChar(150, 287, '+', BLUE, BLACK, 2);

	drawChar(75, 20,  '-', RED, BLACK, 2);
	drawChar(75, 73,  '-', RED, BLACK, 2);
	drawChar(75, 127, '-', RED, BLACK, 2);
	drawChar(75, 180, '-', RED, BLACK, 2);
	drawChar(75, 233, '-', RED, BLACK, 2);
	drawChar(75, 287, '-', RED, BLACK, 2);

	// makeRectangle(10, 20, 20, 120, GREEN, 3);
	// drawString(12, 30, "CONFIRM", BLACK, WHITE, 2);
    renderMonth();
    renderDay();
    renderYear();
    renderHour();
    renderMinute();
    renderAMPM();
}
Beispiel #17
0
void WCalendar::clearSelection()
{
  selection_.clear();

  renderMonth();
}
Beispiel #18
0
void SettingsSetTimeScreen::loop()
{
    return;
    int x = getTouchX();
    int y = getTouchY();

    // TODO
    if (x>54 && x<88) {
        //-
        if (y>6 && y<27) {
            // month
            uint8_t month = GetMonth();
            uint8_t next_month = month - 1;
            if(month == 0)
                next_month = 12;

            SetMonth(next_month);
            renderMonth();
        }
        if (y>40 && y<61) {
            // day
            uint8_t day = GetDate();
            uint8_t next_day = day - 1;
            if(day == 0)
                next_day = 31;

            SetMonth(next_day);
            renderDay();
        }
        if (y>73 && y<94) {
            // yr
            uint8_t year = GetYear();
            uint8_t next_year = year - 1;
            SetYear(next_year);
            renderYear();
        }
        if (y>106 && y<127) {
            // hr
            uint8_t hour = GetHour();
            uint8_t next_hour = hour - 1;
            SetHour(next_hour);
            renderHour();
        }
        if (y>140 && y<161) {
            // min
            uint8_t minute = GetMinute();
            uint8_t next_minute = minute - 1;
            SetMinute(next_minute);
            renderMinute();
        }
        if (y>173 && y<194) {
            // am/pm
            uint8_t ampm = GetAmPm();
            SetAmPm(~ampm);
        }

    }
    if (x>104 && x<138) {
        //+
        if (y>6 && y<27) {
            // month
        }
        if (y>40 && y<61) {
            // day
        }
        if (y>73 && y<94) {
            // yr
        }
        if (y>106 && y<127) {
            // hr
        }
        if (y>140 && y<161) {
            // min
        }
        if (y>173 && y<194) {
            // am/pm
        }
    }
}