本文整理汇总了C++中Fl_Box::show方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Box::show方法的具体用法?C++ Fl_Box::show怎么用?C++ Fl_Box::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fl_Box
的用法示例。
在下文中一共展示了Fl_Box::show方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update_calendar
void EDE_Calendar::update_calendar() {
unsigned int i;
// Find first day of week
edelib::Date d=active_date_;
d.set(d.year(), d.month(), 1);
int day_of_week = d.day_of_week()-1;
// Show/hide first filler
if (day_of_week>0)
m_filler[0]->show();
else
m_filler[0]->hide();
// Days
int row=2;
for (i=0; i<d.days_in_month(); i++) {
Fl_Box* btn = m_dayButtons[i]; // shortcut
btn->show();
// Set button color
Fl_Color daycolor = color(); // base color is the color of calendar
if (day_of_week==0) // Special color for sunday
daycolor = fl_color_average(daycolor, FL_BLUE, 0.8);
if (i==(uint)today_date_.day()-1 && d.month()==today_date_.month() && d.year()==today_date_.year())
btn->color(fl_color_average(daycolor, FL_RED, 0.5)); // today
else if (i==(uint)active_date_.day()-1)
btn->color(fl_lighter(daycolor));
else
btn->color(daycolor);
// Set downbox for active day
if (i==(uint)active_date_.day()-1)
btn->box(FL_DOWN_BOX);
else
btn->box(FL_FLAT_BOX);
day_of_week++;
if (day_of_week==7) { day_of_week=0; row++; }
}
// Hide remaining buttons
for (i=d.days_in_month(); i<31; i++)
m_dayButtons[i]->hide();
// Show/hide second filler
if (day_of_week<6)
m_filler[1]->show();
else
m_filler[1]->hide();
// Show/hide third filler
if (row<7)
m_filler[2]->show();
else
m_filler[2]->hide();
// Set title
static char title[30]; // No month name should be larger than 24 chars, even when localized
// and we can't show it anyway cause the box is too small
snprintf (title, 30, "%s, %d", d.month_name(), d.year());
m_monthNameBox->copy_label(title);
// Calculate tooltip (distance between today and active date)
static char tooltip_str[1024];
tooltip_str[0] = '\0';
if (today_date_ != active_date_) {
long dist = date_distance(today_date_, active_date_);
long weeks = dist/7;
int wdays = dist%7;
int months=0;
int mdays=0;
int years=0;
int ymonths=0;
// Find lower date, first part of tooltip
edelib::Date d1,d2;
if (today_date_ < active_date_) {
d1=today_date_;
d2=active_date_;
snprintf(tooltip_str, 1023, _("In %ld days"), dist);
} else {
d2=today_date_;
d1=active_date_;
snprintf(tooltip_str, 1023, _("%ld days ago"), dist);
}
// If necessary, calculate distance in m/d and y/m/d format
if (dist>30) {
months = d2.month() - d1.month() + (d2.year() - d1.year())*12;
mdays = d2.day() - d1.day();
if (mdays<1) {
mdays += d2.days_in_month();
months--;
}
}
//.........这里部分代码省略.........